hedgewars/CMakeLists.txt
author unc0rr
Sun, 06 Aug 2006 16:00:23 +0000
changeset 98 f1d252c234ec
parent 95 1ef5e2c41115
child 115 4cce20ef48ea
permissions -rw-r--r--
Repair 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})
95
1ef5e2c41115 - Fixed compilation
unc0rr
parents: 89
diff changeset
    19
	set(pascal_compiler_flags "-B -W "${hwengine_project})
73
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})
95
1ef5e2c41115 - Fixed compilation
unc0rr
parents: 89
diff changeset
    31
			set(pascal_compiler_flags "-B -Sd -Xs -OG -O3 -Cs2000000 "${hwengine_project})
73
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
95
1ef5e2c41115 - Fixed compilation
unc0rr
parents: 89
diff changeset
    40
add_custom_target(hwengine ALL COMMAND "${pascal_compiler}" ${pascal_compiler_flags})
73
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    41
89
f9db56409a86 - Fix various bugs
unc0rr
parents: 75
diff changeset
    42
install(PROGRAMS "hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)