gameServer/CMakeLists.txt
changeset 1979 912e450d4db2
child 2015 d2848d723690
equal deleted inserted replaced
1978:8ab9949c8775 1979:912e450d4db2
       
     1 find_program(ghc_executable ghc)
       
     2 
       
     3 if (NOT ghc_executable)
       
     4 	message(FATAL_ERROR "Cannot find GHC")
       
     5 endif(NOT ghc_executable)
       
     6 
       
     7 set(hwserver_sources
       
     8 	OfficialServer/DBInteraction.hs
       
     9 	Actions.hs
       
    10 	ClientIO.hs
       
    11 	CoreTypes.hs
       
    12 	HWProtoCore.hs
       
    13 	HWProtoInRoomState.hs
       
    14 	HWProtoLobbyState.hs
       
    15 	HWProtoNEState.hs
       
    16 	NetRoutines.hs
       
    17 	Opts.hs
       
    18 	ServerCore.hs
       
    19 	Utils.hs
       
    20 	hedgewars-server.hs
       
    21 	)
       
    22 
       
    23 set(hwserv_main ${hedgewars_SOURCE_DIR}/gameServer/hedgewars-server.hs)
       
    24 
       
    25 set(ghc_flags
       
    26 	--make ${hwserv_main}
       
    27 	-i${hedgewars_SOURCE_DIR}/gameServer
       
    28 	-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
       
    29 	-odir ${CMAKE_CURRENT_BINARY_DIR}
       
    30 	-hidir ${CMAKE_CURRENT_BINARY_DIR})
       
    31 
       
    32 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
       
    33 		COMMAND "${ghc_executable}"
       
    34 		ARGS ${ghc_flags}
       
    35 		MAIN_DEPENDENCY ${hwserv_main}
       
    36 		DEPENDS ${hwserver_sources}
       
    37 		)
       
    38 
       
    39 add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")
       
    40 
       
    41 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)