hedgewars/CMakeLists.txt
author unc0rr
Mon, 03 Jul 2006 17:46:58 +0000
changeset 73 fe1c62875a19
child 75 d2b737858ff7
permissions -rw-r--r--
- More smooth hedgehogs physics - Use CMake build system
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
73
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     1
set(dcc32_tryexe dcc32.exe)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     2
set(ppc386_tryexe ppc386)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     3
set(hwengine_project "hwengine.dpr")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     4
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     5
find_program(dcc32_executable ${dcc32_tryexe})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     6
find_program(ppc386_executable ${ppc386_tryexe})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     7
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     8
if (dcc32_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     9
	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    10
endif (dcc32_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    11
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    12
if (ppc386_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    13
	 exec_program(${ppc386_executable} ARGS "-v" OUTPUT_VARIABLE ppc386_output)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    14
endif (ppc386_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    15
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    16
string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    17
if (dcc32version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    18
	set(pascal_compiler ${dcc32_executable})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    19
	set(pascal_compiler_flags "-B -W"${hwengine_project})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    20
else (dcc32version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    21
	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" ppc386_version "${ppc386_output}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    22
	if (ppc386_version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    23
		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ppc386_vers_major "${ppc386_version}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    24
		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ppc386_vers_minor "${ppc386_version}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    25
		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ppc386_vers_patch "${ppc386_version}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    26
		math(EXPR ppc386_ver "${ppc386_vers_major}*10000 + ${ppc386_vers_minor}*100 + ${ppc386_vers_patch}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    27
		if (ppc386_ver LESS "010902")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    28
			message("Minimum required version of FreePascal is 1.9.2")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    29
		else (ppc386_ver LESS "010902")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    30
			set(pascal_compiler ${ppc386_executable})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    31
			set(pascal_compiler_flags "-B -Sd -Xs -OG -Or -O2 -Cs2000000"${hwengine_project})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    32
		endif (ppc386_ver LESS "010902")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    33
	endif (ppc386_version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    34
endif (dcc32version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    35
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    36
if (NOT pascal_compiler)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    37
	message(FATAL_ERROR "No Pascal compiler found!")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    38
endif (NOT pascal_compiler)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    39
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    40
add_custom_target(hwengine ALL
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    41
	${pascal_compiler} ${pascal_compiler_flags})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    42
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    43
install_targets(/bin hwengine)