14 endif (fpc_executable) |
47 endif (fpc_executable) |
15 |
48 |
16 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}") |
49 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}") |
17 if (dcc32version) |
50 if (dcc32version) |
18 set(pascal_compiler ${dcc32_executable}) |
51 set(pascal_compiler ${dcc32_executable}) |
19 set(pascal_compiler_flags "-B" "-W" ${hwengine_project}) |
52 set(pascal_compiler_flags "-B" "-W" "-E${EXECUTABLE_OUTPUT_PATH}" ${hwengine_project}) |
20 else (dcc32version) |
53 else (dcc32version) |
21 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") |
54 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") |
22 if (fpc_version) |
55 if (fpc_version) |
23 string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") |
56 string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") |
24 string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") |
57 string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") |
26 math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
59 math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
27 if (fpc_ver LESS "010904") |
60 if (fpc_ver LESS "010904") |
28 message("Minimum required version of FreePascal is 1.9.4") |
61 message("Minimum required version of FreePascal is 1.9.4") |
29 else (fpc_ver LESS "010904") |
62 else (fpc_ver LESS "010904") |
30 set(pascal_compiler ${fpc_executable}) |
63 set(pascal_compiler ${fpc_executable}) |
31 set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-Cs2000000" ${hwengine_project}) |
64 set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-FE${EXECUTABLE_OUTPUT_PATH}" "-Cs2000000" ${hwengine_project}) |
32 endif (fpc_ver LESS "010904") |
65 endif (fpc_ver LESS "010904") |
33 endif (fpc_version) |
66 endif (fpc_version) |
34 endif (dcc32version) |
67 endif (dcc32version) |
35 |
68 |
36 if (NOT pascal_compiler) |
69 if (NOT pascal_compiler) |
37 message(FATAL_ERROR "No Pascal compiler found!") |
70 message(FATAL_ERROR "No Pascal compiler found!") |
38 endif (NOT pascal_compiler) |
71 endif (NOT pascal_compiler) |
39 |
72 |
40 add_custom_target(hwengine ALL COMMAND "${pascal_compiler}" ${pascal_compiler_flags}) |
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}") |
41 |
81 |
42 install(PROGRAMS "hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin) |
82 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin) |