mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-29 00:05:50 +00:00
build: add option to use system FTGL
This commit is contained in:
parent
b86133f3e9
commit
5e64e66714
3 changed files with 48 additions and 2 deletions
|
@ -24,11 +24,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "Base.h"
|
||||
#include "BaseText.h"
|
||||
|
||||
#ifdef AQUARIA_INTERNAL_FTGL
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTGLTextureFont.h"
|
||||
#else
|
||||
#include <FTGL/ftgl.h>
|
||||
#endif
|
||||
|
||||
struct TTFFont
|
||||
{
|
||||
|
|
|
@ -235,6 +235,21 @@ if (AQUARIA_INTERNAL_TINYXML2 OR NOT TINYXML2_FOUND)
|
|||
set(TINYXML2_SRCS "${EXTLIBDIR}/tinyxml2.cpp")
|
||||
endif (AQUARIA_INTERNAL_TINYXML2 OR 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
|
||||
|
||||
INCLUDE_DIRECTORIES(${BBGEDIR})
|
||||
|
@ -242,7 +257,7 @@ INCLUDE_DIRECTORIES(${BBGEDIR}/GL)
|
|||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${SRCDIR})
|
||||
INCLUDE_DIRECTORIES(${FTGLDIR}/include)
|
||||
INCLUDE_DIRECTORIES(${FTGL_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIRS})
|
||||
|
@ -740,11 +755,13 @@ ELSE(PNG_FOUND)
|
|||
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${PNG_SRCS})
|
||||
ENDIF(PNG_FOUND)
|
||||
|
||||
IF(NOT FTGL_FOUND)
|
||||
IF(FREETYPE_FOUND)
|
||||
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${FREETYPE_LIBRARIES})
|
||||
ELSE(FREETYPE_FOUND)
|
||||
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${FREETYPE2_SRCS})
|
||||
ENDIF(FREETYPE_FOUND)
|
||||
ENDIF(NOT FTGL_FOUND)
|
||||
|
||||
IF(LUA51_FOUND)
|
||||
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${LUA_LIBRARIES})
|
||||
|
@ -764,10 +781,15 @@ ELSE(TINYXML2_FOUND)
|
|||
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${TINYXML2_SRCS})
|
||||
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}
|
||||
${AQUARIA_SRCS}
|
||||
${BBGE_SRCS}
|
||||
${FTGL_SRCS}
|
||||
${OPTIONAL_SRCS}
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(aquaria ${OPTIONAL_LIBS})
|
||||
|
|
20
cmake/Modules/FindFTGL.cmake
Normal file
20
cmake/Modules/FindFTGL.cmake
Normal 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)
|
Loading…
Reference in a new issue