obs-scripting: Fix missing frontend bindings for Lua

The obslua.i file requires `ENABLE_UI` to be defined for the swig
compiler to pull in the actual obs-frontend-api header. If this is not
the case, swig will not discover the required methods and ENUMs and
in turn will not make those available in the scripting environment.
master
PatTheMav 2022-05-28 18:22:40 +02:00 committed by Jim
parent 8a4b765c9c
commit 893d3ce218
1 changed files with 6 additions and 3 deletions

View File

@ -30,9 +30,8 @@ swig_add_library(
target_link_libraries(obslua PRIVATE OBS::scripting OBS::libobs Luajit::Luajit)
set_target_properties(
obslua PROPERTIES SWIG_COMPILE_DEFINITIONS
"SWIG_TYPE_TABLE=obslua;SWIG_LUA_INTERPRETER_NO_DEBUG")
list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obslua"
"SWIG_LUA_INTERPRETER_NO_DEBUG")
set_target_properties(
obslua
@ -44,11 +43,15 @@ 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)