2023-08-04 01:21:54 +02:00
|
|
|
cmake_minimum_required(VERSION 3.22...3.25)
|
2023-03-26 03:55:25 +02:00
|
|
|
|
2023-03-28 19:50:59 +02:00
|
|
|
if(CMAKE_HOST_SYSTEM_NAME MATCHES "(Darwin)" OR OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
|
2023-04-28 15:35:17 +02:00
|
|
|
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
|
2023-03-26 03:55:25 +02:00
|
|
|
|
|
|
|
project(obs-studio VERSION ${OBS_VERSION_CANONICAL})
|
|
|
|
|
2024-08-02 20:28:11 +02:00
|
|
|
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()
|
2023-03-26 03:55:25 +02:00
|
|
|
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)
|
2023-07-06 16:22:31 +02:00
|
|
|
|
|
|
|
add_subdirectory(test/test-input)
|
|
|
|
|
2023-03-26 03:55:25 +02:00
|
|
|
add_subdirectory(UI)
|
|
|
|
|
|
|
|
message_configuration()
|
|
|
|
return()
|
|
|
|
endif()
|
2022-03-16 23:13:26 +01:00
|
|
|
|
2024-04-16 18:20:15 +02:00
|
|
|
message(
|
|
|
|
DEPRECATION
|
2024-03-26 21:28:00 +01:00
|
|
|
"\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 ============"
|
|
|
|
)
|
2024-04-14 03:22:52 +02:00
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
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}")
|
2024-03-26 21:28:00 +01:00
|
|
|
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."
|
|
|
|
)
|
2018-08-08 01:22:00 +02:00
|
|
|
endif()
|
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
project(obs-studio VERSION ${OBS_VERSION_CANONICAL})
|
2020-05-13 15:37:01 +02:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
# Use target folders for MSVC/Xcode/etc.
|
|
|
|
include(DeprecationHelpers)
|
2014-01-25 03:44:34 +01:00
|
|
|
include(ObsHelpers)
|
2022-03-16 23:13:26 +01:00
|
|
|
# Set default compiler flags
|
|
|
|
include(CompilerConfig)
|
2014-01-20 16:58:58 +01:00
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
# Allow selection of common build types via UI
|
2014-01-20 16:58:58 +01:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2024-03-26 21:28:00 +01:00
|
|
|
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
|
|
|
|
)
|
2014-01-20 16:58:58 +01:00
|
|
|
endif()
|
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
# Global project options
|
2022-06-15 18:49:21 +02:00
|
|
|
option(ENABLE_HEVC "Enable HEVC encoders" ON)
|
2022-04-23 21:04:49 +02:00
|
|
|
if(ENABLE_HEVC)
|
|
|
|
add_compile_definitions(ENABLE_HEVC)
|
|
|
|
endif()
|
2023-03-26 03:55:25 +02:00
|
|
|
option(BUILD_FOR_DISTRIBUTION "Build for distribution (enables optimizations)" OFF)
|
2022-03-16 23:13:26 +01:00
|
|
|
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})
|
2023-03-26 03:55:25 +02:00
|
|
|
option(BUILD_TESTS "Build test directory (includes test sources and possibly a platform test executable)" OFF)
|
2022-03-16 23:13:26 +01:00
|
|
|
|
|
|
|
if(OS_WINDOWS)
|
2024-03-26 21:28:00 +01:00
|
|
|
option(
|
|
|
|
INSTALLER_RUN
|
|
|
|
"Build a multiarch installer (needs to run independently after both archs have compiled) (Windows)"
|
|
|
|
OFF
|
|
|
|
)
|
2022-03-16 23:13:26 +01:00
|
|
|
elseif(OS_POSIX)
|
|
|
|
option(LINUX_PORTABLE "Build portable version (Linux)" OFF)
|
|
|
|
option(USE_XDG "Utilize XDG Base Directory Specification (Linux)" ON)
|
2022-05-26 14:29:08 +02:00
|
|
|
option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON)
|
2022-03-16 23:13:26 +01:00
|
|
|
if(OS_LINUX)
|
|
|
|
option(ENABLE_WAYLAND "Enable building with support for Wayland (Linux)" ON)
|
|
|
|
option(BUILD_FOR_PPA "Build for PPA distribution" OFF)
|
|
|
|
endif()
|
2018-12-16 19:33:16 +01:00
|
|
|
endif()
|
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
setup_obs_project()
|
|
|
|
mark_as_advanced(BUILD_TESTS USE_LIBCXX)
|
2014-06-25 09:38:23 +02:00
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
if(INSTALLER_RUN)
|
|
|
|
generate_multiarch_installer()
|
|
|
|
return()
|
2014-01-20 16:58:58 +01:00
|
|
|
endif()
|
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
# OBS sources and plugins
|
|
|
|
add_subdirectory(deps)
|
|
|
|
add_subdirectory(libobs-opengl)
|
|
|
|
if(OS_WINDOWS)
|
|
|
|
add_subdirectory(libobs-d3d11)
|
|
|
|
add_subdirectory(libobs-winrt)
|
2014-01-20 16:58:58 +01:00
|
|
|
endif()
|
2022-03-16 23:13:26 +01:00
|
|
|
add_subdirectory(libobs)
|
|
|
|
add_subdirectory(plugins)
|
2014-01-20 16:58:58 +01:00
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
# OBS main app
|
|
|
|
add_subdirectory(UI)
|
2021-06-23 20:53:35 +02:00
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
# Tests
|
|
|
|
if(ENABLE_UNIT_TESTS)
|
|
|
|
enable_testing()
|
2014-04-05 16:32:48 +02:00
|
|
|
endif()
|
|
|
|
|
2022-03-16 23:13:26 +01:00
|
|
|
if(BUILD_TESTS OR ENABLE_UNIT_TESTS)
|
|
|
|
add_subdirectory(test)
|
2020-08-18 15:50:46 +02:00
|
|
|
endif()
|