Author Topic: CMake not finding Freetype error (on Windows)  (Read 12459 times)

Bloodwurm

  • Guest
CMake not finding Freetype error (on Windows)
« on: 26 February 2012, 18:09:07 »
I just resynched the master branch and went through the complete setup phase for devs.
I did get the Freetype error again (just like the first time I set myself up).

I tried recopying the freetype stuff everywhere, even installed the full GNUWin32 freetype package but to no avail.

In the end, I had to manually add a FREETYPE_INCLUDE_DIRS and set it to this path: C:/Projets/glestae/source/gae-deps/include/freetype2 (would obviously need to be adapted to your personal install). It then stopped complaining about not finding it and I was able to complete the process and compile and run gae.

I was tempted to modify the install steps directly but i wonder if some of the principal devs should look at it a bit more? I think there is an issue with the cmake file itself (as if the FREETYPE_INLUDE_DIRS should already be defined in the script when used but isn't) but I don't know much about that tech so...
« Last Edit: 4 March 2012, 20:14:34 by hailstone »

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: CMake not finding Freetype error
« Reply #1 on: 27 February 2012, 00:05:36 »
Where and what is the exact error?

Freetype includes are already set in CMakeLists.txt:
Code: [Select]
set(ENV{FREETYPE_DIR} ${GAE_WINDEPS})
find_package(Freetype REQUIRED)
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Bloodwurm

  • Guest
Re: CMake not finding Freetype error
« Reply #2 on: 29 February 2012, 15:50:25 »
This is what CMake spits out:

Code: [Select]
Looking for byteswap.h
Looking for byteswap.h - not found
setting windeps: C:/Projets/glestae_musicplaylist/source/gae-deps
Found Lua51: C:/Projets/glestae_musicplaylist/source/gae-deps/lib/lua5.1.lib (Required is at least version "5.1")
Found OpenGL: opengl32
Found VORBIS: C:/Projets/glestae_musicplaylist/source/gae-deps/include
Found ZLIB: C:/Projets/glestae_musicplaylist/source/gae-deps/lib/zlib.lib (found version "1.2.3")
Found CPPUNIT: C:/Projets/glestae_musicplaylist/source/gae-deps/include
Could NOT find LibXml2 (missing:  LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
Found wxWidgets: TRUE
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find Freetype (missing: FREETYPE_INCLUDE_DIRS)
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindFreetype.cmake:83 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:76 (find_package)
« Last Edit: 10 July 2016, 17:14:32 by filux »

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: CMake not finding Freetype error
« Reply #3 on: 29 February 2012, 19:13:03 »
Perhaps there's a CMake version difference. I have 2.8.2.

In my FindFreetype.cmake, FIND_PACKAGE_HANDLE_STANDARD_ARGS is at line 92 instead of 83 and before that it has code to set FREETYPE_INCLUDE_DIRS. This could be missing in your version?

Code: [Select]
# set the user variables
IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
  SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Yggdrasil

  • Local Moderator
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: CMake not finding Freetype error
« Reply #4 on: 29 February 2012, 21:53:46 »
Yeah, they changed the find module a bit and broke the hints (cmake 2.8.7). It can't find ft2build.h that way. It's now set directly as a workaround. Hopefully that fixes the problem. I have no windows system to test it on, so feedback is welcome.

Bloodwurm

  • Guest
Re: CMake not finding Freetype error
« Reply #5 on: 1 March 2012, 02:38:36 »
[Maybe we should move this to another thread  :) ]
Yeah ok we surely dont have the same version considering I downloaded the most recent but by looking into my findfreetype.cmake in Cmake 2.8 this is what I have which seems to pretty much fit what you are talking about so...:
BTW, manually adding the var in cmake (like for GAE_WINDEPS) makes it work, but will it induce other problems? (like not using the proper version of something? it is compiling and linking fine....)

PS: I pasted everything from the file besides the top comments.

Code: [Select]
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
  HINTS
  $ENV{FREETYPE_DIR}
  PATHS
  /usr/local/X11R6/include
  /usr/local/X11/include
  /usr/freeware/include
)

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

FIND_LIBRARY(FREETYPE_LIBRARY
  NAMES freetype libfreetype freetype219
  HINTS
  $ENV{FREETYPE_DIR}
  PATH_SUFFIXES lib64 lib
  PATHS
  /usr/local/X11R6
  /usr/local/X11
  /usr/freeware
)

# set the user variables
IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
  SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")

# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype  DEFAULT_MSG  FREETYPE_LIBRARY  FREETYPE_INCLUDE_DIRS)

MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)
« Last Edit: 10 July 2016, 17:14:07 by filux »

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: CMake not finding Freetype error (on Windows)
« Reply #6 on: 4 March 2012, 20:18:23 »
The FIND_PATHs are slightly different in my version. Setting the dirs manually seems to work anyway.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/