-
Notifications
You must be signed in to change notification settings - Fork 32
/
CMakeLists.txt
69 lines (52 loc) · 2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
project(gdx-cpp)
cmake_minimum_required(VERSION 2.8)
include(cmake/gdx.cmake)
include(cmake/cotire.cmake)
set(ANDROID_NDK $ENV{ANDROID_NDK})
initialize_gdx()
include_directories(src)
link_directories(${LIBRARY_OUTPUT_PATH})
option(BUILD_BOX2D "Builds Box2D" TRUE)
option(BUILD_AS_SHARED_LIBRARIES "Build libraries as shared libraries instead of static" FALSE)
if(CMAKE_COMPILER_IS_GNUCXX)
# get gnu compiler version number
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
# g++' -Wdouble-promotion needs at least version 4.6
if (GCC_VERSION VERSION_LESS 4.6)
message(FATAL_ERROR "gdx++ requires a gcc that's newer than 4.6 to fully support the new c++11 standard. Please upgrade your ndk to r8b or newer if using android.")
endif()
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wreorder")
endif()
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wreorder")
if (BUILD_BOX2D)
set(BOX2D_INSTALL TRUE)
add_subdirectory(src/Box2D)
add_subdirectory(src/gdx-cpp/physics/box2d)
endif()
if (GDX_BACKEND_IOS)
add_subdirectory(src/gdx-cpp/backends/ios)
SET(BUILD_AGG TRUE)
elseif(GDX_BACKEND_ANDROID)
add_subdirectory(src/gdx-cpp/backends/android)
SET(CMAKE_SHARED_LINKER_FLAGS -Wl,--allow-shlib-undefined)
SET(BUILD_AGG TRUE)
elseif(GDX_BACKEND_WIN32)
add_subdirectory(src/gdx-cpp/backends/windows)
elseif(GDX_BACKEND_LINUX)
SET(BUILD_AGG TRUE)
add_subdirectory(src/gdx-cpp/backends/linux)
elseif(GDX_BACKEND_EMSCRIPTEN)
SET(BUILD_AGG TRUE)
add_subdirectory(src/gdx-cpp/backends/emscripten)
endif()
if (BUILD_AGG)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/agg/include ${CMAKE_CURRENT_SOURCE_DIR}/src/agg/svg)
add_subdirectory(src/agg)
endif()
add_subdirectory(src/gdx-cpp)
install(FILES cmake/finders/FindGdxCpp.cmake
DESTINATION share/gdx/cmake)
install(FILES cmake/gdx.cmake
DESTINATION share/gdx/cmake)
install(FILES cmake/cotire.cmake
DESTINATION share/gdx/cmake)