forked from mumble-voip/mumble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
192 lines (150 loc) · 5.3 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
# Copyright 2020-2021 The Mumble Developers. All rights reserved.
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0079 NEW)
cmake_policy(SET CMP0091 NEW)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20.0")
cmake_policy(SET CMP0118 NEW)
endif()
set(BUILD_NUMBER CACHE STRING "The build number of the current build. Will be used in Mumble's version to make sure newer builds upgrade older installations properly.")
set(RELEASE_ID CACHE STRING "The ID of the current release (used for representation in the UI and the updater)")
if ("${BUILD_NUMBER}" STREQUAL "")
if(packaging)
message(FATAL_ERROR "Tried to create a Mumble package, without specifying BUILD_NUMBER!")
else()
set(BUILD_NUMBER "0")
endif()
endif()
# Get compilation year
string(TIMESTAMP MUMBLE_BUILD_YEAR "%Y")
project(Mumble
VERSION "1.5.0.${BUILD_NUMBER}"
DESCRIPTION "Open source, low-latency, high quality voice chat."
HOMEPAGE_URL "https://www.mumble.info"
LANGUAGES "C" "CXX"
)
set(3RDPARTY_DIR "${CMAKE_SOURCE_DIR}/3rdparty")
set(PLUGINS_DIR "${CMAKE_SOURCE_DIR}/plugins")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake"
"${CMAKE_SOURCE_DIR}/cmake/FindModules"
"${3RDPARTY_DIR}/FindPythonInterpreter"
)
include(pkg-utils)
include(project-utils)
include(TargetArch)
option(tests "Build tests" OFF)
option(optimize "Build a heavily optimized version, specific to the machine it's being compiled on." OFF)
option(static "Build static binaries." OFF)
option(symbols "Build binaries in a way that allows easier debugging." OFF)
option(warnings-as-errors "All warnings are treated as errors." ON)
option(overlay "Build overlay." ON)
option(packaging "Build package." OFF)
option(plugins "Build plugins." ON)
option(debug-dependency-search "Prints extended information during the search for the needed dependencies" OFF)
if(NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(
"-DDEBUG"
"-DSNAPSHOT_BUILD"
)
endif()
include(compiler)
include(os)
target_architecture(MUMBLE_TARGET_ARCH)
string(TOLOWER "${MUMBLE_TARGET_ARCH}" MUMBLE_TARGET_ARCH)
message(STATUS "##################################################")
message(STATUS "Mumble release ID: ${RELEASE_ID}")
message(STATUS "Mumble version: ${PROJECT_VERSION}")
message(STATUS "Architecture: ${MUMBLE_TARGET_ARCH}")
if(NOT IS_MULTI_CONFIG)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
else()
message(STATUS "Using multi-config generator that will determine build type on-the-fly")
endif()
message(STATUS "##################################################")
include(install-paths)
# We have to check for BUILD_TESTING before including CTest as CTest defines this variable
if(DEFINED BUILD_TESTING AND NOT BUILD_TESTING_CHECKED)
message(WARNING "Use of option \"BUILD_TESTING\" is deprecated. Use \"tests\" instead.")
if(NOT tests)
# Allow deprecated option to enable tests if they had been disabled otherwise
set(tests "${BUILD_TESTING}")
endif()
endif()
set(BUILD_TESTING_CHECKED ON INTERNAL CACHE BOOL "Persistent helper variable" FORCE)
if(tests)
include(CTest)
endif()
if (WIN32)
set(MUMBLE_TARGET_OS "windows")
elseif (APPLE)
set(MUMBLE_TARGET_OS "macos")
elseif (UNIX)
set(MUMBLE_TARGET_OS "linux")
else()
message(FATAL_ERROR "Unable to determine target OS")
endif()
# Make the build year accessible as a macro
add_compile_definitions(MUMBLE_BUILD_YEAR=${MUMBLE_BUILD_YEAR})
# Make sure that math constants are always defined
add_compile_definitions(_USE_MATH_DEFINES)
# Provide the information about the target architecture to all Mumble source files in form of a macro
add_compile_definitions(MUMBLE_TARGET_ARCH="${MUMBLE_TARGET_ARCH}")
# Also provide information about the target OS
add_compile_definitions(MUMBLE_TARGET_OS="${MUMBLE_TARGET_OS}")
set(CMAKE_UNITY_BUILD_BATCH_SIZE 40)
add_subdirectory(src)
if(g15 AND WIN32)
add_subdirectory(g15helper)
endif()
if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
# mach_override doesn't support ARM
# https://github.com/rentzsch/mach_override/issues/6
set(overlay OFF CACHE BOOL "" FORCE)
message(STATUS "Disabling the overlay on ARM macOS")
endif()
if(overlay AND client)
if(WIN32)
add_subdirectory(overlay)
else()
add_subdirectory(overlay_gl)
if(APPLE)
add_subdirectory(macx/osax)
endif()
endif()
endif()
if(plugins AND client)
add_subdirectory(plugins)
endif()
if(packaging)
file(COPY
${CMAKE_SOURCE_DIR}/installer/gpl.txt
${CMAKE_SOURCE_DIR}/installer/lgpl.txt
${CMAKE_SOURCE_DIR}/installer/Mumble.rtf
${CMAKE_SOURCE_DIR}/installer/portaudio.txt
${CMAKE_SOURCE_DIR}/installer/qt.txt
${CMAKE_SOURCE_DIR}/installer/speex.txt
DESTINATION
${CMAKE_BINARY_DIR}/licenses
)
if(WIN32)
file(COPY
${CMAKE_SOURCE_DIR}/installer/bannrbmp.bmp
${CMAKE_SOURCE_DIR}/installer/dlgbmp.bmp
DESTINATION
${CMAKE_BINARY_DIR}/installer
)
file(COPY
${CMAKE_SOURCE_DIR}/icons/mumble.ico
${CMAKE_SOURCE_DIR}/icons/murmur.ico
DESTINATION
${CMAKE_BINARY_DIR}/installer/icons
)
endif()
endif()