-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
203 lines (165 loc) · 5.92 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
project(pigaco)
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
include(FindPkgConfig)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
SET(SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/)
SET(HDR ${CMAKE_CURRENT_SOURCE_DIR}/include/pigaco/)
set(RSC ${CMAKE_CURRENT_SOURCE_DIR}/Data/ressources)
set(FOR ${CMAKE_CURRENT_SOURCE_DIR}/Data/forms)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(PIGACO_VERSION_MAJOR "0" CACHE STRING "Major-Version")
set(PIGACO_VERSION_MINOR "7" CACHE STRING "Minor-Version")
set(PIGACO_VERSION_PATCH "0" CACHE STRING "Patch-Version")
set(PIGACO_VERSION_TWEAK "0" CACHE STRING "Tweak-Version")
set(PIGACO_VERSION ${PIGACO_VERSION_MAJOR}.${PIGACO_VERSION_MINOR}.${PIGACO_VERSION_PATCH}.${PIGACO_VERSION_TWEAK})
SET(HDRS
${HDR}/App.hpp
${HDR}/DirectoryScanner.hpp
${HDR}/Players.hpp
${HDR}/GameHostStarter.hpp
${HDR}/WebAdmin.hpp
${HDR}/WebNavigationBar.hpp
${HDR}/WebGames.hpp
${HDR}/WebPlayers.hpp
${HDR}/WebInputs.hpp
${HDR}/Game.hpp
${HDR}/packaging/Package.hpp
${HDR}/packaging/PackageManager.hpp
${HDR}/packaging/Version.hpp
)
SET(SRCS
${SRC}/App.cpp
${SRC}/DirectoryScanner.cpp
${SRC}/Players.cpp
${SRC}/GameHostStarter.cpp
${SRC}/WebAdmin.cpp
${SRC}/WebNavigationBar.cpp
${SRC}/WebGames.cpp
${SRC}/WebPlayers.cpp
${SRC}/WebInputs.cpp
${SRC}/Game.cpp
${SRC}/packaging/Package.cpp
${SRC}/packaging/PackageManager.cpp
${SRC}/packaging/Version.cpp
)
set(RSCS
${RSC}/main.qrc
)
set(FORS
${FOR}/MainMenu.qml
${FOR}/MainMenuHeader.qml
${FOR}/GameBox.qml
${FOR}/Pages/Store/Main.qml
${FOR}/Pages/Settings/Main.qml
${FOR}/Pages/Settings/Players.qml
${FOR}/Pages/Settings/PlayerDelegate.qml
)
# Find Qt
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets)
find_package(Qt5Qml)
find_package(Qt5Quick)
add_executable(pigaco ${SRCS} ${HDRS} ${RSCS} ${FORS})
# Compatability with Wt and boost
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
target_link_libraries(pigaco Qt5::Widgets Qt5::Qml Qt5::Quick)
find_package(Boost REQUIRED COMPONENTS system thread filesystem)
if(${Boost_FOUND})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
target_link_libraries(pigaco ${Boost_LIBRARIES})
endif()
target_link_libraries(pigaco pthread)
# Add sigc++2
find_package(SigC++ REQUIRED)
if(${SIGC++_FOUND})
target_link_libraries(pigaco ${SIGC++_LIBRARY})
include_directories(${SIGC++_INCLUDE_DIR})
elseif()
message(STATUS "Did not find Sigc++2! Please install it before you try to compile again.")
endif()
find_package(GLM REQUIRED)
if(${GLM_FOUND})
include_directories(${GLM_INCLUDE_DIR})
endif()
# Add yaml-cpp
find_package(YamlCpp REQUIRED)
if(${YAMLCPP_FOUND})
target_link_libraries(pigaco ${YAMLCPP_LIBRARY})
include_directories(${YAMLCPP_INCLUDE_DIR})
elseif()
message(STATUS "Did not find Yaml-Cpp! Please install it before you try to compile again.")
endif()
find_package(QuaZip REQUIRED)
if(${QUAZIP_FOUND})
target_link_libraries(pigaco ${QUAZIP_LIBRARIES})
include_directories(${QUAZIP_INCLUDE_DIRS})
endif()
find_package(Crypto++)
if(${CRYPTO++_FOUND_TRUE})
target_link_libraries(pigaco ${CRYPTO++_LIBRARY})
include_directories(${CRYPTO++_INCLUDE_DIR})
endif()
# Link to Wt for built in webserver support.
find_package(Wt REQUIRED)
if(${Wt_FOUND})
target_link_libraries(pigaco ${Wt_LIBRARY} ${Wt_HTTP_LIBRARY})
include_directories(${Wt_INCLUDE_DIR})
endif()
find_package(Libpiga REQUIRED)
if(${Libpiga_FOUND})
target_link_libraries(pigaco ${Libpiga_LIBRARIES})
include_directories(${Libpiga_INCLUDE_DIRS})
endif()
add_custom_command(TARGET pigaco
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/distributor.py
COMMAND python
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/distributor.py ${CMAKE_CURRENT_BINARY_DIR}/dist)
target_link_libraries(pigaco -lrt)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/piga_host_config.yml.in
${CMAKE_CURRENT_BINARY_DIR}/piga_host_config.yml)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Definitions.hpp.in
${CMAKE_CURRENT_SOURCE_DIR}/include/pigaco/Definitions.hpp)
include(CMakePackageConfigHelpers)
set_property(TARGET pigaco PROPERTY VERSION ${PIGACO_VERSION})
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/PigacoConfigVersion.cmake"
VERSION ${PIGACO_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(TARGETS pigaco EXPORT PigacoTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
RUNTIME DESTINATION bin)
# Data files
install(
DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/Data
DESTINATION ../var/piga)
# Configuration files
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/piga_host_config.yml
DESTINATION ../etc)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Pigaco Console Suite")
set(CPACK_PACKAGE_VENDOR "Pigaco")
set(CPACK_PACKAGE_VERSION_MAJOR ${PIGACO_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PIGACO_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PIGACO_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_TWEAK ${PIGACO_VERSION_TWEAK})
set(CPACK_DEBIAN_PACKAGE_NAME "piga-pigaco")
set(CPACK_DEBIAN_PACKAGE_HOMEPAHE "https://github.com/pigaco/console")
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"libboost-filesystem1.55.0 (>= 1.55.0), libboost-thread1.55.0 (>= 1.55.0), libboost-system1.55.0 (>= 1.55.0), libyaml-cpp0.5 (>= 0.5.1-1), libstdc++6 (>= 4.9.2-10), piga-libpiga (>= 0.6.0), libquazip-qt5-1 (>= 0.7), libcrypto++9 (>= 5.6.1), libwt38 (>= 3.3.3), libsigc++-2.0-0c2a (>= 2.4.0-1)")
set(CPACK_PACKAGE_NAME "piga-pigaco")
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Max Heisinger <[email protected]>")
include(CPack)
# Activate C++11
list(APPEND CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
list(APPEND ${CMAKE_CXX_FLAGS} "-Wall -std=c++11 ${CMAKE_CXX_FLAGS}")
endif()