From c4d77165a6e725651f61d50535919039b35e530d Mon Sep 17 00:00:00 2001 From: Stefan Schlosser Date: Wed, 20 Nov 2024 16:39:40 +0100 Subject: [PATCH] lua: add build option for Lua support The added build option USE_LUA (enabled by default) allows to enable/disable Lua support in the build. This provides more control over the used dependencies, and is important especially for OpenBSD and FreeBSD i386 builds, where the build fails with enabled Lua support, see also [1]. [1] https://github.com/vinniefalco/LuaBridge/issues/302 --- CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 060b19ec3..c939f8063 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ option(USE_LIBAO "Build with AO support" ON) option(USE_OSS "Build with OSS support" OFF) option(USE_PULSEAUDIO "Build with PulseAudio support" ON) option(USE_BREAKPAD "Build and link with breakpad library" ON) +option(USE_LUA "Build with Lua support" ON) option(ENABLE_GDB_SERVER "Build with GDB debugging support" OFF) option(ENABLE_DC_PROFILER "Build with support for target machine (SH4) profiler" OFF) option(ENABLE_FC_PROFILER "Build with support for host app (Flycast) profiler" OFF) @@ -473,12 +474,14 @@ if(NOT LIBRETRO) target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB) endif() - find_package(Lua 5.2) - if(NOT APPLE AND LUA_FOUND) - target_compile_definitions(${PROJECT_NAME} PRIVATE USE_LUA) - target_include_directories(${PROJECT_NAME} PRIVATE ${LUA_INCLUDE_DIR} core/deps/luabridge/Source) - list(TRANSFORM LUA_LIBRARIES REPLACE "\.dll" "") - target_link_libraries(${PROJECT_NAME} PRIVATE ${LUA_LIBRARIES}) + if(USE_LUA) + find_package(Lua 5.2) + if(NOT APPLE AND LUA_FOUND) + target_compile_definitions(${PROJECT_NAME} PRIVATE USE_LUA) + target_include_directories(${PROJECT_NAME} PRIVATE ${LUA_INCLUDE_DIR} core/deps/luabridge/Source) + list(TRANSFORM LUA_LIBRARIES REPLACE "\.dll" "") + target_link_libraries(${PROJECT_NAME} PRIVATE ${LUA_LIBRARIES}) + endif() endif() endif()