1 find_program(ghc_executable ghc) |
1 find_program(ghc_executable ghc) |
2 |
2 |
3 if(NOT ghc_executable) |
3 if(NOT ghc_executable) |
4 message(FATAL_ERROR "Cannot find GHC") |
4 message(FATAL_ERROR "Cannot find GHC") |
5 endif(NOT ghc_executable) |
5 endif(NOT ghc_executable) |
6 |
6 |
7 |
7 |
8 set(hwserver_sources |
8 set(hwserver_sources |
9 OfficialServer/DBInteraction.hs |
9 OfficialServer/DBInteraction.hs |
10 Actions.hs |
10 Actions.hs |
11 ClientIO.hs |
11 ClientIO.hs |
12 CoreTypes.hs |
12 CoreTypes.hs |
13 HWProtoCore.hs |
13 HWProtoCore.hs |
14 HWProtoInRoomState.hs |
14 HWProtoInRoomState.hs |
15 HWProtoLobbyState.hs |
15 HWProtoLobbyState.hs |
16 HWProtoNEState.hs |
16 HWProtoNEState.hs |
17 HandlerUtils.hs |
17 NetRoutines.hs |
18 NetRoutines.hs |
18 Opts.hs |
19 Opts.hs |
19 ServerCore.hs |
20 RoomsAndClients.hs |
20 Utils.hs |
21 ServerCore.hs |
21 hedgewars-server.hs |
22 ServerState.hs |
22 ) |
23 Store.hs |
|
24 Utils.hs |
|
25 hedgewars-server.hs |
|
26 ) |
|
27 |
23 |
28 set(hwserv_main ${hedgewars_SOURCE_DIR}/gameServer/hedgewars-server.hs) |
24 set(hwserv_main ${hedgewars_SOURCE_DIR}/gameServer/hedgewars-server.hs) |
29 |
25 |
30 set(ghc_flags |
26 set(ghc_flags |
31 -Wall |
27 --make ${hwserv_main} |
32 --make ${hwserv_main} |
28 -i${hedgewars_SOURCE_DIR}/gameServer |
33 -i${hedgewars_SOURCE_DIR}/gameServer |
29 -o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX} |
34 -o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX} |
30 -odir ${CMAKE_CURRENT_BINARY_DIR} |
35 -odir ${CMAKE_CURRENT_BINARY_DIR} |
31 -hidir ${CMAKE_CURRENT_BINARY_DIR}) |
36 -hidir ${CMAKE_CURRENT_BINARY_DIR}) |
|
37 |
32 |
38 set(ghc_flags ${haskell_compiler_flags_cmn} ${ghc_flags}) |
33 set(ghc_flags ${haskell_compiler_flags_cmn} ${ghc_flags}) |
39 |
34 |
40 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" |
35 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" |
41 COMMAND "${ghc_executable}" |
36 COMMAND "${ghc_executable}" |
42 ARGS ${ghc_flags} |
37 ARGS ${ghc_flags} |
43 MAIN_DEPENDENCY ${hwserv_main} |
38 MAIN_DEPENDENCY ${hwserv_main} |
44 DEPENDS ${hwserver_sources} |
39 DEPENDS ${hwserver_sources} |
45 ) |
40 ) |
46 |
41 |
47 add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}") |
42 add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}") |
48 |
43 |
49 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |
44 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |