17 #set other default values |
17 #set other default values |
18 option(NOSERVER "Disable gameServer build [default: auto]" OFF) |
18 option(NOSERVER "Disable gameServer build [default: auto]" OFF) |
19 option(NOPNG "Disable screenshoot compression [default: auto]" OFF) |
19 option(NOPNG "Disable screenshoot compression [default: auto]" OFF) |
20 option(NOVIDEOREC "Disable video recording [default: auto]" OFF) |
20 option(NOVIDEOREC "Disable video recording [default: auto]" OFF) |
21 |
21 |
|
22 #set this to ON when 2.1.0 becomes more widespread (and only for linux) |
|
23 option(SYSTEM_PHYSFS "Use system physfs [default:off]" OFF) |
|
24 |
22 option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF) |
25 option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF) |
23 option(ANDROID "Enable Android build [default: off]" OFF) |
26 option(ANDROID "Enable Android build [default: off]" OFF) |
24 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF) |
27 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF) |
25 option(MINIMAL_FLAGS "Respect system flags as much as possible [default: off]" OFF) |
28 option(MINIMAL_FLAGS "Respect system flags as much as possible [default: off]" OFF) |
|
29 |
26 set(FPFLAGS "" CACHE STRING "Additional Freepascal flags") |
30 set(FPFLAGS "" CACHE STRING "Additional Freepascal flags") |
27 set(GHFLAGS "" CACHE STRING "Additional Haskell flags") |
31 set(GHFLAGS "" CACHE STRING "Additional Haskell flags") |
28 if(UNIX AND NOT APPLE) |
32 if(UNIX AND NOT APPLE) |
29 set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path") |
33 set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path") |
30 endif() |
34 endif() |
266 list(APPEND pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline") |
270 list(APPEND pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline") |
267 endif() |
271 endif() |
268 |
272 |
269 |
273 |
270 #physfs discovery |
274 #physfs discovery |
271 set(PHYSFS_FOUND false) |
275 if (${SYSTEM_PHYSFS}) |
272 if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR) |
276 if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR) |
273 find_package(PhysFS) |
277 find_package(PhysFS) |
274 endif() |
278 endif() |
275 |
279 |
276 #if they bundled one is discovered |
280 find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR}) |
277 set(physfs_output_name "hw_physfs") |
281 if(physfs_h) |
278 get_filename_component(physfs_detected_name ${PHYSFS_LIBRARY} NAME_WE) |
282 file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+") |
279 #or if the found one is too old |
283 file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+") |
280 find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR}) |
284 file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+") |
281 if(physfs_h) |
285 string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}") |
282 file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+") |
286 string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}") |
283 file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+") |
287 string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}") |
284 file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+") |
288 set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}") |
285 string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}") |
289 |
286 string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}") |
290 if (physfs_detected_ver VERSION_LESS "2.1.0") |
287 string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}") |
291 message(FATAL_ERROR "PhysFS version is too old (dected ${physfs_detected_ver}, required 2.1.0)") |
288 set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}") |
292 set(physfs_too_old true) |
289 if(physfs_detected_ver VERSION_LESS "2.1.0") |
293 endif() |
290 message(STATUS "PhysFS version is too old (dected ${physfs_detected_ver}, required 2.1.0)") |
294 endif() |
291 set(physfs_too_old true) |
295 |
292 endif() |
296 if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR) |
293 endif() |
297 message(FATAL_ERROR "Missing PhysFS! Rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version") |
294 |
298 endif() |
295 if(NOT ${PHYSFS_FOUND} OR physfs_too_old OR |
299 else() |
296 (${physfs_detected_name} MATCHES ${physfs_output_name})) |
|
297 message(STATUS "PhysFS will be provided by the bundled sources") |
300 message(STATUS "PhysFS will be provided by the bundled sources") |
|
301 set(physfs_output_name "hw_physfs") |
298 add_subdirectory(misc/libphysfs) |
302 add_subdirectory(misc/libphysfs) |
299 #-XLA is a 'beta' fpc flag that will rename libraries before passing them to the linker |
303 #-XLA is a 'beta' fpc flag that will rename libraries before passing them to the linker |
300 list(APPEND pascal_flags "-XLAphysfs=${physfs_output_name}") |
304 list(APPEND pascal_flags "-XLAphysfs=${physfs_output_name}") |
301 endif() |
305 endif() |
|
306 |
|
307 # |
302 add_subdirectory(misc/libphyslayer) |
308 add_subdirectory(misc/libphyslayer) |
303 |
309 |
304 #main engine |
310 #main engine |
305 add_subdirectory(hedgewars) |
311 add_subdirectory(hedgewars) |
306 |
312 |