Skip to content

Commit f5af3e8

Browse files
committed
++ lz4 unwind deps
1 parent d54deb8 commit f5af3e8

File tree

5 files changed

+102
-6
lines changed

5 files changed

+102
-6
lines changed

cmake/dependencies.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
find_package(PkgConfig REQUIRED)
22

3-
#pkg_check_modules(pthread REQUIRED libpthread)
4-
pkg_check_modules(unwind REQUIRED libunwind)
5-
#pkg_check_modules(atomic REQUIRED libatomic)
6-
pkg_check_modules(xxhash REQUIRED xxhash-devel)
3+
find_package(unwind REQUIRED)
4+
find_package(Threads REQUIRED)
5+
#find_package(Atomic REQUIRED)
6+
find_library(ATOMIC_LIBRARY NAMES atomic)
7+
find_library(DL_LIBRARY NAMES dl)
8+
find_package(lz4 REQUIRED)
9+
10+
if(NOT DL_LIBRARY)
11+
message(FATAL_ERROR "dl library not found!")
12+
endif()
713

814
if (ENABLE_INPUT_PCAP)
915
pkg_check_modules(PCAP REQUIRED libpcap)

cmake/modules/Findlz4.cmake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Find lz4
2+
# Once done this will define
3+
#
4+
# LZ4_FOUND - system has liblz4
5+
# lz4::lz4 - cmake target
6+
7+
find_package(PkgConfig QUIET)
8+
if (PKG_CONFIG_FOUND)
9+
pkg_check_modules(PC_LZ4 QUIET lz4-devel)
10+
endif()
11+
12+
find_path (LZ4_INCLUDE_DIR
13+
NAMES lz4.h
14+
HINTS ${LZ4_ROOT} ${PC_LZ4_INCLUDEDIR} ${PC_LZ4_INCLUDE_DIRS}
15+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
16+
)
17+
18+
find_library (LZ4_LIBRARY
19+
NAMES lz4
20+
HINTS ${LZ4_ROOT} ${PC_LZ4_LIBDIR} ${PC_LZ4_LIBRARY_DIRS}
21+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
22+
)
23+
24+
mark_as_advanced (LZ4_INCLUDE_DIR LZ4_LIBRARY)
25+
26+
include (FindPackageHandleStandardArgs)
27+
# handle the QUIETLY and REQUIRED arguments and set Unwind_FOUND to TRUE
28+
# if all listed variables are TRUE
29+
find_package_handle_standard_args (lz4
30+
REQUIRED_VARS LZ4_INCLUDE_DIR LZ4_LIBRARY
31+
)
32+
33+
if (NOT TARGET lz4::lz4)
34+
add_library(lz4::lz4 STATIC IMPORTED)
35+
set_target_properties(lz4::lz4 PROPERTIES
36+
IMPORTED_LOCATION "${LZ4_LIBRARY}"
37+
INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}")
38+
target_compile_definitions(lz4::lz4 INTERFACE LZ4_FOUND)
39+
else()
40+
message(CRITICAL "lz4 was not found")
41+
add_library(lz4::lz4 INTERFACE IMPORTED)
42+
endif()
43+
44+
unset(LZ4_INCLUDE_DIR)
45+
unset(LZ4_LIBRARY)

cmake/modules/Findunwind.cmake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Find unwind library
2+
# Once done this will define
3+
#
4+
# UNWIND_FOUND - system has libunwind
5+
# unwind::unwind - cmake target
6+
7+
find_package(PkgConfig QUIET)
8+
if (PKG_CONFIG_FOUND)
9+
pkg_check_modules(PC_UNWIND QUIET libunwind)
10+
endif()
11+
12+
find_path (UNWIND_INCLUDE_DIR
13+
NAMES unwind.h libunwind.h
14+
HINTS ${UNWIND_ROOT} ${PC_UNWIND_INCLUDEDIR} ${PC_UNWIND_INCLUDE_DIRS}
15+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
16+
)
17+
18+
find_library (UNWIND_LIBRARY
19+
NAMES unwind
20+
HINTS ${UNWIND_ROOT} ${PC_UNWIND_LIBDIR} ${PC_UNWIND_LIBRARY_DIRS}
21+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
22+
)
23+
24+
mark_as_advanced (UNWIND_INCLUDE_DIR UNWIND_LIBRARY)
25+
26+
include (FindPackageHandleStandardArgs)
27+
# handle the QUIETLY and REQUIRED arguments and set Unwind_FOUND to TRUE
28+
# if all listed variables are TRUE
29+
find_package_handle_standard_args (unwind
30+
REQUIRED_VARS UNWIND_INCLUDE_DIR UNWIND_LIBRARY
31+
)
32+
33+
if (UNWIND_FOUND AND NOT TARGET unwind::unwind)
34+
add_library(unwind::unwind STATIC IMPORTED)
35+
set_target_properties(unwind::unwind PROPERTIES
36+
IMPORTED_LOCATION "${UNWIND_LIBRARY}"
37+
INTERFACE_INCLUDE_DIRECTORIES "${UNWIND_INCLUDE_DIR}")
38+
target_compile_definitions(unwind::unwind INTERFACE UNWIND_FOUND)
39+
else()
40+
message(WARNING "Notice: UNWIND not found, no unwind support")
41+
add_library(unwind::unwind INTERFACE IMPORTED)
42+
endif()
43+
44+
unset(UNWIND_INCLUDE_DIR)
45+
unset(UNWIND_LIBRARY)

src/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ target_link_libraries(ipfixprobe PRIVATE
3434
spdlog::spdlog
3535
pthread
3636
atomic
37-
unwind
37+
unwind::unwind
3838
#ipfixprobe-storage-cache
3939
#ipfixprobe-process-basicplus
4040
#ipfixprobe-process-bstats

src/plugins/output/ipfix/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ add_library(ipfixprobe-output-ipfix SHARED
88

99
target_include_directories(ipfixprobe-output-ipfix PRIVATE ${CMAKE_SOURCE_DIR}/include/)
1010

11-
target_link_libraries(ipfixprobe-output-ipfix PRIVATE lz4)
11+
target_link_libraries(ipfixprobe-output-ipfix PRIVATE lz4::lz4)
1212

1313
install(
1414
TARGETS ipfixprobe-output-ipfix

0 commit comments

Comments
 (0)