Skip to content

Commit

Permalink
[type-safe] New port. (#15468)
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
  • Loading branch information
blaz-kranjc and Blaž Kranjc authored Jan 8, 2021
1 parent 271f58a commit 1ef1ed0
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ports/debug-assert/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions ports/debug-assert/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 12 additions & 0 deletions ports/type-safe/disable_tests.patch
Original file line number Diff line number Diff line change
@@ -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/)
26 changes: 26 additions & 0 deletions ports/type-safe/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions ports/type-safe/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

0 comments on commit 1ef1ed0

Please sign in to comment.