Add PyDict_New and PyTuple_New to obs-scripting-python-import.[ch];
these functions are used by SWIG's generated code when I build OBS on
macOS with SWIG 4.0.1.
The current scripting directory path given to Python on OSX is
`../data/obs-scripting`. This works when bin/ and data/ are in the same
folder like rundir after a compile and in the old .app bundles but the
new normal .app bundle structure is different.
For bundles move obspython.py and _obspython.so to the binary folder,
just like the Lua one, and pass that bin path to the Python interpreter
so it can find it.
The current working dir isn't guaranteed to be set with .app bundles
so look up binary path at runtime.
_obspython.so currently links directly against python as @rpath/Python
and has 3 common python install paths set as rpaths so it would only
work if a user had python installed at one of those hardcoded paths.
Don't link _obspython against python at all but instead link it with
"-undefined dynamic_lookup" so when it is imported by python all it's
undefined python symbols get resolved at runtime against the user
supplied python instance loaded into the process earlier.
The rpaths aren't needed anymore this way.
The libpython .dylib files on MacOS are in the python_path/lib
subdir. The user supplied python_path still needs to be to the actual
python root and not lib/ as the root path get's used as python home dir
so just add lib/ when loading the dylib.
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed. Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
obs-scripting CMakeList.txt expects SWIG, Python3 or Luajit to enable
scripting so in case of not finding just return and don't abort
the configuration
This adds build-time options for disabling the Lua and/or Python
scripting support in cases where users do not wish to build
it, but have the required libraries installed.
Makes it so that the scripting cmake variable ENABLE_SCRIPTING is a user
variable rather than a global internal cmake variable, and defers the
internal global cmake variable to SCRIPTING_ENABLED instead.
Lua uses 1-based index on table insertions, and lua_newtable has a bit
better performance than lua_createtable if initializing tables with an
unknown item count.
Uses the 'install' command in cmake to install scripting modules/files
(such as _obspython.so, obslua.so, and obspython.py), and changes the
install location of those files on all operating systems. If using a
non-unix structure install, those files will be installed in
data/obs-scripting/[32bit/64bit], otherwise with unix structure installs
those files will be installed to [/usr/local/lib]/obs-scripting.