gameServer/CMakeLists.txt
author unc0rr
Thu, 30 Apr 2009 20:13:44 +0000
changeset 2017 7845c77c8d31
parent 2015 d2848d723690
child 2203 6bd39d75e0dd
permissions -rw-r--r--
nemo's great patch: - Speech bubbles - Vampirism + karma

find_program(ghc_executable ghc)

if (NOT ghc_executable)
	message(FATAL_ERROR "Cannot find GHC")
endif(NOT ghc_executable)

set(hwserver_sources
	OfficialServer/DBInteraction.hs
	Actions.hs
	ClientIO.hs
	CoreTypes.hs
	HWProtoCore.hs
	HWProtoInRoomState.hs
	HWProtoLobbyState.hs
	HWProtoNEState.hs
	NetRoutines.hs
	Opts.hs
	ServerCore.hs
	Utils.hs
	hedgewars-server.hs
	)

set(hwserv_main ${hedgewars_SOURCE_DIR}/gameServer/hedgewars-server.hs)

set(ghc_flags
	--make ${hwserv_main}
	-i${hedgewars_SOURCE_DIR}/gameServer
	-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
	-odir ${CMAKE_CURRENT_BINARY_DIR}
	-hidir ${CMAKE_CURRENT_BINARY_DIR})

add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
		COMMAND "${ghc_executable}"
		ARGS ${ghc_flags}
		MAIN_DEPENDENCY ${hwserv_main}
		DEPENDS ${hwserver_sources}
		)

add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")


if(APPLE)
	set (target_dir ".")
else(APPLE)
	set (target_dir "bin")
endif(APPLE)

install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})