Hi,
I got all demos running on Windows using the msys2 MinGW64 gcc toolchain. msys2 provides easy access to all required packages / dependencies (except AntTweakBar, but see below), so it makes building native binaries on Windows less of a headache. It took me some nights to figure all out, so I wanted to propose some changes to make it easier for others using Windows. (if there is anyone)
Most demos work without needing any changes, but for some I had to make some adjustments:
makefont demo
I needed to change the makefont target in CMakeLists.txt to only add MATH_LIBRARY if the library is found.
This is already done in the other CMakeLists.txt files so I guess that is the reasonable thing to do:
Currently a runtime error is produced on windows with the following messages:
"font_manager_match_description" not implemented for windows.
"font_manager_get_from_description" not implemented yet.
Houston, we've got a problem !
To make it work:
Removed #if 1 from font-manager.c
Check additionally in some #if defined _WIN32 statements for __MINGW32__ in font-manager.c and demos/markup.c
atb-agg demo
gcc can link the import libraries from windows/AntTweakBar/lib/ without problems, just one change is required in FindAntTweakBar.cmake. CMake seems to default to .dll extension, so that needs to change into .lib. Relevant snippet:
FIND_LIBRARY( ANT_TWEAK_BAR_LIBRARY AntTweakBar.lib
Caveat: This works fine for 32-bit, but for 64-bit it fails. It still includes the 32-bit lib, but should include AntTweakbar64.lib.
I am not sure yet what the best way is to handle different library names for 32 and 64-bit with CMake.
It was also necessary to link fontconfig for the target in demos/CMakeLists.txt
On Windows symlinks are a bit problematic and are thus disabled for git by default. See git-for-windows/wiki for details.
I did the following to make it work:
Change harfbuzz/CMakeLists.txt to include the needed files from root directory instead of using symlinks
Change include paths in the following files:
harfbuzz/texture-font.hharfbuzz/texture-font.charfbuzz/demo-harfbuzz.charfbuzz/demo-texture.c
(Delete symlinks from harfbuzz directory)
Caveat: include "texture-font.h" would need to come before other freetype-gl includes in demo-harfbuzz.c and demo-texture.c.
Otherwise the texture-font.h from the project root directory would get included, making it not compile.
I took some notes and can provide full install instructions to setup the toolchain e.g. to include in INSTALL.md.
I'd be happy to make a PR for all this (it is probably easier to discuss code there), but I wanted to hear you guys thoughts on this first.
There are perhaps better solutions for some of the problems I mentioned.
PS Sorry for the wall of text, but thanks for reading.
Hi, I got all demos running on Windows using the msys2 MinGW64 gcc toolchain. msys2 provides easy access to all required packages / dependencies (except AntTweakBar, but see below), so it makes building native binaries on Windows less of a headache. It took me some nights to figure all out, so I wanted to propose some changes to make it easier for others using Windows. (if there is anyone)
Most demos work without needing any changes, but for some I had to make some adjustments:
makefont demo
I needed to change the
makefont
target inCMakeLists.txt
to only addMATH_LIBRARY
if the library is found. This is already done in the otherCMakeLists.txt
files so I guess that is the reasonable thing to do:To support modern format specifiers like
%zu
infprintf
I also needed to add this flag:markup demo
Currently a runtime error is produced on windows with the following messages:
To make it work:
#if 1
fromfont-manager.c
#if defined _WIN32
statements for__MINGW32__
infont-manager.c
anddemos/markup.c
atb-agg demo
gcc can link the import libraries from
windows/AntTweakBar/lib/
without problems, just one change is required inFindAntTweakBar.cmake
. CMake seems to default to.dll
extension, so that needs to change into.lib
. Relevant snippet:FIND_LIBRARY( ANT_TWEAK_BAR_LIBRARY AntTweakBar.lib
Caveat: This works fine for 32-bit, but for 64-bit it fails. It still includes the 32-bit lib, but should include AntTweakbar64.lib. I am not sure yet what the best way is to handle different library names for 32 and 64-bit with CMake.
It was also necessary to link fontconfig for the target in
demos/CMakeLists.txt
harfbuzz and hb-texture demos
On Windows symlinks are a bit problematic and are thus disabled for git by default. See git-for-windows/wiki for details.
I did the following to make it work:
harfbuzz/CMakeLists.txt
to include the needed files from root directory instead of using symlinksharfbuzz/texture-font.h
harfbuzz/texture-font.c
harfbuzz/demo-harfbuzz.c
harfbuzz/demo-texture.c
harfbuzz
directory)Caveat:
include "texture-font.h"
would need to come before other freetype-gl includes indemo-harfbuzz.c
anddemo-texture.c
. Otherwise thetexture-font.h
from the project root directory would get included, making it not compile.I took some notes and can provide full install instructions to setup the toolchain e.g. to include in
INSTALL.md
.I'd be happy to make a PR for all this (it is probably easier to discuss code there), but I wanted to hear you guys thoughts on this first. There are perhaps better solutions for some of the problems I mentioned.
PS Sorry for the wall of text, but thanks for reading.