forked from eventhorizon5/skyscraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
198 lines (157 loc) · 5.41 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
cmake_minimum_required(VERSION 3.2)
project(Skyscraper)
set (CMAKE_CXX_FLAGS "-DBT_USE_DOUBLE_PRECISION ${CMAKE_CXX_FLAGS}")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake;${CMAKE_MODULE_PATH}")
if(NOT APPLE)
if(UNIX)
set(FRONTENDGLINC "-lGL")
endif()
#if (MSVC)
#add_link_options("/SUBSYSTEM:WINDOWS")
#endif()
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (CMAKE_BUILD_TYPE STREQUAL "")
# CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
# differentiation between debug and release builds.
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
if (UNIX AND NOT APPLE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif ()
if (WIN32)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_CXX_FLAGS "-D_OGREBULLET_DYNAMIC /MP ${CMAKE_CXX_FLAGS}")
endif ()
find_package(OGRE REQUIRED)
if(NOT OGRE_FOUND)
message(SEND_ERROR "Failed to find OGRE.")
endif()
set (OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_Overlay_LIBRARIES} ${OGRE_RTShaderSystem_LIBRARIES} ${OGRE_Bites_LIBRARIES})
#find wxWidgets
find_package(wxWidgets COMPONENTS core base REQUIRED)
#find FMOD
find_package(FMOD REQUIRED)
#find GTK
if(NOT APPLE)
if(UNIX)
find_package(GTK3 3.0 REQUIRED gtk)
endif ()
endif()
#find BULLET
find_package(Bullet REQUIRED)
#find Caelum
find_package(Caelum REQUIRED)
file(GLOB FRONTEND_FILES
src/frontend/*.cpp
src/frontend/gui/*.cpp
)
file(GLOB SCRIPTPROC_FILES
src/script/*.cpp
)
file(GLOB SBS_FILES
src/sbs/*.cpp
)
file(GLOB ALLOC_FILES
src/alloc/*.cpp
)
file(GLOB OGREBULLET_COLL_FILES
ogrebullet/Collisions/src/*.cpp
ogrebullet/Collisions/src/Debug/*.cpp
ogrebullet/Collisions/src/Shapes/*.cpp
ogrebullet/Collisions/src/Utils/*.cpp
)
file (GLOB OGREBULLET_DYN_FILES
ogrebullet/Dynamics/src/*.cpp
ogrebullet/Dynamics/src/Constraints/*.cpp
ogrebullet/Dynamics/src/Prefab/*.cpp
)
include_directories( ${OGRE_INCLUDE_DIRS}
${OGRE_Overlay_INCLUDE_DIRS}
${OGRE_RTShaderSystem_INCLUDE_DIRS}
${OGRE_Bites_INCLUDE_DIRS}
${FMOD_INCLUDE_DIR}
${GTK3_INCLUDE_DIRS}
${BULLET_INCLUDE_DIRS}
${Caelum_INCLUDE_DIRS}
src/frontend
src/sbs
src/script
src/alloc
ogrebullet/Collisions/include
ogrebullet/Collisions/include/Debug
ogrebullet/Collisions/include/Shapes
ogrebullet/Collisions/include/Utils
ogrebullet/Dynamics/include
ogrebullet/Dynamics/include/Constraints
ogrebullet/Dynamics/include/Prefab
)
include(${wxWidgets_USE_FILE})
#ogrebullet libraries
add_library(OgreBulletCol SHARED ${OGREBULLET_COLL_FILES})
add_library(OgreBulletDyn SHARED ${OGREBULLET_DYN_FILES})
#SBS library
add_library(SBS SHARED ${SBS_FILES})
#ScriptProc Library
if (NOT WIN32)
add_library(ScriptProc SHARED ${SCRIPTPROC_FILES})
endif ()
#Alloc Library
add_library(Alloc SHARED ${ALLOC_FILES})
#frontend executable
if (NOT WIN32)
add_executable(skyscraper ${FRONTEND_FILES})
else ()
add_executable(skyscraper ${FRONTEND_FILES} ${SCRIPTPROC_FILES})
target_compile_options(OgreBulletCol PRIVATE -D_OGREBULLET_EXPORTS)
target_compile_options(OgreBulletDyn PRIVATE -D_OGREBULLET_EXPORTS)
target_compile_options(SBS PRIVATE -DSBS_DLL)
endif ()
target_precompile_headers(OgreBulletCol PRIVATE ogrebullet/Collisions/include/OgreBulletCollisionsPreRequisites.h)
target_precompile_headers(OgreBulletDyn PRIVATE ogrebullet/Dynamics/include/OgreBulletDynamicsPreRequisites.h)
target_precompile_headers(SBS PRIVATE src/sbs/globals.h)
if (NOT WIN32)
target_precompile_headers(ScriptProc PRIVATE src/sbs/globals.h)
endif ()
target_precompile_headers(skyscraper PRIVATE src/sbs/globals.h)
target_link_libraries(OgreBulletCol ${OGRE_LIBRARIES} ${BULLET_LIBRARIES})
target_link_libraries(OgreBulletDyn OgreBulletCol ${OGRE_LIBRARIES} ${BULLET_LIBRARIES})
target_link_libraries(SBS OgreBulletCol OgreBulletDyn ${OGRE_LIBRARIES} ${FMOD_LIBRARY})
if (NOT WIN32)
target_link_libraries(ScriptProc SBS ${OGRE_LIBRARIES} ${wxWidgets_LIBRARIES})
target_link_libraries(skyscraper ScriptProc SBS ${OGRE_LIBRARIES} ${wxWidgets_LIBRARIES} ${FMOD_LIBRARY} ${GTK3_LIBRARIES} ${Caelum_LIBRARIES} ${FRONTENDGLINC})
else ()
target_link_libraries(skyscraper SBS ${OGRE_LIBRARIES} ${wxWidgets_LIBRARIES} ${FMOD_LIBRARY} ${GTK3_LIBRARIES} ${Caelum_LIBRARIES} ${FRONTENDGLINC})
endif ()
if (APPLE)
set_target_properties(skyscraper PROPERTIES
MACOSX_BUNDLE ON
OUTPUT_NAME "Skyscraper"
BUILD_WITH_INSTALL_RPATH 1
INSTALL_RPATH "@executable_path/../Frameworks")
ADD_CUSTOM_COMMAND(TARGET skyscraper
POST_BUILD
COMMAND ${CMAKE_HOME_DIRECTORY}/tools/mac/copyframework.sh)
#install(CODE "execute_process(COMMAND bash \".macos_app.sh\" \"${OGRE_LIBRARY_DIRS}/macosx/release\")")
endif()
if (APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
endif ()
if (NOT WIN32)
ADD_CUSTOM_COMMAND(TARGET OgreBulletDyn
POST_BUILD
COMMAND ${CMAKE_HOME_DIRECTORY}/gitrev.sh)
else ()
ADD_CUSTOM_COMMAND(TARGET OgreBulletDyn
POST_BUILD
COMMAND ${CMAKE_HOME_DIRECTORY}/gitrev.cmd)
endif ()
if (UNIX AND NOT APPLE)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tools/scripts/skyscraper
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()