gameServer/CMakeLists.txt
author unC0Rr
Thu, 19 Dec 2024 12:40:48 +0100
branchtransitional_engine
changeset 16079 624b74443b53
parent 15722 a3d2f69f3ac1
child 15905 bf92592915c6
permissions -rw-r--r--
Make FPNum use saturating calculations
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
     1
8686
d303da4568b7 introduce find_package_or_fail/disable to group together similar cmake code
koda
parents: 8671
diff changeset
     2
include(${CMAKE_MODULE_PATH}/utils.cmake)
d303da4568b7 introduce find_package_or_fail/disable to group together similar cmake code
koda
parents: 8671
diff changeset
     3
d303da4568b7 introduce find_package_or_fail/disable to group together similar cmake code
koda
parents: 8671
diff changeset
     4
find_package_or_disable(GHC NOSERVER)
2401
2a694ea2a437 fixes & co.
koda
parents: 2203
diff changeset
     5
13291
31615a2e0db1 CMake: Rework Haskell package detection, use ghc-pkg to detect packages
Wuzzy <Wuzzy2@mail.ru>
parents: 11855
diff changeset
     6
include(${CMAKE_MODULE_PATH}/CheckHaskellPackageExists.cmake)
10109
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents: 10090
diff changeset
     7
15722
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
     8
check_haskell_package_exists(base "Control.Exception" mask 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
     9
check_haskell_package_exists(containers "Data.Map" size 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    10
check_haskell_package_exists(vector "Data.Vector" length 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    11
check_haskell_package_exists(bytestring "Data.ByteString" pack 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    12
check_haskell_package_exists(network "Network.Socket" defaultHints 0 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    13
check_haskell_package_exists(network-bsd "Network.BSD" getHostName 0 OPTIONAL)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    14
check_haskell_package_exists(time "Data.Time" getCurrentTime 0 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    15
check_haskell_package_exists(mtl "Control.Monad.State" fix 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    16
check_haskell_package_exists(sandi "Codec.Binary.Base64" encode 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    17
check_haskell_package_exists(hslogger "System.Log.Logger" warningM 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    18
check_haskell_package_exists(process "System.Process" createProcess 3 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    19
check_haskell_package_exists(utf8-string "Data.ByteString.Lazy.UTF8" decode 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    20
check_haskell_package_exists(SHA "Data.Digest.Pure.SHA" sha1 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    21
check_haskell_package_exists(entropy "System.Entropy" openHandle 0 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    22
check_haskell_package_exists(zlib "Codec.Compression.Zlib" decompress 1 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    23
check_haskell_package_exists(random "System.Random" getStdGen 0 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    24
check_haskell_package_exists(regex-tdfa "Text.Regex.TDFA.ByteString" execute 2 REQUIRED)
a3d2f69f3ac1 Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
Gianfranco Costamagna <locutusofborg@debian.org>
parents: 15721
diff changeset
    25
check_haskell_package_exists(deepseq "Control.DeepSeq" deepseq 2 REQUIRED)
10109
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents: 10090
diff changeset
    26
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents: 10090
diff changeset
    27
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents: 10090
diff changeset
    28
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    29
set(hwserver_sources
6537
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    30
    OfficialServer/DBInteraction.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    31
    Actions.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    32
    ClientIO.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    33
    ConfigFile.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    34
    Consts.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    35
    CoreTypes.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    36
    EngineInteraction.hs
10090
a471a7bbc339 - Start work on flood detector
unc0rr
parents: 10070
diff changeset
    37
    FloodDetection.hs
6537
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    38
    HWProtoCore.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    39
    HWProtoInRoomState.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    40
    HWProtoLobbyState.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    41
    HWProtoNEState.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    42
    HandlerUtils.hs
9975
9fcdaa2be27e Allow logins at any interval, but not more than 2 logins in 30 seconds, 4 in 2 minutes and 6 in 10 minutes.
unc0rr
parents: 8686
diff changeset
    43
    JoinsMonitor.hs
6537
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    44
    NetRoutines.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    45
    Opts.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    46
    RoomsAndClients.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    47
    ServerCore.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    48
    ServerState.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    49
    Store.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    50
    Utils.hs
10056
cb9e07753802 Don't delegate special room to another player when owner quits
unc0rr
parents: 10046
diff changeset
    51
    Votes.hs
6537
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    52
    hedgewars-server.hs
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    53
    )
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    54
10068
cbe06dc07332 use CMAKE_CURRENT_SOURCE_DIR consistently
koda
parents: 10056
diff changeset
    55
set(hwserv_main ${CMAKE_CURRENT_SOURCE_DIR}/hedgewars-server.hs)
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    56
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    57
set(ghc_flags
6537
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    58
    --make ${hwserv_main}
10070
87fa6d14187f ghc ooops
koda
parents: 10068
diff changeset
    59
    -i${CMAKE_CURRENT_SOURCE_DIR}
6537
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    60
    -o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    61
    -odir ${CMAKE_CURRENT_BINARY_DIR}
7112
38c5d56c4d6e rename a few internal cmake variables (for consistency and readability)
koda
parents: 6537
diff changeset
    62
    -hidir ${CMAKE_CURRENT_BINARY_DIR}
38c5d56c4d6e rename a few internal cmake variables (for consistency and readability)
koda
parents: 6537
diff changeset
    63
    ${haskell_flags})
2203
6bd39d75e0dd -Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents: 2015
diff changeset
    64
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    65
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
8671
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents: 8316
diff changeset
    66
        COMMAND "${GHC_EXECUTABLE}"
6537
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    67
        ARGS ${ghc_flags}
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    68
        MAIN_DEPENDENCY ${hwserv_main}
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    69
        DEPENDS ${hwserver_sources}
1df1f224f3e9 Take koda's notice into account, also update list of source files
unc0rr
parents: 6536
diff changeset
    70
        )
1979
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    71
912e450d4db2 - Add gameServer to build system
unc0rr
parents:
diff changeset
    72
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
    73
8316
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 7113
diff changeset
    74
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_binary_install_dir})