forked from obsproject/obs-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
145 lines (122 loc) · 4.1 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
cmake_minimum_required(VERSION 3.22...3.25)
if(CMAKE_HOST_SYSTEM_NAME MATCHES "(Windows|Darwin)" OR OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
project(obs-studio VERSION ${OBS_VERSION_CANONICAL})
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/architecture.cmake")
if(NOT OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_GENERATOR_PLATFORM)
return()
endif()
endif()
include(compilerconfig)
include(defaults)
include(helpers)
option(ENABLE_UI "Enable building with UI (requires Qt)" ON)
option(ENABLE_SCRIPTING "Enable scripting support" ON)
option(ENABLE_HEVC "Enable HEVC encoders" ON)
add_subdirectory(libobs)
if(OS_WINDOWS)
add_subdirectory(libobs-d3d11)
add_subdirectory(libobs-winrt)
endif()
add_subdirectory(libobs-opengl)
add_subdirectory(plugins)
add_subdirectory(test/test-input)
add_subdirectory(UI)
message_configuration()
return()
endif()
message(
DEPRECATION
"\n"
"============ LEGACY BUILD SYSTEM IS DEPRECATED ============"
"\n"
"You are using the legacy build system to build OBS Studio. "
"The legacy build system is unsupported and will be removed in the near future."
"\n"
"To migrate to the new build system, familiarize yourself with CMake presets "
"(https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) and create "
"a user preset with your customized build settings, inheriting from one of the default presets."
"\n"
"============ LEGACY BUILD SYSTEM IS DEPRECATED ============"
)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules")
include(VersionConfig)
# Prohibit in-source builds
if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message(
FATAL_ERROR
"OBS: You cannot build in a source directory (or any directory with CMakeLists.txt file). "
"Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles."
)
endif()
project(obs-studio VERSION ${OBS_VERSION_CANONICAL})
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Use target folders for MSVC/Xcode/etc.
include(DeprecationHelpers)
include(ObsHelpers)
# Set default compiler flags
include(CompilerConfig)
# Allow selection of common build types via UI
if(NOT CMAKE_BUILD_TYPE)
set(
CMAKE_BUILD_TYPE
"RelWithDebInfo"
CACHE STRING
"OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]"
FORCE
)
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel
)
endif()
# Global project options
option(ENABLE_HEVC "Enable HEVC encoders" ON)
if(ENABLE_HEVC)
add_compile_definitions(ENABLE_HEVC)
endif()
option(BUILD_FOR_DISTRIBUTION "Build for distribution (enables optimizations)" OFF)
option(ENABLE_UI "Enable building with UI (requires Qt)" ON)
option(ENABLE_SCRIPTING "Enable scripting support" ON)
option(USE_LIBCXX "Use libc++ instead of libstdc++" ${APPLE})
option(BUILD_TESTS "Build test directory (includes test sources and possibly a platform test executable)" OFF)
if(OS_WINDOWS)
option(
INSTALLER_RUN
"Build a multiarch installer (needs to run independently after both archs have compiled) (Windows)"
OFF
)
elseif(OS_POSIX)
option(LINUX_PORTABLE "Build portable version (Linux)" OFF)
option(USE_XDG "Utilize XDG Base Directory Specification (Linux)" ON)
option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON)
if(OS_LINUX)
option(ENABLE_WAYLAND "Enable building with support for Wayland (Linux)" ON)
option(BUILD_FOR_PPA "Build for PPA distribution" OFF)
endif()
endif()
setup_obs_project()
mark_as_advanced(BUILD_TESTS USE_LIBCXX)
if(INSTALLER_RUN)
generate_multiarch_installer()
return()
endif()
# OBS sources and plugins
add_subdirectory(deps)
add_subdirectory(libobs-opengl)
if(OS_WINDOWS)
add_subdirectory(libobs-d3d11)
add_subdirectory(libobs-winrt)
endif()
add_subdirectory(libobs)
add_subdirectory(plugins)
# OBS main app
add_subdirectory(UI)
# Tests
if(ENABLE_UNIT_TESTS)
enable_testing()
endif()
if(BUILD_TESTS OR ENABLE_UNIT_TESTS)
add_subdirectory(test)
endif()