From 71f1e3ea1fc641db283b8da31af5ff98128a8802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?furby=E2=84=A2?= Date: Sat, 27 Jul 2024 15:34:08 -0600 Subject: [PATCH] Offer alternative for cxxabi on Windows (Swift+Clang). * This fixes the clang compilation of OpenTimelineIO on Windows, when compiling with Swift. --- src/opentimelineio/stringUtils.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/opentimelineio/stringUtils.cpp b/src/opentimelineio/stringUtils.cpp index f84d977..3d713f3 100644 --- a/src/opentimelineio/stringUtils.cpp +++ b/src/opentimelineio/stringUtils.cpp @@ -4,7 +4,12 @@ #include "opentimelineio/serializableObject.h" #if defined(__GNUC__) || defined(__clang__) # include -# include +# if __has_include() +# define OTIO_HAVE_DEMANGLER 1 +# include +# else // !__has_include() +# define OTIO_HAVE_DEMANGLER 0 +# endif // __has_include() # include #else # include @@ -15,6 +20,7 @@ namespace { std::string cxxabi_type_name_for_error_mesage(const char* name) { + #if OTIO_HAVE_DEMANGLE int status = -4; // some arbitrary value to eliminate the compiler warning std::unique_ptr res{ @@ -23,6 +29,9 @@ cxxabi_type_name_for_error_mesage(const char* name) }; return (status == 0) ? res.get() : name; + #else // !OTIO_HAVE_DEMANGLE + return name; + #endif // OTIO_HAVE_DEMANGLE } #endif } // namespace