Update 'src/patches/cmake-libndpi-nolibicu-cpp17-includes-protoc-grpc.patch'
All checks were successful
continuous-integration/drone/push Build is passing

* only have CMakeLists.txt-related stuff in this patch
* more cleaning up done here
* a little smarter build logic introduced - now building both from
  build folder and directly from the src folder is supported

Signed-off-by: wanderer <wanderer@noreply.git.dotya.ml>
This commit is contained in:
wanderer 2021-05-04 03:33:38 +02:00
parent 95f1f21be3
commit b661def40e
Signed by: Gitea
GPG Key ID: 0DD13DBC6B5433D3

@ -1,115 +1,47 @@
.gitignore | 73 +++++++++++++++++++++++++++++++++++++++++
src/CMakeLists.txt | 95 +++++++++++++++++++++++++++---------------------------
2 files changed, 121 insertions(+), 47 deletions(-)
src/CMakeLists.txt | 187 ++++++++++++++++++++++++++++-------------------------
1 file changed, 98 insertions(+), 89 deletions(-)
diff --git a/.gitignore b/.gitignore
index 7ea5909..e3d7fc8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,76 @@
__pycache__
*.DS_Store
src/build/
+*.swp
+
+### CMake ###
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+_deps
+CMakeUserPresets.json
+
+### CMake Patch ###
+# External projects
+*-prefix/
+
+### C ###
+# Prerequisites
+*.d
+
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Linker output
+*.ilk
+*.map
+*.exp
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+*.su
+*.idb
+*.pdb
+
+# Kernel Module Compile Results
+*.mod*
+*.cmd
+.tmp_versions/
+modules.order
+Module.symvers
+Mkfile.old
+dkms.conf
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 03e5315..1089c06 100644
index 03e5315..1ada301 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -34,8 +34,8 @@ set(CAPNP_CUSTOM_INSTALL_PATH "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/capnproto_0_8
@@ -1,5 +1,6 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.15)
+# TODO check and update this
# cmake versions:
# Debian 6 - 2.8.2
# Debian 7 - 2.8.9
@@ -34,8 +35,12 @@ set(CAPNP_CUSTOM_INSTALL_PATH "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/capnproto_0_8
set(OPENSSL_CUSTOM_INSTALL_PATH "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/openssl_1_0_2d")
set(GRPC_CUSTOM_INSTALL_PATH "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/grpc_1_30_2")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} --std=c++14")
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --std=c++14")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} --std=c++17 -I.. -I/usr/local/include/libndpi-1.7.1")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --std=c++17 -I.. -I/usr/local/include/libndpi-1.7.1")
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -I..")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -I..")
+# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} --std=c++17 -I..")
+# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --std=c++17 -I..")
set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "/lib/systemd/system"
CACHE PATH "Location for systemd service files")
@@ -44,8 +44,8 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "/lib/systemd/system"
@@ -44,8 +49,10 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "/lib/systemd/system"
option(ENABLE_GOBGP_SUPPORT "Enable GoBGP support build" ON)
if (ENABLE_GOBGP_SUPPORT)
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++14")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++14")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17")
+ # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17")
+ # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
endif()
option(ENABLE_CUSTOM_BOOST_BUILD "Enable build with custom Boost" ON)
@@ -54,13 +54,13 @@ if (ENABLE_CUSTOM_BOOST_BUILD)
@@ -54,13 +61,13 @@ if (ENABLE_CUSTOM_BOOST_BUILD)
set(Boost_NO_SYSTEM_PATHS ON)
@ -127,7 +59,7 @@ index 03e5315..1089c06 100644
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-deprecated-declarations")
@@ -73,11 +73,11 @@ if (ENABLE_CUSTOM_BOOST_BUILD)
@@ -73,14 +80,14 @@ if (ENABLE_CUSTOM_BOOST_BUILD)
find_library(ICU_LIBRARY_DATA_PATH NAMES icudata PATHS "${ICU_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
find_library(ICU_LIBRARY_I18N_PATH NAMES icui18n PATHS "${ICU_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
@ -143,8 +75,98 @@ index 03e5315..1089c06 100644
+ # endif()
endif()
-
+
# Specify full RPATH for build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
@@ -283,16 +283,16 @@ if (ENABLE_DPI_SUPPORT)
@@ -98,12 +105,12 @@ set(FASTNETMON_PROFILE_FLAGS "-g -pg")
# set(CMAKE_BUILD_TYPE DEBUG)
-if (NOT CMAKE_BUILD_TYPE)
+if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to Release as none was specified.")
set(CMAKE_BUILD_TYPE Release)
endif()
-if (FASTNETMON_PROFILER)
+if (FASTNETMON_PROFILER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FASTNETMON_PROFILE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FASTNETMON_PROFILE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FASTNETMON_PROFILE_FLAGS}")
@@ -111,7 +118,7 @@ endif()
execute_process(COMMAND sh -c ". /etc/os-release; echo $ID" OUTPUT_VARIABLE OS_ID ERROR_QUIET)
-### Executables definition
+### Executables definition
# Main tool
add_executable(fastnetmon fastnetmon.cpp)
@@ -126,8 +133,8 @@ configure_file(fast_platform.h.template "${PROJECT_SOURCE_DIR}/fast_platform.h")
# You could enable it using: cmake .. -DUSE_NEW_ATOMIC_BUILTINS=ON
if (USE_NEW_ATOMIC_BUILTINS)
message(STATUS "Will use new memory model aware atomic builtins")
- add_definitions(-DUSE_NEW_ATOMIC_BUILTINS)
-endif()
+ add_definitions(-DUSE_NEW_ATOMIC_BUILTINS)
+endif()
CHECK_CXX_SOURCE_COMPILES("
#include <cstdint>
@@ -159,7 +166,7 @@ int main() {
" HAVE_ATOMIC_THREAD_FENCE)
# If we do not have it then we need to disable it
-if (NOT HAVE_ATOMIC_THREAD_FENCE)
+if (NOT HAVE_ATOMIC_THREAD_FENCE)
set(ENABLE_NETMAP_SUPPORT OFF)
message(STATUS "Your system does not support __atomic_thread_fence, disabled Netmap plugin support")
endif()
@@ -178,7 +185,7 @@ if (ENABLE_PF_RING_SUPPORT)
if (NOT PFRING_LIBRARIES)
message(FATAL_ERROR "Could not find PF_RING")
endif()
-
+
link_directories("${PFRING_CUSTOM_INSTALL_PATH}/lib")
add_definitions(-DPF_RING)
@@ -187,7 +194,7 @@ if (ENABLE_PF_RING_SUPPORT)
# Enable ZC support
add_definitions(-DPF_RING_ZC)
else()
- message(WARNING "We can't find PF_RING ZC header pfring_zc.h. Will not compile ZC support")
+ message(WARNING "We can't find PF_RING ZC header pfring_zc.h. Will not compile ZC support")
endif()
include_directories(${PFRING_INCLUDE_DIRS})
@@ -245,7 +252,7 @@ endif()
# -DENABLE_AFPACKET_SUPPORT=ON ..
if (ENABLE_AFPACKET_SUPPORT)
- add_definitions(-DFASTNETMON_ENABLE_AFPACKET)
+ add_definitions(-DFASTNETMON_ENABLE_AFPACKET)
add_library(afpacket_plugin STATIC afpacket_plugin/afpacket_collector.cpp)
target_link_libraries(afpacket_plugin unified_parser)
endif()
@@ -268,7 +275,7 @@ add_library(sflow_plugin STATIC sflow_plugin/sflow_collector.cpp)
target_link_libraries(sflow_plugin simple_packet_parser_ng)
# Link sFlow plugin with libsflow
-target_link_libraries(sflow_plugin libsflow)
+target_link_libraries(sflow_plugin libsflow)
# netflow library
add_library(netflow STATIC netflow_plugin/netflow.cpp)
@@ -278,21 +285,21 @@ add_library(netflow_plugin STATIC netflow_plugin/netflow_collector.cpp)
target_link_libraries(netflow_plugin ipfix_rfc netflow)
option(ENABLE_DPI_SUPPORT "Enable Deep Packet Inspection support" ON)
-if (ENABLE_DPI_SUPPORT)
+if (ENABLE_DPI_SUPPORT)
message(STATUS "We will enable nDPI support")
add_library(fast_dpi STATIC fast_dpi.cpp)
@ -161,11 +183,20 @@ index 03e5315..1089c06 100644
- link_directories("${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/lib")
- include_directories(${NDPI_INCLUDE_DIRS})
+ link_directories("/usr/local/lib" "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/lib")
+ include_directories("/usr/local/include/libndpi-1.7.1/" "/usr/include/ndpi" ${NDPI_INCLUDE_DIRS})
+ include_directories("/usr/local/include/libndpi-1.7.1" "/usr/include/ndpi" ${NDPI_INCLUDE_DIRS})
add_definitions(-DENABLE_DPI)
@@ -320,10 +320,10 @@ if (ENABLE_GOBGP_SUPPORT)
@@ -305,7 +312,7 @@ target_link_libraries(pcap_plugin pcap)
find_package(Threads)
-if (ENABLE_PF_RING_SUPPORT)
+if (ENABLE_PF_RING_SUPPORT)
add_library(pfring_plugin STATIC pfring_plugin/pfring_collector.cpp)
target_link_libraries(pfring_plugin ${PFRING_LIBRARIES})
target_link_libraries(pfring_plugin numa)
@@ -320,10 +327,10 @@ if (ENABLE_GOBGP_SUPPORT)
add_definitions(-DENABLE_GOBGP)
add_library(gobgp_action STATIC actions/gobgp_action.cpp)
@ -173,15 +204,43 @@ index 03e5315..1089c06 100644
- find_library(GRPC_LIBRARY_GRPC_PATH NAMES grpc PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
- find_library(GRPC_LIBRARY_GPR_PATH NAMES gpr PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
- find_library(GRPC_LIBRARY_GRPC_CPP_PATH NAMES grpc++ PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
+ find_path(GRPC_INCLUDES_FOLDER NAMES grpc/grpc.h PATHS "${GRPC_CUSTOM_INSTALL_PATH}/include" "/usr/lib" "/usr/include" NO_DEFAULT_PATH)
+ find_library(GRPC_LIBRARY_GRPC_PATH NAMES grpc PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" "/usr/include" NO_DEFAULT_PATH)
+ find_library(GRPC_LIBRARY_GPR_PATH NAMES gpr PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" "/usr/include" "/usr/lib" NO_DEFAULT_PATH)
+ find_library(GRPC_LIBRARY_GRPC_CPP_PATH NAMES grpc++ PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" "/usr/include" NO_DEFAULT_PATH)
+ find_path(GRPC_INCLUDES_FOLDER NAMES grpc/grpc.h PATHS "${GRPC_CUSTOM_INSTALL_PATH}/include" "/usr/include" NO_DEFAULT_PATH)
+ find_library(GRPC_LIBRARY_GRPC_PATH NAMES grpc PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
+ find_library(GRPC_LIBRARY_GPR_PATH NAMES gpr PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
+ find_library(GRPC_LIBRARY_GRPC_CPP_PATH NAMES grpc++ PATHS "${GRPC_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
if (GRPC_INCLUDES_FOLDER AND GRPC_LIBRARY_GRPC_PATH AND GRPC_LIBRARY_GPR_PATH AND GRPC_LIBRARY_GRPC_CPP_PATH)
include_directories(${GRPC_INCLUDES_FOLDER})
@@ -352,7 +352,7 @@ if (ENABLE_GOBGP_SUPPORT)
# message(STATUS "grpc: ${GRPC_INCLUDES_FOLDER} ${GRPC_LIBRARY_GRPC_PATH} ${GRPC_LIBRARY_GPR_PATH}")
@@ -331,28 +338,28 @@ if (ENABLE_GOBGP_SUPPORT)
target_link_libraries(gobgp_action ${GRPC_LIBRARY_GPR_PATH})
target_link_libraries(gobgp_action ${GRPC_LIBRARY_GRPC_CPP_PATH})
- message(STATUS "Found gRPC library: ${GRPC_LIBRARY_GRPC_PATH} ${GRPC_LIBRARY_GPR_PATH} ${GRPC_LIBRARY_GRPC_CPP_PATH}")
+ message(STATUS "Found gRPC library: ${GRPC_LIBRARY_GRPC_PATH} ${GRPC_LIBRARY_GPR_PATH} ${GRPC_LIBRARY_GRPC_CPP_PATH}")
else()
message(FATAL_ERROR "Could not find gRPC library")
endif()
- find_path(PROTOCOL_BUFFERS_INCLUDE_FOLDER NAMES "google/protobuf/stubs/common.h" PATHS "${PROTOCOL_BUFFERS_CUSTOM_INSTALL_PATH}/include")
+ find_path(PROTOCOL_BUFFERS_INCLUDE_FOLDER NAMES "google/protobuf/stubs/common.h" PATHS "/usr/include" "${PROTOCOL_BUFFERS_CUSTOM_INSTALL_PATH}/include")
- find_library(PROTOCOL_BUFFERS_LIBRARY_PATH NAMES protobuf PATHS "${PROTOCOL_BUFFERS_CUSTOM_INSTALL_PATH}/lib")
+ find_library(PROTOCOL_BUFFERS_LIBRARY_PATH NAMES protobuf PATHS "${PROTOCOL_BUFFERS_CUSTOM_INSTALL_PATH}/lib")
if (PROTOCOL_BUFFERS_INCLUDE_FOLDER AND PROTOCOL_BUFFERS_LIBRARY_PATH)
- include_directories(${PROTOCOL_BUFFERS_INCLUDE_FOLDER})
- target_link_libraries(gobgp_action ${PROTOCOL_BUFFERS_LIBRARY_PATH})
- message(STATUS "Found protobuf library: ${PROTOCOL_BUFFERS_LIBRARY_PATH}")
+ include_directories(${PROTOCOL_BUFFERS_INCLUDE_FOLDER})
+ target_link_libraries(gobgp_action ${PROTOCOL_BUFFERS_LIBRARY_PATH})
+ message(STATUS "Found protobuf library: ${PROTOCOL_BUFFERS_LIBRARY_PATH}")
else()
message(FATAL_ERROR "Could not find protocol buffers")
endif()
- # message(STATUS "grpc: ${GRPC_INCLUDES_FOLDER} ${GRPC_LIBRARY_GRPC_PATH} ${GRPC_LIBRARY_GPR_PATH}")
+ message(STATUS "grpc: ${GRPC_INCLUDES_FOLDER} ${GRPC_LIBRARY_GRPC_PATH} ${GRPC_LIBRARY_GPR_PATH}")
# message(STATUS ${PROJECT_BINARY_DIR})
- find_program(PROTOC_BINARY protoc PATHS "${PROTOCOL_BUFFERS_CUSTOM_INSTALL_PATH}/bin" NO_DEFAULT_PATH)
@ -189,7 +248,7 @@ index 03e5315..1089c06 100644
if (PROTOC_BINARY)
message(STATUS "Found protoc protobuf compiler: ${PROTOC_BINARY}")
@@ -362,13 +362,13 @@ if (ENABLE_GOBGP_SUPPORT)
@@ -362,21 +369,22 @@ if (ENABLE_GOBGP_SUPPORT)
message(STATUS "Building protobuf and gRPC mappings for C++")
@ -197,7 +256,7 @@ index 03e5315..1089c06 100644
+ set(GRPC_CPP_PLUGIN "/usr/bin/grpc_cpp_plugin")
- execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR}/../actions --grpc_out=${PROJECT_BINARY_DIR}/../actions --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} ${PROJECT_BINARY_DIR}/../actions/gobgp.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR}/actions --grpc_out=${PROJECT_BINARY_DIR}/actions --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} ${PROJECT_BINARY_DIR}/actions/gobgp.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_SOURCE_DIR}/actions --grpc_out=${PROJECT_BINARY_DIR}/actions --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} ${PROJECT_BINARY_DIR}/actions/gobgp.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Protoc return code for gobgp.proto gRPC: ${PROTOC_RETURN_CODE} std err: ${PROTOC_STDERR}")
@ -206,45 +265,63 @@ index 03e5315..1089c06 100644
message(STATUS "Protoc return code for gobgp.proto and attribute.proto Protobuf: ${PROTOC_RETURN_CODE} std err: ${PROTOC_STDERR}")
@@ -393,11 +393,11 @@ if (ENABLE_GOBGP_SUPPORT)
- # Build gRPC and protocol bufffers libraries and link they to gobgp_action
+ # Build gRPC and protocol buffers libraries and link them to gobgp_action
add_library(gobgp_api_client_pb_cc STATIC actions/gobgp.pb.cc)
add_library(gobgp_api_client_grpc_pb_cc STATIC actions/gobgp.grpc.pb.cc)
# Disable annoying warnings
+ # or TODO fix them...
set_source_files_properties(actions/gobgp.pb.cc PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
set_source_files_properties(actions/gobgp.grpc.pb.cc PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
@@ -391,13 +399,13 @@ if (ENABLE_GOBGP_SUPPORT)
target_link_libraries(gobgp_action attribute_pb_cc)
# FastNetMon API
add_definitions(-DFASTNETMON_API)
- add_definitions(-DFASTNETMON_API)
+ add_definitions(-DFASTNETMON_API)
- execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR}/.. --grpc_out=${PROJECT_BINARY_DIR}/.. --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} ${PROJECT_BINARY_DIR}/../fastnetmon.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR} --grpc_out=${PROJECT_BINARY_DIR}/.. --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} ${PROJECT_BINARY_DIR}/fastnetmon.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR} --grpc_out=${PROJECT_BINARY_DIR} --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} ${PROJECT_BINARY_DIR}/fastnetmon.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Protoc return code for gRPC fastnetmon.proto: ${PROTOC_RETURN_CODE} std err: ${PROTOC_STDERR}")
- execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR}/.. --cpp_out=${PROJECT_BINARY_DIR}/.. ${PROJECT_BINARY_DIR}/../fastnetmon.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR} --cpp_out=${PROJECT_BINARY_DIR}/.. ${PROJECT_BINARY_DIR}/fastnetmon.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${PROTOC_BINARY} -I ${PROJECT_BINARY_DIR} --cpp_out=${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}/fastnetmon.proto ERROR_VARIABLE PROTOC_STDERR RESULT_VARIABLE PROTOC_RETURN_CODE OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Protoc return code for protobuf fastnetmon.proto: ${PROTOC_RETURN_CODE} std err: ${PROTOC_STDERR}")
@@ -407,8 +407,8 @@ if (ENABLE_GOBGP_SUPPORT)
set_source_files_properties(fastnetmon.grpc.pb.h PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
set_source_files_properties(fastnetmon.pb.h PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
@@ -417,21 +425,21 @@ if (ENABLE_GOBGP_SUPPORT)
target_link_libraries(fastnetmon_api_client ${GRPC_LIBRARY_GRPC_PATH})
target_link_libraries(fastnetmon_api_client fastnetmon_grpc_pb_cc)
target_link_libraries(fastnetmon_api_client fastnetmon_pb_cc)
- target_link_libraries(fastnetmon_api_client ${PROTOCOL_BUFFERS_LIBRARY_PATH})
+ target_link_libraries(fastnetmon_api_client ${PROTOCOL_BUFFERS_LIBRARY_PATH})
- add_library(fastnetmon_grpc_pb_cc STATIC fastnetmon.grpc.pb.cc)
- add_library(fastnetmon_pb_cc STATIC fastnetmon.pb.cc)
+ add_library(fastnetmon_grpc_pb_cc STATIC ../fastnetmon.grpc.pb.cc)
+ add_library(fastnetmon_pb_cc STATIC ../fastnetmon.pb.cc)
add_executable(fastnetmon_api_client fastnetmon_api_client.cpp)
@@ -428,9 +428,9 @@ if (ENABLE_GOBGP_SUPPORT)
target_link_libraries(fastnetmon ${GRPC_LIBRARY_GPR_PATH})
target_link_libraries(fastnetmon ${GRPC_LIBRARY_GRPC_CPP_PATH})
target_link_libraries(fastnetmon ${GRPC_LIBRARY_GRPC_PATH})
target_link_libraries(fastnetmon fastnetmon_grpc_pb_cc)
target_link_libraries(fastnetmon fastnetmon_pb_cc)
- target_link_libraries(fastnetmon ${PROTOCOL_BUFFERS_LIBRARY_PATH})
+ target_link_libraries(fastnetmon ${PROTOCOL_BUFFERS_LIBRARY_PATH})
endif()
if (ENABLE_CUSTOM_BOOST_BUILD)
-if (ENABLE_CUSTOM_BOOST_BUILD)
- target_link_libraries(fastnetmon ${ICU_LIBRARY_UC_PATH})
- target_link_libraries(fastnetmon ${ICU_LIBRARY_DATA_PATH})
- target_link_libraries(fastnetmon ${ICU_LIBRARY_I18N_PATH})
-endif()
+# if (ENABLE_CUSTOM_BOOST_BUILD)
+ # target_link_libraries(fastnetmon ${ICU_LIBRARY_UC_PATH})
+ # target_link_libraries(fastnetmon ${ICU_LIBRARY_DATA_PATH})
+ # target_link_libraries(fastnetmon ${ICU_LIBRARY_I18N_PATH})
endif()
+# endif()
# example plugin
@@ -459,6 +459,7 @@ find_package(Boost COMPONENTS thread regex program_options system REQUIRED)
add_library(example_plugin STATIC example_plugin/example_collector.cpp)
@@ -459,6 +467,7 @@ find_package(Boost COMPONENTS thread regex program_options system REQUIRED)
if(Boost_FOUND)
message(STATUS "Found Boost: ${Boost_LIBRARIES} ${Boost_INCLUDE_DIRS}")
@ -252,7 +329,16 @@ index 03e5315..1089c06 100644
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(fastnetmon ${Boost_LIBRARIES})
target_link_libraries(fast_library ${Boost_LIBRARIES})
@@ -479,10 +480,10 @@ endif()
@@ -471,7 +480,7 @@ target_link_libraries(fast_library fastnetmon_pcap_format)
# Try to find ncurses librreary
find_package(Curses REQUIRED)
-if(CURSES_FOUND)
+if(CURSES_FOUND)
include_directories(${CURSES_INCLUDE_DIRS})
target_link_libraries(fastnetmon_client ${CURSES_LIBRARIES})
endif()
@@ -479,12 +488,12 @@ endif()
### Move this code to cmake module
# Try to find hiredis in a specific folder
@ -263,9 +349,12 @@ index 03e5315..1089c06 100644
-find_library(HIREDIS_LIBRARY_PATH NAMES hiredis PATHS "${HIREDIS_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
+find_library(HIREDIS_LIBRARY_PATH NAMES hiredis PATHS "${HIREDIS_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
if (HIREDIS_INCLUDES_FOLDER AND HIREDIS_LIBRARY_PATH)
-if (HIREDIS_INCLUDES_FOLDER AND HIREDIS_LIBRARY_PATH)
+if (HIREDIS_INCLUDES_FOLDER AND HIREDIS_LIBRARY_PATH)
message(STATUS "We found hiredis library ${HIREDIS_INCLUDES_FOLDER} ${HIREDIS_LIBRARY_PATH}")
@@ -497,9 +498,9 @@ endif()
add_definitions(-DREDIS)
@@ -497,11 +506,11 @@ endif()
set(ENABLE_OPENSSL_SUPPORT TRUE)
if (ENABLE_OPENSSL_SUPPORT)
@ -276,9 +365,12 @@ index 03e5315..1089c06 100644
+ find_library(OPENSSL_LIBRARY_PATH NAMES ssl PATHS "${OPENSSL_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
+ find_library(OPENSSL_CRYPTO_LIBRARY_PATH NAMES crypto PATHS "${OPENSSL_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
if (OPENSSL_INCLUDES_FOLDER AND OPENSSL_LIBRARY_PATH AND OPENSSL_CRYPTO_LIBRARY_PATH)
- if (OPENSSL_INCLUDES_FOLDER AND OPENSSL_LIBRARY_PATH AND OPENSSL_CRYPTO_LIBRARY_PATH)
+ if (OPENSSL_INCLUDES_FOLDER AND OPENSSL_LIBRARY_PATH AND OPENSSL_CRYPTO_LIBRARY_PATH)
message(STATUS "We found OpenSSL library: ${OPENSSL_LIBRARY_PATH} ${OPENSSL_CRYPTO_LIBRARY_PATH}")
@@ -512,8 +513,8 @@ endif()
include_directories(${OPENSSL_INCLUDES_FOLDER})
else()
@@ -512,8 +521,8 @@ endif()
SET(CAPNP_SUPPORT TRUE)
if (CAPNP_SUPPORT)
@ -289,7 +381,16 @@ index 03e5315..1089c06 100644
if (CAPNP_LIBRARY_PATH AND CAPNP_KJ_LIBRARY_PATH)
message(STATUS "We found capnp and kj libraries: ${CAPNP_LIBRARY_PATH} ${CAPNP_KJ_LIBRARY_PATH}")
@@ -530,12 +531,12 @@ target_link_libraries(simple_packet_capnp ${CAPNP_LIBRARY_PATH} ${CAPNP_KJ_LIBRA
@@ -521,7 +530,7 @@ if (CAPNP_SUPPORT)
message(FATAL_ERROR "Could not find capnp libraries")
endif()
- include_directories("${CAPNP_CUSTOM_INSTALL_PATH}/include")
+ include_directories("${CAPNP_CUSTOM_INSTALL_PATH}/include" "/usr/include")
endif()
target_link_libraries(simple_packet_capnp ${CAPNP_LIBRARY_PATH} ${CAPNP_KJ_LIBRARY_PATH})
@@ -530,12 +539,12 @@ target_link_libraries(simple_packet_capnp ${CAPNP_LIBRARY_PATH} ${CAPNP_KJ_LIBRA
target_link_libraries(fast_library simple_packet_capnp)
### Find mongo-c
@ -306,20 +407,42 @@ index 03e5315..1089c06 100644
if (MONGOC_INCLUDES_FOLDER AND MONGOC_LIBRARY_PATH AND BSON_INCLUDES_FOLDER AND BSON_LIBRARY_PATH)
message(STATUS "We found mongo-c library ${MONGOC_INCLUDES_FOLDER} ${MONGOC_LIBRARY_PATH} ${BSON_INCLUDES_FOLDER} ${BSON_LIBRARY_PATH}")
@@ -568,10 +569,10 @@ endif()
@@ -553,25 +562,25 @@ endif()
### Look for libpcap
-#find_path(LIBPCAP_INCLUDES_FOLDER NAMES pcap.h PATHS "${LIBPCAP_CUSTOM_INSTALL_PATH}/include" NO_DEFAULT_PATH)
+find_path(LIBPCAP_INCLUDES_FOLDER NAMES pcap.h PATHS "/usr/include" "${LIBPCAP_CUSTOM_INSTALL_PATH}/include" NO_DEFAULT_PATH)
-#find_library(LIBPCAP_LIBRARY_PATH NAMES pcap PATHS "${LIBPCAP_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
+find_library(LIBPCAP_LIBRARY_PATH NAMES pcap PATHS "/usr/lib" "${LIBPCAP_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
-#if (LIBPCAP_INCLUDES_FOLDER AND LIBPCAP_LIBRARY_PATH)
-# message(STATUS "We found pcap library ${LIBPCAP_LIBRARY_PATH}")
+if (LIBPCAP_INCLUDES_FOLDER AND LIBPCAP_LIBRARY_PATH)
+ message(STATUS "We found pcap library ${LIBPCAP_LIBRARY_PATH}")
-# include_directories(${LIBPCAP_INCLUDES_FOLDER})
+ include_directories(${LIBPCAP_INCLUDES_FOLDER})
#else()
-# message(FATAL_ERROR "We can't find pcap library")
-#endif()
+# message(FATAL_ERROR "We can't find pcap library")
+endif()
### Look for log4cpp
# Try to find log4cpp includes path
-find_path(LOG4CPP_INCLUDES_FOLDER NAMES log4cpp/Appender.hh PATHS "${LOG4CPP_CUSTOM_INSTALL_PATH}/include" NO_DEFAULT_PATH)
+find_path(LOG4CPP_INCLUDES_FOLDER NAMES log4cpp/Appender.hh PATHS "${LOG4CPP_CUSTOM_INSTALL_PATH}/include" "/usr/include" NO_DEFAULT_PATH)
+find_path(LOG4CPP_INCLUDES_FOLDER NAMES log4cpp/Appender.hh PATHS "/usr/include" "${LOG4CPP_CUSTOM_INSTALL_PATH}/include" NO_DEFAULT_PATH)
# Try to find log4cpp library path
-find_library(LOG4CPP_LIBRARY_PATH NAMES log4cpp PATHS "${LOG4CPP_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
+find_library(LOG4CPP_LIBRARY_PATH NAMES log4cpp PATHS "${LOG4CPP_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
+find_library(LOG4CPP_LIBRARY_PATH NAMES log4cpp PATHS "/usr/lib" "${LOG4CPP_CUSTOM_INSTALL_PATH}/lib" NO_DEFAULT_PATH)
if (LOG4CPP_INCLUDES_FOLDER AND LOG4CPP_LIBRARY_PATH)
include_directories(${LOG4CPP_INCLUDES_FOLDER})
@@ -582,8 +583,8 @@ endif()
@@ -582,11 +591,11 @@ endif()
### Look for jsonc
@ -329,4 +452,45 @@ index 03e5315..1089c06 100644
+find_library(JSONC_LIBRARY_PATH NAMES json-c PATHS "${JSONC_CUSTOM_INSTALL_PATH}/lib" "/usr/lib" NO_DEFAULT_PATH)
if (JSONC_INCLUDES_FOLDER AND JSONC_LIBRARY_PATH)
include_directories(${JSONC_INCLUDES_FOLDER})
- include_directories(${JSONC_INCLUDES_FOLDER})
+ include_directories(${JSONC_INCLUDES_FOLDER})
message(STATUS "We have found json-c library correctly: ${JSONC_LIBRARY_PATH}")
else()
message(FATAL_ERROR "We can't find json-c library! Can't build project")
@@ -648,7 +657,7 @@ endif()
if (BUILD_PLUGIN_RUNNER)
add_executable(fastnetmon_plugin_runner plugin_runner.cpp)
- if (ENABLE_AFPACKET_SUPPORT)
+ if (ENABLE_AFPACKET_SUPPORT)
target_link_libraries(fastnetmon_plugin_runner afpacket_plugin)
endif()
@@ -681,7 +690,7 @@ if (BUILD_PCAP_READER)
target_link_libraries(fastnetmon_pcap_reader fast_library)
target_link_libraries(fastnetmon_pcap_reader ${LOG4CPP_LIBRARY_PATH})
- target_link_libraries(fastnetmon_pcap_reader netflow_plugin)
+ target_link_libraries(fastnetmon_pcap_reader netflow_plugin)
target_link_libraries(fastnetmon_pcap_reader sflow_plugin)
if (ENABLE_NETMAP_SUPPORT)
@@ -694,15 +703,15 @@ if (BUILD_PCAP_READER)
endif()
# cmake -DBUILD_TESTS=ON ..
-if (BUILD_TESTS)
+if (BUILD_TESTS)
add_executable(fastnetmon_tests fastnetmon_tests.cpp)
target_link_libraries(fastnetmon_tests fast_library)
target_link_libraries(fastnetmon_tests ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(fastnetmon_tests ${Boost_LIBRARIES})
target_link_libraries(fastnetmon_tests ${LOG4CPP_LIBRARY_PATH})
- set(GOOGLE_TEST_INCLUDE_DIRS ${FASTNETMON_LIBRARIES_GLOBAL_PATH}/gtest/include)
- set(GOOGLE_TEST_LIBRARIES ${FASTNETMON_LIBRARIES_GLOBAL_PATH}/gtest/lib/libgtest.a ${FASTNETMON_LIBRARIES_GLOBAL_PATH}/gtest/lib/libgtest_main.a)
+ set(GOOGLE_TEST_INCLUDE_DIRS "/usr/include/gtest" "/usr/include" "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/gtest/include")
+ set(GOOGLE_TEST_LIBRARIES "/usr/lib64/libgtest.so" "/usr/lib64/libgtest_main.so")
# Compiled Google Library
include_directories(${GOOGLE_TEST_INCLUDE_DIRS})