diff --git a/ports/tomlplusplus/portfile.cmake b/ports/tomlplusplus/portfile.cmake index 25cb4544c6..49eb9c8d5e 100644 --- a/ports/tomlplusplus/portfile.cmake +++ b/ports/tomlplusplus/portfile.cmake @@ -11,13 +11,29 @@ vcpkg_from_github( vcpkg_configure_meson( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -Dgenerate_cmake_config=false -Dbuild_tests=false -Dbuild_examples=false ) vcpkg_install_meson() vcpkg_fixup_pkgconfig() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/tomlplusplus) +# Fixup link lib name and multi-config +find_library(lib NAMES tomlplusplus PATHS "${CURRENT_PACKAGES_DIR}/lib" NO_DEFAULT_PATH REQUIRED) +cmake_path(GET lib FILENAME name) +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/tomlplusplus/tomlplusplusConfig.cmake" + [[(IMPORTED_LOCATION "..PACKAGE_PREFIX_DIR./lib/)[^"]*"]] + " \\1${name}\"" + REGEX +) +if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/tomlplusplus/tomlplusplusConfig.cmake" + [[IMPORTED_LOCATION ("..PACKAGE_PREFIX_DIR.)(/lib/[^"]*")]] + [[IMPORTED_CONFIGURATIONS "DEBUG;RELEASE" + IMPORTED_LOCATION_DEBUG \1/debug\2 + IMPORTED_LOCATION_RELEASE \1\2]] + REGEX + ) +endif() -file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/tomlplusplus/usage b/ports/tomlplusplus/usage deleted file mode 100644 index b178ba27df..0000000000 --- a/ports/tomlplusplus/usage +++ /dev/null @@ -1,5 +0,0 @@ -The package tomlplusplus can be imported via CMake FindPkgConfig module: - - find_package(PkgConfig REQUIRED) - pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus) - target_link_libraries(main PkgConfig::tomlplusplus) diff --git a/ports/tomlplusplus/vcpkg.json b/ports/tomlplusplus/vcpkg.json index bdde65521a..b981492bc8 100644 --- a/ports/tomlplusplus/vcpkg.json +++ b/ports/tomlplusplus/vcpkg.json @@ -1,11 +1,16 @@ { "name": "tomlplusplus", "version": "3.4.0", + "port-version": 1, "description": "Header-only TOML config file parser and serializer for modern C++.", "homepage": "https://marzer.github.io/tomlplusplus/", "license": "MIT", "supports": "!uwp", "dependencies": [ + { + "name": "vcpkg-cmake-config", + "host": true + }, { "name": "vcpkg-tool-meson", "host": true diff --git a/scripts/test_ports/vcpkg-ci-tomlplusplus/portfile.cmake b/scripts/test_ports/vcpkg-ci-tomlplusplus/portfile.cmake new file mode 100644 index 0000000000..dd25706120 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-tomlplusplus/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-tomlplusplus/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-tomlplusplus/project/CMakeLists.txt new file mode 100644 index 0000000000..4a54d5b684 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-tomlplusplus/project/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.30) +project(tomlplusplus-test CXX) + + +find_package(tomlplusplus CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE tomlplusplus::tomlplusplus) + + +find_package(PkgConfig REQUIRED) +pkg_check_modules(tomlplusplus_pc tomlplusplus REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.cpp) +target_compile_features(main-pkconfig PRIVATE cxx_std_17) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::tomlplusplus_pc) diff --git a/scripts/test_ports/vcpkg-ci-tomlplusplus/project/main.cpp b/scripts/test_ports/vcpkg-ci-tomlplusplus/project/main.cpp new file mode 100644 index 0000000000..338201089a --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-tomlplusplus/project/main.cpp @@ -0,0 +1,22 @@ +#include +#include + +int main(int argc, char** argv) +{ + if (argc < 2) + return 1; + + try + { + toml::table tbl; + tbl = toml::parse_file(argv[1]); + std::cout << tbl << "\n"; + } + catch (const toml::parse_error& err) + { + std::cerr << "Parsing failed: " << err << "\n"; + return 2; + } + + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-tomlplusplus/vcpkg.json b/scripts/test_ports/vcpkg-ci-tomlplusplus/vcpkg.json new file mode 100644 index 0000000000..155989ea7f --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-tomlplusplus/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "vcpkg-ci-tomlplusplus", + "version-string": "ci", + "description": "Port to force features of tomlplusplus within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + "tomlplusplus", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 96b6746fd3..683330be47 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9366,7 +9366,7 @@ }, "tomlplusplus": { "baseline": "3.4.0", - "port-version": 0 + "port-version": 1 }, "tomsolver": { "baseline": "1.0.1", diff --git a/versions/t-/tomlplusplus.json b/versions/t-/tomlplusplus.json index 98b0f86af7..77af711fb7 100644 --- a/versions/t-/tomlplusplus.json +++ b/versions/t-/tomlplusplus.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c89c408f778aebf69ac0bbbb3d19db57c97d664c", + "version": "3.4.0", + "port-version": 1 + }, { "git-tree": "9866e66fa79aa1addd508e672062392313fc6085", "version": "3.4.0",