Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » FreeType in dependencies folder on Windows.

This thread is locked; no one can reply to it. rss feed Print
FreeType in dependencies folder on Windows.
Max Savenkov
Member #4,613
May 2004
avatar

I have a problem that I was ignoring for a very long while, but I think it's time to set it straight.

When I compile Allegro on Windows, where should I put FreeType include files for CMake to find them?

Presently, I use this structure:

allegro-git/deps/include/ft2build.h
allegro-git/deps/include/freetype/freetype.h

Unfortunately, CMake do not detect path to freetype.h correctly. It assumes it is the same as the path to ft2build.h, so I have to change it manually every time, after which Allegro successfully builds.

But if I move ft2build.h into include/freetype folder, CMake can't find it at all!

So, what is the correct place for freetype includes inside deps/include folder (correct - meaning CMake can find them without manual editing of variables).

Elias
Member #358
May 2000

It's freetype2 not freetype.

--
"Either help out or stop whining" - Evert

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I have the same problem on Windows. cmake can never find the include directory for freetype.


c:\mingw\LIBS\A5GIT\allegro\build>cmake -G "MinGW Makefiles" -DWANT_MONOLITH=On -DSHARED=On -DCMAKE_BUILD_TYPE=Debug -DWANT_DOCS=Off -DWANT_EXAMPLES=Off -DWANT_DEMO=Off ..
...
-- Could NOT find Freetype (missing:  FREETYPE_INCLUDE_DIRS)
WARNING: FreeType not found, disabling support.

I always have to go in and set the include directory manually with cmake-gui. Having to run cmake twice is kind of obnoxious.

Do we need a FindFreeType.cmake file? I don't personally know how to write one but maybe I could model one off of a similar cmake file.

Elias
Member #358
May 2000

Do we need a FindFreeType.cmake file?

No, if we can fix it, then we should submit the patch to cmake so it can be included in their FindFreetype.cmake instead. Still, calling the folder deps/include/freetype2 should find it. And msys2 freetype also is found. So it's not completely broken.

--
"Either help out or stop whining" - Evert

Max Savenkov
Member #4,613
May 2004
avatar

Elias said:

It's freetype2 not freetype.

That does not seem to work at all for me. If I name FreeType include folder freetype2 then it is never found at all, both configurations fail:

allegro-git/deps/include/ft2build.h
allegro-git/deps/include/freetype2/freetype.h

( ^ this one was working better with just freetype)

allegro-git/deps/include/freetype2/ft2build.h
allegro-git/deps/include/freetype2/freetype.h

(And ft2build.h is never found unless I put it directly into deps/include/)

OK, from what I see, there is at least one error in FindFreeType.cmake as of CMake 2.8.10.2:

find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
  HINTS
    ENV FREETYPE_DIR
  PATHS
    /usr/local/X11R6
    /usr/local/X11
    /usr/freeware
  PATH_SUFFIXES include/freetype2 include
)

It searches for ftheader.h inside freetype folder, not freetype2, but it uses PATH_SUFFIXES with include/freetype2. I'm not sure what to fix here. Changing file name to freetype2/config/ftheader.h gives bad path (surely, we must search for config/ftheader.h with the given PATH_SUFFIXES? But that does not find the file at all).

Edit: Somewhat heated discussion on CMake bug tracker amounts to "FindFreeType does not work and will not work until it has a new maintainer (which it still hasn't)". Later contribution seem to note that the problem could be easily fixed, but maybe not.

Anyway, it seems like we all have to fix path manually if we use FreeType 2.5.x for now...

Arvidsson
Member #4,603
May 2004
avatar

I had a similar issue in another project, so I copied the faulty FindFreeType.cmake and fixed it (it seems to work at the least). I attached it to this post, maybe it could be of use.

pkrcel
Member #14,001
February 2012

The latest Dev version of CMAKE overcomes the problem using a new improved findfreetype.cmake file.

look here.

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Elias
Member #358
May 2000

Oh, that might explain my experience, I'm using the cmake-git from msys2.

--
"Either help out or stop whining" - Evert

beoran
Member #12,636
March 2011

We might want to include the improved FindFreetype in Allegro's cmake directory for the benefit of people who don't use the dev version of cmake... The basic problem seems to be that the olf findfreetype looks for the headers in all the wrong places. No one puts it in /usr/local/X11 anymore.

Go to: