author | koda |
Sat, 10 Oct 2009 14:26:50 +0000 | |
changeset 2413 | d921d13a8546 |
parent 2406 | 2e757b32991e |
child 2420 | b7390a3040f8 |
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 |
|
2401 | 3 |
find_package(SDL REQUIRED) |
2404 | 4 |
find_package(SDL_image REQUIRED) |
5 |
find_package(SDL_net REQUIRED) |
|
6 |
find_package(SDL_ttf REQUIRED) |
|
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) |
|
103 |
set(pascal_compiler_flags "-O-" "-gl" "-dDEBUGFILE" "-pg" "-va" ${pascal_compiler_flags}) |
|
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 |
119 |
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
|
120 |
include_directories(${SDL_INCLUDE_DIR}) |
|
121 |
link_libraries(${SDL_LIBRARY}) |
|
2016 | 122 |
|
2401 | 123 |
add_library (SDLmain STATIC SDLMain.m) |
124 |
set(engine_sources SDLmain ${engine_sources}) |
|
1997 | 125 |
ENDIF(APPLE) |
126 |
||
2219
07f5345ecae7
additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
2213
diff
changeset
|
127 |
IF(NOT APPLE OR NOT universal_build) |
2003 | 128 |
#here is the standard command for any system |
220 | 129 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" |
781 | 130 |
COMMAND "${pascal_compiler}" |
131 |
ARGS ${pascal_compiler_flags} |
|
132 |
MAIN_DEPENDENCY ${hwengine_project} |
|
2200
8192be6e3aef
koda/Smaxx changes to openal for crossplatform building
nemo
parents:
2191
diff
changeset
|
133 |
DEPENDS openalbridge ${engine_sources} |
781 | 134 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
135 |
ELSE() |
2003 | 136 |
#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
|
137 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.386" |
2003 | 138 |
COMMAND "ppc386" |
2406 | 139 |
ARGS ${pascal_compiler_flags} -ohwengine.386 -CfSSE2 |
2003 | 140 |
MAIN_DEPENDENCY ${hwengine_project} |
2200
8192be6e3aef
koda/Smaxx changes to openal for crossplatform building
nemo
parents:
2191
diff
changeset
|
141 |
DEPENDS openalbridge ${engine_sources} |
2003 | 142 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
143 |
add_custom_target(hwengine.386 ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.386") |
2003 | 144 |
|
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
145 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc" |
2003 | 146 |
COMMAND "ppcppc" |
147 |
ARGS ${pascal_compiler_flags} -ohwengine.ppc |
|
148 |
MAIN_DEPENDENCY ${hwengine_project} |
|
2200
8192be6e3aef
koda/Smaxx changes to openal for crossplatform building
nemo
parents:
2191
diff
changeset
|
149 |
DEPENDS openalbridge ${engine_sources} |
2003 | 150 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
151 |
add_custom_target(hwengine.ppc ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc") |
2003 | 152 |
|
153 |
#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
|
154 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine" |
2003 | 155 |
COMMAND "lipo" |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
156 |
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
|
157 |
DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.386" "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc" |
2003 | 158 |
) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2200
diff
changeset
|
159 |
ENDIF() |
2003 | 160 |
|
161 |
||
220 | 162 |
add_custom_target(hwengine ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}") |
184 | 163 |
|
2015 | 164 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |
165 |