aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/ryml
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/ryml')
-rw-r--r--vcpkg/ports/ryml/cmake-fix.patch29
-rw-r--r--vcpkg/ports/ryml/portfile.cmake71
-rw-r--r--vcpkg/ports/ryml/vcpkg.json32
3 files changed, 132 insertions, 0 deletions
diff --git a/vcpkg/ports/ryml/cmake-fix.patch b/vcpkg/ports/ryml/cmake-fix.patch
new file mode 100644
index 0000000..ae14fc2
--- /dev/null
+++ b/vcpkg/ports/ryml/cmake-fix.patch
@@ -0,0 +1,29 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d80b395..8f1699e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -27,10 +27,7 @@ option(RYML_INSTALL "Enable install target" ON)
+
+ #-------------------------------------------------------
+
+-c4_require_subproject(c4core INCORPORATE
+- SUBDIRECTORY ${RYML_EXT_DIR}/c4core
+- OVERRIDE C4CORE_INSTALL ${RYML_INSTALL}
+-)
++find_package(c4core CONFIG REQUIRED)
+
+ c4_add_library(ryml
+ SOURCES
+@@ -77,10 +74,10 @@ c4_add_library(ryml
+ ryml.natvis
+ SOURCE_ROOT ${RYML_SRC_DIR}
+ INC_DIRS
++ $<BUILD_INTERFACE:${C4CORE_INCLUDE_DIR}>
+ $<BUILD_INTERFACE:${RYML_SRC_DIR}>
+ $<INSTALL_INTERFACE:include>
+- LIBS c4core
+- INCORPORATE c4core
++ LIBS c4core::c4core
+ )
+
+ if(RYML_WITH_TAB_TOKENS)
diff --git a/vcpkg/ports/ryml/portfile.cmake b/vcpkg/ports/ryml/portfile.cmake
new file mode 100644
index 0000000..ba286bc
--- /dev/null
+++ b/vcpkg/ports/ryml/portfile.cmake
@@ -0,0 +1,71 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+# Get rapidyaml src
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO biojppm/rapidyaml
+ REF "v${VERSION}"
+ SHA512 e0dd2409e08e556c65fb906de546c1012627aea97a36964d65a1265e7c2465bee1d7dceafebb843ae294a348f8c5fe7b6887e7ddffbc1b1eb419e924d94b41fa
+ HEAD_REF master
+ PATCHES cmake-fix.patch
+)
+
+set(CM_COMMIT_HASH fe41e86552046c3df9ba73a40bf3d755df028c1e)
+
+# Get cmake scripts for rapidyaml
+vcpkg_download_distfile(
+ CMAKE_ARCHIVE
+ URLS "https://github.com/biojppm/cmake/archive/${CM_COMMIT_HASH}.zip"
+ FILENAME "cmake-${CM_COMMIT_HASH}.zip"
+ SHA512 7292f9856d9c41581f2731e73fdf08880e0f4353b757da38a13ec89b62c5c8cb52b9efc1a9ff77336efa0b6809727c17649e607d8ecacc965a9b2a7a49925237
+)
+
+vcpkg_extract_source_archive(
+ 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_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ def-callbacks RYML_DEFAULT_CALLBACKS
+ dbg RYML_DBG
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_cmake_install()
+
+vcpkg_copy_pdbs()
+
+if(EXISTS "${CURRENT_PACKAGES_DIR}/cmake")
+ vcpkg_cmake_config_fixup(CONFIG_PATH cmake)
+elseif(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake/ryml")
+ vcpkg_cmake_config_fixup(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" IGNORE_UNCHANGED)
+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")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
diff --git a/vcpkg/ports/ryml/vcpkg.json b/vcpkg/ports/ryml/vcpkg.json
new file mode 100644
index 0000000..607d92f
--- /dev/null
+++ b/vcpkg/ports/ryml/vcpkg.json
@@ -0,0 +1,32 @@
+{
+ "name": "ryml",
+ "version": "0.10.0",
+ "description": "Rapid YAML library",
+ "homepage": "https://github.com/biojppm/rapidyaml",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "c4core",
+ "default-features": false
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "def-callbacks"
+ ],
+ "features": {
+ "dbg": {
+ "description": "Enable (very verbose) ryml debug prints."
+ },
+ "def-callbacks": {
+ "description": "Enable ryml's default implementation of callbacks: allocate(), free(), error()"
+ }
+ }
+}