From 1ef1ed0d82c7418b5314cf334b67afd1762e90d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kranjc?= Date: Fri, 8 Jan 2021 21:01:00 +0100 Subject: [PATCH] [type-safe] New port. (#15468) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [type-safe] New port. [debug-assert] Added as it is a dependency. * [type-safe] Formatting fix. * [debug-assert] Add homepage to vcpkg.json Co-authored-by: Blaž Kranjc --- ports/debug-assert/portfile.cmake | 24 ++++++++++++++++++++++++ ports/debug-assert/vcpkg.json | 6 ++++++ ports/type-safe/disable_tests.patch | 12 ++++++++++++ ports/type-safe/portfile.cmake | 26 ++++++++++++++++++++++++++ ports/type-safe/vcpkg.json | 9 +++++++++ 5 files changed, 77 insertions(+) create mode 100644 ports/debug-assert/portfile.cmake create mode 100644 ports/debug-assert/vcpkg.json create mode 100644 ports/type-safe/disable_tests.patch create mode 100644 ports/type-safe/portfile.cmake create mode 100644 ports/type-safe/vcpkg.json diff --git a/ports/debug-assert/portfile.cmake b/ports/debug-assert/portfile.cmake new file mode 100644 index 00000000000000..41f9385fff7018 --- /dev/null +++ b/ports/debug-assert/portfile.cmake @@ -0,0 +1,24 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO foonathan/debug_assert + REF 0144b6532ec80349780ffac3cf85a92d87eb7b1b + SHA512 16cf38406d5f71585b763ff8af59b09c7b8b05372b07714cdc82f6f27292597c0b6d9025f823515744f8235b326b95e1d630af34db4a0e15d4ded79364290630 + HEAD_REF v1.3.3 +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DDEBUG_ASSERT_INSTALL=ON +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/debug_assert TARGET_PATH share/debug_assert) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib) + +vcpkg_copy_pdbs() + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/debug-assert/vcpkg.json b/ports/debug-assert/vcpkg.json new file mode 100644 index 00000000000000..413b23d303d7c8 --- /dev/null +++ b/ports/debug-assert/vcpkg.json @@ -0,0 +1,6 @@ +{ + "name": "debug-assert", + "version-string": "1.3.3", + "description": "Provides flexible DEBUG_ASSERT() macro.", + "homepage": "https://github.com/foonathan/debug_assert" +} diff --git a/ports/type-safe/disable_tests.patch b/ports/type-safe/disable_tests.patch new file mode 100644 index 00000000000000..f18d2ebbfaa2a1 --- /dev/null +++ b/ports/type-safe/disable_tests.patch @@ -0,0 +1,12 @@ +diff -ur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -136,7 +136,7 @@ + # other subdirectories + # only add if not inside add_subdirectory() + option(TYPE_SAFE_BUILD_TEST_EXAMPLE "build test and example" OFF) +-if(${TYPE_SAFE_BUILD_TEST_EXAMPLE} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)) ++if(${TYPE_SAFE_BUILD_TEST_EXAMPLE}) + enable_testing() + add_subdirectory(example/) + add_subdirectory(test/) diff --git a/ports/type-safe/portfile.cmake b/ports/type-safe/portfile.cmake new file mode 100644 index 00000000000000..8930f3f9247288 --- /dev/null +++ b/ports/type-safe/portfile.cmake @@ -0,0 +1,26 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO foonathan/type_safe + REF da1d15abc612afbdc81d70c817b49ba1752177de + SHA512 5b344af89378e34f05d96bff2de61615bc16e21601d9fe9d0886c71db211bd3b42afb2467dd2eb7f3d11176dc9adc2d71c6dc0b60722e12aaf8c1d79ea869289 + HEAD_REF v0.2.1 + PATCHES + disable_tests.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DTYPE_SAFE_BUILD_TEST_EXAMPLE=OFF +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/type_safe TARGET_PATH share/type_safe) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib) + +vcpkg_copy_pdbs() + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/type-safe/vcpkg.json b/ports/type-safe/vcpkg.json new file mode 100644 index 00000000000000..3b16d3c7b101eb --- /dev/null +++ b/ports/type-safe/vcpkg.json @@ -0,0 +1,9 @@ +{ + "name": "type-safe", + "version-string": "0.2.1", + "description": "Zero overhead abstractions that use the C++ type system to prevent bugs.", + "homepage": "https://github.com/foonathan/type_safe", + "dependencies": [ + "debug-assert" + ] +}