mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-27 09:46:20 -04:00
cmake: Add explicit target_enable function
This provides the counterpart to the existing "target_disable" function, which also allows the functionality to be factored out of existing helper code that might run this implicitly. Co-authored-by: PatTheMav <PatTheMav@users.noreply.github.com>
This commit is contained in:
committed by
Ryan Foster
co-authored by
PatTheMav
parent
1c315c33f8
commit
db8d9071b2
@@ -82,6 +82,11 @@ function(target_disable_feature target feature_description)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# target_enable: Adds target to list of enabled modules
|
||||
function(target_enable target)
|
||||
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_ENABLED ${target})
|
||||
endfunction()
|
||||
|
||||
# target_disable: Adds target to list of disabled modules
|
||||
function(target_disable target)
|
||||
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_DISABLED ${target})
|
||||
@@ -499,8 +504,14 @@ function(add_obs_plugin target)
|
||||
|
||||
if(found_platform AND found_architecture)
|
||||
add_subdirectory(${target})
|
||||
elseif(_AOP_WITH_MESSAGE)
|
||||
add_custom_target(${target} COMMENT "Dummy target for unavailable module ${target}")
|
||||
endif()
|
||||
|
||||
if(TARGET ${target})
|
||||
target_enable(${target})
|
||||
else()
|
||||
if(_AOP_WITH_MESSAGE)
|
||||
add_custom_target(${target} COMMENT "Dummy target for unavailable module ${target}")
|
||||
endif()
|
||||
target_disable(${target})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@@ -213,8 +213,6 @@ function(set_target_properties_obs target)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_ENABLED ${target})
|
||||
endif()
|
||||
|
||||
target_install_resources(${target})
|
||||
@@ -236,8 +234,8 @@ function(target_install_resources target)
|
||||
source_group("Resources/${relative_path}" FILES "${data_file}")
|
||||
endforeach()
|
||||
|
||||
get_property(obs_module_list GLOBAL PROPERTY OBS_MODULES_ENABLED)
|
||||
if(target IN_LIST obs_module_list)
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(target_type STREQUAL MODULE_LIBRARY)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}")
|
||||
elseif(target STREQUAL obs)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-studio")
|
||||
@@ -267,10 +265,10 @@ endfunction()
|
||||
|
||||
# Helper function to add a specific resource to a bundle
|
||||
function(target_add_resource target resource)
|
||||
get_property(obs_module_list GLOBAL PROPERTY OBS_MODULES_ENABLED)
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(ARGN)
|
||||
set(target_destination "${ARGN}")
|
||||
elseif(${target} IN_LIST obs_module_list)
|
||||
elseif(target_type STREQUAL MODULE_LIBRARY)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}")
|
||||
elseif(target STREQUAL obs)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-studio")
|
||||
|
||||
@@ -303,7 +303,6 @@ function(set_target_properties_obs target)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_ENABLED ${target})
|
||||
set_property(GLOBAL APPEND PROPERTY _OBS_DEPENDENCIES ${target})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -157,8 +157,6 @@ function(set_target_properties_obs target)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_ENABLED ${target})
|
||||
endif()
|
||||
|
||||
target_link_options(${target} PRIVATE "/PDBALTPATH:$<TARGET_PDB_FILE_NAME:${target}>")
|
||||
@@ -314,8 +312,8 @@ function(target_install_resources target)
|
||||
source_group("Resources/${relative_path}" FILES "${data_file}")
|
||||
endforeach()
|
||||
|
||||
get_property(obs_module_list GLOBAL PROPERTY OBS_MODULES_ENABLED)
|
||||
if(target IN_LIST obs_module_list)
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(target_type STREQUAL MODULE_LIBRARY)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}")
|
||||
elseif(target STREQUAL obs-studio)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-studio")
|
||||
@@ -346,10 +344,10 @@ endfunction()
|
||||
|
||||
# Helper function to add a specific resource to a bundle
|
||||
function(target_add_resource target resource)
|
||||
get_property(obs_module_list GLOBAL PROPERTY OBS_MODULES_ENABLED)
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(ARGN)
|
||||
set(target_destination "${ARGN}")
|
||||
elseif(${target} IN_LIST obs_module_list)
|
||||
elseif(target_type STREQUAL MODULE_LIBRARY)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/${target}")
|
||||
elseif(target STREQUAL obs-studio)
|
||||
set(target_destination "${OBS_DATA_DESTINATION}/obs-studio")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
if(NOT ENABLE_AJA)
|
||||
target_disable(aja-output-ui)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
option(ENABLE_AJA "Build OBS with aja support" ON)
|
||||
|
||||
if(NOT ENABLE_AJA)
|
||||
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_DISABLED aja)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
if(OS_WINDOWS)
|
||||
option(ENABLE_COREAUDIO_ENCODER "Enable building with CoreAudio encoder (Windows)" ON)
|
||||
if(NOT ENABLE_COREAUDIO_ENCODER)
|
||||
target_disable(coreaudio-encoder)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
if(NOT ENABLE_DECKLINK)
|
||||
target_disable(decklink-captions)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
if(NOT ENABLE_DECKLINK)
|
||||
target_disable(decklink-output-ui)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
option(ENABLE_DECKLINK "Build OBS with Decklink support" ON)
|
||||
if(NOT ENABLE_DECKLINK)
|
||||
target_disable(decklink)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
option(ENABLE_ALSA "Build OBS with ALSA support" ON)
|
||||
|
||||
if(NOT ENABLE_ALSA)
|
||||
target_disable(linux-alsa)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
option(ENABLE_JACK "Build OBS with JACK support" OFF)
|
||||
if(NOT ENABLE_JACK)
|
||||
target_disable(linux-jack)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
option(ENABLE_PIPEWIRE "Enable PipeWire support" ON)
|
||||
if(NOT ENABLE_PIPEWIRE)
|
||||
target_disable(linux-pipewire)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
if(NOT ENABLE_PULSEAUDIO)
|
||||
target_disable(linux-pulseaudio)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ option(ENABLE_V4L2 "Build OBS with v4l2 support" ON)
|
||||
option(ENABLE_UDEV "Build linux-v4l2 with UDEV support" ON)
|
||||
|
||||
if(NOT ENABLE_V4L2)
|
||||
target_disable(linux-v4l2)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ set_target_properties_obs(
|
||||
XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES
|
||||
XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES
|
||||
)
|
||||
target_enable(mac-avcapture-legacy)
|
||||
|
||||
add_library(mac-avcapture MODULE)
|
||||
add_library(OBS::avcapture ALIAS mac-avcapture)
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
option(ENABLE_SYPHON "Enable Syphon sharing support" ON)
|
||||
if(NOT ENABLE_SYPHON)
|
||||
target_disable(mac-syphon)
|
||||
target_disable_feature(mac-syphon "Syphon sharing support")
|
||||
return()
|
||||
else()
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
option(ENABLE_LIBFDK "Enable FDK AAC support" OFF)
|
||||
if(NOT ENABLE_LIBFDK)
|
||||
target_disable(obs-libfdk)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ mark_as_advanced(ENABLE_NVENC_FFMPEG_IDS)
|
||||
|
||||
if(NOT ENABLE_NVENC)
|
||||
target_disable_feature(obs-nvenc "NVIDIA Hardware Encoder")
|
||||
target_disable(obs-nvenc)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
option(ENABLE_QSV11 "Build Intel QSV11 Hardware Encoder." TRUE)
|
||||
if(NOT ENABLE_QSV11)
|
||||
target_disable_feature(obs-qsv11 "Intel QSV11 Hardware Encoder")
|
||||
target_disable(obs-qsv11)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
option(ENABLE_VST "Enable building OBS with VST plugin" ON)
|
||||
|
||||
if(NOT ENABLE_VST)
|
||||
target_disable(obs-vst)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
option(ENABLE_WEBRTC "Enable WebRTC Output support" ON)
|
||||
if(NOT ENABLE_WEBRTC)
|
||||
target_disable(obs-webrtc)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
option(ENABLE_OSS "Enable building with OSS audio support" ON)
|
||||
|
||||
if(NOT ENABLE_OSS)
|
||||
target_disable(oss-audio)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
|
||||
option(ENABLE_SNDIO "Build OBS with sndio support" OFF)
|
||||
if(NOT ENABLE_SNDIO)
|
||||
target_disable(sndio)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
|
||||
option(ENABLE_FREETYPE "Enable FreeType text plugin" ON)
|
||||
|
||||
if(NOT ENABLE_FREETYPE)
|
||||
target_disable(text-freetype2)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ endmacro()
|
||||
|
||||
option(ENABLE_VLC "Build OBS with VLC plugin support" ON)
|
||||
if(NOT ENABLE_VLC)
|
||||
target_disable(vlc-video)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user