hedgewars/CMakeLists.txt
changeset 360 ab6a94334d6d
parent 358 236bbd12d4d9
child 368 fe71e55d2d7b
equal deleted inserted replaced
359:59fbfc65fbda 360:ab6a94334d6d
     1 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in 
     1 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in 
     2 	${hedgewars_SOURCE_DIR}/hedgewars/proto.inc) 
     2 	${hedgewars_SOURCE_DIR}/hedgewars/proto.inc) 
     3 
     3 
     4 set(dcc32_tryexe "delphi!doesnt!work.exe")
       
     5 set(fpc_tryexe fpc)
     4 set(fpc_tryexe fpc)
     6 set(hwengine_project "hwengine.dpr")
     5 set(hwengine_project "hwengine.dpr")
     7 
     6 
     8 set(engine_sources
     7 set(engine_sources
     9 	${hwengine_project}
     8 	${hwengine_project}
    40 	options.inc
    39 	options.inc
    41 	proto.inc
    40 	proto.inc
    42 	tunsetborder.inc
    41 	tunsetborder.inc
    43 	)
    42 	)
    44 
    43 
    45 find_program(dcc32_executable ${dcc32_tryexe})
       
    46 find_program(fpc_executable ${fpc_tryexe})
    44 find_program(fpc_executable ${fpc_tryexe})
    47 
       
    48 if (dcc32_executable)
       
    49 	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
       
    50 endif (dcc32_executable)
       
    51 
    45 
    52 if (fpc_executable)
    46 if (fpc_executable)
    53 	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
    47 	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
    54 endif (fpc_executable)
    48 endif (fpc_executable)
    55 
    49 
    56 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
    50 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    57 if (dcc32version)
    51 if (fpc_version)
    58 	set(pascal_compiler ${dcc32_executable})
    52 	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    59 	set(pascal_compiler_flags "-B" "-va" "-W" "-E${EXECUTABLE_OUTPUT_PATH}" ${hwengine_project})
    53 	string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
    60 else (dcc32version)
    54 	string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
    61 	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    55 	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    62 	if (fpc_version)
    56 	if (fpc_ver LESS "010904")
    63 		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    57 		message("Minimum required version of FreePascal is 1.9.4")
    64 		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
    58 	else (fpc_ver LESS "010904")
    65 		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
    59 		set(pascal_compiler ${fpc_executable})
    66 		math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    60 		set(pascal_compiler_flags "-B" "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
    67 		if (fpc_ver LESS "010904")
    61 	endif (fpc_ver LESS "010904")
    68 			message("Minimum required version of FreePascal is 1.9.4")
    62 endif (fpc_version)
    69 		else (fpc_ver LESS "010904")
       
    70 			set(pascal_compiler ${fpc_executable})
       
    71 			set(pascal_compiler_flags "-B" "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
       
    72 		endif (fpc_ver LESS "010904")
       
    73 	endif (fpc_version)
       
    74 endif (dcc32version)
       
    75 
    63 
    76 if (NOT pascal_compiler)
    64 if (NOT pascal_compiler)
    77 	message(FATAL_ERROR "No Pascal compiler found!")
    65 	message(FATAL_ERROR "No Pascal compiler found!")
    78 endif (NOT pascal_compiler)
    66 endif (NOT pascal_compiler)
    79 
    67