gameServer/CMakeLists.txt
author unc0rr
Tue, 20 Oct 2020 20:09:44 +0200
branch1.0.0
changeset 15864 c63d0ea4907d
parent 15862 c96220666d93
permissions -rw-r--r--
Fix lack of declaration decorations for dynamic arrays in Pas2C


include(${CMAKE_MODULE_PATH}/utils.cmake)

find_package_or_disable(GHC NOSERVER)

include(${CMAKE_MODULE_PATH}/CheckHaskellPackageExists.cmake)

check_haskell_package_exists(base "Control.Exception" mask 1 REQUIRED)
check_haskell_package_exists(containers "Data.Map" size 1 REQUIRED)
check_haskell_package_exists(vector "Data.Vector" length 1 REQUIRED)
check_haskell_package_exists(bytestring "Data.ByteString" pack 1 REQUIRED)
check_haskell_package_exists(network "Network.Socket" defaultHints 0 REQUIRED)
check_haskell_package_exists(network-bsd "Network.BSD" getHostName 0 OPTIONAL)
check_haskell_package_exists(time "Data.Time" getCurrentTime 0 REQUIRED)
check_haskell_package_exists(mtl "Control.Monad.State" fix 1 REQUIRED)
check_haskell_package_exists(sandi "Codec.Binary.Base64" encode 1 REQUIRED)
check_haskell_package_exists(hslogger "System.Log.Logger" warningM 1 REQUIRED)
check_haskell_package_exists(process "System.Process" createProcess 3 REQUIRED)
check_haskell_package_exists(utf8-string "Data.ByteString.Lazy.UTF8" decode 1 REQUIRED)
check_haskell_package_exists(SHA "Data.Digest.Pure.SHA" sha1 1 REQUIRED)
check_haskell_package_exists(entropy "System.Entropy" openHandle 0 REQUIRED)
check_haskell_package_exists(zlib "Codec.Compression.Zlib" decompress 1 REQUIRED)
check_haskell_package_exists(random "System.Random" getStdGen 0 REQUIRED)
check_haskell_package_exists(regex-tdfa "Text.Regex.TDFA.ByteString" execute 2 REQUIRED)
check_haskell_package_exists(deepseq "Control.DeepSeq" deepseq 2 REQUIRED)



set(hwserver_sources
    OfficialServer/DBInteraction.hs
    Actions.hs
    ClientIO.hs
    ConfigFile.hs
    Consts.hs
    CoreTypes.hs
    EngineInteraction.hs
    FloodDetection.hs
    HWProtoCore.hs
    HWProtoInRoomState.hs
    HWProtoLobbyState.hs
    HWProtoNEState.hs
    HandlerUtils.hs
    JoinsMonitor.hs
    NetRoutines.hs
    Opts.hs
    RoomsAndClients.hs
    ServerCore.hs
    ServerState.hs
    Store.hs
    Utils.hs
    Votes.hs
    hedgewars-server.hs
    )

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

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

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}")

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