forked from dalerank/caesaria-game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
200 lines (166 loc) · 5.09 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
199
200
project(CaesarIA)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})
message("CMake module path is ${CMAKE_MODULE_PATH}")
message("System is ${CMAKE_SYSTEM_NAME}")
option( BUILD_ZLIB "Static zlib" ON )
option( BUILD_AES "Static aes" ON )
option( BUILD_BZIP "Static bzip" ON )
option( BUILD_LZMA "Static lzma" ON )
option( BUILD_CURL "Static curl" ON )
option( BUILD_PNG "Static png" ON )
option( BUILD_SMK "Static smk" ON )
option( BUILD_LITEHTML "Static litehtml" ON )
option( BUILD_PICOC "Static picoc" ON )
option( BUILD_SDL2MINI "Static sdl2-mini" ON )
option( BUILD_MINIZIP "static minizip" ON )
option( BUILD_MIXER "Static sdl mixer" ON )
option( BUILD_FREETYPE "Static freetype2" ON )
option( BUILD_TTF "Static ttf" ON )
option( BUILD_GL_FRAMEBUFFER "Opengl framebuffer" ON )
option( BUILD_AUDIO "Use sdl_mixer" ON )
option( DEBUG_TIMERS "Show debug timers" ON)
option( USE_STEAM "Build steam" OFF)
option( SYSTEM_DEPS "Use system-installed dependencies (if found)" OFF)
set(DEP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep" )
set(WORK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(GAME_CONFIG_DIR "${WORK_DIR}/resources" )
set(PK_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources" )
set(STEAM_API_DIR "${CMAKE_CURRENT_SOURCE_DIR}/steam" )
set(CMAKE_COMPILER_IS_CLANG 0)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_COMPILER_IS_CLANG 1)
endif()
if(X32_BUILD)
message("WARNING! 32bit application will be deprecated")
endif()
set(CMAKE_BUILD_TYPE_RELEASE 0)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_BUILD_TYPE_RELEASE 1)
endif()
if(USE_STEAM)
add_definitions(-DGAME_USE_STEAM)
endif(USE_STEAM)
if(BUILD_AUDIO)
set( GAME_USE_SDL_MIXER ON)
message("Note: SDL audio is enabled (default)")
message(" ")
else()
set( GAME_USE_SDL_MIXER OFF)
message("Note: SDL audio is disabled")
message(" ")
endif(BUILD_AUDIO)
# Search for appropriate packages on linux, osx and not compile them
if(UNIX AND NOT CYGWIN AND SYSTEM_DEPS)
find_package ( BZip2 )
if (BZIP2_FOUND)
set(BZIP_LIBRARY ${BZIP2_LIBRARIES})
set(BZIP_INCLUDE_DIR ${BZIP2_INCLUDE_DIR})
set(BUILD_BZIP FALSE)
endif()
find_package( ZLIB )
if ( ZLIB_FOUND )
set(BUILD_ZLIB FALSE)
endif()
find_package( CURL )
if (CURL_FOUND)
set(BUILD_CURL FALSE)
endif()
find_package( PNG )
if (PNG_FOUND)
set(BUILD_PNG FALSE)
endif()
find_package( Freetype )
if (FREETYPE_FOUND)
set(BUILD_FREETYPE FALSE)
endif()
find_package( SDL2_ttf )
if (SDL2_TTF_FOUND)
set(BUILD_TTF FALSE)
endif()
find_package( SDL2_mixer )
if( SDL2_MIXER_FOUND )
set(BUILD_MIXER FALSE)
set(MIXER_LIBRARY ${SDL2_MIXER_LIBRARY})
endif()
endif()
if( BUILD_ZLIB )
set(ZLIB_NAME "zlib")
set(ZLIB_HOME "${DEP_SOURCE_DIR}/${ZLIB_NAME}" )
add_subdirectory(${ZLIB_HOME})
endif()
if( BUILD_MINIZIP )
set(MINIZIP_NAME "minizip")
set(MINIZIP_HOME "${DEP_SOURCE_DIR}/${MINIZIP_NAME}" )
add_subdirectory(${MINIZIP_HOME})
endif()
if( BUILD_LITEHTML )
set(LITEHTML_NAME "litehtml")
set(LITEHTML_HOME "${DEP_SOURCE_DIR}/${LITEHTML_NAME}" )
add_subdirectory(${LITEHTML_HOME})
endif()
if( BUILD_SDL2MINI )
set(SDL2MINI_NAME "sdl2mini")
set(SDL2MINI_HOME "${DEP_SOURCE_DIR}/${SDL2MINI_NAME}" )
add_subdirectory(${SDL2MINI_HOME})
endif()
if( BUILD_MIXER )
set(MIXER_NAME "mixer")
set(MIXER_HOME "${DEP_SOURCE_DIR}/${MIXER_NAME}" )
add_subdirectory(${MIXER_HOME})
endif()
if( BUILD_PICOC )
set(PICOC_NAME "picoc")
set(PICOC_HOME "${DEP_SOURCE_DIR}/${PICOC_NAME}")
add_subdirectory(${PICOC_HOME})
endif()
if( BUILD_SMK )
set(SMKLIB_NAME "smk")
set(SMKLIB_HOME "${DEP_SOURCE_DIR}/${SMKLIB_NAME}" )
add_subdirectory(${SMKLIB_HOME})
endif()
if( BUILD_AES )
set(AESLIB_NAME "aes")
set(AESLIB_HOME "${DEP_SOURCE_DIR}/${AESLIB_NAME}" )
add_subdirectory(${AESLIB_HOME})
endif()
if( BUILD_BZIP )
set(BZIPLIB_NAME "bzip2")
set(BZIPLIB_HOME "${DEP_SOURCE_DIR}/${BZIPLIB_NAME}" )
add_subdirectory(${BZIPLIB_HOME})
endif()
if( BUILD_FREETYPE )
set(FREETYPELIB_NAME "freetype")
set(FREETYPELIB_HOME "${DEP_SOURCE_DIR}/${FREETYPELIB_NAME}" )
add_subdirectory(${FREETYPELIB_HOME})
endif()
if( BUILD_TTF )
set(TTFLIB_NAME "ttf")
set(TTFLIB_HOME "${DEP_SOURCE_DIR}/${TTFLIB_NAME}" )
add_subdirectory(${TTFLIB_HOME})
endif()
if( BUILD_LZMA )
set(LZMALIB_NAME "lzma")
set(LZMALIB_HOME "${DEP_SOURCE_DIR}/${LZMALIB_NAME}" )
add_subdirectory(${LZMALIB_HOME})
endif()
if( BUILD_CURL )
set(CURLLIB_NAME "curl")
set(CURLLIB_HOME "${DEP_SOURCE_DIR}/${CURLLIB_NAME}" )
add_subdirectory(${CURLLIB_HOME})
endif()
if( BUILD_PNG )
set(PNGLIB_NAME "libpng")
set(PNGLIB_HOME "${DEP_SOURCE_DIR}/${PNGLIB_NAME}" )
add_subdirectory(${PNGLIB_HOME})
endif()
# Include individual projects
message("")
# We always build game otherwise we would miss the generated header
message("\nBuilding CaesarIA-game")
add_subdirectory(source source)
message("\nBuilding CaesarIA-updater")
add_subdirectory(updater updater)
message("\nBuilding tileset")
add_subdirectory(tileset tileset)
#set(NO_USE_SYSTEM_ZLIB ON)