Skip to content

Commit

Permalink
build: use the system provided LuaJIT if found
Browse files Browse the repository at this point in the history
e.g. buildroot has logic to build luajit,
so if pkg_check_modules can find a suitable version,
then use that one if -DFLB_PREFER_SYSTEM_LIBS=Yes.

Signed-off-by: Thomas Devoogdt <[email protected]>
  • Loading branch information
ThomasDevoogdt committed Oct 9, 2023
1 parent 3f93f98 commit 32ad873
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ option(FLB_TESTS_INTERNAL_FUZZ "Enable internal fuzz tests" No)
option(FLB_TESTS_OSSFUZZ "Enable OSS-Fuzz build" No)
option(FLB_MTRACE "Enable mtrace support" No)
option(FLB_POSIX_TLS "Force POSIX thread storage" No)
option(FLB_PREFER_SYSTEM_LIBS "Prefer system installed libraries" No)
option(FLB_INOTIFY "Enable inotify support" Yes)
option(FLB_SQLDB "Enable SQL embedded DB" Yes)
option(FLB_HTTP_SERVER "Enable HTTP Server" Yes)
Expand Down Expand Up @@ -1011,7 +1012,16 @@ endif()
# LuaJIT (Scripting Support)
# ==========================
if(FLB_LUAJIT)
include(cmake/luajit.cmake)
if(FLB_PREFER_SYSTEM_LIBS)
find_package(PkgConfig)
pkg_check_modules(LUAJIT luajit>=2.1.0)
endif()
if(LUAJIT_FOUND)
include_directories(${LUAJIT_INCLUDE_DIRS})
else()
include(cmake/luajit.cmake)
set(LUAJIT_LIBRARIES "libluajit")
endif()
FLB_DEFINITION(FLB_HAVE_LUAJIT)
endif()

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ endif()
if(FLB_LUAJIT)
set(extra_libs
${extra_libs}
"libluajit")
${LUAJIT_LIBRARIES})
endif()

if(FLB_SQLDB)
Expand Down

0 comments on commit 32ad873

Please sign in to comment.