|
1 set(dcc32_tryexe dcc32.exe) |
|
2 set(ppc386_tryexe ppc386) |
|
3 set(hwengine_project "hwengine.dpr") |
|
4 |
|
5 find_program(dcc32_executable ${dcc32_tryexe}) |
|
6 find_program(ppc386_executable ${ppc386_tryexe}) |
|
7 |
|
8 if (dcc32_executable) |
|
9 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output) |
|
10 endif (dcc32_executable) |
|
11 |
|
12 if (ppc386_executable) |
|
13 exec_program(${ppc386_executable} ARGS "-v" OUTPUT_VARIABLE ppc386_output) |
|
14 endif (ppc386_executable) |
|
15 |
|
16 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}") |
|
17 if (dcc32version) |
|
18 set(pascal_compiler ${dcc32_executable}) |
|
19 set(pascal_compiler_flags "-B -W"${hwengine_project}) |
|
20 else (dcc32version) |
|
21 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" ppc386_version "${ppc386_output}") |
|
22 if (ppc386_version) |
|
23 string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ppc386_vers_major "${ppc386_version}") |
|
24 string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ppc386_vers_minor "${ppc386_version}") |
|
25 string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ppc386_vers_patch "${ppc386_version}") |
|
26 math(EXPR ppc386_ver "${ppc386_vers_major}*10000 + ${ppc386_vers_minor}*100 + ${ppc386_vers_patch}") |
|
27 if (ppc386_ver LESS "010902") |
|
28 message("Minimum required version of FreePascal is 1.9.2") |
|
29 else (ppc386_ver LESS "010902") |
|
30 set(pascal_compiler ${ppc386_executable}) |
|
31 set(pascal_compiler_flags "-B -Sd -Xs -OG -Or -O2 -Cs2000000"${hwengine_project}) |
|
32 endif (ppc386_ver LESS "010902") |
|
33 endif (ppc386_version) |
|
34 endif (dcc32version) |
|
35 |
|
36 if (NOT pascal_compiler) |
|
37 message(FATAL_ERROR "No Pascal compiler found!") |
|
38 endif (NOT pascal_compiler) |
|
39 |
|
40 add_custom_target(hwengine ALL |
|
41 ${pascal_compiler} ${pascal_compiler_flags}) |
|
42 |
|
43 install_targets(/bin hwengine) |