mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
deps,shared,frontend-tools: Move obs-scripting to shared folder
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
cmake_minimum_required(VERSION 3.22...3.25)
|
||||
|
||||
legacy_check()
|
||||
|
||||
if(POLICY CMP0078)
|
||||
cmake_policy(SET CMP0078 NEW)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0086)
|
||||
cmake_policy(SET CMP0086 NEW)
|
||||
endif()
|
||||
|
||||
find_package(Luajit REQUIRED)
|
||||
find_package(SWIG 4 REQUIRED)
|
||||
|
||||
include(UseSWIG)
|
||||
|
||||
set_source_files_properties(obslua.i PROPERTIES USE_TARGET_INCLUDE_DIRECTORIES TRUE)
|
||||
|
||||
swig_add_library(
|
||||
obslua
|
||||
LANGUAGE lua
|
||||
TYPE MODULE
|
||||
SOURCES obslua.i)
|
||||
|
||||
add_library(OBS::lua ALIAS obslua)
|
||||
|
||||
target_compile_options(
|
||||
obslua
|
||||
PRIVATE $<$<PLATFORM_ID:Windows>:/wd4054>
|
||||
$<$<PLATFORM_ID:Windows>:/wd4197>
|
||||
$<$<PLATFORM_ID:Windows>:/wd4244>
|
||||
$<$<PLATFORM_ID:Windows>:/wd4267>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-shorten-64-to-32>
|
||||
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-unreachable-code>
|
||||
$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-maybe-uninitialized>)
|
||||
|
||||
target_compile_definitions(obslua PRIVATE SWIG_TYPE_TABLE=obslua SWIG_LUA_INTERPRETER_NO_DEBUG
|
||||
$<$<BOOL:${ENABLE_UI}>:ENABLE_UI>)
|
||||
|
||||
target_link_libraries(obslua PRIVATE OBS::cstrcache OBS::libobs OBS::scripting Luajit::Luajit
|
||||
$<$<BOOL:${ENABLE_UI}>:OBS::frontend-api>)
|
||||
|
||||
set_property(
|
||||
TARGET obslua
|
||||
APPEND
|
||||
PROPERTY SWIG_COMPILE_DEFINITIONS "SWIG_TYPE_TABLE=obslua" "SWIG_LUA_INTERPRETER_NO_DEBUG"
|
||||
"$<$<BOOL:${ENABLE_UI}>:ENABLE_UI>")
|
||||
|
||||
# cmake-format: off
|
||||
set_target_properties_obs(obslua PROPERTIES FOLDER scripting XCODE_ATTRIBUTE_STRIP_STYLE non-global)
|
||||
# cmake-format: on
|
||||
@@ -0,0 +1,63 @@
|
||||
if(POLICY CMP0086)
|
||||
cmake_policy(SET CMP0086 NEW)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0078)
|
||||
cmake_policy(SET CMP0078 NEW)
|
||||
endif()
|
||||
|
||||
project(obslua)
|
||||
|
||||
find_package(Luajit REQUIRED)
|
||||
|
||||
if(OS_MACOS)
|
||||
find_package(SWIG 4 REQUIRED)
|
||||
elseif(OS_POSIX)
|
||||
find_package(SWIG 3 REQUIRED)
|
||||
elseif(OS_WINDOWS)
|
||||
find_package(SwigWindows 3 REQUIRED)
|
||||
endif()
|
||||
include(UseSWIG)
|
||||
|
||||
set_source_files_properties(obslua.i PROPERTIES USE_TARGET_INCLUDE_DIRECTORIES TRUE)
|
||||
|
||||
swig_add_library(
|
||||
obslua
|
||||
LANGUAGE lua
|
||||
TYPE MODULE
|
||||
SOURCES obslua.i ../cstrcache.cpp ../cstrcache.h)
|
||||
|
||||
target_link_libraries(obslua PRIVATE OBS::scripting OBS::libobs Luajit::Luajit)
|
||||
|
||||
list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obslua" "SWIG_LUA_INTERPRETER_NO_DEBUG")
|
||||
|
||||
set_target_properties(
|
||||
obslua
|
||||
PROPERTIES FOLDER "scripting"
|
||||
VERSION "${OBS_VERSION_MAJOR}"
|
||||
SOVERSION "${OBS_VERSION_CANONICAL}")
|
||||
|
||||
target_compile_definitions(obslua PRIVATE SWIG_TYPE_TABLE=obslua SWIG_LUA_INTERPRETER_NO_DEBUG)
|
||||
|
||||
if(ENABLE_UI)
|
||||
list(APPEND _SWIG_DEFINITIONS "ENABLE_UI")
|
||||
target_link_libraries(obslua PRIVATE OBS::frontend-api)
|
||||
|
||||
target_compile_definitions(obslua PRIVATE ENABLE_UI)
|
||||
endif()
|
||||
|
||||
set_target_properties(obslua PROPERTIES SWIG_COMPILE_DEFINITIONS "${_SWIG_DEFINITIONS}")
|
||||
|
||||
if(OS_WINDOWS)
|
||||
if(MSVC)
|
||||
target_compile_options(obslua PRIVATE /wd4054 /wd4197 /wd4244 /wd4267)
|
||||
endif()
|
||||
elseif(OS_MACOS)
|
||||
set_target_properties(obslua PROPERTIES MACHO_CURRENT_VERSION 0 MACHO_COMPATIBILITY_VERSION 0)
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND SWIG_VERSION VERSION_LESS "4.1")
|
||||
target_compile_options(obslua PRIVATE -Wno-maybe-uninitialized)
|
||||
endif()
|
||||
|
||||
setup_script_plugin_target(obslua)
|
||||
@@ -0,0 +1,111 @@
|
||||
%module obslua
|
||||
%{
|
||||
#define SWIG_FILE_WITH_INIT
|
||||
#define DEPRECATED_START
|
||||
#define DEPRECATED_END
|
||||
#include <graphics/graphics.h>
|
||||
#include <graphics/vec4.h>
|
||||
#include <graphics/vec3.h>
|
||||
#include <graphics/vec2.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <graphics/matrix3.h>
|
||||
#include <graphics/quat.h>
|
||||
#include <graphics/image-file.h>
|
||||
#include <obs.h>
|
||||
#include <obs-hotkey.h>
|
||||
#include <obs-source.h>
|
||||
#include <obs-data.h>
|
||||
#include <obs-properties.h>
|
||||
#include <obs-interaction.h>
|
||||
#include <callback/calldata.h>
|
||||
#include <callback/proc.h>
|
||||
#include <callback/signal.h>
|
||||
#include <util/bmem.h>
|
||||
#include <util/base.h>
|
||||
#include "cstrcache.h"
|
||||
#include <util/platform.h>
|
||||
#include <util/config-file.h>
|
||||
|
||||
#if defined(ENABLE_UI)
|
||||
#include "obs-frontend-api.h"
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
#define DEPRECATED_START
|
||||
#define DEPRECATED_END
|
||||
#define OBS_DEPRECATED
|
||||
#define OBS_EXTERNAL_DEPRECATED
|
||||
#define EXPORT
|
||||
|
||||
%rename(blog) wrap_blog;
|
||||
%inline %{
|
||||
static inline void wrap_blog(int log_level, const char *message)
|
||||
{
|
||||
blog(log_level, "%s", message);
|
||||
}
|
||||
%}
|
||||
|
||||
%include "stdint.i"
|
||||
|
||||
/* Used to free when using %newobject functions. E.G.:
|
||||
* %newobject obs_module_get_config_path; */
|
||||
%typemap(newfree) char * "bfree($1);";
|
||||
|
||||
%ignore blog;
|
||||
%ignore blogva;
|
||||
%ignore bcrash;
|
||||
%ignore base_set_crash_handler;
|
||||
%ignore obs_source_info;
|
||||
%ignore obs_register_source_s(const struct obs_source_info *info, size_t size);
|
||||
%ignore obs_output_set_video(obs_output_t *output, video_t *video);
|
||||
%ignore obs_output_video(const obs_output_t *output);
|
||||
%ignore obs_add_tick_callback;
|
||||
%ignore obs_remove_tick_callback;
|
||||
%ignore obs_add_main_render_callback;
|
||||
%ignore obs_remove_main_render_callback;
|
||||
%ignore obs_enum_sources;
|
||||
%ignore obs_source_enum_filters;
|
||||
%ignore obs_properties_add_button;
|
||||
%ignore obs_property_set_modified_callback;
|
||||
%ignore signal_handler_connect;
|
||||
%ignore signal_handler_disconnect;
|
||||
%ignore signal_handler_connect_global;
|
||||
%ignore signal_handler_disconnect_global;
|
||||
%ignore signal_handler_remove_current;
|
||||
%ignore obs_hotkey_register_frontend;
|
||||
%ignore obs_hotkey_register_encoder;
|
||||
%ignore obs_hotkey_register_output;
|
||||
%ignore obs_hotkey_register_service;
|
||||
%ignore obs_hotkey_register_source;
|
||||
%ignore obs_hotkey_pair_register_frontend;
|
||||
%ignore obs_hotkey_pair_register_encoder;
|
||||
%ignore obs_hotkey_pair_register_output;
|
||||
%ignore obs_hotkey_pair_register_service;
|
||||
%ignore obs_hotkey_pair_register_source;
|
||||
|
||||
%include "graphics/graphics.h"
|
||||
%include "graphics/vec4.h"
|
||||
%include "graphics/vec3.h"
|
||||
%include "graphics/vec2.h"
|
||||
%include "graphics/matrix4.h"
|
||||
%include "graphics/matrix3.h"
|
||||
%include "graphics/quat.h"
|
||||
%include "graphics/image-file.h"
|
||||
%include "obs-data.h"
|
||||
%include "obs-source.h"
|
||||
%include "obs-properties.h"
|
||||
%include "obs-interaction.h"
|
||||
%include "obs-hotkey.h"
|
||||
%include "obs.h"
|
||||
%include "callback/calldata.h"
|
||||
%include "callback/proc.h"
|
||||
%include "callback/signal.h"
|
||||
%include "util/bmem.h"
|
||||
%include "util/base.h"
|
||||
%include "util/platform.h"
|
||||
%include "util/config-file.h"
|
||||
|
||||
#if defined(ENABLE_UI)
|
||||
%include "obs-frontend-api.h"
|
||||
#endif
|
||||
Reference in New Issue
Block a user