-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
164 lines (140 loc) · 5.55 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
include (${CMAKE_CURRENT_SOURCE_DIR}/scripts/VersionConfig.cmake)
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/modules/Common/scripts;${CMAKE_CURRENT_SOURCE_DIR}/../Common/scripts;${CMAKE_CURRENT_SOURCE_DIR}/scripts")
include (Configuration)
include (Macros)
include (OS)
cmake_minimum_required (VERSION 2.8)
project (yarp CXX)
# make relative paths absolute (needed later on)
foreach (path BIN CMAKE SHARE INCLUDE LIB)
set (var INSTALL_${path}_DIR)
# if (NOT IS_ABSOLUTE "${${var}}")
string (TOLOWER "${path}" RELATIVE_INSTALL_PATH)
if (UNIX)
set (${var} "${CMAKE_INSTALL_PREFIX}/${RELATIVE_INSTALL_PATH}")
elseif (WIN32)
set (${var} ${RELATIVE_INSTALL_PATH})
endif ()
# message (STATUS "set \"${var}\" to \"${${var}}\"")
endforeach ()
#extract package version from VCS
# find_package(Subversion)
# if(SUBVERSION_FOUND)
# Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} ER)
# if(${Subversion_svn_info_result} EQUAL 0)
# set(SUBVERSION_REVISION ${ER_WC_REVISION})
# endif()
# endif()
find_package (Git)
if (GIT_FOUND)
set (GIT_REVISION "539")
endif ()
# if(${SUBVERSION_REVISION})
# message(STATUS "found subversion revision ${SUBVERSION_REVISION}...")
# set(PACKAGE_REVISION ${SUBVERSION_REVISION})
# elseif(${GIT_REVISION})
if (${GIT_REVISION})
message (STATUS "found git revision ${GIT_REVISION}...")
set (PACKAGE_REVISION ${GIT_REVISION})
endif (${GIT_REVISION})
set (CPACK_PACKAGE_DESCRIPTION "(yet another) role-playing game system framework")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "A RPG system framework")
set (CPACK_PACKAGE_NAME "Yarp")
#set (CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.6), libgcc1 (>= 1:4.1)")
#set (CPACK_PACKAGE_CONTACT "Erik Sohns <[email protected]>")
#set (CPACK_PACKAGE_VENDOR "Erik Sohns")
#set (CPACK_PACKAGE_VERSION_MAJOR "0")
#set (CPACK_PACKAGE_VERSION_MINOR "1")
#set (CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_REVISION})
# set(CPACK_PACKAGE_VERSION_PATCH "0")
#set (VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
#message (STATUS "configuring ${CPACK_PACKAGE_NAME} version ${VERSION}...")
#set (CPACK_GENERATOR "DEB;RPM;")
#set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CMAKE_SYSTEM_PROCESSOR}")
include (CPack)
option (DOXYGEN_SUPPORT "generate documentation" OFF)
if (DOXYGEN_SUPPORT)
find_package (Doxygen)
if (DOXYGEN_FOUND STREQUAL "NO")
message(FATAL_ERROR "Doxygen not found. Please get a copy http://www.doxygen.org")
endif (DOXYGEN_FOUND STREQUAL "NO")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
add_custom_target (doxygen
${DOXYGEN_EXECUTABLE}
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES api-doc)
get_target_property(DOC_TARGET doc TYPE)
if(NOT DOC_TARGET)
add_custom_target (doc)
endif (NOT DOC_TARGET)
add_dependencies (doc doxygen)
endif (DOXYGEN_SUPPORT)
#Use solution folders.
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR
CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
add_definitions (-D_DEBUG)
endif ()
if (UNIX)
if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
set (CMAKE_EXE_LINKER_FLAGS "-Wl,-z,multidefs")
set (CMAKE_STATIC_LINKER_FLAGS "-Wl,-z,multidefs")
endif (CMAKE_COMPILER_IS_GNUCC)
endif (UNIX)
if (UNIX)
set (NEWLINE_STYLE UNIX)
elseif (WIN32)
set (NEWLINE_STYLE WIN32)
else ()
set (NEWLINE_STYLE UNIX)
endif ()
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/scripts/config.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/rpg_config.h
@ONLY
NEWLINE_STYLE ${NEWLINE_STYLE})
add_definitions (-DHAVE_CONFIG_H)
# include rpg_config.h
include_directories (${CMAKE_CURRENT_BINARY_DIR})
string (REPLACE ${CMAKE_SOURCE_DIR} "" BUILD_PATH_SUFFIX ${CMAKE_BINARY_DIR})
string (SUBSTRING ${BUILD_PATH_SUFFIX} 1 -1 BUILD_PATH_SUFFIX)
find_package (Common
REQUIRED
CONFIG
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/modules ${CMAKE_CURRENT_SOURCE_DIR}/..
PATH_SUFFIXES Common/${BUILD_PATH_SUFFIX}
NO_DEFAULT_PATH)
if (NOT EXISTS ${Common_DIR})
message (FATAL_ERROR "could not find package \"Common\", aborting")
else ()
message (STATUS "found package \"Common\": \"${Common_DIR}\"")
endif ()
#add_subdirectory(../tools tools)
add_subdirectory (chance)
add_subdirectory (common)
add_subdirectory (magic)
add_subdirectory (item)
add_subdirectory (character)
add_subdirectory (combat)
add_subdirectory (map)
add_subdirectory (graphics)
add_subdirectory (sound)
add_subdirectory (engine)
add_subdirectory (net)
add_subdirectory (client)
add_subdirectory (test_u)
#add_subdirectory (tools)
set (DOC_FILES COPYING INSTALL AUTHORS NEWS README TODO)
set (DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}")
install (FILES
${DOC_FILES}
DESTINATION ${DOC_PATH})
option (INSTALL_DOCUMENTATION "install generated documentation" OFF)
if (INSTALL_DOCUMENTATION)
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/html
DESTINATION ${DOC_PATH})
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/man/man3
DESTINATION share/man/man3)
else (INSTALL_DOCUMENTATION)
message (STATUS "documentation will NOT be installed...")
endif (INSTALL_DOCUMENTATION)