diff --git a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt index 21c3f49ea..9ef43e34a 100644 --- a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt +++ b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt @@ -8,7 +8,6 @@ set(BUILD_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/out) add_library(LuaInterpreter SHARED Interpreter.cpp lua_vessel_mtd.cpp - lua_xrsound.cpp ) target_include_directories(LuaInterpreter @@ -21,18 +20,24 @@ target_link_libraries(LuaInterpreter ${ORBITER_LIB} ${ORBITER_SDK_LIB} lua::lib - XRSound_lib ) add_dependencies(LuaInterpreter ${OrbiterTgt} Orbitersdk - D3D9Client - D3D9Client_Interface - XRSound_lib - XRSound_assets ) +if(ORBITER_BUILD_D3D9CLIENT) + add_dependencies(LuaInterpreter D3D9Client D3D9Client_Interface) +endif() + +if(ORBITER_BUILD_XRSOUND) + add_dependencies(LuaInterpreter XRSound_lib XRSound_assets) + target_link_libraries(LuaInterpreter XRSound_lib) + target_compile_definitions(LuaInterpreter PRIVATE ENABLE_XRSOUND) + target_sources(LuaInterpreter PRIVATE lua_xrsound.cpp) +endif() + set_target_properties(LuaInterpreter PROPERTIES FOLDER Modules/Lua @@ -85,4 +90,4 @@ install(TARGETS LuaInterpreter ) install(FILES $ DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua -) \ No newline at end of file +) diff --git a/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp b/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp index b04b568f5..85c7728de 100644 --- a/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp +++ b/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp @@ -123,7 +123,9 @@ void Interpreter::Initialise () LoadSketchpadAPI (); // load Sketchpad methods LoadAnnotationAPI (); // load screen annotation methods LoadVesselStatusAPI (); +#ifdef ENABLE_XRSOUND LoadXRSoundAPI (); +#endif LoadStartupScript (); // load default initialisation script } @@ -1055,12 +1057,14 @@ void Interpreter::LoadAPI () }; luaL_openlib (L, "term", termLib, 0); +#ifdef ENABLE_XRSOUND // Load XRSound library static const struct luaL_reg XRSoundLib[] = { {"create_instance", xrsound_create_instance}, {NULL, NULL} }; luaL_openlib (L, "xrsound", XRSoundLib, 0); +#endif // ENABLE_XRSOUND // Set up global tables of constants diff --git a/Src/Module/LuaScript/LuaInterpreter/Interpreter.h b/Src/Module/LuaScript/LuaInterpreter/Interpreter.h index d9c199db7..b96eefb66 100644 --- a/Src/Module/LuaScript/LuaInterpreter/Interpreter.h +++ b/Src/Module/LuaScript/LuaInterpreter/Interpreter.h @@ -1114,6 +1114,7 @@ class INTERPRETERLIB Interpreter { // ------------------------------------------- // XRSound // ------------------------------------------- +#ifdef ENABLE_XRSOUND virtual void LoadXRSoundAPI (); static int lua_isxrsound(lua_State *L, int idx); static XRSound *lua_toxrsound(lua_State *L, int idx); @@ -1137,6 +1138,7 @@ class INTERPRETERLIB Interpreter { static int xrsound_set_playposition(lua_State *L); static int xrsound_get_playposition(lua_State *L); static int xrsound_collect(lua_State *L); +#endif private: HANDLE hExecMutex; // flow control synchronisation