39 option(MINIMAL_FLAGS "Respect system flags as much as possible (off)" OFF) |
39 option(MINIMAL_FLAGS "Respect system flags as much as possible (off)" OFF) |
40 option(NOAUTOUPDATE "Disable OS X Sparkle update checking (off)" OFF) |
40 option(NOAUTOUPDATE "Disable OS X Sparkle update checking (off)" OFF) |
41 option(SKIPBUNDLE "Do not create relocate bundle (off)" OFF) |
41 option(SKIPBUNDLE "Do not create relocate bundle (off)" OFF) |
42 |
42 |
43 option(BUILD_ENGINE_C "Compile hwengine as native C (off)" OFF) |
43 option(BUILD_ENGINE_C "Compile hwengine as native C (off)" OFF) |
|
44 option(BUILD_ENGINE_JS "Compile hwengine as javascript (off)" OFF) |
44 option(GL2 "Enable OpenGL 2 rendering !!!EXPERIMENTAL - DO NOT USE!!! [default: off)" OFF) |
45 option(GL2 "Enable OpenGL 2 rendering !!!EXPERIMENTAL - DO NOT USE!!! [default: off)" OFF) |
45 |
46 |
46 set(GHFLAGS "" CACHE STRING "Additional Haskell flags") |
47 set(GHFLAGS "" CACHE STRING "Additional Haskell flags") |
47 if(UNIX AND NOT APPLE) |
48 if(UNIX AND NOT APPLE) |
48 set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path") |
49 set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path") |
49 endif() |
50 endif() |
50 |
51 |
51 option(NOVERSIONINFOUPDATE "Disable update of version_info.txt. To be used if source is in a git/repo that is NOT the hedgewars repo" OFF) |
52 option(NOVERSIONINFOUPDATE "Disable update of version_info.txt. To be used if source is in a git/repo that is NOT the hedgewars repo" OFF) |
|
53 |
|
54 |
|
55 if(BUILD_ENGINE_JS) |
|
56 if(NOT CMAKE_TOOLCHAIN_FILE) |
|
57 message(FATAL_ERROR "Missing emscripten toolchain file\nRerun cmake with -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake_modules/Platform/Emscripten.cmake") |
|
58 endif() |
|
59 |
|
60 set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
61 set(NOAUTOUPDATE ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
62 set(PHYSFS_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
63 set(LUA_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
64 set(NOVIDEOREC ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
65 set(NOSERVER ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
66 set(GL2 ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
67 set(BUILD_SHARED_LIBS OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE) |
|
68 endif() |
52 |
69 |
53 #system paths for finding required fonts (see share/hedgewars/Data/fonts) |
70 #system paths for finding required fonts (see share/hedgewars/Data/fonts) |
54 #subdirectories will NOT be searched. |
71 #subdirectories will NOT be searched. |
55 #all fonts that can't be found will be bundled with hedgewars |
72 #all fonts that can't be found will be bundled with hedgewars |
56 set(FONTS_DIRS "" CACHE STRING "Additional paths to folders where required fonts can be found ( ; is separator)") |
73 set(FONTS_DIRS "" CACHE STRING "Additional paths to folders where required fonts can be found ( ; is separator)") |
88 set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE) |
105 set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE) |
89 endif(CMAKE_BUILD_TYPE) |
106 endif(CMAKE_BUILD_TYPE) |
90 |
107 |
91 |
108 |
92 #perform safe check that enable/disable compilation features |
109 #perform safe check that enable/disable compilation features |
93 include(${CMAKE_MODULE_PATH}/compilerchecks.cmake) |
110 #skip when crosscompiling to javascript |
|
111 if(NOT BUILD_ENGINE_JS) |
|
112 include(${CMAKE_MODULE_PATH}/compilerchecks.cmake) |
|
113 endif() |
94 |
114 |
95 #set default compiler flags |
115 #set default compiler flags |
96 add_flag_append(CMAKE_C_FLAGS "-Wall -pipe") |
116 add_flag_append(CMAKE_C_FLAGS "-Wall -pipe") |
97 add_flag_append(CMAKE_C_FLAGS_RELEASE "-O2") |
117 add_flag_append(CMAKE_C_FLAGS_RELEASE "-O2") |
98 add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0") |
118 add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0") |
133 ) |
153 ) |
134 endif() |
154 endif() |
135 |
155 |
136 |
156 |
137 #build engine without freepascal |
157 #build engine without freepascal |
138 if(BUILD_ENGINE_C) |
158 if(BUILD_ENGINE_C AND NOT BUILD_ENGINE_JS) |
139 find_package(Clang REQUIRED) |
159 find_package(Clang REQUIRED) |
140 |
160 |
141 if(${CLANG_VERSION} VERSION_LESS "3.0") |
161 if(${CLANG_VERSION} VERSION_LESS "3.0") |
142 message(FATAL_ERROR "LLVM/Clang compiler required version is 3.0 but version ${CLANG_VERSION} was found!") |
162 message(FATAL_ERROR "LLVM/Clang compiler required version is 3.0 but version ${CLANG_VERSION} was found!") |
143 endif() |
163 endif() |
230 #Android related build scripts |
250 #Android related build scripts |
231 #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set |
251 #TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set |
232 if(ANDROID) |
252 if(ANDROID) |
233 add_subdirectory(project_files/Android-build) |
253 add_subdirectory(project_files/Android-build) |
234 else(ANDROID) |
254 else(ANDROID) |
|
255 #skip frontend for javascript |
|
256 if(NOT BUILD_ENGINE_JS) |
|
257 add_subdirectory(qmlFrontend) |
|
258 add_subdirectory(share) |
|
259 endif() |
|
260 |
235 add_subdirectory(bin) |
261 add_subdirectory(bin) |
236 add_subdirectory(qmlFrontend) |
|
237 add_subdirectory(share) |
|
238 add_subdirectory(tools) |
262 add_subdirectory(tools) |
239 endif(ANDROID) |
263 endif(ANDROID) |
240 |
264 |
241 include(${CMAKE_MODULE_PATH}/cpackvars.cmake) |
265 include(${CMAKE_MODULE_PATH}/cpackvars.cmake) |
242 |
266 |