-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
78 lines (76 loc) · 3.01 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
70
71
72
73
74
75
76
77
78
cmake_minimum_required(VERSION 2.8.4)
project(Engine)
set(EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external" CACHE STRING "Path to external libs (SFML, Box2D, json-cpp)")
set(SFMLENGINE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "Path to Engine")
message(STATUS "${EXTERNAL_PATH}")
include("includes.cmake")
include("compiler.cmake")
include_directories(${SFMLENGINE_PATH}/include/Engine)
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Dont want jsoncpp tests")
set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF CACHE BOOL "Dont want jsoncpp unit tests to be run")
set(BOX2D_BUILD_EXAMPLES OFF CACHE BOOL "Dont want box2d examples")
set(BOX2D_BUILD_STATIC ON CACHE BOOL "Build box2d as static lib")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build jsoncpp as static lib" FORCE)
add_subdirectory(${EXTERNAL_PATH}/jsoncpp ${CMAKE_CURRENT_BINARY_DIR}/external/jsoncpp/)
add_subdirectory(${EXTERNAL_PATH}/box2d/Box2D ${CMAKE_CURRENT_BINARY_DIR}/external/box2d)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build sfml as shared lib" FORCE)
add_subdirectory(${EXTERNAL_PATH}/SFML ${CMAKE_CURRENT_BINARY_DIR}/external/sfml/)
set(SOURCE_FILES src/Button.cpp
src/Factory.cpp
src/Game.cpp
src/Light.cpp
src/LightSystem.cpp
src/Node.cpp
src/ObjectPlacer.cpp
src/ParallaxBackground.cpp
src/ParticleSystem.cpp
src/ResourceManager.cpp
src/Scene.cpp
src/LoadingScene.cpp
src/Text.cpp
src/SpriteNode.cpp
src/util/Box2dDebugDraw.cpp
src/util/Random.cpp
src/util/math.cpp
src/util/json.cpp
src/Scrollable.cpp
include/Engine/Button.hpp
include/Engine/Factory.hpp
include/Engine/Game.hpp
include/Engine/Light.hpp
include/Engine/LightSystem.hpp
include/Engine/Node.hpp
include/Engine/ObjectPlacer.hpp
include/Engine/ParallaxBackground.hpp
include/Engine/ParticleSystem.hpp
include/Engine/ResourceManager.hpp
include/Engine/Scene.hpp
include/Engine/LoadingScene.hpp
include/Engine/Text.hpp
include/Engine/SpriteNode.hpp
include/Engine/util/Box2dDebugDraw.hpp
include/Engine/util/Random.hpp
include/Engine/util/math.hpp
include/Engine/util/json.hpp
include/Engine/util/Event.hpp
include/Engine/util/misc.hpp
include/Engine/util/singleton.hpp
include/Engine/Scrollable.hpp
src/util/Event.cpp
include/Engine/util/Tween.hpp
)
add_library(Engine STATIC ${SOURCE_FILES})
target_link_libraries(Engine jsoncpp_lib_static
Box2D
sfml-window
sfml-audio
sfml-system
sfml-network
sfml-graphics)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_link_libraries(Engine sfml-main OpenGL32.lib)
endif()
if (ANDROID)
set(BLA -Wl,--whole-archive sfml-main -Wl,--no-whole-archive)
target_link_libraries(Engine ${BLA})
endif()