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) |
6 find_package(Lua) |
7 |
7 |
|
8 include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake) |
|
9 |
8 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
10 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
9 |
|
10 #find which version of SDL_image and SDL_mixer we have (for IMG_Init and Mix_Init) |
|
11 #if the headers are not installed, the newer apis won't be activated |
|
12 find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_INCLUDE_DIR}) |
|
13 if(sdlmixer_h) |
|
14 file(STRINGS ${sdlmixer_h} sdlmixer_version_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+") |
|
15 string(REGEX MATCH ".([0-9]+)" sdlmixer_version "${sdlmixer_version_tmp}") |
|
16 |
|
17 if(sdlmixer_version GREATER 9) |
|
18 message(STATUS "Enabling enhanced SDL_Mixer calls") |
|
19 set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn}) |
|
20 endif() |
|
21 endif() |
|
22 |
|
23 find_file(sdlimage_h SDL_image.h ${SDLIMAGE_INCLUDE_DIR}) |
|
24 if(sdlimage_h) |
|
25 file(STRINGS ${sdlimage_h} sdlimage_version_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+") |
|
26 string(REGEX MATCH ".([0-9]+)" sdlimage_version "${sdlimage_version_tmp}") |
|
27 |
|
28 if(sdlimage_version GREATER 7) |
|
29 message(STATUS "Enabling enhanced SDL_Image calls") |
|
30 set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn}) |
|
31 endif() |
|
32 endif() |
|
33 |
11 |
34 #SOURCE AND PROGRAMS SECTION |
12 #SOURCE AND PROGRAMS SECTION |
35 set(fpc_tryexe fpc) |
13 set(fpc_tryexe fpc) |
36 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas) |
14 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas) |
37 set(engine_output_name "hwengine") |
15 set(engine_output_name "hwengine") |
152 message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}") |
130 message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}") |
153 math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
131 math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
154 |
132 |
155 if(fpc_ver LESS "020200") |
133 if(fpc_ver LESS "020200") |
156 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
134 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
157 elseif(APPLE AND x86_64_build AND fpc_ver LESS "020400") |
135 elseif(APPLE AND x86_64_build AND (fpc_ver LESS "020400")) |
158 message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!") |
136 message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications on Mac OS X!") |
159 endif() |
137 endif() |
160 else() |
138 else() |
161 message(FATAL_ERROR "No Pascal compiler found!") |
139 message(FATAL_ERROR "No Pascal compiler found!") |
162 endif() |
140 endif() |
163 |
141 |