From 468a2a0e1eb09d259ad55e2e8f5f0e09f7bdc3d0 Mon Sep 17 00:00:00 2001 From: "Oleg V. Kozlyuk" Date: Wed, 1 Jan 2025 16:12:31 +0100 Subject: [PATCH] Fixed LuaInterpreter compilation with default options turned off (#532) --- Extern/Lua/CMakeLists.txt | 8 +++++++- .../LuaScript/LuaInterpreter/CMakeLists.txt | 18 +++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Extern/Lua/CMakeLists.txt b/Extern/Lua/CMakeLists.txt index 841dc7ccd..580c299cd 100644 --- a/Extern/Lua/CMakeLists.txt +++ b/Extern/Lua/CMakeLists.txt @@ -32,7 +32,13 @@ install(TARGETS lua-exe DESTINATION ${ORBITER_INSTALL_SDK_DIR}/Utils/) # Library - lua.dll add_library(lua SHARED ${LUA_SRC_FILES}) -target_compile_definitions(lua PUBLIC LUA_BUILD_AS_DLL) + +if(MSVC) + target_compile_definitions(lua PUBLIC LUA_BUILD_AS_DLL) +else() + target_link_libraries(lua-exe PUBLIC m) + target_link_libraries(lua PUBLIC m) +endif() set_target_properties(lua PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR} diff --git a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt index 21c3f49ea..773dcc1b2 100644 --- a/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt +++ b/Src/Module/LuaScript/LuaInterpreter/CMakeLists.txt @@ -8,7 +8,7 @@ set(BUILD_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/out) add_library(LuaInterpreter SHARED Interpreter.cpp lua_vessel_mtd.cpp - lua_xrsound.cpp + lua_xrsound.cpp ) target_include_directories(LuaInterpreter @@ -21,18 +21,22 @@ 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) +endif() + set_target_properties(LuaInterpreter PROPERTIES FOLDER Modules/Lua @@ -85,4 +89,4 @@ install(TARGETS LuaInterpreter ) install(FILES $ DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua -) \ No newline at end of file +)