hedgewars/CMakeLists.txt
author unc0rr
Thu, 27 Jul 2006 21:13:04 +0000
changeset 90 b18a6cd6a17c
parent 89 f9db56409a86
child 95 1ef5e2c41115
permissions -rw-r--r--
One more page become layouted
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
d2b737858ff7 - New First Aid powerup
unc0rr
parents: 73
diff changeset
     1
add_subdirectory(Data)
d2b737858ff7 - New First Aid powerup
unc0rr
parents: 73
diff changeset
     2
73
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     3
set(dcc32_tryexe dcc32.exe)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     4
set(ppc386_tryexe ppc386)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     5
set(hwengine_project "hwengine.dpr")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     6
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     7
find_program(dcc32_executable ${dcc32_tryexe})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     8
find_program(ppc386_executable ${ppc386_tryexe})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
     9
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    10
if (dcc32_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    11
	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    12
endif (dcc32_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    13
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    14
if (ppc386_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    15
	 exec_program(${ppc386_executable} ARGS "-v" OUTPUT_VARIABLE ppc386_output)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    16
endif (ppc386_executable)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    17
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    18
string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    19
if (dcc32version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    20
	set(pascal_compiler ${dcc32_executable})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    21
	set(pascal_compiler_flags "-B -W"${hwengine_project})
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    22
else (dcc32version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    23
	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" ppc386_version "${ppc386_output}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    24
	if (ppc386_version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    25
		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ppc386_vers_major "${ppc386_version}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    26
		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ppc386_vers_minor "${ppc386_version}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    27
		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ppc386_vers_patch "${ppc386_version}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    28
		math(EXPR ppc386_ver "${ppc386_vers_major}*10000 + ${ppc386_vers_minor}*100 + ${ppc386_vers_patch}")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    29
		if (ppc386_ver LESS "010902")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    30
			message("Minimum required version of FreePascal is 1.9.2")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    31
		else (ppc386_ver LESS "010902")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    32
			set(pascal_compiler ${ppc386_executable})
75
d2b737858ff7 - New First Aid powerup
unc0rr
parents: 73
diff changeset
    33
			set(pascal_compiler_flags "-B -Sd -Xs -OG -O3 -Cs2000000"${hwengine_project})
73
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    34
		endif (ppc386_ver LESS "010902")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    35
	endif (ppc386_version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    36
endif (dcc32version)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    37
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    38
if (NOT pascal_compiler)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    39
	message(FATAL_ERROR "No Pascal compiler found!")
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    40
endif (NOT pascal_compiler)
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    41
89
f9db56409a86 - Fix various bugs
unc0rr
parents: 75
diff changeset
    42
add_custom_command(COMMAND ${pascal_compiler} TARGET hwengine OUTPUTS hwengine ARGS ${pascal_compiler_flags})
73
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    43
89
f9db56409a86 - Fix various bugs
unc0rr
parents: 75
diff changeset
    44
install(PROGRAMS "hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)