diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d6fb37..ca689f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,22 @@ cmake_minimum_required(VERSION 3.17) +if(NOT CMAKE_TOOLCHAIN_FILE) +if (NOT DEFINED "$ENV{VCPKG_ROOT}") + message(WARNING "VCPKG_ROOT env var not found, install vcpkg and set the env var") +endif() +set(vcpkg "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") +if (NOT EXISTS "${vcpkg}") +set(vcpkg "$ENV{HOME}/vcpkg/scripts/buildsystems/vcpkg.cmake") +endif() +if (EXISTS "${vcpkg}") + set(CMAKE_TOOLCHAIN_FILE "${vcpkg}" + CACHE FILEPATH "CMake toolchain file") + message(STATUS "vcpkg toolchain found: ${CMAKE_TOOLCHAIN_FILE}") +else() +message(STATUS "vcpkg toolchain NOT found") +endif() +endif() +set(VCPKG_OVERLAY_PORTS "${CMAKE_SOURCE_DIR}/ports/overlay") + project(prometheus_disk_usage) set(CMAKE_CXX_STANDARD 17) @@ -7,33 +25,6 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) include(CheckSymbolExists) -include(conan.cmake) - -conan_cmake_configure(REQUIRES - fmt/6.1.2 - boost/1.74.0 - nlohmann_json/3.9.1 - rapidjson/cci.20220822 - snappy/1.1.9 - gsl-lite/0.38.1 - gtest/1.11.0 - GENERATORS cmake_find_package) - -conan_cmake_autodetect(settings) - -option(CONAN_MACOS_ARM64 "Dowload (or build) MacOS Arm64 deps from conan" OFF) - -if(DEFINED ENV{CONAN_MACOS_ARM64}) - if($ENV{CONAN_MACOS_ARM64} MATCHES "ON") - set(CONAN_MACOS_ARM64 ON) - endif() -endif() - -if (CONAN_MACOS_ARM64) - set(CONAN_PROFILE_HOST_ARG "${PROJECT_SOURCE_DIR}/conan/profiles/armv8") -else() - set(CONAN_PROFILE_HOST_ARG "") -endif() # the pre-built fmt dep was compiled with _FORTIFY_SOURCE @@ -48,13 +39,6 @@ if (NOT HAVE_SNPRINTF_CHK) add_definitions(-DFMT_HEADER_ONLY) endif () - -conan_cmake_install(PATH_OR_REFERENCE . - BUILD missing - REMOTE conancenter - SETTINGS ${settings} - PROFILE_HOST ${CONAN_PROFILE_HOST_ARG}) - list(PREPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}") add_subdirectory(src) diff --git a/ports/overlay/python3/portfile.cmake b/ports/overlay/python3/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/ports/overlay/python3/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/ports/overlay/python3/vcpkg.json b/ports/overlay/python3/vcpkg.json new file mode 100644 index 0000000..9dc9fb9 --- /dev/null +++ b/ports/overlay/python3/vcpkg.json @@ -0,0 +1,10 @@ +{ + "name": "python3", + "version": "3.11.8", + "port-version": 0, + "features": { + "ssl": { + "description": "" + } + } +} diff --git a/src/pdu/CMakeLists.txt b/src/pdu/CMakeLists.txt index 661366f..39aab46 100644 --- a/src/pdu/CMakeLists.txt +++ b/src/pdu/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Boost REQUIRED) +find_package(Boost REQUIRED COMPONENTS program_options filesystem iostreams) find_package(fmt REQUIRED) find_package(nlohmann_json REQUIRED) find_package(Snappy REQUIRED) diff --git a/src/pypdu/CMakeLists.txt b/src/pypdu/CMakeLists.txt index 9772961..39d5ce2 100644 --- a/src/pypdu/CMakeLists.txt +++ b/src/pypdu/CMakeLists.txt @@ -3,7 +3,7 @@ project(pypdu) set(CMAKE_CXX_STANDARD 17) -find_package(RapidJSON) +find_package(RapidJSON CONFIG REQUIRED) add_subdirectory(../../third_party/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11) pybind11_add_module(pypdu @@ -25,7 +25,7 @@ set_property(TARGET pypdu PROPERTY CXX_VISIBILITY_PRESET hidden) target_compile_definitions(pypdu PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO} PYTHON_VERSION_MAJOR=${PYTHON_VERSION_MAJOR}) -target_link_libraries(pypdu PUBLIC plib RapidJSON::RapidJSON) +target_link_libraries(pypdu PUBLIC plib rapidjson) # determine git revision diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..50b270f --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,14 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "7adc2e4d49e8d0efc07a369079faa6bc3dbb90f3", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..03d8492 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,70 @@ +{ + "dependencies": [ + { + "name": "fmt", + "version>=": "6.1.2" + }, + { + "name": "boost", + "version>=": "1.85.0" + }, + { + "name": "boost-program-options", + "version>=": "1.85.0" + }, + { + "name": "nlohmann-json", + "version>=": "3.9.1" + }, + { + "name": "rapidjson", + "version>=": "cci.20220822" + }, + { + "name": "snappy", + "version>=": "1.1.9" + }, + { + "name": "gsl-lite", + "version>=": "0.38.1" + }, + { + "name": "gtest", + "version>=": "1.11.0" + } + ], + "overrides": [ + { + "name": "fmt", + "version": "6.1.2" + }, + { + "name": "boost", + "version": "1.85.0" + }, + { + "name": "boost-program-options", + "version": "1.85.0#2" + }, + { + "name": "nlohmann-json", + "version": "3.9.1" + }, + { + "name": "rapidjson", + "version": "2023-07-17#1" + }, + { + "name": "snappy", + "version": "1.1.9" + }, + { + "name": "gsl-lite", + "version": "0.38.1" + }, + { + "name": "gtest", + "version": "1.11.0" + } + ] +} \ No newline at end of file