From a0126a86e7f8de5004e0aacf68ab8c5019b3e921 Mon Sep 17 00:00:00 2001 From: vvandrounik Date: Thu, 23 Apr 2020 23:43:38 +0300 Subject: [PATCH] [ryml] Add new port (#10793) * [ryml] Add new port * Remove deprecated include * Fix ver regarding maintainer guide * Mark port as unsupport arm/arm64/osx * Update CI baseline * Replace deprecated func vcpkg_extract_source_archive, add PREFER_NINJA to conf * Fix wrong placed port states * Resolve merge conflict --- ports/ryml/CONTROL | 6 ++++ ports/ryml/cmake-fix.patch | 34 ++++++++++++++++++ ports/ryml/portfile.cmake | 70 ++++++++++++++++++++++++++++++++++++++ scripts/ci.baseline.txt | 3 ++ 4 files changed, 113 insertions(+) create mode 100644 ports/ryml/CONTROL create mode 100644 ports/ryml/cmake-fix.patch create mode 100644 ports/ryml/portfile.cmake diff --git a/ports/ryml/CONTROL b/ports/ryml/CONTROL new file mode 100644 index 0000000000..b6efa45ff3 --- /dev/null +++ b/ports/ryml/CONTROL @@ -0,0 +1,6 @@ +Source: ryml +Version: 2020-04-12 +Homepage: https://github.com/biojppm/rapidyaml +Description: Rapid YAML library +Build-Depends: c4core[core] +Supports: !(arm|arm64|osx) \ No newline at end of file diff --git a/ports/ryml/cmake-fix.patch b/ports/ryml/cmake-fix.patch new file mode 100644 index 0000000000..f2ee817036 --- /dev/null +++ b/ports/ryml/cmake-fix.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3e4eb23..115b8aa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,5 @@ + cmake_minimum_required(VERSION 3.9) ++ + project(ryml) + + include(./ext/c4core/cmake/c4Project.cmake) +@@ -19,8 +20,7 @@ option(RYML_BUILD_API "Enable API generation (python, etc)" OFF) + + #------------------------------------------------------- + +-c4_require_subproject(c4core INCORPORATE +- SUBDIRECTORY ${RYML_EXT_DIR}/c4core) ++find_package(c4core CONFIG REQUIRED) + + c4_add_library(ryml + SOURCES +@@ -46,10 +46,10 @@ c4_add_library(ryml + ryml.natvis + SOURCE_ROOT ${RYML_SRC_DIR} + INC_DIRS ++ $ + $ + $ +- LIBS c4core +- INCORPORATE c4core ++ LIBS c4core::c4core + ) + + if(NOT RYML_DEFAULT_CALLBACKS) + diff --git a/ports/ryml/portfile.cmake b/ports/ryml/portfile.cmake new file mode 100644 index 0000000000..ed7953f2e5 --- /dev/null +++ b/ports/ryml/portfile.cmake @@ -0,0 +1,70 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_fail_port_install( + ON_ARCH "arm" "arm64" + ON_TARGET "OSX" +) + +# Get rapidyaml src +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO biojppm/rapidyaml + REF ec23e87007ccc39c6132345c154b267de9381706 + SHA512 7d349c0dd58da814dad02de88a5c54394ef8d77e7db3014fb5fb684d519e35604d45f5d16db5ed6ed8ccb52b1ed4a4dbc91e717a091b54b04dc18901800e12c1 + HEAD_REF master + PATCHES cmake-fix.patch +) + +set(COMMIT_HASH a0f0c17bfc9a9a91cc72891539b513c129c6d122) + +# Get cmake scripts for rapidyaml +vcpkg_download_distfile(CMAKE_ARCHIVE + URLS "https://github.com/biojppm/cmake/archive/${COMMIT_HASH}.zip" + FILENAME "cmake-${COMMIT_HASH}.zip" + SHA512 4fbc711f3120501fa40733c3b66e34cd6a7e1b598b1378fbb59d1a87c88290a03d021f5176634089da41682fd918d7e27c6c146052dec54d7e956be15f12744f +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH_CMAKE + ARCHIVE ${CMAKE_ARCHIVE} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/deps" +) + +file(REMOVE_RECURSE "${SOURCE_PATH}/ext/c4core/cmake") +file(RENAME ${SOURCE_PATH_CMAKE} "${SOURCE_PATH}/ext/c4core/cmake") + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +if(EXISTS ${CURRENT_PACKAGES_DIR}/cmake) + vcpkg_fixup_cmake_targets(CONFIG_PATH cmake) +elseif(EXISTS ${CURRENT_PACKAGES_DIR}/lib/cmake/ryml) + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/ryml) +endif() + +# Move headers and natvis to own dir +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include/ryml") +file(RENAME "${CURRENT_PACKAGES_DIR}/include/ryml.hpp" "${CURRENT_PACKAGES_DIR}/include/ryml/ryml.hpp") +file(RENAME "${CURRENT_PACKAGES_DIR}/include/ryml_std.hpp" "${CURRENT_PACKAGES_DIR}/include/ryml/ryml_std.hpp") +file(RENAME "${CURRENT_PACKAGES_DIR}/include/ryml.natvis" "${CURRENT_PACKAGES_DIR}/include/ryml/ryml.natvis") + +# Fix paths in headers file +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ryml/ryml.hpp" "./c4" "../c4") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ryml/ryml_std.hpp" "./c4" "../c4") + +# Fix paths in config file +file(READ "${CURRENT_PACKAGES_DIR}/share/ryml/rymlConfig.cmake" _contents) +string(REGEX REPLACE [[[ \t\r\n]*"\${PACKAGE_PREFIX_DIR}[\./\\]*"]] [["${PACKAGE_PREFIX_DIR}/../.."]] _contents "${_contents}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/ryml/rymlConfig.cmake" "${_contents}") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL + "${SOURCE_PATH}/LICENSE.txt" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/ryml" RENAME copyright) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 04d6ea2577..d8b6fe9f94 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1591,6 +1591,9 @@ rttr:arm-uwp=fail rttr:x64-uwp=fail rxspencer:x64-uwp=fail rxspencer:arm-uwp=fail +ryml:arm-uwp=fail +ryml:arm64-windows=fail +ryml:x64-osx=fail ryu:arm-uwp=fail ryu:x64-uwp=fail ryu:x64-windows-static=fail