mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-06-25 00:00:04 -04:00
The actual frontend provided an "ENABLE_FRONTEND" build flag, whereas the global project still provided an "ENABLE_UI" flag, which itself was only read and respected by the scripting module. This change retains the global flag and makes both the actual frontend as well as the scripting module respect its value.
58 lines
1.4 KiB
CMake
58 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.28...3.30)
|
|
|
|
if(NOT ENABLE_SCRIPTING)
|
|
target_disable_feature(obs-scripting "Scripting support")
|
|
return()
|
|
endif()
|
|
|
|
include(cmake/cstrcache.cmake)
|
|
|
|
find_package(SWIG 4 REQUIRED)
|
|
|
|
add_library(obs-scripting SHARED)
|
|
add_library(OBS::scripting ALIAS obs-scripting)
|
|
|
|
include(cmake/lua.cmake)
|
|
include(cmake/python.cmake)
|
|
|
|
if(NOT ENABLE_SCRIPTING_LUA AND NOT ENABLE_SCRIPTING_PYTHON)
|
|
target_disable_feature(obs-scripting "Scripting support")
|
|
return()
|
|
else()
|
|
target_enable_feature(obs-scripting "Scripting support")
|
|
endif()
|
|
|
|
target_sources(
|
|
obs-scripting
|
|
PUBLIC obs-scripting.h
|
|
PRIVATE obs-scripting-callback.h obs-scripting-logging.c obs-scripting.c
|
|
)
|
|
|
|
target_compile_definitions(
|
|
obs-scripting
|
|
PRIVATE SCRIPT_DIR="${OBS_SCRIPT_PLUGIN_PATH}" $<$<BOOL:${ENABLE_FRONTEND}>:ENABLE_FRONTEND>
|
|
)
|
|
|
|
target_include_directories(obs-scripting PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
target_link_libraries(
|
|
obs-scripting
|
|
PRIVATE
|
|
OBS::libobs
|
|
OBS::cstrcache
|
|
$<$<BOOL:${ENABLE_FRONTEND}>:OBS::frontend-api>
|
|
$<$<PLATFORM_ID:Windows>:OBS::w32-pthreads>
|
|
$<$<PLATFORM_ID:Darwin>:objc>
|
|
)
|
|
|
|
if(OS_WINDOWS)
|
|
configure_file(cmake/windows/obs-module.rc.in obs-scripting.rc)
|
|
target_sources(obs-scripting PRIVATE obs-scripting.rc)
|
|
endif()
|
|
|
|
set_target_properties_obs(obs-scripting PROPERTIES FOLDER scripting)
|
|
|
|
if(OS_WINDOWS OR OS_MACOS)
|
|
set_property(TARGET obs-scripting PROPERTY PREFIX "")
|
|
endif()
|