[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
This commit is contained in:
Thomas1664 2024-02-15 08:01:53 +01:00 committed by GitHub
parent fba75d0906
commit cd6d94cec5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 71 additions and 9 deletions

View File

@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/assert/assert>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/assert>
)
#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(

View File

@ -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"
+ <magic_enum.hpp>
#endif
#define LIBASSERT_IS_CLANG 0

View File

@ -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")

View File

@ -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

View File

@ -4134,7 +4134,7 @@
},
"libassert": {
"baseline": "1.2.2",
"port-version": 0
"port-version": 1
},
"libassuan": {
"baseline": "2.5.6",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "dfa096c003c1f98dbcdac5a67d924643bc12f994",
"version": "1.2.2",
"port-version": 1
},
{
"git-tree": "b67ed1f09482482afcb344d882f99fa6fa53caf4",
"version": "1.2.2",