Skip to content

Commit

Permalink
chore: use cmake style for package includes in src folder (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoparente authored Aug 19, 2024
1 parent 70d89ed commit 3e1745d
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 39 deletions.
31 changes: 19 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ message(STATUS "visor-core")

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

#generate cpp code from opentelemetry-proto
find_package(Protobuf REQUIRED)
find_package(fmt REQUIRED)
find_package(httplib REQUIRED)
find_package(maxminddb REQUIRED)
find_package(fast-cpp-csv-parser REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(spdlog REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(Catch2 REQUIRED)

#generate cpp code from opentelemetry-proto
find_program(PROTOBUF_PROTOC_EXECUTABLE NAMES protoc PATHS ${CONAN_BIN_DIRS_PROTOBUF})
set(OTELCPP_PROTO_PATH ${CONAN_OPENTELEMETRY-PROTO_ROOT}/res)
set(BUILD_SHARED_LIBS FALSE)
Expand Down Expand Up @@ -40,16 +49,14 @@ target_link_libraries(visor-core
rng
timer
opentelemetry_proto
${CONAN_LIBS_PROTOBUF}
${CONAN_LIBS_ABSEIL}
${CONAN_LIBS_LIBMAXMINDDB}
${CONAN_LIBS_CORRADE}
${CONAN_LIBS_SPDLOG}
${CONAN_LIBS_FMT}
${CONAN_LIBS_FAST-CPP-CSV-PARSER}
${CONAN_LIBS_YAML-CPP}
${CONAN_LIBS_OPENSSL}
${CONAN_LIBS_ZLIB}
protobuf::libprotobuf
maxminddb::maxminddb
Corrade::Corrade
spdlog::spdlog
fmt::fmt
fast-cpp-csv-parser::fast-cpp-csv-parser
yaml-cpp::yaml-cpp
OpenSSL::SSL
${VISOR_STATIC_PLUGINS}
)

Expand Down Expand Up @@ -77,7 +84,7 @@ target_link_libraries(unit-tests-visor-core
PRIVATE
Visor::Core
${VISOR_STATIC_PLUGINS}
${CONAN_LIBS_CATCH2})
catch2::catch2_with_main)

add_test(NAME unit-tests-visor-core
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src
Expand Down
4 changes: 3 additions & 1 deletion src/handlers/bgp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ add_executable(unit-tests-handler-bgp
tests/test_bgp_layer.cpp
tests/test_json_schema.cpp)

find_package(nlohmann_json_schema_validator REQUIRED)

target_link_libraries(unit-tests-handler-bgp
PRIVATE
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
nlohmann_json_schema_validator
Visor::Handler::Bgp
Visor::Lib::Test)

Expand Down
4 changes: 3 additions & 1 deletion src/handlers/dhcp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ add_executable(unit-tests-handler-dhcp
tests/test_dhcp_layer.cpp
tests/test_json_schema.cpp)

find_package(nlohmann_json_schema_validator REQUIRED)

target_link_libraries(unit-tests-handler-dhcp
PRIVATE
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
nlohmann_json_schema_validator
Visor::Handler::Dhcp
Visor::Lib::Test)

Expand Down
4 changes: 3 additions & 1 deletion src/handlers/dns/v1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ add_executable(unit-tests-handler-dns
tests/test_dnstap.cpp
tests/test_json_schema.cpp)

find_package(nlohmann_json_schema_validator REQUIRED)

target_link_libraries(unit-tests-handler-dns
PRIVATE
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
nlohmann_json_schema_validator
Visor::Handler::Dns
Visor::Lib::Test)

Expand Down
4 changes: 3 additions & 1 deletion src/handlers/dns/v2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ add_executable(unit-tests-handler-dns-v2
tests/test_dns_layer.cpp
tests/test_dnstap.cpp)

find_package(nlohmann_json_schema_validator REQUIRED)

target_link_libraries(unit-tests-handler-dns-v2
PRIVATE
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
nlohmann_json_schema_validator
Visor::Handler::Dns::V2
Visor::Lib::Test)

Expand Down
4 changes: 3 additions & 1 deletion src/handlers/net/v1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ else()
tests/test_json_schema.cpp)
endif()

find_package(nlohmann_json_schema_validator REQUIRED)

target_link_libraries(unit-tests-handler-net
PRIVATE
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
nlohmann_json_schema_validator
Visor::Handler::Net
Visor::Handler::Dns
Visor::Lib::Test)
Expand Down
4 changes: 3 additions & 1 deletion src/handlers/net/v2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Handler::Net::V2 PARENT_
if (NOT WIN32)
add_executable(unit-tests-handler-net-v2 tests/test_net_layer.cpp)

find_package(nlohmann_json_schema_validator REQUIRED)

target_link_libraries(unit-tests-handler-net-v2
PRIVATE
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
nlohmann_json_schema_validator
Visor::Handler::Net::V2
Visor::Handler::Dns::V2
Visor::Lib::Test)
Expand Down
4 changes: 3 additions & 1 deletion src/handlers/pcap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ add_executable(unit-tests-handler-pcap
tests/test_pcap_layer.cpp
tests/test_json_schema.cpp)

find_package(nlohmann_json_schema_validator REQUIRED)

target_link_libraries(unit-tests-handler-pcap
PRIVATE
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
nlohmann_json_schema_validator
Visor::Handler::Pcap
Visor::Lib::Test)

Expand Down
5 changes: 3 additions & 2 deletions src/inputs/dnstap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ if(NOT WIN32)
set(DNSTAP_ADDITIONAL_LIBS fstrm)
endif()

find_package(uvw REQUIRED)

target_link_libraries(VisorInputDnstap
PUBLIC
${DNSTAP_ADDITIONAL_LIBS}
Visor::Core
Visor::Lib::Utils
${CONAN_LIBS_LIBUV}
${CONAN_LIBS_UVW}
uvw::uvw
)

set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Input::Dnstap PARENT_SCOPE)
Expand Down
11 changes: 5 additions & 6 deletions src/inputs/flow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ target_include_directories(VisorInputFlow
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

find_package(pcapplusplus REQUIRED)
find_package(uvw REQUIRED)

target_link_libraries(VisorInputFlow
PUBLIC
netflow
sflow
Visor::Core
${CONAN_LIBS_LIBUV}
${CONAN_LIBS_UVW}
${CONAN_LIBS_PCAPPLUSPLUS}
${CONAN_LIBS_PTHREADS4W}
${CONAN_LIBS_LIBPCAP}
${CONAN_LIBS_NPCAP}
pcapplusplus::pcapplusplus
uvw::uvw
)

set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Input::Flow PARENT_SCOPE)
Expand Down
4 changes: 3 additions & 1 deletion src/inputs/mock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Input::Mock PARENT_SCOPE
## TEST SUITE
add_executable(unit-tests-input-mock test_mock.cpp)

find_package(Catch2 REQUIRED)

target_link_libraries(unit-tests-input-mock
PRIVATE
Visor::Input::Mock
${CONAN_LIBS_CATCH2})
catch2::catch2_with_main)

