author | nemo |
Fri, 16 Oct 2009 22:46:58 +0000 | |
changeset 2514 | df9d0728c5bb |
parent 2494 | 1e10a47cabea |
child 2515 | 51d3f4b6293a |
permissions | -rw-r--r-- |
2219
07f5345ecae7
additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
2213
diff
changeset
|
1 |
configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in ${CMAKE_CURRENT_BINARY_DIR}/proto.inc) |
271 | 2 |
|
2420 | 3 |
find_package(SDL) |
4 |
find_package(SDL_image) |
|
5 |
find_package(SDL_net) |
|
6 |
find_package(SDL_ttf) |
|
2401 | 7 |
|
2406 | 8 |
|
9 |
#SOURCE AND PROGRAMS SECTION |
|
184 | 10 |
set(fpc_tryexe fpc) |
2326
0ddf641fddee
rename dpr -> pas, restores ammos on two columns, minor fixes to openalbridge
koda
parents:
2251
diff
changeset
|
11 |
set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas) |
184 | 12 |
|
220 | 13 |
set(engine_sources |
14 |
${hwengine_project} |
|
15 |
SDLh.pas |
|
16 |
uAI.pas |
|
17 |
uAIActions.pas |
|
18 |
uAIAmmoTests.pas |
|
19 |
uAIMisc.pas |
|
288 | 20 |
uAmmos.pas |
942 | 21 |
uChat.pas |
220 | 22 |
uCollisions.pas |
23 |
uConsole.pas |
|
24 |
uConsts.pas |
|
357 | 25 |
uFloat.pas |
220 | 26 |
uGame.pas |
27 |
uGears.pas |
|
28 |
uIO.pas |
|
29 |
uKeys.pas |
|
30 |
uLand.pas |
|
31 |
uLandGraphics.pas |
|
32 |
uLandObjects.pas |
|
33 |
uLandTemplates.pas |
|
1806 | 34 |
uLandTexture.pas |
220 | 35 |
uLocale.pas |
36 |
uMisc.pas |
|
37 |
uRandom.pas |
|
368 | 38 |
uSHA.pas |
220 | 39 |
uSound.pas |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
802
diff
changeset
|
40 |
uStats.pas |
220 | 41 |
uStore.pas |
42 |
uTeams.pas |
|
593 | 43 |
uTriggers.pas |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
782
diff
changeset
|
44 |
uVisualGears.pas |
220 | 45 |
uWorld.pas |
46 |
CCHandlers.inc |
|
47 |
GSHandlers.inc |
|
48 |
HHHandlers.inc |
|
357 | 49 |
SinTable.inc |
220 | 50 |
options.inc |
781 | 51 |
${CMAKE_CURRENT_BINARY_DIR}/proto.inc |
220 | 52 |
tunsetborder.inc |
53 |
) |
|
54 |
||
184 | 55 |
find_program(fpc_executable ${fpc_tryexe}) |
56 |
||
57 |
if (fpc_executable) |
|
58 |
exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output) |
|
59 |
endif (fpc_executable) |
|
60 |
||
476
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
61 |
set (noexecstack_flags "-k-z" "-knoexecstack") |
781 | 62 |
file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.") |
476
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
63 |
|
781 | 64 |
exec_program(${fpc_executable} ${EXECUTABLE_OUTPUT_PATH} |
476
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
65 |
ARGS ${noexecstack_flags} checkstack.pas |
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
66 |
OUTPUT_VARIABLE noout |
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
67 |
RETURN_VALUE testnoexecstack) |
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
68 |
|
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
69 |
if (${testnoexecstack}) |
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
70 |
set (noexecstack_flags "") |
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
71 |
endif (${testnoexecstack}) |
a4e975f70b60
check for noexecstack linker compatibility (MacOS linker)
displacer
parents:
433
diff
changeset
|
72 |
|
2406 | 73 |
|
74 |
#PASCAL DETECTION SECTION |
|
75 |
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") |
|
76 |
||
77 |
if (fpc_version) |
|
78 |
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") |
|
79 |
string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") |
|
80 |
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}") |
|
81 |
math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
|
82 |
if (fpc_ver LESS "020200") |
|
83 |
message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
|
84 |
else() |
|
85 |
set(pascal_compiler ${fpc_executable}) |
|
86 |
endif () |
|
87 |
endif (fpc_version) |
|
88 |
||
89 |
if (NOT pascal_compiler) |
|
90 |
message(FATAL_ERROR "No Pascal compiler found!") |
|
91 |
endif (NOT pascal_compiler) |
|
92 |
||
93 |
||
94 |
#PASCAL FLAG SECTION |
|
2413
d921d13a8546
fix that nasty "Pascal Internal Error" when compiling
koda
parents:
2406
diff
changeset
|
95 |
set(pascal_compiler_flags ${noexecstack_flags} "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi" ${hwengine_project}) |
2406 | 96 |
|
97 |
if(OPTIMIZATIONS) |
|
98 |
set(pascal_compiler_flags "-O2" "-Xs" "-Nu" ${pascal_compiler_flags}) |
|
99 |
if(APPLE AND NOT universal_build) |
|
2413
d921d13a8546
fix that nasty "Pascal Internal Error" when compiling
koda
parents:
2406
diff
changeset
|
100 |
set(pascal_compiler_flags "-fPIC" "-CfSSE2" ${pascal_compiler_flags}) #instruction set for ppc is 7400 |
2406 | 101 |
endif() |
102 |
else(OPTIMIZATIONS) |
|
2494 | 103 |
set(pascal_compiler_flags "-O-" "-gl" "-dDEBUGFILE" "-dDEBUG" "-pg" "-va" ${pascal_compiler_flags}) |
2406 | 104 |
endif(OPTIMIZATIONS) |
105 |
||
106 |
if(LOWRES) |
|
107 |
set(pascal_compiler_flags "-dLOWRES" ${pascal_compiler_flags} ${hwengine_project}) |
|
108 |
endif(LOWRES) |
|
109 |
||
110 |
#special handling of MSVC compiler (no static linking) |
|
111 |
if(MSVC) |
|
112 |
set(pascal_compiler_flags "-dMSVC" ${pascal_compiler_flags}) |
|
113 |
endif(MSVC) |
|
114 |
||
115 |
||
116 |
#DEPENDECIES AND EXECUTABLES SECTION |
|
1997 | 117 |
IF(APPLE) |
2401 | 118 |
#let's build sdlmain, which is absent from the framework |
2420 | 119 |
find_package(SDL REQUIRED) |
120 |
||
2401 | 121 |
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
122 |
include_directories(${SDL_INCLUDE_DIR}) |
|
123 |
link_libraries(${SDL_LIBRARY}) |
|
2016 | 124 |
|
2401 | 125 |
add_library (SDLmain STATIC SDLMain.m) |
126 |
set(engine_sources SDLmain ${engine_sources}) |
|
1997 | 127 |
ENDIF(APPLE) |
128 |
||
2219
07f5345ecae7
additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
2213
diff
changeset
|
129 |
IF(NOT APPLE OR NOT universal_build) |
2003 | 130 |
#here is the standard command for any system |
220 | 131 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" |
781 | 132 |
COMMAND "${pascal_compiler}" |
133 |
ARGS ${pascal_compiler_flags} |
|
134 |
MAIN_DEPENDENCY ${hwengine_project} |
|
2200
8192be6e3aef
koda/Smaxx changes to openal for crossplatform building
nemo
parents:
2191
diff
changeset
|
135 |
DEPENDS openalbridge ${engine_sources} |
781 | 136 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
137 |
ELSE() |
2003 | 138 |
#these are the two dependencies for building a universal binary on Mac OS X |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
139 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.386" |
2003 | 140 |
COMMAND "ppc386" |
2406 | 141 |
ARGS ${pascal_compiler_flags} -ohwengine.386 -CfSSE2 |
2003 | 142 |
MAIN_DEPENDENCY ${hwengine_project} |
2200
8192be6e3aef
koda/Smaxx changes to openal for crossplatform building
nemo
parents:
2191
diff
changeset
|
143 |
DEPENDS openalbridge ${engine_sources} |
2003 | 144 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
145 |
add_custom_target(hwengine.386 ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.386") |
2003 | 146 |
|
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
147 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc" |
2003 | 148 |
COMMAND "ppcppc" |
149 |
ARGS ${pascal_compiler_flags} -ohwengine.ppc |
|
150 |
MAIN_DEPENDENCY ${hwengine_project} |
|
2200
8192be6e3aef
koda/Smaxx changes to openal for crossplatform building
nemo
parents:
2191
diff
changeset
|
151 |
DEPENDS openalbridge ${engine_sources} |
2003 | 152 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
153 |
add_custom_target(hwengine.ppc ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc") |
2003 | 154 |
|
155 |
#this is the command that bundles the two executables into one |
|
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
156 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine" |
2003 | 157 |
COMMAND "lipo" |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
158 |
ARGS ${EXECUTABLE_OUTPUT_PATH}/hwengine.386 ${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc -create -output ${EXECUTABLE_OUTPUT_PATH}/hwengine |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
159 |
DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.386" "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc" |
2003 | 160 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
161 |
ENDIF() |
2003 | 162 |
|
163 |
||
220 | 164 |
add_custom_target(hwengine ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}") |
184 | 165 |
|
2015 | 166 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |
167 |