Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0580d49552f69955437fd49b1773166481ef59bc (plain)
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
# Copyright 2019-2020 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)

set(version "1.4.0" CACHE STRING "Project version")

string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]" version_short ${version})

# Get compilation year
string(TIMESTAMP MUMBLE_BUILD_YEAR "%Y")

project(Mumble
	VERSION ${version_short}
	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(CMAKE_CXX_STANDARD 14)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)

list(APPEND CMAKE_MODULE_PATH
	"${CMAKE_SOURCE_DIR}/cmake"
	"${CMAKE_SOURCE_DIR}/cmake/FindModules"
)


include(pkg-utils)
include(project-utils)
include(GNUInstallDirs)


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." OFF)

option(dpkg-buildflags "Add CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS from dpkg-buildflags to the build flags." OFF)

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)

# We support the "Debug" and "Release" configurations.
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
	"Debug"
	"Release"
)

get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(IS_MULTI_CONFIG)
	set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)

	set(BUILD_STR "<multi-config>")
else()
	# We set the CMake configuration to "Release", in case it's not set.
	if(NOT CMAKE_BUILD_TYPE)
		set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")

		set(BUILD_STR "Release")
	elseif(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
		add_definitions(
			"-DDEBUG"
			"-DSNAPSHOT_BUILD"
		)

		set(BUILD_STR "Debug")
	elseif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release")
		message(FATAL_ERROR "Unsupported build type! Please choose either \"Debug\" or \"Release\".")
	endif()
endif()

include(compiler)
include(os)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
	if(UNIX)
		# Use default GNU location
		set(DEFAULT_LIBDIR "${CMAKE_INSTALL_LIBDIR}/mumble")
	else()
		# Default to current directory
		set(DEFAULT_LIBDIR "./lib/mumble")
	endif()
else()
	# Use a path relative to the prefix
	set(DEFAULT_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib/mumble")
endif()

set(MUMBLE_INSTALL_LIBDIR "${DEFAULT_LIBDIR}" CACHE STRING "The path to which Mumble will install its plugins")

if (64_BIT)
	set(ARCH "64bit")
else()
	set(ARCH "32bit")
endif()

message(STATUS "##################################################")
message(STATUS "Mumble version:  ${version}")
message(STATUS "Architecture:    ${ARCH}")
message(STATUS "Build type:      ${BUILD_STR}")
message(STATUS "##################################################")

# We have to check for BUILD_TESTING before including CTest as CTest defines this variable
if(DEFINED BUILD_TESTING)
	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()

if(tests)
	include(CTest)
endif()


add_subdirectory(src)

if(g15 AND WIN32)
	add_subdirectory(g15helper)
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)
	if(WIN32)
		file(COPY "${CMAKE_SOURCE_DIR}/scripts/Create-Win32InstallerMUI.ps1" DESTINATION ${CMAKE_BINARY_DIR})
	endif()

	include(cmake/packaging.cmake)
endif()