Skip to content

Commit

Permalink
lua: add build option for Lua support
Browse files Browse the repository at this point in the history
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] vinniefalco/LuaBridge#302
  • Loading branch information
bsdcode authored and flyinghead committed Nov 20, 2024
1 parent d618abc commit c4d7716
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit c4d7716

Please sign in to comment.