mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-06-11 09:19:22 -04:00
The actual frontend provided an "ENABLE_FRONTEND" build flag, whereas the global project still provided an "ENABLE_UI" flag, which itself was only read and respected by the scripting module. This change retains the global flag and makes both the actual frontend as well as the scripting module respect its value.
41 lines
1.2 KiB
CMake
41 lines
1.2 KiB
CMake
option(ENABLE_SCRIPTING_LUA "Enable Lua scripting support" ON)
|
|
|
|
if(ENABLE_SCRIPTING_LUA)
|
|
add_subdirectory(obslua)
|
|
|
|
find_package(Luajit REQUIRED)
|
|
|
|
add_custom_command(
|
|
OUTPUT swig/swigluarun.h
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
PRE_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory swig
|
|
COMMAND ${CMAKE_COMMAND} -E env "SWIG_LIB=${SWIG_DIR}" ${SWIG_EXECUTABLE} -lua -external-runtime swig/swigluarun.h
|
|
COMMENT "obs-scripting - generating Luajit SWIG interface headers"
|
|
)
|
|
|
|
set_source_files_properties(swig/swigluarun.h PROPERTIES GENERATED TRUE)
|
|
|
|
target_sources(
|
|
obs-scripting
|
|
PRIVATE
|
|
$<$<BOOL:${ENABLE_FRONTEND}>:obs-scripting-lua-frontend.c>
|
|
obs-scripting-lua-source.c
|
|
obs-scripting-lua.c
|
|
obs-scripting-lua.h
|
|
swig/swigluarun.h
|
|
)
|
|
|
|
target_compile_definitions(obs-scripting PUBLIC LUAJIT_FOUND)
|
|
|
|
set_source_files_properties(
|
|
obs-scripting-lua.c
|
|
obs-scripting-lua-source.c
|
|
PROPERTIES COMPILE_OPTIONS $<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-error=shorten-64-to-32>
|
|
)
|
|
|
|
target_link_libraries(obs-scripting PRIVATE Luajit::Luajit)
|
|
else()
|
|
target_disable_feature(obs-scripting "Lua scripting support")
|
|
endif()
|