Git Product home page Git Product logo

Comments (12)

HitkoDev avatar HitkoDev commented on May 7, 2024 11

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_

from woff2.

chebum avatar chebum commented on May 7, 2024 5

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

from woff2.

lencil avatar lencil commented on May 7, 2024 4

https://github.com/lencil/woff2_build/releases/tag/v1.0.2

from woff2.

kirawi avatar kirawi commented on May 7, 2024 3

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):

  1. Build Brotli (Built using MSVC)
> cd brotli
> mkdir out
> cd out
> cmake -DCMAKE_BUILD_TYPE=RELEASE ..
> cmake --build . --config Release
  1. Build WOFF2 CLI
> 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

from woff2.

fred-wang avatar fred-wang commented on May 7, 2024 1

There is now cmake support after #92 ; maybe that can help you for Windows (probably the cmake file might need some adjustments).

from woff2.

hfhchan avatar hfhchan commented on May 7, 2024

Is it possible to have the compiled binaries hosted somewhere?

from woff2.

vincent38 avatar vincent38 commented on May 7, 2024

You can bypass the lack of makefile for windows by installing a linux subsystem and building the application from there (tested)

from woff2.

tim-harding avatar tim-harding commented on May 7, 2024

@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.

from woff2.

fmotion1 avatar fmotion1 commented on May 7, 2024

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.

from woff2.

neheb avatar neheb commented on May 7, 2024

MSYS2 can build this. It requires no dllexport shenanigans.

from woff2.

MarthB avatar MarthB commented on May 7, 2024

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

from woff2.

re-memeber avatar re-memeber commented on May 7, 2024

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>

from woff2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.