New upstream version 24.0.5+dfsg1
This commit is contained in:
parent
52fa83f147
commit
4c2ea24267
61 changed files with 710 additions and 130 deletions
5
deps/obs-scripting/CMakeLists.txt
vendored
5
deps/obs-scripting/CMakeLists.txt
vendored
|
|
@ -12,6 +12,11 @@ if(MSVC)
|
|||
w32-pthreads)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(obs-scripting_PLATFORM_DEPS
|
||||
objc)
|
||||
endif()
|
||||
|
||||
option(DISABLE_LUA "Disable Lua scripting support" OFF)
|
||||
option(DISABLE_PYTHON "Disable Python scripting support" OFF)
|
||||
|
||||
|
|
|
|||
29
deps/obs-scripting/obs-scripting-lua.c
vendored
29
deps/obs-scripting/obs-scripting-lua.c
vendored
|
|
@ -43,7 +43,8 @@ static const char *startup_script_template = "\
|
|||
for val in pairs(package.preload) do\n\
|
||||
package.preload[val] = nil\n\
|
||||
end\n\
|
||||
package.cpath = package.cpath .. \";\" .. \"%s\" .. \"/?." SO_EXT "\"\n\
|
||||
package.cpath = package.cpath .. \";\" .. \"%s/Contents/MacOS/?.so\" .. \";\" .. \"%s\" .. \"/?." SO_EXT
|
||||
"\"\n\
|
||||
require \"obslua\"\n";
|
||||
|
||||
static const char *get_script_path_func = "\
|
||||
|
|
@ -1310,7 +1311,31 @@ void obs_lua_load(void)
|
|||
/* ---------------------------------------------- */
|
||||
/* Initialize Lua startup script */
|
||||
|
||||
dstr_printf(&tmp, startup_script_template, SCRIPT_DIR);
|
||||
char *bundlePath = "./";
|
||||
|
||||
#ifdef __APPLE__
|
||||
Class nsRunningApplication = objc_lookUpClass("NSRunningApplication");
|
||||
SEL currentAppSel = sel_getUid("currentApplication");
|
||||
|
||||
typedef id (*running_app_func)(Class, SEL);
|
||||
running_app_func operatingSystemName = (running_app_func)objc_msgSend;
|
||||
id app = operatingSystemName(nsRunningApplication, currentAppSel);
|
||||
|
||||
typedef id (*bundle_url_func)(id, SEL);
|
||||
bundle_url_func bundleURL = (bundle_url_func)objc_msgSend;
|
||||
id url = bundleURL(app, sel_getUid("bundleURL"));
|
||||
|
||||
typedef id (*url_path_func)(id, SEL);
|
||||
url_path_func urlPath = (url_path_func)objc_msgSend;
|
||||
|
||||
id path = urlPath(url, sel_getUid("path"));
|
||||
|
||||
typedef id (*string_func)(id, SEL);
|
||||
string_func utf8String = (string_func)objc_msgSend;
|
||||
bundlePath = (char *)utf8String(path, sel_registerName("UTF8String"));
|
||||
#endif
|
||||
|
||||
dstr_printf(&tmp, startup_script_template, bundlePath, SCRIPT_DIR);
|
||||
startup_script = tmp.array;
|
||||
|
||||
dstr_free(&dep_paths);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@
|
|||
#define SO_EXT ".dylib"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define PYTHON_LIB_SUBDIR "lib/"
|
||||
#else
|
||||
#define PYTHON_LIB_SUBDIR ""
|
||||
#endif
|
||||
|
||||
bool import_python(const char *python_path)
|
||||
{
|
||||
struct dstr lib_path;
|
||||
|
|
@ -44,7 +50,7 @@ bool import_python(const char *python_path)
|
|||
dstr_init_copy(&lib_path, python_path);
|
||||
dstr_replace(&lib_path, "\\", "/");
|
||||
if (!dstr_is_empty(&lib_path)) {
|
||||
dstr_cat(&lib_path, "/");
|
||||
dstr_cat(&lib_path, "/" PYTHON_LIB_SUBDIR);
|
||||
}
|
||||
dstr_cat(&lib_path, PYTHON_LIB SO_EXT);
|
||||
|
||||
|
|
|
|||
7
deps/obs-scripting/obs-scripting-python.c
vendored
7
deps/obs-scripting/obs-scripting-python.c
vendored
|
|
@ -1651,6 +1651,13 @@ bool obs_scripting_load_python(const char *python_path)
|
|||
|
||||
add_to_python_path(SCRIPT_DIR);
|
||||
|
||||
#if __APPLE__
|
||||
char *exec_path = os_get_executable_path_ptr("");
|
||||
if (exec_path)
|
||||
add_to_python_path(exec_path);
|
||||
bfree(exec_path);
|
||||
#endif
|
||||
|
||||
py_obspython = PyImport_ImportModule("obspython");
|
||||
bool success = !py_error();
|
||||
if (!success) {
|
||||
|
|
|
|||
16
deps/obs-scripting/obspython/CMakeLists.txt
vendored
16
deps/obs-scripting/obspython/CMakeLists.txt
vendored
|
|
@ -42,7 +42,12 @@ if(CMAKE_VERSION VERSION_GREATER 3.7.2)
|
|||
else()
|
||||
SWIG_ADD_MODULE(obspython python obspython.i ../cstrcache.cpp ../cstrcache.h)
|
||||
endif()
|
||||
SWIG_LINK_LIBRARIES(obspython obs-scripting libobs ${PYTHON_LIBRARIES})
|
||||
|
||||
IF(APPLE)
|
||||
SWIG_LINK_LIBRARIES(obspython obs-scripting libobs)
|
||||
ELSE()
|
||||
SWIG_LINK_LIBRARIES(obspython obs-scripting libobs ${PYTHON_LIBRARIES})
|
||||
ENDIF()
|
||||
|
||||
function(install_plugin_bin_swig target additional_target)
|
||||
if(APPLE)
|
||||
|
|
@ -57,14 +62,7 @@ function(install_plugin_bin_swig target additional_target)
|
|||
PREFIX "")
|
||||
|
||||
if (APPLE)
|
||||
set_property(
|
||||
TARGET ${additional_target}
|
||||
APPEND
|
||||
PROPERTY INSTALL_RPATH
|
||||
"/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/"
|
||||
"/Library/Frameworks/Python.framework/Versions/3.6/lib/"
|
||||
"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/"
|
||||
)
|
||||
SET_TARGET_PROPERTIES(${additional_target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/obspython.py"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue