hedgewars/CMakeLists.txt
author unc0rr
Tue, 26 Sep 2006 20:25:42 +0000
changeset 173 004493dd60e4
parent 126 93df479aa1b9
child 184 f97a7a3dc8f6
permissions -rw-r--r--
- Better landgen - Small fixes
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)
115
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
     2
set(fpc_tryexe fpc)
73
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})
115
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
     6
find_program(fpc_executable ${fpc_tryexe})
73
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
115
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    12
if (fpc_executable)
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    13
	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    14
endif (fpc_executable)
73
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})
126
93df479aa1b9 - Now really fix unicode issues
unc0rr
parents: 115
diff changeset
    19
	set(pascal_compiler_flags "-B" "-W" ${hwengine_project})
73
fe1c62875a19 - More smooth hedgehogs physics
unc0rr
parents:
diff changeset
    20
else (dcc32version)
115
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    21
	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    22
	if (fpc_version)
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    23
		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    24
		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    25
		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    26
		math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
173
004493dd60e4 - Better landgen
unc0rr
parents: 126
diff changeset
    27
		if (${fpc_ver} LESS "010906")
004493dd60e4 - Better landgen
unc0rr
parents: 126
diff changeset
    28
			message("Minimum required version of FreePascal is 2.0.5")
004493dd60e4 - Better landgen
unc0rr
parents: 126
diff changeset
    29
		else (${fpc_ver} LESS "010906")
115
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    30
			set(pascal_compiler ${fpc_executable})
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    31
			set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-Cs2000000" ${hwengine_project})
173
004493dd60e4 - Better landgen
unc0rr
parents: 126
diff changeset
    32
		endif (${fpc_ver} LESS "010906")
115
4cce20ef48ea Fix compilation on *nix
unc0rr
parents: 98
diff changeset
    33
	endif (fpc_version)
73
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)