mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-22 14:05:00 -04:00
deps,shared,frontend-tools: Move obs-scripting to shared folder
This commit is contained in:
1 parent
ade04f4f1c
commit
f5e2f15d28
32 files changed
+6
-2
No files matched your search
@@ -0,0 +1,54 @@
|
||||
cmake_minimum_required(VERSION 3.22...3.25)
|
||||
|
||||
option(ENABLE_SCRIPTING_PYTHON "Enable Python scripting support" ON)
|
||||
|
||||
if(ENABLE_SCRIPTING_PYTHON)
|
||||
add_subdirectory(obspython)
|
||||
|
||||
if(OS_WINDOWS)
|
||||
find_package(Python 3.8...<3.11 REQUIRED Interpreter Development)
|
||||
elseif(
|
||||
OS_LINUX
|
||||
OR OS_FREEBSD
|
||||
OR OS_OPENBSD)
|
||||
find_package(Python 3.8 REQUIRED Interpreter Development)
|
||||
else()
|
||||
find_package(Python 3.8...<3.12 REQUIRED Interpreter Development)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT swig/swigpyrun.h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory swig
|
||||
COMMAND ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} -python
|
||||
$<$<PLATFORM_ID:Windows,Darwin>:-py3-stable-abi> -external-runtime swig/swigpyrun.h
|
||||
COMMENT "obs-scripting - generating Python 3 SWIG interface headers")
|
||||
|
||||
set_source_files_properties(swig/swigpyrun.h PROPERTIES GENERATED TRUE)
|
||||
|
||||
target_sources(
|
||||
obs-scripting
|
||||
PRIVATE # cmake-format: sortable
|
||||
$<$<BOOL:${ENABLE_UI}>:obs-scripting-python-frontend.c>
|
||||
$<$<PLATFORM_ID:Windows,Darwin>:obs-scripting-python-import.c>
|
||||
obs-scripting-python-import.h
|
||||
obs-scripting-python.c
|
||||
obs-scripting-python.h
|
||||
swig/swigpyrun.h)
|
||||
|
||||
target_compile_definitions(
|
||||
obs-scripting
|
||||
PRIVATE ENABLE_SCRIPTING PYTHON_LIB="$<TARGET_LINKER_FILE_NAME:Python::Python>"
|
||||
PUBLIC Python_FOUND)
|
||||
|
||||
target_include_directories(
|
||||
obs-scripting
|
||||
PRIVATE "$<$<PLATFORM_ID:Windows,Darwin>:$<TARGET_PROPERTY:Python::Python,INTERFACE_INCLUDE_DIRECTORIES>>")
|
||||
|
||||
target_link_libraries(obs-scripting PRIVATE $<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:Python::Python>)
|
||||
|
||||
target_link_options(obs-scripting PRIVATE $<$<PLATFORM_ID:Darwin>:LINKER:-undefined,dynamic_lookup>)
|
||||
else()
|
||||
target_disable_feature(obs-scripting "Python scripting support")
|
||||
endif()
|
||||
Reference in new issue
Block a user