equal
deleted
inserted
replaced
1 find_package(SDL) |
1 find_package(SDL) |
2 find_package(SDL_image) |
2 find_package(SDL_image) |
3 find_package(SDL_net) |
3 find_package(SDL_net) |
4 find_package(SDL_ttf) |
4 find_package(SDL_ttf) |
5 find_package(SDL_mixer) |
5 find_package(SDL_mixer) |
6 find_package(Lua) |
|
7 |
6 |
8 include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake) |
7 include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake) |
9 |
8 |
10 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
9 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
11 |
10 |
89 if (APPLE) |
88 if (APPLE) |
90 set(engine_output_name "hwengine.dylib") |
89 set(engine_output_name "hwengine.dylib") |
91 endif (APPLE) |
90 endif (APPLE) |
92 endif(BUILD_ENGINE_LIBRARY) |
91 endif(BUILD_ENGINE_LIBRARY) |
93 |
92 |
94 find_program(fpc_executable fpc) |
93 IF(FPC) |
|
94 set(fpc_executable ${FPC}) |
|
95 ELSE() |
|
96 find_program(fpc_executable fpc) |
|
97 ENDIF() |
95 |
98 |
96 if(fpc_executable) |
99 if(fpc_executable) |
97 exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output) |
100 exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output) |
98 endif(fpc_executable) |
101 endif(fpc_executable) |
99 |
102 |
136 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
139 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
137 elseif(APPLE AND (fpc_ver LESS "020600")) |
140 elseif(APPLE AND (fpc_ver LESS "020600")) |
138 message(FATAL_ERROR "Minimum required version of FreePascal is 2.6.0 on Mac OS X") |
141 message(FATAL_ERROR "Minimum required version of FreePascal is 2.6.0 on Mac OS X") |
139 endif() |
142 endif() |
140 else() |
143 else() |
141 message(FATAL_ERROR "No Pascal compiler found!") |
144 message(FATAL_ERROR "No FreePascal compiler found!") |
142 endif() |
145 endif() |
143 |
146 |
144 |
147 |
145 #DEPENDECIES AND EXECUTABLES SECTION |
148 #DEPENDECIES AND EXECUTABLES SECTION |
146 find_package(PNG) |
149 find_package(PNG) |
182 set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list}) |
185 set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list}) |
183 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" |
186 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" |
184 COMMAND "${pascal_compiler}" |
187 COMMAND "${pascal_compiler}" |
185 ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch} |
188 ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch} |
186 MAIN_DEPENDENCY ${hwengine_project} |
189 MAIN_DEPENDENCY ${hwengine_project} |
187 DEPENDS ${engine_sources} SDLmain lua |
190 DEPENDS ${engine_sources} SDLmain |
188 ) |
191 ) |
189 add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}") |
192 add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}") |
190 endforeach() |
193 endforeach() |
191 |
194 |
192 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" |
195 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" |
196 ) |
199 ) |
197 ENDIF() |
200 ENDIF() |
198 |
201 |
199 |
202 |
200 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}") |
203 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}") |
201 IF(NOT APPLE) |
204 |
|
205 #when system Lua is not found we need to compile it before engine |
|
206 if(NOT ${LUA_FOUND}) |
|
207 add_dependencies(${engine_output_name} lua) |
|
208 endif() |
|
209 |
|
210 #this command is a workaround to some inlining issues present in older |
|
211 # FreePascal versions and fixed in 2.6, That version is mandatory on OSX, |
|
212 # hence the command is not needed there |
|
213 if(NOT APPLE) |
202 add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars") |
214 add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars") |
203 add_dependencies(${engine_output_name} ENGINECLEAN) |
215 add_dependencies(${engine_output_name} ENGINECLEAN) |
204 ENDIF() |
216 endif() |
205 |
217 |
206 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |
218 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |
207 |
219 |