271
|
1 |
configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in
|
|
2 |
${hedgewars_SOURCE_DIR}/hedgewars/proto.inc)
|
|
3 |
|
226
|
4 |
set(dcc32_tryexe dcc32.exe)
|
184
|
5 |
set(fpc_tryexe fpc)
|
|
6 |
set(hwengine_project "hwengine.dpr")
|
|
7 |
|
220
|
8 |
set(engine_sources
|
|
9 |
${hwengine_project}
|
|
10 |
SDLh.pas
|
|
11 |
uAI.pas
|
|
12 |
uAIActions.pas
|
|
13 |
uAIAmmoTests.pas
|
|
14 |
uAIMisc.pas
|
|
15 |
uAIThinkStack.pas
|
|
16 |
uCollisions.pas
|
|
17 |
uConsole.pas
|
|
18 |
uConsts.pas
|
|
19 |
uGame.pas
|
|
20 |
uGears.pas
|
|
21 |
uIO.pas
|
|
22 |
uKeys.pas
|
|
23 |
uLand.pas
|
|
24 |
uLandGraphics.pas
|
|
25 |
uLandObjects.pas
|
|
26 |
uLandTemplates.pas
|
|
27 |
uLocale.pas
|
|
28 |
uMisc.pas
|
|
29 |
uRandom.pas
|
|
30 |
uSound.pas
|
|
31 |
uStore.pas
|
|
32 |
uTeams.pas
|
|
33 |
uWorld.pas
|
|
34 |
CCHandlers.inc
|
|
35 |
GSHandlers.inc
|
|
36 |
HHHandlers.inc
|
|
37 |
options.inc
|
271
|
38 |
proto.inc
|
220
|
39 |
tunsetborder.inc
|
|
40 |
)
|
|
41 |
|
184
|
42 |
find_program(dcc32_executable ${dcc32_tryexe})
|
|
43 |
find_program(fpc_executable ${fpc_tryexe})
|
|
44 |
|
|
45 |
if (dcc32_executable)
|
|
46 |
exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
|
|
47 |
endif (dcc32_executable)
|
|
48 |
|
|
49 |
if (fpc_executable)
|
|
50 |
exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
|
|
51 |
endif (fpc_executable)
|
|
52 |
|
|
53 |
string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
|
|
54 |
if (dcc32version)
|
|
55 |
set(pascal_compiler ${dcc32_executable})
|
220
|
56 |
set(pascal_compiler_flags "-B" "-W" "-E${EXECUTABLE_OUTPUT_PATH}" ${hwengine_project})
|
184
|
57 |
else (dcc32version)
|
|
58 |
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
|
|
59 |
if (fpc_version)
|
|
60 |
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
|
|
61 |
string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
|
|
62 |
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
|
|
63 |
math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
|
196
|
64 |
if (fpc_ver LESS "010904")
|
|
65 |
message("Minimum required version of FreePascal is 1.9.4")
|
|
66 |
else (fpc_ver LESS "010904")
|
184
|
67 |
set(pascal_compiler ${fpc_executable})
|
256
|
68 |
set(pascal_compiler_flags "-k-z" "-knoexecstack" "-B" "-Sd" "-Xs" "-OG" "-O2" "-FE${EXECUTABLE_OUTPUT_PATH}" "-Cs2000000" ${hwengine_project})
|
196
|
69 |
endif (fpc_ver LESS "010904")
|
184
|
70 |
endif (fpc_version)
|
|
71 |
endif (dcc32version)
|
|
72 |
|
|
73 |
if (NOT pascal_compiler)
|
|
74 |
message(FATAL_ERROR "No Pascal compiler found!")
|
|
75 |
endif (NOT pascal_compiler)
|
|
76 |
|
220
|
77 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
|
|
78 |
COMMAND "${pascal_compiler}"
|
|
79 |
ARGS ${pascal_compiler_flags}
|
|
80 |
MAIN_DEPENDENCY ${hwengine_project}
|
|
81 |
DEPENDS ${engine_sources}
|
|
82 |
)
|
|
83 |
|
|
84 |
add_custom_target(hwengine ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
|
184
|
85 |
|
220
|
86 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
|