Open XmlmXmlmX opened 7 years ago
There is now cmake support after #92 ; maybe that can help you for Windows (probably the cmake file might need some adjustments).
The following works on Windows, assuming you have cmake and Visual Studio Build Tools installed:
git clone --recursive https://github.com/google/woff2.git
# Build brotli
cd woff2\brotli
mkdir out
cd out
cmake ..
cmake --build . --target ALL_BUILD --config Release
# Apply the fix to src/table_tags.h before proceeding (see below)
# Build woff2
cd ..\.. # Go back to the project root
mkdir out
cd out
cmake -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DBUILD_SHARED_LIBS=TRUE -DBROTLIDEC_INCLUDE_DIRS="../brotli/c/include" -DBROTLIDEC_LIBRARIES="../brotli/out/Release/brotlidec.lib" -DBROTLIENC_INCLUDE_DIRS="../brotli/c/include" -DBROTLIENC_LIBRARIES="../brotli/out/Release/brotlienc.lib" ..
cmake --build . --target ALL_BUILD --config Release
Copy-item -Recurse -Verbose ..\brotli\out\Release -Destination .
# woff2 libraries and binaries are now in the `out/Release` folder
Fixed src/table_tags.h
/* Copyright 2014 Google Inc. All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/
/* Font table tags */
#ifndef WOFF2_TABLE_TAGS_H_
#define WOFF2_TABLE_TAGS_H_
#include <inttypes.h>
#if COMPILING_THE_DLL
#define DLLEXTERN __declspec(dllexport)
#else
#define DLLEXTERN __declspec(dllimport)
#endif
namespace woff2 {
// Tags of popular tables.
static const uint32_t kGlyfTableTag = 0x676c7966;
static const uint32_t kHeadTableTag = 0x68656164;
static const uint32_t kLocaTableTag = 0x6c6f6361;
static const uint32_t kDsigTableTag = 0x44534947;
static const uint32_t kCffTableTag = 0x43464620;
static const uint32_t kHmtxTableTag = 0x686d7478;
static const uint32_t kHheaTableTag = 0x68686561;
static const uint32_t kMaxpTableTag = 0x6d617870;
DLLEXTERN extern const uint32_t kKnownTags[];
} // namespace woff2
#endif // WOFF2_TABLE_TAGS_H_
Is it possible to have the compiled binaries hosted somewhere?
You can bypass the lack of makefile for windows by installing a linux subsystem and building the application from there (tested)
Is it possible to have the compiled binaries hosted somewhere?
I uploaded compiled binaries to DropBox: https://www.dropbox.com/s/fgm9wnm1xfmzx2d/woff2.zip?dl=1
@HitkoDev Is there a reason your fix for src/table_tags.h
isn't in the master branch? To build on Windows, you still have to manually edit this file for the project to build correctly.
The exact steps by HitkoDev did not work for me, specifically editing the file, but these did (I used MinGW64 for compilation, no idea if others work):
> cd brotli
> mkdir out
> cd out
> cmake -DCMAKE_BUILD_TYPE=RELEASE ..
> cmake --build . --config Release
> cd ../.. (to go to woff2 folder)
> mkdir out
> cd out
> cmake -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=OFF -DBROTLIDEC_LIBRARIES="../brotli/out/brotlidec.lib" -DBROTLIENC_LIBRARIES="../brotli/out/brotlienc.lib" ..
Make sure you have env variables set to the path of your built Brotli dlls!
64-bit Brotli: brotli.zip 64-bit Binaries: out.zip
You can bypass the lack of makefile for windows by installing a linux subsystem and building the application from there (tested)
I don't see any instructions on how to build windows binaries from WSL2. The Github landing page instructions builds Linux executables (with no file extension).
woff2_compress
woff2_decompress
woff2_info
Can anyone shed some light on how to build windows binaries for this? I know they are hosted, but I'd like to figure out how to build on my own.
MSYS2 can build this. It requires no dllexport shenanigans.
I don't know if there would be any issues using google CoLab to run this (I am a beginner) but that is what I did because I could not figure out how to do it in my Command Prompt on Windows. Here is my step by step colab doc that you are welcome to make a copy of and use: https://colab.research.google.com/drive/1wig2KmizPuH97BeiS-3B4v0-r1cLVSNk?usp=sharing
I am very new to this stuff, so I need a little more guidence. Could you please share a step-by-step instruction on how to use this and make it work. I am sure you'd help a lot of Newbies like myself out.
Status: OS -Windows 11 / Hyper.io (Terminal) / git installed / cmake installed.
When following the instructions on "github.com/google/woff2" the error occurs when "make"(unrecognized command) or alternative "cmake .."(failed with: file not found)
C:\Users\user\Downloads\var convert\woff2\out>cmake ..
-- Building for: NMake Makefiles
CMake Deprecation Warning at CMakeLists.txt:10 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Error at CMakeLists.txt:12 (project):
Running
'nmake' '-?'
failed with:
Das System kann die angegebene Datei nicht finden
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
C:\Users\user\Downloads\var convert\woff2\out>
To build this for Windows would be great.
https://docs.microsoft.com/en-us/cpp/build/sample-makefile