add_test(NAME unit-tests-input-mock
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src
Expand Down
9 changes: 3 additions & 6 deletions src/inputs/netprobe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ target_include_directories(VisorInputNetProbe
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

find_package(uvw REQUIRED)

target_link_libraries(VisorInputNetProbe
PUBLIC
Visor::Core
Visor::Lib::Tcp
${CONAN_LIBS_LIBUV}
${CONAN_LIBS_UVW}
${CONAN_LIBS_PCAPPLUSPLUS}
${CONAN_LIBS_PTHREADS4W}
${CONAN_LIBS_LIBPCAP}
${CONAN_LIBS_NPCAP}
uvw::uvw
)

set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Input::NetProbe PARENT_SCOPE)
Expand Down
8 changes: 3 additions & 5 deletions src/inputs/pcap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ target_include_directories(VisorInputPcap

target_link_libraries(VisorInputPcap
PUBLIC
${CONAN_LIBS_PCAPPLUSPLUS}
${CONAN_LIBS_PTHREADS4W}
${CONAN_LIBS_LIBPCAP}
${CONAN_LIBS_NPCAP}
Visor::Core
Visor::Lib::Utils
)
Expand All @@ -32,9 +28,11 @@ add_executable(unit-tests-input-pcap
tests/test_mock_traffic.cpp
tests/test_parse_pcap.cpp)

find_package(Catch2 REQUIRED)

target_link_libraries(unit-tests-input-pcap
PRIVATE Visor::Input::Pcap
${CONAN_LIBS_CATCH2})
catch2::catch2_with_main)

add_test(NAME unit-tests-input-pcap
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src
Expand Down

0 comments on commit 3e1745d

Please sign in to comment.