diff --git a/.github/actions/build-cpp/entrypoint.sh b/.github/actions/build-cpp/entrypoint.sh index 18ad7f92b..7bfb61342 100644 --- a/.github/actions/build-cpp/entrypoint.sh +++ b/.github/actions/build-cpp/entrypoint.sh @@ -18,7 +18,7 @@ function build() { cp -rf /github/workspace/integration_tests/ /pktvisor-src/integration_tests/ cp -rf /github/workspace/cmake/ /pktvisor-src/cmake/ cp -rf /github/workspace/CMakeLists.txt /pktvisor-src/ - cp -rf /github/workspace/conanfile.txt /pktvisor-src/ + cp -rf /github/workspace/conanfile.py /pktvisor-src/ mkdir /tmp/build cd /tmp/build cp -rf /pktvisor-src/build/conan_home/ . diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 4eaa5ffa2..b1f40e9cf 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -51,7 +51,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: Configure CMake @@ -112,7 +112,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: Configure CMake @@ -170,16 +170,11 @@ jobs: with: version: 1.64.1 - - name: Remove libpcap from conanfile - shell: bash - run: | - sed -i -e "s/libpcap.*//g" "${{github.workspace}}\conanfile.txt" - - name: Setup Conan Cache uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: Configure CMake @@ -292,7 +287,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: Build pktvisord + push symbol to bugsplat.com @@ -832,7 +827,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}-arm64- - name: Build pktvisord + push symbol to bugsplat.com diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 7e589c0a2..18990890c 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -38,7 +38,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: linux package install @@ -282,16 +282,11 @@ jobs: with: version: 1.64.1 - - name: Remove libpcap from conanfile - shell: bash - run: | - sed -i -e "s/libpcap.*//g" "${{github.workspace}}\conanfile.txt" - - name: Setup Conan Cache uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: Configure CMake @@ -406,7 +401,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}-arm64- - name: Build pktvisord + push symbol to backtrace.io @@ -528,7 +523,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: Build pktvisord + push symbol to backtrace.io diff --git a/.github/workflows/build_cross.yml b/.github/workflows/build_cross.yml index b75d87b83..7009fdbc1 100644 --- a/.github/workflows/build_cross.yml +++ b/.github/workflows/build_cross.yml @@ -114,8 +114,7 @@ jobs: path: src - name: Remove crashpad from conanfile - run: | - sed -i -e "s/crashpad.*//g" ${{github.workspace}}/src/conanfile.txt + run: sed -i "/crashpad/d" ${{github.workspace}}/src/conanfile.py - name: Install dependencies run: | diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml index e6d933726..119bc3769 100644 --- a/.github/workflows/build_debug.yml +++ b/.github/workflows/build_debug.yml @@ -39,7 +39,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: linux package install @@ -100,7 +100,7 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/build/conan_home/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - name: Build pktvisord + push symbol to backtrace.io diff --git a/.gitignore b/.gitignore index 83447f79a..bd0450e41 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ localconfig/ .cache/ .vscode/ build/ +CMakeUserPresets.json \ No newline at end of file diff --git a/README.md b/README.md index bc366cc44..ce27331d2 100644 --- a/README.md +++ b/README.md @@ -595,7 +595,7 @@ pktvisor is developed and tested on Linux and OSX. A Windows port is in progress * CMake >= 3.13 (`cmake`) * C++ compiler supporting C++17 -For the list of packages included by conan, see [conanfile.txt](conanfile.txt) +For the list of packages included by conan, see [conanfile.py](conanfile.py) #### Building diff --git a/cmd/pktvisor-reader/CMakeLists.txt b/cmd/pktvisor-reader/CMakeLists.txt index 31e99f07a..091c74dd6 100644 --- a/cmd/pktvisor-reader/CMakeLists.txt +++ b/cmd/pktvisor-reader/CMakeLists.txt @@ -4,6 +4,6 @@ find_package(docopt REQUIRED) target_link_libraries(pktvisor-reader PRIVATE - docopt::docopt + docopt_s ${VISOR_STATIC_PLUGINS} ) diff --git a/cmd/pktvisord/CMakeLists.txt b/cmd/pktvisord/CMakeLists.txt index 895624db1..e6512627f 100644 --- a/cmd/pktvisord/CMakeLists.txt +++ b/cmd/pktvisord/CMakeLists.txt @@ -15,7 +15,7 @@ target_link_libraries(pktvisord PRIVATE timer ${ADDITIONAL_LIBS} - docopt::docopt + docopt_s Visor::Core ${VISOR_STATIC_PLUGINS} ) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 000000000..dbd8096d4 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,34 @@ +from conan import ConanFile + + +class Pktvisor(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps" + + def requirements(self): + self.requires("catch2/3.6.0") + self.requires("corrade/2020.06") + self.requires("cpp-httplib/0.16.0") + self.requires("docopt.cpp/0.6.3") + self.requires("fast-cpp-csv-parser/cci.20240102") + self.requires("json-schema-validator/2.3.0") + self.requires("libmaxminddb/1.10.0") + self.requires("nlohmann_json/3.11.3") + self.requires("openssl/3.3.1") + if self.settings.os != "Windows": + self.requires("libpcap/1.10.4", force=True) + self.requires("opentelemetry-proto/1.3.0") + self.requires("pcapplusplus/23.09") + self.requires("abseil/20240116.2", force=True) + self.requires("protobuf/5.27.0") + self.requires("sigslot/1.2.2") + self.requires("spdlog/1.14.1") + self.requires("uvw/3.4.0") + self.requires("yaml-cpp/0.8.0") + self.requires("robin-hood-hashing/3.11.5") + self.requires("libcurl/8.9.1") + self.requires("crashpad/cci.20220219") + + def build_requirements(self): + self.tool_requires("corrade/2020.06") + self.tool_requires("protobuf/5.27.0") diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index e7d625ae9..000000000 --- a/conanfile.txt +++ /dev/null @@ -1,32 +0,0 @@ -[requires] -catch2/3.6.0 -corrade/2020.06 -cpp-httplib/0.16.0 -docopt.cpp/0.6.3 -fast-cpp-csv-parser/cci.20240102 -json-schema-validator/2.3.0 -libmaxminddb/1.10.0 -nlohmann_json/3.11.3 -openssl/3.3.1 -opentelemetry-proto/1.3.0 -pcapplusplus/23.09 -abseil/20240116.2 -protobuf/5.27.0 -sigslot/1.2.2 -spdlog/1.14.1 -uvw/3.4.0 -libpcap/1.10.4 -yaml-cpp/0.8.0 -robin-hood-hashing/3.11.5 -libcurl/8.9.1 -crashpad/cci.20220219 - -[tool_requires] -corrade/2020.06 -protobuf/5.27.0 - -[options] -pcapplusplus:immediate_mode=True - -[generators] -cmake_find_package \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 898700706..5e71c815e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,7 +19,7 @@ COPY ./golang/ /pktvisor-src/golang/ COPY ./integration_tests/ /pktvisor-src/integration_tests/ COPY ./cmake/ /pktvisor-src/cmake/ COPY ./CMakeLists.txt /pktvisor-src/ -COPY ./conanfile.txt /pktvisor-src/ +COPY ./conanfile.py /pktvisor-src/ WORKDIR /tmp/build diff --git a/libs/visor_dns/CMakeLists.txt b/libs/visor_dns/CMakeLists.txt index ca40e1bb4..643c3f43a 100644 --- a/libs/visor_dns/CMakeLists.txt +++ b/libs/visor_dns/CMakeLists.txt @@ -1,6 +1,6 @@ message(STATUS "Visor Lib DNS Helper") -find_package(pcapplusplus REQUIRED) +find_package(PcapPlusPlus REQUIRED) find_package(Catch2 REQUIRED) add_library(VisorLibDns @@ -19,7 +19,7 @@ target_include_directories(VisorLibDns target_link_libraries(VisorLibDns PUBLIC Visor::Lib::Tcp - pcapplusplus::pcapplusplus + PcapPlusPlus::PcapPlusPlus ) ## TEST SUITE @@ -30,7 +30,7 @@ add_executable(unit-tests-visor-dns target_link_libraries(unit-tests-visor-dns PRIVATE Visor::Lib::Dns - catch2::catch2_with_main) + Catch2::Catch2WithMain) add_test(NAME unit-tests-visor-dns WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/visor_dns diff --git a/libs/visor_tcp/CMakeLists.txt b/libs/visor_tcp/CMakeLists.txt index b1cd87bc3..ed037ef7f 100644 --- a/libs/visor_tcp/CMakeLists.txt +++ b/libs/visor_tcp/CMakeLists.txt @@ -1,6 +1,6 @@ message(STATUS "Visor Lib TCP Helper") -find_package(pcapplusplus REQUIRED) +find_package(PcapPlusPlus REQUIRED) add_library(VisorLibTcp VisorTcpLayer.cpp) @@ -13,5 +13,5 @@ target_include_directories(VisorLibTcp target_link_libraries(VisorLibTcp PUBLIC - pcapplusplus::pcapplusplus + PcapPlusPlus::PcapPlusPlus ) diff --git a/libs/visor_test/CMakeLists.txt b/libs/visor_test/CMakeLists.txt index c98029dbe..b2fbf4429 100644 --- a/libs/visor_test/CMakeLists.txt +++ b/libs/visor_test/CMakeLists.txt @@ -13,7 +13,7 @@ target_include_directories(VisorLibTest target_link_libraries(VisorLibTest INTERFACE spdlog::spdlog - catch2::catch2_with_main) + Catch2::Catch2WithMain) target_compile_features(VisorLibTest INTERFACE cxx_std_17) diff --git a/libs/visor_utils/CMakeLists.txt b/libs/visor_utils/CMakeLists.txt index 9bfc30c6a..ca3b14780 100644 --- a/libs/visor_utils/CMakeLists.txt +++ b/libs/visor_utils/CMakeLists.txt @@ -1,6 +1,6 @@ message(STATUS "Visor Lib Utils") -find_package(pcapplusplus REQUIRED) +find_package(PcapPlusPlus REQUIRED) find_package(fmt REQUIRED) find_package(Catch2 REQUIRED) @@ -15,7 +15,7 @@ target_include_directories(VisorLibUtils target_link_libraries(VisorLibUtils PUBLIC - pcapplusplus::pcapplusplus + PcapPlusPlus::PcapPlusPlus fmt::fmt ) @@ -25,7 +25,7 @@ add_executable(unit-tests-visor-utils test_utils.cpp) target_link_libraries(unit-tests-visor-utils PRIVATE Visor::Lib::Utils - catch2::catch2_with_main) + Catch2::Catch2WithMain) add_test(NAME unit-tests-visor-utils WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libs diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3433a8e58..66f7e1fcd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -84,7 +84,7 @@ target_link_libraries(unit-tests-visor-core PRIVATE Visor::Core ${VISOR_STATIC_PLUGINS} - catch2::catch2_with_main) + Catch2::Catch2WithMain) add_test(NAME unit-tests-visor-core WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src diff --git a/src/inputs/flow/CMakeLists.txt b/src/inputs/flow/CMakeLists.txt index 3ab66ce77..70b588684 100644 --- a/src/inputs/flow/CMakeLists.txt +++ b/src/inputs/flow/CMakeLists.txt @@ -14,7 +14,7 @@ target_include_directories(VisorInputFlow $ ) -find_package(pcapplusplus REQUIRED) +find_package(PcapPlusPlus REQUIRED) find_package(uvw REQUIRED) target_link_libraries(VisorInputFlow @@ -22,7 +22,7 @@ target_link_libraries(VisorInputFlow netflow sflow Visor::Core - pcapplusplus::pcapplusplus + PcapPlusPlus::PcapPlusPlus uvw::uvw ) diff --git a/src/inputs/mock/CMakeLists.txt b/src/inputs/mock/CMakeLists.txt index a7a9260e2..c446742f0 100644 --- a/src/inputs/mock/CMakeLists.txt +++ b/src/inputs/mock/CMakeLists.txt @@ -29,7 +29,7 @@ find_package(Catch2 REQUIRED) target_link_libraries(unit-tests-input-mock PRIVATE Visor::Input::Mock - catch2::catch2_with_main) + Catch2::Catch2WithMain) add_test(NAME unit-tests-input-mock WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src diff --git a/src/inputs/pcap/CMakeLists.txt b/src/inputs/pcap/CMakeLists.txt index 250a2c3d2..6876f02da 100644 --- a/src/inputs/pcap/CMakeLists.txt +++ b/src/inputs/pcap/CMakeLists.txt @@ -32,7 +32,7 @@ find_package(Catch2 REQUIRED) target_link_libraries(unit-tests-input-pcap PRIVATE Visor::Input::Pcap - catch2::catch2_with_main) + Catch2::Catch2WithMain) add_test(NAME unit-tests-input-pcap WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src