25 |
25 |
26 #libraries are built shared unless explicitly added as a static |
26 #libraries are built shared unless explicitly added as a static |
27 option(BUILD_SHARED_LIBS "Build libraries as shared modules (on)" ON) |
27 option(BUILD_SHARED_LIBS "Build libraries as shared modules (on)" ON) |
28 |
28 |
29 if(WIN32 OR APPLE) |
29 if(WIN32 OR APPLE) |
30 option(PHYSFS_SYSTEM "Use system physfs (off)" OFF) |
|
31 option(LUA_SYSTEM "Use system lua (off)" OFF) |
30 option(LUA_SYSTEM "Use system lua (off)" OFF) |
32 else() |
31 else() |
33 option(PHYSFS_SYSTEM "Use system physfs (on)" ON) |
|
34 option(LUA_SYSTEM "Use system lua (on)" ON) |
32 option(LUA_SYSTEM "Use system lua (on)" ON) |
35 endif() |
33 endif() |
36 |
34 |
37 option(BUILD_ENGINE_LIBRARY "Enable hwengine library (off)" OFF) |
35 option(BUILD_ENGINE_LIBRARY "Enable hwengine library (off)" OFF) |
38 option(ANDROID "Enable Android build (off)" OFF) |
36 option(ANDROID "Enable Android build (off)" OFF) |
59 endif() |
57 endif() |
60 |
58 |
61 set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
59 set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
62 set(BUILD_ENGINE_LIBRARY ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
60 set(BUILD_ENGINE_LIBRARY ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
63 set(NOAUTOUPDATE ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
61 set(NOAUTOUPDATE ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
64 set(PHYSFS_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
65 set(LUA_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
62 set(LUA_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
66 set(NOVIDEOREC ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
63 set(NOVIDEOREC ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
67 set(NOSERVER ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
64 set(NOSERVER ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
68 set(GL2 ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
65 set(GL2 ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
69 set(BUILD_SHARED_LIBS OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
66 set(BUILD_SHARED_LIBS OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
197 add_subdirectory(misc/liblua) |
194 add_subdirectory(misc/liblua) |
198 endif() |
195 endif() |
199 |
196 |
200 |
197 |
201 #physfs discovery |
198 #physfs discovery |
202 if(PHYSFS_SYSTEM) |
199 if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR) |
203 if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR) |
200 find_package(PhysFS) |
204 find_package(PhysFS) |
201 endif() |
205 endif() |
202 |
206 |
203 find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR}) |
207 find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR}) |
204 if(physfs_h) |
208 if(physfs_h) |
205 file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+") |
209 file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+") |
206 file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+") |
210 file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+") |
207 file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+") |
211 file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+") |
208 string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}") |
212 string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}") |
209 string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}") |
213 string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}") |
210 string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}") |
214 string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}") |
211 set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}") |
215 set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}") |
212 |
216 |
213 if(${physfs_detected_ver} VERSION_LESS 3.0.0) |
217 if(${physfs_detected_ver} VERSION_LESS 2.0.0) |
214 message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 3.0.0)\n" |
218 message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 2.0.0)\n" |
215 "Perform an update of PhysFS to fix this.") |
219 "Perform an update or rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version") |
216 endif() |
220 endif() |
217 endif() |
221 endif() |
218 |
222 |
219 if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) |
223 if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) |
220 #use an IMPORTED tharget so that we can just use 'physfs' to link |
224 #use an IMPORTED tharget so that we can just use 'physfs' to link |
221 add_library(physfs UNKNOWN IMPORTED) |
225 add_library(physfs UNKNOWN IMPORTED) |
222 set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY}) |
226 set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY}) |
223 else() |
227 else() |
224 message(FATAL_ERROR "Missing PhysFS! Install PhysFS to fix this.") |
228 message(FATAL_ERROR "Missing PhysFS! Rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version") |
|
229 endif() |
|
230 else() |
|
231 if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR) |
|
232 message(STATUS "PhysFS will be provided by the bundled sources") |
|
233 endif() |
|
234 set(physfs_output_name "hwphysfs") |
|
235 add_subdirectory(misc/libphysfs) |
|
236 endif() |
225 endif() |
237 |
226 |
238 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built") |
227 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built") |
239 |
228 |
240 #physfs helper library |
229 #physfs helper library |