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