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