-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCMakeLists.txt
216 lines (178 loc) · 9.5 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
# Root CMake File for Hive
# Minimum CMake version
cmake_minimum_required(VERSION 3.22)
############ Versioning
# Using Semantic Versioning (http://semver.org/spec/v2.0.0.html)
# This variable defines the project version number.
# It should have 3 digits (x.y.z) on main branch, and 4 digits (x.y.z.w) on dev and task branches. The last digit being used as beta label.
# As soon as a new version begins, update the version number by following SemVer rules.
# Example: 1.5.0 is the upcoming release version (main branch) of current 1.5.0.3 devel version (dev/task) which will be labelled 1.5.0-beta3
set(HIVE_VERSION 1.3.1.2)
set(AEMDUMPER_VERSION 1.3.1.2)
############ Override from command line "CMake -D<OPTION>=TRUE/FALSE/0/1/ON/OFF"
# Build options
option(BUILD_HIVE_TESTS "Build Hive tests." FALSE)
option(BUILD_HIVE_MODELS_SHARED_LIBRARY "Build Hive Models Shared Library (for external usage)." FALSE)
option(BUILD_HIVE_APPLICATION "Build Hive main application." TRUE)
# Install options
option(ENABLE_HIVE_CPACK "Enable Hive installer generation target." FALSE)
# Signing options
option(ENABLE_CODE_SIGNING "Enable binaries signing." FALSE)
# Enable features
option(ENABLE_HIVE_FEATURE_SPARKLE "Use Sparkle for Hive auto-update" FALSE)
############ Override from command line "CMake -D<PARAM>=<VALUE>"
# Configuration options
if(ENABLE_HIVE_FEATURE_SPARKLE)
if(NOT APPCAST_RELEASES_URL)
set(APPCAST_RELEASES_URL "https://localhost/hive/appcast-release.xml" CACHE STRING "Appcast URL for Hive Releases" FORCE)
endif()
message(STATUS "Appcast URL for Hive Releases defined to: ${APPCAST_RELEASES_URL}")
if(NOT APPCAST_BETAS_URL)
set(APPCAST_BETAS_URL "https://localhost/hive/appcast-beta.xml" CACHE STRING "Appcast URL for Hive Betas" FORCE)
endif()
message(STATUS "Appcast URL for Hive Betas defined to: ${APPCAST_BETAS_URL}")
if(NOT APPCAST_RELEASES_FALLBACK_URL)
set(APPCAST_RELEASES_FALLBACK_URL "${APPCAST_RELEASES_URL}" CACHE STRING "Appcast Fallback URL for Hive Releases" FORCE)
endif()
message(STATUS "Appcast fallback URL for Hive Releases defined to: ${APPCAST_RELEASES_FALLBACK_URL}")
if(NOT APPCAST_BETAS_FALLBACK_URL)
set(APPCAST_BETAS_FALLBACK_URL "${APPCAST_BETAS_URL}" CACHE STRING "Appcast Fallback URL for Hive Betas" FORCE)
endif()
message(STATUS "Appcast fallback URL for Hive Betas defined to: ${APPCAST_BETAS_FALLBACK_URL}")
if(APPLE AND NOT HIVE_DSA_PUB_KEY)
message(FATAL_ERROR "DSA Public Key not set in HIVE_DSA_PUB_KEY CMake Variable")
endif()
endif()
if(NOT NEWSFEED_URL)
set(NEWSFEED_URL "https://localhost/hive/news.php" CACHE STRING "Newsfeed URL for Hive" FORCE)
endif()
message(STATUS "Newsfeed URL for Hive defined to: ${NEWSFEED_URL}")
if(NOT QT_MAJOR_VERSION)
message(FATAL_ERROR "Qt major version not set in QT_MAJOR_VERSION CMake Variable")
endif()
############ CMake Configuration
project(Hive)
# Using c++17 standard for all targets
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# Define some product/company specific values
set(CU_PROJECT_FULL_NAME "${PROJECT_NAME} - Pro Audio ATDECC Controller")
set(CU_COMPANY_NAME "KikiSoft")
set(CU_COMPANY_URL "https://github.com/christophe-calmejane/Hive")
set(CU_COMPANY_DOMAIN "com")
set(CU_PROJECT_PRODUCTDESCRIPTION "${CU_PROJECT_FULL_NAME}")
set(CU_PROJECT_CONTACT "[email protected]")
set(CU_PROJECT_STARTING_YEAR "2017")
set(CU_COPYRIGHT_HOLDER "Emilien Vallot, Christophe Calmejane and other contributors")
# Avdecc project location
if(NOT AVDECC_BASE_FOLDER)
set(AVDECC_BASE_FOLDER "${CMAKE_CURRENT_LIST_DIR}/3rdparty/avdecc")
endif()
# Define base folder for cmakeUtils scripts
set(CU_BASE_DIR "${AVDECC_BASE_FOLDER}/cmake/cmakeUtils")
# Include project macros
include(${CU_BASE_DIR}/ProjectMacros.cmake)
# Include common properties overrides
include(${CU_BASE_DIR}/ProjectProperties.cmake)
# Override avdecc options
set(BUILD_AVDECC_EXAMPLES OFF CACHE BOOL "Build examples." FORCE)
set(BUILD_AVDECC_TESTS OFF CACHE BOOL "Build unit tests." FORCE)
set(BUILD_AVDECC_LIB_SHARED_CXX ON CACHE BOOL "Build C++ shared library." FORCE)
set(BUILD_AVDECC_LIB_STATIC_RT_SHARED OFF CACHE BOOL "Build static library (runtime shared)." FORCE)
set(BUILD_AVDECC_DOC OFF CACHE BOOL "Build documentation." FORCE)
set(BUILD_AVDECC_BINDINGS_C OFF CACHE BOOL "Build avdecc C bindings library." FORCE)
set(BUILD_AVDECC_CONTROLLER ON CACHE BOOL "Build avdecc controller library." FORCE)
set(BUILD_AVDECC_INTERFACE_PCAP ON CACHE BOOL "Build the pcap protocol interface." FORCE)
set(BUILD_AVDECC_INTERFACE_PCAP_DYNAMIC_LINKING ON CACHE BOOL "Pcap protocol interface uses dynamic shared library linking (instead of static linking)." FORCE)
set(BUILD_AVDECC_INTERFACE_MAC ON CACHE BOOL "Build the macOS native protocol interface (macOS only)." FORCE)
set(BUILD_AVDECC_INTERFACE_PROXY OFF CACHE BOOL "Build the proxy protocol interface." FORCE)
set(BUILD_AVDECC_INTERFACE_VIRTUAL ON CACHE BOOL "Build the virtual protocol interface (for unit tests)." FORCE)
# Install options
set(INSTALL_AVDECC_EXAMPLES OFF CACHE BOOL "Install examples." FORCE)
set(INSTALL_AVDECC_TESTS OFF CACHE BOOL "Install unit tests." FORCE)
set(INSTALL_AVDECC_LIB_SHARED_CXX OFF CACHE BOOL "Install C++ shared library." FORCE) # Don't install the libraries, we copy them manually (we want them inside the Bundle on macOS)
set(INSTALL_AVDECC_LIB_STATIC OFF CACHE BOOL "Install static library." FORCE)
set(INSTALL_AVDECC_HEADERS OFF CACHE BOOL "Install headers." FORCE)
set(INSTALL_AVDECC_DOC OFF CACHE BOOL "Install documentation." FORCE)
# Enable features
set(ENABLE_AVDECC_FEATURE_REDUNDANCY ON CACHE BOOL "Enable 'Network Redundancy' feature as defined by AVnu Alliance." FORCE)
# Compatibility options
set(ENABLE_AVDECC_USE_FMTLIB ON CACHE BOOL "Use fmtlib" FORCE)
set(ENABLE_AVDECC_CUSTOM_ANY ON CACHE BOOL "Use custom std::any instead of c++17 one (for compilers not supporting std::any yet)" FORCE)
set(ENABLE_AVDECC_STRICT_2018_REDUNDANCY ON CACHE BOOL "Be strict about 'Network Redundancy' feature, using AVnu 2018 specifications." FORCE)
set(IGNORE_INVALID_CONTROL_DATA_LENGTH ON CACHE BOOL "Allow messages with an invalid advertised 'Control Data Length' field." FORCE)
set(IGNORE_INVALID_NON_SUCCESS_AEM_RESPONSES ON CACHE BOOL "Allow invalid AEM non-success responses messages." FORCE)
set(IGNORE_NEITHER_STATIC_NOR_DYNAMIC_MAPPINGS ON CACHE BOOL "Allow Entities not supporting Dynamic Mapping and not adversiting AUDIO_MAP." FORCE)
set(ALLOW_GET_AUDIO_MAP_UNSOL ON CACHE BOOL "Allow receiving GetAudioMap unsolicited notifications." FORCE)
set(ALLOW_RECV_BIG_AECP_PAYLOADS ON CACHE BOOL "Allow receiving AECP payloads bigger than the allowed 524 bytes." FORCE)
set(ALLOW_SEND_BIG_AECP_PAYLOADS OFF CACHE BOOL "Allow sending AECP payloads bigger than the allowed 524 bytes." FORCE)
# Include avdecc project
add_subdirectory(${AVDECC_BASE_FOLDER})
# Override discount options
set(DISCOUNT_MAKE_INSTALL OFF CACHE BOOL "Disable install rules" FORCE)
set(DISCOUNT_INSTALL_SAMPLES OFF CACHE BOOL "Disable install samples" FORCE)
set(DISCOUNT_ONLY_LIBRARY ON CACHE BOOL "Disable all samples" FORCE)
# Include discount project
add_subdirectory(3rdparty/discount/cmake/)
# Set folder for markdown library targets
target_compile_options(libmarkdown PRIVATE -DDESTRUCTOR=)
set_target_properties(libmarkdown PROPERTIES FOLDER "Libraries/Markdown")
set_target_properties(mktags PROPERTIES FOLDER "Libraries/Markdown")
# Set Folder for FMT library
if(ENABLE_AVDECC_USE_FMTLIB)
set_target_properties(fmt PROPERTIES FOLDER "Libraries")
endif()
# Add SparkleHelper targets
if(ENABLE_HIVE_FEATURE_SPARKLE)
add_subdirectory(3rdparty/sparkleHelper)
endif()
# Add our cmake modules path
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) # Required to find_package 3rd party modules that don't provide their CMake Config files
# Find Qt dependencies
find_package(Qt${QT_MAJOR_VERSION} COMPONENTS Widgets;Network REQUIRED)
# Setup variables related to the project version
cu_setup_project_version_variables(${HIVE_VERSION})
# Set minimum OSX/iOS version
cu_setup_apple_minimum_versions(MACOS 11 IOS 14)
############ Define some variables
set(HIVE_RESOURCES_FOLDER "${CMAKE_CURRENT_LIST_DIR}/resources")
if(FALSE)
set(INSTALL_TEST_FLAG "INSTALL")
endif()
if(${ENABLE_CODE_SIGNING})
set(SIGN_FLAG "SIGN")
endif()
# Install paramaters
if(APPLE)
cu_build_marketing_version(MARKETING_VERSION_STRING "${HIVE_VERSION}" ${MARKETING_VERSION_DIGITS} "${MARKETING_VERSION_POSTFIX}")
set(MACOS_INSTALL_FOLDER "${PROJECT_NAME} ${MARKETING_VERSION_STRING}")
list(APPEND SDR_PARAMETERS "BUNDLE_DIR" "${MACOS_INSTALL_FOLDER}" "RUNTIME_DIR" "${MACOS_INSTALL_FOLDER}")
endif()
list(APPEND SDR_PARAMETERS QT_MAJOR_VERSION ${QT_MAJOR_VERSION})
############ Add projects
# Add Libraries
add_subdirectory(libs)
# Add main project
add_subdirectory(src)
# Add tools
add_subdirectory(tools)
# Add tests
if(BUILD_HIVE_TESTS)
message(STATUS "Building Hive tests")
# Setup gtest options
set(gtest_force_shared_crt ON CACHE BOOL "For shared crt for gtest" FORCE)
set(BUILD_GMOCK OFF CACHE BOOL "Don't build the googlemock subproject" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "Disable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" FORCE)
# Include gtest framework
add_subdirectory(${AVDECC_BASE_FOLDER}/externals/3rdparty/gtest)
# Include our unit tests
add_subdirectory(tests)
endif()
# Add CPack
if(ENABLE_HIVE_CPACK)
add_subdirectory(installer)
endif()
# Force Project as visual default target
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT ${PROJECT_NAME})
# Configure a few things that has to be done last
cu_finalize(NO_VSCODE_WORKSPACE)