Skip to content

Commit

Permalink
build: use the system provided msgpack if found
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Devoogdt <[email protected]>
  • Loading branch information
ThomasDevoogdt committed Nov 9, 2024
1 parent 282923d commit 49be837
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ option(FLB_PREFER_SYSTEM_LIB_CARES "Prefer the libcares system library"
option(FLB_PREFER_SYSTEM_LIB_JEMALLOC "Prefer the libjemalloc system library" ${FLB_PREFER_SYSTEM_LIBS})
option(FLB_PREFER_SYSTEM_LIB_KAFKA "Prefer the libkafka system library" ${FLB_PREFER_SYSTEM_LIBS})
option(FLB_PREFER_SYSTEM_LIB_LUAJIT "Prefer the libluajit system library" ${FLB_PREFER_SYSTEM_LIBS})
option(FLB_PREFER_SYSTEM_LIB_MSGPACK "Prefer the libmsgpack system library" ${FLB_PREFER_SYSTEM_LIBS})
option(FLB_PREFER_SYSTEM_LIB_NGHTTP2 "Prefer the libnghttp2 system library" ${FLB_PREFER_SYSTEM_LIBS})

# Enable all features
Expand Down Expand Up @@ -450,11 +451,16 @@ FLB_OPTION(FLUENT_PROTO_METRICS ON)
add_subdirectory(${FLB_PATH_LIB_FLUENT_OTEL} EXCLUDE_FROM_ALL)

# MsgPack options
option(MSGPACK_ENABLE_CXX OFF)
option(MSGPACK_ENABLE_SHARED OFF)
option(MSGPACK_BUILD_TESTS OFF)
option(MSGPACK_BUILD_EXAMPLES OFF)
add_subdirectory(${FLB_PATH_LIB_MSGPACK} EXCLUDE_FROM_ALL)
if(FLB_PREFER_SYSTEM_LIB_MSGPACK)
find_package(PkgConfig)
pkg_check_modules(MSGPACK msgpack>=4.0.0)
endif()
if(MSGPACK_FOUND)
include_directories(${MSGPACK_INCLUDE_DIRS})
link_directories(${MSGPACK_LIBRARY_DIRS})
else()
include(cmake/msgpack.cmake)
endif()

# MPack
add_definitions(-DMPACK_EXTENSIONS=1)
Expand Down
1 change: 0 additions & 1 deletion cmake/headers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ include_directories(

${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_CO}
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_RBTREE}
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MSGPACK}/include

# Chunk I/O generate headers also in the binary path
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_CHUNKIO}/include
Expand Down
10 changes: 10 additions & 0 deletions cmake/msgpack.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# msgpack cmake
option(MSGPACK_ENABLE_CXX OFF)
option(MSGPACK_ENABLE_SHARED OFF)
option(MSGPACK_BUILD_TESTS OFF)
option(MSGPACK_BUILD_EXAMPLES OFF)
include_directories(
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MSGPACK}/include
)
add_subdirectory(${FLB_PATH_LIB_MSGPACK} EXCLUDE_FROM_ALL)
set(MSGPACK_LIBRARIES "msgpack-c-static")
2 changes: 1 addition & 1 deletion plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ endmacro()
macro(FLB_PLUGIN name src deps)
add_library(flb-plugin-${name} STATIC ${src})
add_sanitizers(flb-plugin-${name})
target_link_libraries(flb-plugin-${name} fluent-bit-static msgpack-c-static ${deps})
target_link_libraries(flb-plugin-${name} fluent-bit-static ${MSGPACK_LIBRARIES} ${deps})
endmacro()


Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ set(FLB_DEPS
ctraces-static
mk_core
jsmn
msgpack-c-static
${MSGPACK_LIBRARIES}
mpack-static
chunkio-static
miniz
Expand Down

0 comments on commit 49be837

Please sign in to comment.