obs-scripting: Update CMakeLists.txt for scripting modules
This commit is contained in:
parent
dba1041034
commit
dbdf5c7f7a
9 changed files with 379 additions and 387 deletions
46
deps/obs-scripting/obs-scripting.c
vendored
46
deps/obs-scripting/obs-scripting.c
vendored
|
|
@ -25,7 +25,7 @@
|
|||
#include "obs-scripting-callback.h"
|
||||
#include "obs-scripting-config.h"
|
||||
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
extern obs_script_t *obs_lua_script_create(const char *path,
|
||||
obs_data_t *settings);
|
||||
extern bool obs_lua_script_load(obs_script_t *s);
|
||||
|
|
@ -39,7 +39,7 @@ extern void obs_lua_script_update(obs_script_t *script, obs_data_t *settings);
|
|||
extern void obs_lua_script_save(obs_script_t *script);
|
||||
#endif
|
||||
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
extern obs_script_t *obs_python_script_create(const char *path,
|
||||
obs_data_t *settings);
|
||||
extern bool obs_python_script_load(obs_script_t *s);
|
||||
|
|
@ -61,10 +61,10 @@ static struct dstr file_filter = {0};
|
|||
static bool scripting_loaded = false;
|
||||
|
||||
static const char *supported_formats[] = {
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
"lua",
|
||||
#endif
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
"py",
|
||||
#endif
|
||||
NULL};
|
||||
|
|
@ -144,13 +144,15 @@ bool obs_scripting_load(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
obs_lua_load();
|
||||
#endif
|
||||
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
obs_python_load();
|
||||
#ifndef _WIN32 /* don't risk python startup load issues on windows */
|
||||
#if !defined(_WIN32) && \
|
||||
!defined( \
|
||||
__APPLE__) /* Win32 and macOS need user-provided Python library paths */
|
||||
obs_scripting_load_python(NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -166,11 +168,11 @@ void obs_scripting_unload(void)
|
|||
|
||||
/* ---------------------- */
|
||||
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
obs_lua_unload();
|
||||
#endif
|
||||
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
obs_python_unload();
|
||||
#endif
|
||||
|
||||
|
|
@ -249,12 +251,12 @@ obs_script_t *obs_script_create(const char *path, obs_data_t *settings)
|
|||
if (!ext)
|
||||
return NULL;
|
||||
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
if (strcmp(ext, ".lua") == 0) {
|
||||
script = obs_lua_script_create(path, settings);
|
||||
} else
|
||||
#endif
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
if (strcmp(ext, ".py") == 0) {
|
||||
script = obs_python_script_create(path, settings);
|
||||
} else
|
||||
|
|
@ -306,13 +308,13 @@ obs_properties_t *obs_script_get_properties(obs_script_t *script)
|
|||
|
||||
if (!ptr_valid(script))
|
||||
return NULL;
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_LUA) {
|
||||
props = obs_lua_script_get_properties(script);
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_PYTHON) {
|
||||
props = obs_python_script_get_properties(script);
|
||||
goto out;
|
||||
|
|
@ -332,13 +334,13 @@ obs_data_t *obs_script_save(obs_script_t *script)
|
|||
if (!ptr_valid(script))
|
||||
return NULL;
|
||||
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_LUA) {
|
||||
obs_lua_script_save(script);
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_PYTHON) {
|
||||
obs_python_script_save(script);
|
||||
goto out;
|
||||
|
|
@ -373,12 +375,12 @@ void obs_script_update(obs_script_t *script, obs_data_t *settings)
|
|||
{
|
||||
if (!ptr_valid(script))
|
||||
return;
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_LUA) {
|
||||
obs_lua_script_update(script, settings);
|
||||
}
|
||||
#endif
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_PYTHON) {
|
||||
obs_python_script_update(script, settings);
|
||||
}
|
||||
|
|
@ -392,7 +394,7 @@ bool obs_script_reload(obs_script_t *script)
|
|||
if (!ptr_valid(script))
|
||||
return false;
|
||||
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_LUA) {
|
||||
obs_lua_script_unload(script);
|
||||
clear_call_queue();
|
||||
|
|
@ -400,7 +402,7 @@ bool obs_script_reload(obs_script_t *script)
|
|||
goto out;
|
||||
}
|
||||
#endif
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_PYTHON) {
|
||||
obs_python_script_unload(script);
|
||||
clear_call_queue();
|
||||
|
|
@ -423,14 +425,14 @@ void obs_script_destroy(obs_script_t *script)
|
|||
if (!script)
|
||||
return;
|
||||
|
||||
#if COMPILE_LUA
|
||||
#if defined(LUAJIT_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_LUA) {
|
||||
obs_lua_script_unload(script);
|
||||
obs_lua_script_destroy(script);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if COMPILE_PYTHON
|
||||
#if defined(Python_FOUND)
|
||||
if (script->type == OBS_SCRIPT_LANG_PYTHON) {
|
||||
obs_python_script_unload(script);
|
||||
obs_python_script_destroy(script);
|
||||
|
|
@ -439,7 +441,7 @@ void obs_script_destroy(obs_script_t *script)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !COMPILE_PYTHON
|
||||
#if !defined(Python_FOUND)
|
||||
bool obs_scripting_load_python(const char *python_path)
|
||||
{
|
||||
UNUSED_PARAMETER(python_path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue