From cd6d94cec5abe3cb628fc1fe5aa4e7abb5dd078b Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Thu, 15 Feb 2024 08:01:53 +0100 Subject: [PATCH] [libassert] Use magic-enum from vcpkg (#36745) * [libassert] Use magic-enum from vcpkg * version * copy pdbs * version * fix usage * version * find_dependency * version * Fix include path * version --- ports/libassert/include-dir.patch | 22 ++++++++++++++++++++++ ports/libassert/magic-enum.patch | 26 ++++++++++++++++++++++++++ ports/libassert/portfile.cmake | 23 +++++++++++++++-------- ports/libassert/vcpkg.json | 2 ++ versions/baseline.json | 2 +- versions/l-/libassert.json | 5 +++++ 6 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 ports/libassert/include-dir.patch create mode 100644 ports/libassert/magic-enum.patch diff --git a/ports/libassert/include-dir.patch b/ports/libassert/include-dir.patch new file mode 100644 index 0000000000..0202df2712 --- /dev/null +++ b/ports/libassert/include-dir.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c653d61..c9e599f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,7 +43,7 @@ target_include_directories( + assert + PUBLIC + $ +- $ ++ $ + ) + + #set(CMAKE_CXX_FLAGS_REL_WITH_ASSERTS "-O3") +@@ -119,7 +121,7 @@ if(NOT CMAKE_SKIP_INSTALL_RULES) + install( + FILES + include/assert.hpp +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/assert/assert ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/assert + ) + + install( diff --git a/ports/libassert/magic-enum.patch b/ports/libassert/magic-enum.patch new file mode 100644 index 0000000000..1d6713ce84 --- /dev/null +++ b/ports/libassert/magic-enum.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c653d61..a5d9980 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -94,6 +94,8 @@ endif() + + if(ASSERT_USE_MAGIC_ENUM) + target_compile_definitions(assert PUBLIC ASSERT_USE_MAGIC_ENUM) ++ find_package(magic_enum CONFIG REQUIRED) ++ target_link_libraries(assert PUBLIC magic_enum::magic_enum) + endif() + + if(NOT "${ASSERT_FAIL}" STREQUAL "") +diff --git a/include/assert.hpp b/include/assert.hpp +index b49c633..299a47e 100644 +--- a/include/assert.hpp ++++ b/include/assert.hpp +@@ -34,7 +34,7 @@ + #ifdef ASSERT_USE_MAGIC_ENUM + // this is a temporary hack to make testing thing in compiler explorer quicker (it disallows simple relative includes) + #include \ +- "../third_party/magic_enum.hpp" ++ + #endif + + #define LIBASSERT_IS_CLANG 0 diff --git a/ports/libassert/portfile.cmake b/ports/libassert/portfile.cmake index 76473094db..83871f93bf 100644 --- a/ports/libassert/portfile.cmake +++ b/ports/libassert/portfile.cmake @@ -5,25 +5,32 @@ vcpkg_from_github( SHA512 beba94e033f7e43c84123736a32725a333c915392d5dc57c26a63f832a507564d79f290a151cb136de8bded3d8d343dad3c4bf2efec9977d878df3c9a8677554 HEAD_REF main PATCHES - runtime_destination.patch + runtime_destination.patch + magic-enum.patch + include-dir.patch ) -vcpkg_list(SET options -DASSERT_USE_EXTERNAL_CPPTRACE=On) -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - vcpkg_list(APPEND options -DASSERT_STATIC=On) -endif() +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" - OPTIONS ${options} + OPTIONS + -DASSERT_USE_EXTERNAL_CPPTRACE=ON + -DASSERT_STATIC=${BUILD_STATIC} ) vcpkg_cmake_install() vcpkg_cmake_config_fixup( - PACKAGE_NAME "libassert" - CONFIG_PATH "lib/cmake/assert" + PACKAGE_NAME assert + CONFIG_PATH lib/cmake/assert ) +vcpkg_copy_pdbs() + +file(APPEND "${CURRENT_PACKAGES_DIR}/share/assert/assert-config.cmake" "include(CMakeFindDependencyMacro) +find_dependency(magic_enum) +find_dependency(cpptrace)") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/assert/third_party") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/libassert/vcpkg.json b/ports/libassert/vcpkg.json index bb5639e1dc..593c13ce16 100644 --- a/ports/libassert/vcpkg.json +++ b/ports/libassert/vcpkg.json @@ -1,12 +1,14 @@ { "name": "libassert", "version": "1.2.2", + "port-version": 1, "description": "The most over-engineered and overpowered C++ assertion library.", "homepage": "https://github.com/jeremy-rifkin/libassert", "license": "MIT", "supports": "!uwp", "dependencies": [ "cpptrace", + "magic-enum", { "name": "vcpkg-cmake", "host": true diff --git a/versions/baseline.json b/versions/baseline.json index ff28369f22..e4d32bf257 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4134,7 +4134,7 @@ }, "libassert": { "baseline": "1.2.2", - "port-version": 0 + "port-version": 1 }, "libassuan": { "baseline": "2.5.6", diff --git a/versions/l-/libassert.json b/versions/l-/libassert.json index d9299f7215..c2f7f8d8c3 100644 --- a/versions/l-/libassert.json +++ b/versions/l-/libassert.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "dfa096c003c1f98dbcdac5a67d924643bc12f994", + "version": "1.2.2", + "port-version": 1 + }, { "git-tree": "b67ed1f09482482afcb344d882f99fa6fa53caf4", "version": "1.2.2",