53 option(NOPNG "Disable screenshoot compression [default: auto]" OFF) |
53 option(NOPNG "Disable screenshoot compression [default: auto]" OFF) |
54 option(NOVIDEOREC "Disable video recording [default: auto]" OFF) |
54 option(NOVIDEOREC "Disable video recording [default: auto]" OFF) |
55 |
55 |
56 option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF) |
56 option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF) |
57 option(ANDROID "Enable Android build [default: off]" OFF) |
57 option(ANDROID "Enable Android build [default: off]" OFF) |
|
58 option(WEBGL "Enable WebGL build [default: off]" OFF) |
58 |
59 |
59 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF) |
60 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF) |
60 option(CROSSAPPLE "Enable OSX when not on OSX [default: off]" OFF) |
61 option(CROSSAPPLE "Enable OSX when not on OSX [default: off]" OFF) |
61 |
62 |
62 |
63 |
202 endif() |
203 endif() |
203 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
204 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
204 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
205 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
205 |
206 |
206 |
207 |
207 #server discovery |
208 #Haskell compiler discovery (for server and webgl |
208 if(NOT NOSERVER) |
209 if((NOT NOSERVER) OR WEBGL) |
209 if(GHC) |
210 if(GHC) |
210 set(ghc_executable ${GHC}) |
211 set(ghc_executable ${GHC}) |
211 else() |
212 else() |
212 find_program(ghc_executable ghc) |
213 find_program(ghc_executable ghc) |
213 endif() |
214 endif() |
214 |
215 |
215 if(ghc_executable) |
216 if(ghc_executable) |
216 set(HAVE_NETSERVER true) |
217 exec_program(${ghc_executable} ARGS "-V" OUTPUT_VARIABLE ghc_version_long) |
217 add_subdirectory(gameServer) |
218 string(REGEX REPLACE ".*([0-9]+\\.[0-9]+\\.[0-9]+)" "\\1" ghc_version "${ghc_version_long}") |
218 message(STATUS "Found GHC: ${ghc_executable}") |
219 message(STATUS "Found GHC: ${ghc_executable} (version ${ghc_version})") |
219 else() |
220 else() |
220 message(STATUS "Could NOT find GHC, server will not be built") |
221 message(STATUS "Could NOT find GHC, needed by gameServer and pas2c") |
221 set(HAVE_NETSERVER false) |
222 endif() |
222 endif() |
223 endif() |
223 else() |
224 |
224 message(STATUS "Server will not be built per user request") |
225 |
|
226 #check gameServer |
|
227 if((ghc_executable) AND (NOT NOSERVER) AND (NOT WEBGL)) |
|
228 set(HAVE_NETSERVER true) |
|
229 add_subdirectory(gameServer) |
|
230 else() |
|
231 message(STATUS "Skipping gameServer target") |
225 set(HAVE_NETSERVER false) |
232 set(HAVE_NETSERVER false) |
226 endif() |
233 endif() |
227 |
234 |
228 |
235 |
229 #lua discovery |
236 #lua discovery |
230 find_package(Lua) |
237 find_package(Lua) |
231 if(LUA_FOUND) |
238 if(LUA_FOUND AND (NOT WEBGL)) |
232 message(STATUS "Found LUA: ${LUA_DEFAULT}") |
239 message(STATUS "Found LUA: ${LUA_DEFAULT}") |
233 else() |
240 else() |
234 message(STATUS "LUA will be provided by the bundled sources") |
241 message(STATUS "LUA will be provided by the bundled sources") |
235 add_subdirectory(misc/liblua) |
242 add_subdirectory(misc/liblua) |
236 #linking with liblua.a requires system readline -- this works everywhere, right? |
243 #linking with liblua.a requires system readline -- this works everywhere, right? |
237 set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags}) |
244 set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags}) |
238 endif() |
245 endif() |
239 |
246 |
240 |
247 |
241 #main engine |
248 if(WEBGL) |
242 add_subdirectory(hedgewars) |
249 if (NOT ghc_executable) |
243 |
250 message(FATAL_ERROR "A Haskell compiler is required to build the WebGL port") |
244 #Android related build scripts |
251 endif() |
245 if(ANDROID) |
252 #pascal to c converter |
246 #run cmake -DANDROID=1 to enable this |
253 add_subdirectory(tools/pas2c) |
247 add_subdirectory(project_files/Android-build) |
254 else() |
248 endif() |
255 #main engine |
249 |
256 add_subdirectory(hedgewars) |
250 #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set |
257 |
251 if(NOT (BUILD_ENGINE_LIBRARY OR ANDROID)) |
258 #Android related build scripts |
252 add_subdirectory(bin) |
259 if(ANDROID) |
253 add_subdirectory(misc/quazip) |
260 #run cmake -DANDROID=1 to enable this |
254 add_subdirectory(QTfrontend) |
261 add_subdirectory(project_files/Android-build) |
255 add_subdirectory(share) |
262 endif() |
256 add_subdirectory(tools) |
263 |
257 endif() |
264 #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set |
|
265 if(NOT (BUILD_ENGINE_LIBRARY OR ANDROID OR WEBGL)) |
|
266 add_subdirectory(bin) |
|
267 add_subdirectory(misc/quazip) |
|
268 add_subdirectory(QTfrontend) |
|
269 add_subdirectory(share) |
|
270 add_subdirectory(tools) |
|
271 endif() |
|
272 endif() |
|
273 |
258 |
274 |
259 |
275 |
260 # CPack variables |
276 # CPack variables |
261 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hedgewars, a free turn-based strategy") |
277 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hedgewars, a free turn-based strategy") |
262 set(CPACK_PACKAGE_VENDOR "Hedgewars Project") |
278 set(CPACK_PACKAGE_VENDOR "Hedgewars Project") |