1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-28 19:23:53 +00:00

Merge pull request #20 from jbeich/system-ftgl

Allow using system FTGL
This commit is contained in:
False.Genesis 2015-09-30 23:23:26 +02:00
commit aa7afa1b00
3 changed files with 48 additions and 2 deletions

View file

@ -24,11 +24,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Base.h" #include "Base.h"
#include "BaseText.h" #include "BaseText.h"
#ifdef AQUARIA_INTERNAL_FTGL
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include "FTGL.h" #include "FTGL.h"
#include "FTGLTextureFont.h" #include "FTGLTextureFont.h"
#else
#include <FTGL/ftgl.h>
#endif
struct TTFFont struct TTFFont
{ {

View file

@ -236,6 +236,21 @@ if(NOT TINYXML2_FOUND)
set(TINYXML2_SRCS "${EXTLIBDIR}/tinyxml2.cpp") set(TINYXML2_SRCS "${EXTLIBDIR}/tinyxml2.cpp")
endif(NOT TINYXML2_FOUND) endif(NOT TINYXML2_FOUND)
### FTGL
OPTION(AQUARIA_INTERNAL_FTGL "Always use included FTGL library" TRUE)
if(NOT AQUARIA_INTERNAL_FTGL)
find_package(FTGL)
endif(NOT AQUARIA_INTERNAL_FTGL)
if(FTGL_FOUND)
# Nothing else uses freetype2 directly
set(FREETYPE_INCLUDE_DIRS)
else(FTGL_FOUND)
message(STATUS "Using internal copy of FTGL")
set(FTGL_INCLUDE_DIRS "${FTGLDIR}/include")
ADD_DEFINITIONS(-DAQUARIA_INTERNAL_FTGL=1)
endif(FTGL_FOUND)
################ End of external libraries ################ End of external libraries
INCLUDE_DIRECTORIES(${BBGEDIR}) INCLUDE_DIRECTORIES(${BBGEDIR})
@ -243,7 +258,7 @@ INCLUDE_DIRECTORIES(${BBGEDIR}/GL)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${SRCDIR}) INCLUDE_DIRECTORIES(${SRCDIR})
INCLUDE_DIRECTORIES(${FTGLDIR}/include) INCLUDE_DIRECTORIES(${FTGL_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIRS})
@ -750,11 +765,13 @@ ELSE(PNG_FOUND)
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${PNG_SRCS}) SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${PNG_SRCS})
ENDIF(PNG_FOUND) ENDIF(PNG_FOUND)
IF(NOT FTGL_FOUND)
IF(FREETYPE_FOUND) IF(FREETYPE_FOUND)
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${FREETYPE_LIBRARIES}) SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${FREETYPE_LIBRARIES})
ELSE(FREETYPE_FOUND) ELSE(FREETYPE_FOUND)
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${FREETYPE2_SRCS}) SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${FREETYPE2_SRCS})
ENDIF(FREETYPE_FOUND) ENDIF(FREETYPE_FOUND)
ENDIF(NOT FTGL_FOUND)
IF(LUA51_FOUND) IF(LUA51_FOUND)
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${LUA_LIBRARIES}) SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${LUA_LIBRARIES})
@ -774,10 +791,15 @@ ELSE(TINYXML2_FOUND)
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${TINYXML2_SRCS}) SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${TINYXML2_SRCS})
ENDIF(TINYXML2_FOUND) ENDIF(TINYXML2_FOUND)
IF(FTGL_FOUND)
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${FTGL_LIBRARIES})
ELSE(FTGL_FOUND)
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${FTGL_SRCS})
ENDIF(FTGL_FOUND)
ADD_EXECUTABLE(aquaria ${EXETYPE} ADD_EXECUTABLE(aquaria ${EXETYPE}
${AQUARIA_SRCS} ${AQUARIA_SRCS}
${BBGE_SRCS} ${BBGE_SRCS}
${FTGL_SRCS}
${OPTIONAL_SRCS} ${OPTIONAL_SRCS}
) )
TARGET_LINK_LIBRARIES(aquaria ${OPTIONAL_LIBS}) TARGET_LINK_LIBRARIES(aquaria ${OPTIONAL_LIBS})

View file

@ -0,0 +1,20 @@
# - Try to find FTGL
# Once done this will define
# FTGL_FOUND - System has FTGL
# FTGL_INCLUDE_DIRS - The FTGL include directories
# FTGL_LIBRARIES - The libraries needed to use FTGL
# FTGL_DEFINITIONS - Compiler switches required for using FTGL
find_package(PkgConfig)
pkg_check_modules(PC_FTGL QUIET ftgl)
set(FTGL_INCLUDE_DIRS ${PC_FTGL_INCLUDE_DIRS})
set(FTGL_DEFINITIONS ${PC_FTGL_CFLAGS_OTHER})
find_library(FTGL_LIBRARY ftgl
HINTS ${PC_FTGL_LIBDIR} ${PC_FTGL_LIBRARY_DIRS})
set(FTGL_LIBRARIES ${FTGL_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FTGL DEFAULT_MSG FTGL_LIBRARIES FTGL_INCLUDE_DIRS)
mark_as_advanced(FTGL_LIBRARIES FTGL_INCLUDE_DIRS)