gameServer/CMakeLists.txt
author koda
Tue, 06 Oct 2009 16:30:08 +0000
changeset 2406 2e757b32991e
parent 2401 2a694ea2a437
child 2409 dbf195c3e09c
permissions -rw-r--r--
cmake optimizations and simplification
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
     1
find_program(ghc_executable ghc)
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
     2
2401
2a694ea2a437 fixes & co.
koda
parents: 2203
diff changeset
     3
if(NOT ghc_executable)
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
     4
	message(FATAL_ERROR "Cannot find GHC")
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
     5
endif(NOT ghc_executable)
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
     6
2401
2a694ea2a437 fixes & co.
koda
parents: 2203
diff changeset
     7
if(APPLE)
2a694ea2a437 fixes & co.
koda
parents: 2203
diff changeset
     8
	find_package(GMP REQUIRED)
2a694ea2a437 fixes & co.
koda
parents: 2203
diff changeset
     9
endif(APPLE)
2a694ea2a437 fixes & co.
koda
parents: 2203
diff changeset
    10
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    11
set(hwserver_sources
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    12
	OfficialServer/DBInteraction.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    13
	Actions.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    14
	ClientIO.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    15
	CoreTypes.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    16
	HWProtoCore.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    17
	HWProtoInRoomState.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    18
	HWProtoLobbyState.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    19
	HWProtoNEState.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    20
	NetRoutines.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    21
	Opts.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    22
	ServerCore.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    23
	Utils.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    24
	hedgewars-server.hs
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    25
	)
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    26
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    27
set(hwserv_main ${hedgewars_SOURCE_DIR}/gameServer/hedgewars-server.hs)
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    28
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    29
set(ghc_flags
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    30
	--make ${hwserv_main}
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    31
	-i${hedgewars_SOURCE_DIR}/gameServer
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    32
	-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    33
	-odir ${CMAKE_CURRENT_BINARY_DIR}
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    34
	-hidir ${CMAKE_CURRENT_BINARY_DIR})
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    35
2406
2e757b32991e cmake optimizations and simplification
koda
parents: 2401
diff changeset
    36
if(OPTIMIZATIONS)
2203
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    37
set(ghc_flags
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    38
	-w
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    39
	-O2
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    40
	${ghc_flags}
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    41
)
2406
2e757b32991e cmake optimizations and simplification
koda
parents: 2401
diff changeset
    42
else(OPTIMIZATIONS)
2203
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    43
set(ghc_flags
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    44
	-Wall
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    45
	-debug
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    46
	-dcore-lint
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    47
	${ghc_flags}
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    48
)
2406
2e757b32991e cmake optimizations and simplification
koda
parents: 2401
diff changeset
    49
endif(OPTIMIZATIONS)
2203
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    50
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    51
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    52
		COMMAND "${ghc_executable}"
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    53
		ARGS ${ghc_flags}
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    54
		MAIN_DEPENDENCY ${hwserv_main}
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    55
		DEPENDS ${hwserver_sources}
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    56
		)
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    57
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    58
add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    59
2015
d2848d723690 koda's patch
unc0rr
parents: 1979
diff changeset
    60
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})