-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
119 lines (101 loc) · 3.83 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4)
# Informace o projektu
PROJECT(totem_destroyer)
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "2")
SET(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_PACKAGE_VERSION "${VERSION}")
SET(CPACK_GENERATOR "TGZ;ZIP;DEB")
SET(CPACK_PACKAGE_NAME "totem-destroyer")
SET(CPACK_PACKAGE_CONTACT "patek.mail@gmail.com")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "totem-destroyer is war between hovercrafts")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.4), libsdl1.2debian (>= 1.2),
libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.4.0), libgl1-mesa-glx | libgl1,
libglu1-mesa | libglu1")
# Nejake globalni promenne
SET(TOTEM_DESTROYER_CFLAGS "-Wall") # pridavne parametry
SET(TOTEM_DESTROYER_LDFLAGS "") # linkovaci parametry
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
SET(CMAKE_INSTALL_PREFIX "/usr")
IF(BIN_PATH)
SET(BIN_DESTINATION, ${BIN_PATH})
ELSE(BIN_PATH)
IF(UNIX AND NOT WIN32)
SET(BIN_DESTINATION "bin")
ELSE(UNIX AND NOT WIN32)
SET(BIN_DESTINATION ${CMAKE_BINARY_DIR})
ENDIF(UNIX AND NOT WIN32)
ENDIF(BIN_PATH)
IF(DATA_PATH)
# uzivatel specifikoval cestu k datum
SET(INSTALL_DATADIR "${DATA_PATH}/data/")
SET(INSTALL_LOCALEDIR "${DATA_PATH}/locale/")
SET(DATA_DESTINATION "${DATA_PATH}/data/")
ELSE(DATA_PATH)
# vychozi cesty
IF(UNIX AND NOT WIN32)
SET(INSTALL_DATADIR "${CMAKE_INSTALL_PREFIX}/share/totem-destroyer/")
SET(DATA_DESTINATION "share/totem-destroyer")
ELSE(UNIX AND NOT WIN32)
SET(INSTALL_DATADIR "data/")
SET(DATA_DESTINATION "data")
ENDIF(UNIX AND NOT WIN32)
ENDIF(DATA_PATH)
# spusti totem-destroyer bez instalace
ADD_CUSTOM_TARGET(run
COMMAND TOTEM_DESTROYER_DATADIR=${PROJECT_SOURCE_DIR}/data/ src/totem-destroyer
DEPENDS src/totem-destroyer
)
# spusti totem-destroyer ve valgrindu
ADD_CUSTOM_TARGET(valgrind
COMMAND TOTEM_DESTROYER_DATADIR=${PROJECT_SOURCE_DIR}/data/ valgrind `echo \${VALGRIND_FLAGS}` src/totem-destroyer
DEPENDS src/totem-destroyer
)
# spusti totem-destroyer v ddd
ADD_CUSTOM_TARGET(ddd
COMMAND TOTEM_DESTROYER_DATADIR=${PROJECT_SOURCE_DIR}/data/ ddd src/totem-destroyer
DEPENDS src/totem-destroyer
)
# vytvori Doxygenovou dokumentaci
ADD_CUSTOM_TARGET(doxy COMMAND doxygen Doxyfile)
# knihovny
FIND_PACKAGE(SDL REQUIRED)
FIND_PACKAGE(SDL_ttf REQUIRED)
FIND_PACKAGE(SDL_image REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
# nastaveni kvuli kompatibilite
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0005 OLD)
cmake_policy(SET CMP0003 NEW)
ENDIF(COMMAND cmake_policy)
# config.h
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/config.h.cmake ${PROJECT_SOURCE_DIR}/src/config.h)
IF(NOT WIN32)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-Wextra" COMPILER_SUPPORTS_WEXTRA)
IF(COMPILER_SUPPORTS_WEXTRA)
SET(TOTEM_DESTROYER_CFLAGS "-Wextra ${TOTEM_DESTROYER_CFLAGS} -Wno-unused")
ENDIF(COMPILER_SUPPORTS_WEXTRA)
ENDIF(NOT WIN32)
IF(CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
SET(TOTEM_DESTROYER_CFLAGS "-g -O0 ${WORMUX_CFLAGS}")
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
ADD_DEFINITIONS(-DNDEBUG)
SET(TOTEM_DESTROYER_CFLAGS "-O3 ${TOTEM_DESTROYER_CFLAGS}")
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
# podadresare
ADD_SUBDIRECTORY(guichan)
ADD_SUBDIRECTORY(Box2D)
ADD_SUBDIRECTORY(src)
# instalace datovych souboru
INSTALL(DIRECTORY data/ DESTINATION ${DATA_DESTINATION}
FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
PATTERN "Makefile*" EXCLUDE
PATTERN ".*.sw*" EXCLUDE
)
INCLUDE(CPack)