Skip to content

Commit b1bd85c

Browse files
committed
cmake: Update CMake files to current state found on obs-studio
1 parent 77bc111 commit b1bd85c

28 files changed

+548
-699
lines changed

.github/scripts/build-ubuntu

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,6 @@ ${_usage_host:-}"
203203
local cmake_version
204204
read -r _ _ cmake_version <<< "$(cmake --version)"
205205
206-
if [[ ${CPUTYPE} != ${target##*-} ]] {
207-
if is-at-least 3.21.0 ${cmake_version}; then
208-
cmake_args+=(--toolchain "${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
209-
else
210-
cmake_args+=(-D"CMAKE_TOOLCHAIN_FILE=${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
211-
fi
212-
}
213-
214206
cmake_build_args+=(--preset ${_preset}-${target##*-} --config ${config})
215207
if [[ ${generator} == 'Unix Makefiles' ]] {
216208
cmake_build_args+=(--parallel $(( $(nproc) + 1 )))

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.16...3.26)
1+
cmake_minimum_required(VERSION 3.28...3.30)
22

33
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
44

@@ -25,13 +25,13 @@ if(ENABLE_QT)
2525
find_package(Qt6 COMPONENTS Widgets Core)
2626
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets)
2727
target_compile_options(
28-
${CMAKE_PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header
29-
-Wno-comma>)
28+
${CMAKE_PROJECT_NAME}
29+
PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header -Wno-comma>
30+
)
3031
set_target_properties(
3132
${CMAKE_PROJECT_NAME}
32-
PROPERTIES AUTOMOC ON
33-
AUTOUIC ON
34-
AUTORCC ON)
33+
PROPERTIES AUTOMOC ON AUTOUIC ON AUTORCC ON
34+
)
3535
endif()
3636

3737
target_sources(${CMAKE_PROJECT_NAME} PRIVATE src/plugin-main.c)

CMakePresets.json

Lines changed: 25 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"version": 3,
2+
"version": 8,
33
"cmakeMinimumRequired": {
44
"major": 3,
5-
"minor": 22,
5+
"minor": 28,
66
"patch": 0
77
},
88
"configurePresets": [
@@ -29,6 +29,7 @@
2929
"warnings": {"dev": true, "deprecated": true},
3030
"cacheVariables": {
3131
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0",
32+
"CMAKE_OSX_ARCHITECTURES": "arm64;x86_64",
3233
"CODESIGN_IDENTITY": "$penv{CODESIGN_IDENT}",
3334
"CODESIGN_TEAM": "$penv{CODESIGN_TEAM}"
3435
}
@@ -40,7 +41,8 @@
4041
"description": "Build for macOS 11.0+ (Universal binary) for CI",
4142
"generator": "Xcode",
4243
"cacheVariables": {
43-
"CMAKE_COMPILE_WARNING_AS_ERROR": true
44+
"CMAKE_COMPILE_WARNING_AS_ERROR": true,
45+
"ENABLE_CCACHE": true
4446
}
4547
},
4648
{
@@ -55,7 +57,7 @@
5557
"rhs": "Windows"
5658
},
5759
"generator": "Visual Studio 17 2022",
58-
"architecture": "x64",
60+
"architecture": "x64,version=10.0.22621",
5961
"warnings": {"dev": true, "deprecated": true},
6062
"cacheVariables": {
6163
"CMAKE_SYSTEM_VERSION": "10.0.18363.657"
@@ -71,9 +73,9 @@
7173
}
7274
},
7375
{
74-
"name": "linux-x86_64",
75-
"displayName": "Linux x86_64",
76-
"description": "Build for Linux x86_64",
76+
"name": "ubuntu-x86_64",
77+
"displayName": "Ubuntu x86_64",
78+
"description": "Build for Ubuntu x86_64",
7779
"inherits": ["template"],
7880
"binaryDir": "${sourceDir}/build_x86_64",
7981
"condition": {
@@ -83,45 +85,20 @@
8385
},
8486
"generator": "Ninja",
8587
"warnings": {"dev": true, "deprecated": true},
86-
"cacheVariables": {
87-
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
88-
}
89-
},
90-
{
91-
"name": "linux-ci-x86_64",
92-
"inherits": ["linux-x86_64"],
93-
"displayName": "Linux x86_64 CI build",
94-
"description": "Build for Linux x86_64 on CI",
9588
"cacheVariables": {
9689
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
97-
"CMAKE_COMPILE_WARNING_AS_ERROR": true
98-
}
99-
},
100-
{
101-
"name": "linux-aarch64",
102-
"displayName": "Linux aarch64",
103-
"description": "Build for Linux aarch64",
104-
"inherits": ["template"],
105-
"binaryDir": "${sourceDir}/build_aarch64",
106-
"condition": {
107-
"type": "equals",
108-
"lhs": "${hostSystemName}",
109-
"rhs": "Linux"
110-
},
111-
"generator": "Ninja",
112-
"warnings": {"dev": true, "deprecated": true},
113-
"cacheVariables": {
114-
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
90+
"CMAKE_INSTALL_LIBDIR": "lib/CMAKE_SYSTEM_PROCESSOR-linux-gnu"
11591
}
11692
},
11793
{
118-
"name": "linux-ci-aarch64",
119-
"inherits": ["linux-aarch64"],
120-
"displayName": "Linux aarch64 CI build",
121-
"description": "Build for Linux aarch64 on CI",
94+
"name": "ubuntu-ci-x86_64",
95+
"inherits": ["ubuntu-x86_64"],
96+
"displayName": "Ubuntu x86_64 CI build",
97+
"description": "Build for Ubuntu x86_64 on CI",
12298
"cacheVariables": {
12399
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
124-
"CMAKE_COMPILE_WARNING_AS_ERROR": true
100+
"CMAKE_COMPILE_WARNING_AS_ERROR": true,
101+
"ENABLE_CCACHE": true
125102
}
126103
}
127104
],
@@ -131,7 +108,7 @@
131108
"configurePreset": "macos",
132109
"displayName": "macOS Universal",
133110
"description": "macOS build for Universal architectures",
134-
"configuration": "Release"
111+
"configuration": "RelWithDebInfo"
135112
},
136113
{
137114
"name": "macos-ci",
@@ -155,31 +132,17 @@
155132
"configuration": "RelWithDebInfo"
156133
},
157134
{
158-
"name": "linux-x86_64",
159-
"configurePreset": "linux-x86_64",
160-
"displayName": "Linux x86_64",
161-
"description": "Linux build for x86_64",
162-
"configuration": "RelWithDebInfo"
163-
},
164-
{
165-
"name": "linux-ci-x86_64",
166-
"configurePreset": "linux-ci-x86_64",
167-
"displayName": "Linux x86_64 CI",
168-
"description": "Linux CI build for x86_64",
169-
"configuration": "RelWithDebInfo"
170-
},
171-
{
172-
"name": "linux-aarch64",
173-
"configurePreset": "linux-aarch64",
174-
"displayName": "Linux aarch64",
175-
"description": "Linux build for aarch64",
135+
"name": "ubuntu-x86_64",
136+
"configurePreset": "ubuntu-x86_64",
137+
"displayName": "Ubuntu x86_64",
138+
"description": "Ubuntu build for x86_64",
176139
"configuration": "RelWithDebInfo"
177140
},
178141
{
179-
"name": "linux-ci-aarch64",
180-
"configurePreset": "linux-ci-aarch64",
181-
"displayName": "Linux aarch64 CI",
182-
"description": "Linux CI build for aarch64",
142+
"name": "ubuntu-ci-x86_64",
143+
"configurePreset": "ubuntu-ci-x86_64",
144+
"displayName": "Ubuntu x86_64 CI",
145+
"description": "Ubuntu CI build for x86_64",
183146
"configuration": "RelWithDebInfo"
184147
}
185148
]

