-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathCMakeLists.txt
217 lines (173 loc) · 5.96 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
cmake_minimum_required(VERSION 3.10)
project(Huestacean)
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
endif()
if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Quick REQUIRED)
find_package(Qt5RemoteObjects REQUIRED)
set(MAIN_SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
)
SET(THIRD_PARTY_SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/hsluv-c/src/hsluv.c
)
SET(THIRD_PARTY_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/hsluv-c/src/hsluv.h
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ChromaSDK/inc/RzChromaLinkAPI.h
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ChromaSDK/inc/RzChromaSDK.h
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ChromaSDK/inc/RzChromaSDKDefines.h
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ChromaSDK/inc/RzChromaSDKTypes.h
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ChromaSDK/inc/RzErrors.h
)
set(SOURCES
${SOURCES}
${THIRD_PARTY_SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/src/backend/backend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/common/math.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/common/scene.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/common/device.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/common/effect.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/effects/effects.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/hue/hue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/hue/bridge.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/hue/bridgediscovery.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/hue/streamer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/razer/chroma.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/razer/razer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/razer/razerdevices.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/frontend/gui/gui.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/frontend/frontend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/frontend/frontendtypes.cpp
)
set(HEADERS
${HEADERS}
${THIRD_PARTY_HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/include/common/device.h
${CMAKE_CURRENT_SOURCE_DIR}/include/common/effect.h
${CMAKE_CURRENT_SOURCE_DIR}/include/common/lightupdate.h
${CMAKE_CURRENT_SOURCE_DIR}/include/common/providertype.h
${CMAKE_CURRENT_SOURCE_DIR}/include/common/scene.h
${CMAKE_CURRENT_SOURCE_DIR}/include/common/math.h
${CMAKE_CURRENT_SOURCE_DIR}/include/effects/effects.h
${CMAKE_CURRENT_SOURCE_DIR}/include/hue/hue.h
${CMAKE_CURRENT_SOURCE_DIR}/include/hue/bridge.h
${CMAKE_CURRENT_SOURCE_DIR}/include/hue/bridgediscovery.h
${CMAKE_CURRENT_SOURCE_DIR}/include/hue/streamer.h
${CMAKE_CURRENT_SOURCE_DIR}/include/razer/chroma.h
${CMAKE_CURRENT_SOURCE_DIR}/include/razer/razer.h
${CMAKE_CURRENT_SOURCE_DIR}/include/razer/razerdevices.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/gui/gui.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/rep_frontend.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/frontend.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/frontendtypes.h
)
#headers with Qt-relevant types (for moc)
set(QT_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/hue/bridgediscovery.h
${CMAKE_CURRENT_SOURCE_DIR}/include/hue/bridge.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/gui/gui.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/frontendtypes.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/frontend.h
${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/rep_frontend.h
)
#QT5_WRAP_CPP(HEADERS_MOC ${QT_HEADERS})
set(CMAKE_AUTOMOC ON)
set(INCLUDE_PATHS
${INCLUDE_PATHS}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/resources
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mbedtls/include
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ChromaSDK/inc
)
include_directories(${INCLUDE_PATHS})
add_subdirectory(thirdparty/screen_capture_lite EXCLUDE_FROM_ALL)
add_subdirectory(thirdparty/mbedtls EXCLUDE_FROM_ALL)
set(LIBRARIES
${LIBRARIES}
Qt5::Core
Qt5::Network
Qt5::Quick
Qt5::RemoteObjects
screen_capture_lite
mbedtls
mbedx509
mbedcrypto
)
#screen_capture_lite additional requirements
if(WIN32)
set(LIBRARIES
${LIBRARIES}
Dwmapi
wsock32
ws2_32
legacy_stdio_definitions
)
elseif(LINUX)
set(LIBRARIES
${LIBRARIES}
pthread
X11
Xext
Xinerama
Xfixes
)
endif()
add_executable(huestacean WIN32 ${MAIN_SOURCE} ${SOURCES} ${HEADERS} ${HEADERS_MOC} resources/qml.qrc resources/resources.rc)
target_link_libraries(huestacean ${LIBRARIES})
add_custom_command(
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/rep_frontend.rep
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/frontend/rep_frontend.h
COMMAND repc -o merged rep_frontend.rep rep_frontend.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/frontend
COMMENT "compile with repc"
)
### Tests
enable_testing()
find_package(Qt5Test REQUIRED)
include_directories(
${Qt5Test_INCLUDES}
)
# Prepare "Catch" library for other executables
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests/catch)
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
set(TEST_SOURCES
${SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/tests/testsmain.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/backendtests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/mathtests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/huetests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/razertests.cpp
)
set(TEST_HEADERS
${HEADERS}
${HEADERS_MOC}
)
set(TEST_LIBRARIES
${LIBRARIES}
Catch
Qt5::Test
)
# Make test executable
add_executable(huestacean_tests ${TEST_SOURCES} ${TEST_HEADERS})
target_link_libraries(huestacean_tests ${TEST_LIBRARIES})
include(${CMAKE_CURRENT_SOURCE_DIR}/tests/catch/cmake/Catch.cmake)
catch_discover_tests(huestacean_tests)