271
|
1 |
configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in
|
|
2 |
${hedgewars_SOURCE_DIR}/hedgewars/proto.inc)
|
|
3 |
|
184
|
4 |
set(fpc_tryexe fpc)
|
|
5 |
set(hwengine_project "hwengine.dpr")
|
|
6 |
|
220
|
7 |
set(engine_sources
|
|
8 |
${hwengine_project}
|
|
9 |
SDLh.pas
|
|
10 |
uAI.pas
|
|
11 |
uAIActions.pas
|
|
12 |
uAIAmmoTests.pas
|
|
13 |
uAIMisc.pas
|
288
|
14 |
uAmmos.pas
|
220
|
15 |
uCollisions.pas
|
|
16 |
uConsole.pas
|
|
17 |
uConsts.pas
|
357
|
18 |
uFloat.pas
|
220
|
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
|
368
|
30 |
uSHA.pas
|
220
|
31 |
uSound.pas
|
|
32 |
uStore.pas
|
|
33 |
uTeams.pas
|
|
34 |
uWorld.pas
|
|
35 |
CCHandlers.inc
|
|
36 |
GSHandlers.inc
|
|
37 |
HHHandlers.inc
|
357
|
38 |
SinTable.inc
|
220
|
39 |
options.inc
|
271
|
40 |
proto.inc
|
220
|
41 |
tunsetborder.inc
|
|
42 |
)
|
|
43 |
|
184
|
44 |
find_program(fpc_executable ${fpc_tryexe})
|
|
45 |
|
|
46 |
if (fpc_executable)
|
|
47 |
exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
|
|
48 |
endif (fpc_executable)
|
|
49 |
|
360
|
50 |
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
|
|
51 |
if (fpc_version)
|
|
52 |
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
|
|
53 |
string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
|
|
54 |
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
|
|
55 |
math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
|
|
56 |
if (fpc_ver LESS "010904")
|
|
57 |
message("Minimum required version of FreePascal is 1.9.4")
|
|
58 |
else (fpc_ver LESS "010904")
|
|
59 |
set(pascal_compiler ${fpc_executable})
|
|
60 |
set(pascal_compiler_flags "-B" "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
|
|
61 |
endif (fpc_ver LESS "010904")
|
|
62 |
endif (fpc_version)
|
184
|
63 |
|
|
64 |
if (NOT pascal_compiler)
|
|
65 |
message(FATAL_ERROR "No Pascal compiler found!")
|
|
66 |
endif (NOT pascal_compiler)
|
|
67 |
|
220
|
68 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
|
|
69 |
COMMAND "${pascal_compiler}"
|
|
70 |
ARGS ${pascal_compiler_flags}
|
|
71 |
MAIN_DEPENDENCY ${hwengine_project}
|
|
72 |
DEPENDS ${engine_sources}
|
|
73 |
)
|
|
74 |
|
|
75 |
add_custom_target(hwengine ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
|
184
|
76 |
|
220
|
77 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
|