author | unc0rr |
Thu, 13 Aug 2009 08:54:20 +0000 | |
changeset 2310 | 581e59f123a2 |
parent 2203 | 6bd39d75e0dd |
child 2401 | 2a694ea2a437 |
permissions | -rw-r--r-- |
1979 | 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 |
||
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
32 |
if( NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "Release") |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
33 |
set(ghc_flags |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
34 |
-w |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
35 |
-O2 |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
36 |
${ghc_flags} |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
37 |
) |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
38 |
else() |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
39 |
set(ghc_flags |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
40 |
-Wall |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
41 |
-debug |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
42 |
-dcore-lint |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
43 |
${ghc_flags} |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
44 |
) |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
45 |
endif() |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
46 |
|
1979 | 47 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" |
48 |
COMMAND "${ghc_executable}" |
|
49 |
ARGS ${ghc_flags} |
|
50 |
MAIN_DEPENDENCY ${hwserv_main} |
|
51 |
DEPENDS ${hwserver_sources} |
|
52 |
) |
|
53 |
||
54 |
add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}") |
|
55 |
||
2015 | 56 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |