瀏覽代碼

obs-scripting: Fix missing frontend bindings for Python

The obspython.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.
PatTheMav 3 年之前
父節點
當前提交
29759ef8fb
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      deps/obs-scripting/obspython/CMakeLists.txt

+ 6 - 6
deps/obs-scripting/obspython/CMakeLists.txt

@@ -32,12 +32,8 @@ swig_add_library(
 
 target_link_libraries(obspython PRIVATE OBS::scripting OBS::libobs)
 
-set_target_properties(
-  obspython
-  PROPERTIES
-    SWIG_COMPILE_DEFINITIONS
-    "SWIG_TYPE_TABLE=obspython;Py_ENABLE_SHARED=1;SWIG_PYTHON_INTERPRETER_NO_DEBUG"
-)
+list(APPEND _SWIG_DEFINITIONS "SWIG_TYPE_TABLE=obspython" "Py_ENABLE_SHARED=1"
+     "SWIG_PYTHON_INTERPRETER_NO_DEBUG")
 
 target_compile_features(obspython PRIVATE cxx_auto_type c_std_11)
 
@@ -46,11 +42,15 @@ target_compile_definitions(
                     SWIG_PYTHON_INTERPRETER_NO_DEBUG)
 
 if(ENABLE_UI)
+  list(APPEND _SWIG_DEFINITIONS "ENABLE_UI")
   target_link_libraries(obspython PRIVATE OBS::frontend-api)
 
   target_compile_definitions(obspython PRIVATE ENABLE_UI)
 endif()
 
+set_target_properties(obspython PROPERTIES SWIG_COMPILE_DEFINITIONS
+                                           "${_SWIG_DEFINITIONS}")
+
 if(OS_WINDOWS)
   set_target_properties(
     obspython