hedgewars/CMakeLists.txt
changeset 115 4cce20ef48ea
parent 98 f1d252c234ec
child 126 93df479aa1b9
equal deleted inserted replaced
114:2762edfc23a9 115:4cce20ef48ea
     1 set(dcc32_tryexe dcc32.exe)
     1 set(dcc32_tryexe dcc32.exe)
     2 set(ppc386_tryexe ppc386)
     2 set(fpc_tryexe fpc)
     3 set(hwengine_project "hwengine.dpr")
     3 set(hwengine_project "hwengine.dpr")
     4 
     4 
     5 find_program(dcc32_executable ${dcc32_tryexe})
     5 find_program(dcc32_executable ${dcc32_tryexe})
     6 find_program(ppc386_executable ${ppc386_tryexe})
     6 find_program(fpc_executable ${fpc_tryexe})
     7 
     7 
     8 if (dcc32_executable)
     8 if (dcc32_executable)
     9 	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
     9 	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
    10 endif (dcc32_executable)
    10 endif (dcc32_executable)
    11 
    11 
    12 if (ppc386_executable)
    12 if (fpc_executable)
    13 	 exec_program(${ppc386_executable} ARGS "-v" OUTPUT_VARIABLE ppc386_output)
    13 	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
    14 endif (ppc386_executable)
    14 endif (fpc_executable)
    15 
    15 
    16 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
    16 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
    17 if (dcc32version)
    17 if (dcc32version)
    18 	set(pascal_compiler ${dcc32_executable})
    18 	set(pascal_compiler ${dcc32_executable})
    19 	set(pascal_compiler_flags "-B -W "${hwengine_project})
    19 	set(pascal_compiler_flags "-B -W "${hwengine_project})
    20 else (dcc32version)
    20 else (dcc32version)
    21 	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" ppc386_version "${ppc386_output}")
    21 	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    22 	if (ppc386_version)
    22 	if (fpc_version)
    23 		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ppc386_vers_major "${ppc386_version}")
    23 		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" ppc386_vers_minor "${ppc386_version}")
    24 		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
    25 		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ppc386_vers_patch "${ppc386_version}")
    25 		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
    26 		math(EXPR ppc386_ver "${ppc386_vers_major}*10000 + ${ppc386_vers_minor}*100 + ${ppc386_vers_patch}")
    26 		math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    27 		if (ppc386_ver LESS "010902")
    27 		if (fpc_ver LESS "010902")
    28 			message("Minimum required version of FreePascal is 1.9.2")
    28 			message("Minimum required version of FreePascal is 1.9.2")
    29 		else (ppc386_ver LESS "010902")
    29 		else (fpc_ver LESS "010902")
    30 			set(pascal_compiler ${ppc386_executable})
    30 			set(pascal_compiler ${fpc_executable})
    31 			set(pascal_compiler_flags "-B -Sd -Xs -OG -O3 -Cs2000000 "${hwengine_project})
    31 			set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-Cs2000000" ${hwengine_project})
    32 		endif (ppc386_ver LESS "010902")
    32 		endif (fpc_ver LESS "010902")
    33 	endif (ppc386_version)
    33 	endif (fpc_version)
    34 endif (dcc32version)
    34 endif (dcc32version)
    35 
    35 
    36 if (NOT pascal_compiler)
    36 if (NOT pascal_compiler)
    37 	message(FATAL_ERROR "No Pascal compiler found!")
    37 	message(FATAL_ERROR "No Pascal compiler found!")
    38 endif (NOT pascal_compiler)
    38 endif (NOT pascal_compiler)