buildspec.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
{
22
"dependencies": {
33
"obs-studio": {
4-
"version": "30.1.2",
4+
"version": "31.0.0-beta1",
55
"baseUrl": "https://github.com/obsproject/obs-studio/archive/refs/tags",
66
"label": "OBS sources",
77
"hashes": {
8-
"macos": "490bae1c392b3b344b0270afd8cb887da4bc50bd92c0c426e96713c1ccb9701a",
9-
"windows-x64": "c2dd03fa7fd01fad5beafce8f7156da11f9ed9a588373fd40b44a06f4c03b867"
8+
"macos": "41d783ae8705717f07ea9a433c70f561bb3e18242b4b4c65bbfa68215d052bf9",
9+
"windows-x64": "4d44b41f7a58b3c3df7bfc53ea4d20c7b480193511693b297ffc1018f048b276"
1010
}
1111
},
1212
"prebuilt": {
13-
"version": "2024-03-19",
13+
"version": "2024-09-12",
1414
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
1515
"label": "Pre-Built obs-deps",
1616
"hashes": {
17-
"macos": "2e9bfb55a5e0e4c1086fa1fda4cf268debfead473089df2aaea80e1c7a3ca7ff",
18-
"windows-x64": "6e86068371526a967e805f6f9903f9407adb683c21820db5f07da8f30d11e998"
17+
"macos": "c857b211ee378772994b632036e1e5befe66b37e85286cb8e3cefc1435d5220a",
18+
"windows-x64": "d4a4f194591766891ad3c0b267deec3c4b85239c8fe557273559927456aeedbb"
1919
}
2020
},
2121
"qt6": {
22-
"version": "2024-03-19",
22+
"version": "2024-09-12",
2323
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
2424
"label": "Pre-Built Qt6",
2525
"hashes": {
26-
"macos": "694f1e639c017e3b1f456f735330dc5afae287cbea85757101af1368de3142c8",
27-
"windows-x64": "72d1df34a0ef7413a681d5fcc88cae81da60adc03dcd23ef17862ab170bcc0dd"
26+
"macos": "34a2de6b7f4d4d58fc5a15a4dba49a61d81a4045d0cedfc1a1f08c0dfb8047cf",
27+
"windows-x64": "4d15ce13dbb0a8a2cabcce5ae0da5e80ee589b482a61b2025378465c1da32c4f"
2828
},
2929
"debugSymbols": {
30-
"windows-x64": "fbddd1f659c360f2291911ac5709b67b6f8182e6bca519d24712e4f6fd3cc865"
30+
"windows-x64": "dad2351a5c9cd438168e1ed8fb453a2534532252edb555f1001a5e8eb3f1bbd4"
3131
}
3232
}
3333
},
3434
"platformConfig": {
3535
"macos": {
36-
"bundleId": "com.example.obs-plugintemplate"
36+
"bundleId": "com.example.plugintemplate-for-obs"
3737
}
3838
},
39-
"name": "obs-plugintemplate",
40-
"displayName": "OBS Plugin Template",
39+
"name": "plugintemplate-for-obs",
40+
"displayName": "Plugin Template for OBS",
4141
"version": "1.0.0",
4242
"author": "Your Name Here",
4343
"website": "https://example.com",

cmake/common/bootstrap.cmake

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,88 @@
1-
cmake_minimum_required(VERSION 3.16...3.26)
1+
# Plugin bootstrap module
22

33
include_guard(GLOBAL)
44

5-
# Enable automatic PUSH and POP of policies to parent scope
6-
if(POLICY CMP0011)
7-
cmake_policy(SET CMP0011 NEW)
8-
endif()
9-
10-
# Enable distinction between Clang and AppleClang
11-
if(POLICY CMP0025)
12-
cmake_policy(SET CMP0025 NEW)
13-
endif()
14-
15-
# Enable strict checking of "break()" usage
16-
if(POLICY CMP0055)
17-
cmake_policy(SET CMP0055 NEW)
18-
endif()
19-
20-
# Honor visibility presets for all target types (executable, shared, module, static)
21-
if(POLICY CMP0063)
22-
cmake_policy(SET CMP0063 NEW)
23-
endif()
24-
25-
# Disable export function calls to populate package registry by default
26-
if(POLICY CMP0090)
27-
cmake_policy(SET CMP0090 NEW)
28-
endif()
5+
# Map fallback configurations for optimized build configurations
6+
# gersemi: off
7+
set(
8+
CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO
9+
RelWithDebInfo
10+
Release
11+
MinSizeRel
12+
None
13+
""
14+
)
15+
set(
16+
CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL
17+
MinSizeRel
18+
Release
19+
RelWithDebInfo
20+
None
21+
""
22+
)
23+
set(
24+
CMAKE_MAP_IMPORTED_CONFIG_RELEASE
25+
Release
26+
RelWithDebInfo
27+
MinSizeRel
28+
None
29+
""
30+
)
31+
# gersemi: on
2932

3033
# Prohibit in-source builds
3134
if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
32-
message(FATAL_ERROR "In-source builds are not supported. "
33-
"Specify a build directory via 'cmake -S <SOURCE DIRECTORY> -B <BUILD_DIRECTORY>' instead.")
35+
message(
36+
FATAL_ERROR
37+
"In-source builds are not supported. "
38+
"Specify a build directory via 'cmake -S <SOURCE DIRECTORY> -B <BUILD_DIRECTORY>' instead."
39+
)
3440
file(REMOVE_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt" "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles")
3541
endif()
3642

37-
# Use folders for source file organization with IDE generators (Visual Studio/Xcode)
38-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
39-
4043
# Add common module directories to default search path
4144
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common")
4245

4346
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
4447

45-
# cmake-format: off
4648
string(JSON _name GET ${buildspec} name)
4749
string(JSON _website GET ${buildspec} website)
4850
string(JSON _author GET ${buildspec} author)
4951
string(JSON _email GET ${buildspec} email)
5052
string(JSON _version GET ${buildspec} version)
5153
string(JSON _bundleId GET ${buildspec} platformConfig macos bundleId)
5254
string(JSON _windowsAppUUID GET ${buildspec} uuids windowsApp)
53-
# cmake-format: on
5455

5556
set(PLUGIN_AUTHOR ${_author})
5657
set(PLUGIN_WEBSITE ${_website})
5758
set(PLUGIN_EMAIL ${_email})
5859
set(PLUGIN_VERSION ${_version})
5960
set(MACOS_BUNDLEID ${_bundleId})
6061

62+
string(REPLACE "." ";" _version_canonical "${_version}")
63+
list(GET _version_canonical 0 PLUGIN_VERSION_MAJOR)
64+
list(GET _version_canonical 1 PLUGIN_VERSION_MINOR)
65+
list(GET _version_canonical 2 PLUGIN_VERSION_PATCH)
66+
unset(_version_canonical)
67+
6168
include(buildnumber)
6269
include(osconfig)
6370

6471
# Allow selection of common build types via UI
65-
if(NOT CMAKE_BUILD_TYPE)
66-
set(CMAKE_BUILD_TYPE
72+
if(NOT CMAKE_GENERATOR MATCHES "(Xcode|Visual Studio .+)")
73+
if(NOT CMAKE_BUILD_TYPE)
74+
set(
75+
CMAKE_BUILD_TYPE
6776
"RelWithDebInfo"
68-
CACHE STRING "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE)
69-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel)
77+
CACHE STRING
78+
"OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]"
79+
FORCE
80+
)
81+
set_property(
82+
CACHE CMAKE_BUILD_TYPE
83+
PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel
84+
)
85+
endif()
7086
endif()
7187

7288
# Disable exports automatically going into the CMake package registry

0 commit comments

Comments
 (0)