author | koda |
Tue, 06 Oct 2009 16:30:08 +0000 | |
changeset 2406 | 2e757b32991e |
parent 2401 | 2a694ea2a437 |
child 2409 | dbf195c3e09c |
permissions | -rw-r--r-- |
1979 | 1 |
find_program(ghc_executable ghc) |
2 |
||
2401 | 3 |
if(NOT ghc_executable) |
1979 | 4 |
message(FATAL_ERROR "Cannot find GHC") |
5 |
endif(NOT ghc_executable) |
|
6 |
||
2401 | 7 |
if(APPLE) |
8 |
find_package(GMP REQUIRED) |
|
9 |
endif(APPLE) |
|
10 |
||
1979 | 11 |
set(hwserver_sources |
12 |
OfficialServer/DBInteraction.hs |
|
13 |
Actions.hs |
|
14 |
ClientIO.hs |
|
15 |
CoreTypes.hs |
|
16 |
HWProtoCore.hs |
|
17 |
HWProtoInRoomState.hs |
|
18 |
HWProtoLobbyState.hs |
|
19 |
HWProtoNEState.hs |
|
20 |
NetRoutines.hs |
|
21 |
Opts.hs |
|
22 |
ServerCore.hs |
|
23 |
Utils.hs |
|
24 |
hedgewars-server.hs |
|
25 |
) |
|
26 |
||
27 |
set(hwserv_main ${hedgewars_SOURCE_DIR}/gameServer/hedgewars-server.hs) |
|
28 |
||
29 |
set(ghc_flags |
|
30 |
--make ${hwserv_main} |
|
31 |
-i${hedgewars_SOURCE_DIR}/gameServer |
|
32 |
-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX} |
|
33 |
-odir ${CMAKE_CURRENT_BINARY_DIR} |
|
34 |
-hidir ${CMAKE_CURRENT_BINARY_DIR}) |
|
35 |
||
2406 | 36 |
if(OPTIMIZATIONS) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
37 |
set(ghc_flags |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
38 |
-w |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
39 |
-O2 |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
40 |
${ghc_flags} |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
41 |
) |
2406 | 42 |
else(OPTIMIZATIONS) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
43 |
set(ghc_flags |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
44 |
-Wall |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
45 |
-debug |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
46 |
-dcore-lint |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
47 |
${ghc_flags} |
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
48 |
) |
2406 | 49 |
endif(OPTIMIZATIONS) |
2203
6bd39d75e0dd
-Added support for Release and Debug for CMAKE_BUILD_TYPE
koda
parents:
2015
diff
changeset
|
50 |
|
1979 | 51 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" |
52 |
COMMAND "${ghc_executable}" |
|
53 |
ARGS ${ghc_flags} |
|
54 |
MAIN_DEPENDENCY ${hwserv_main} |
|
55 |
DEPENDS ${hwserver_sources} |
|
56 |
) |
|
57 |
||
58 |
add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}") |
|
59 |
||
2015 | 60 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) |