Skip to content

Commit

Permalink
Offer alternative for cxxabi on Windows (Swift+Clang).
Browse files Browse the repository at this point in the history
* This fixes the clang compilation of OpenTimelineIO on Windows, when compiling with Swift.
  • Loading branch information
furby-tm committed Jul 27, 2024
1 parent 99aa1bc commit 71f1e3e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/opentimelineio/stringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
#include "opentimelineio/serializableObject.h"
#if defined(__GNUC__) || defined(__clang__)
# include <cstdlib>
# include <cxxabi.h>
# if __has_include(<cxxabi.h>)
# define OTIO_HAVE_DEMANGLER 1
# include <cxxabi.h>
# else // !__has_include(<cxxabi.h>)
# define OTIO_HAVE_DEMANGLER 0
# endif // __has_include(<cxxabi.h>)
# include <memory>
#else
# include <typeinfo>
Expand All @@ -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<char, void (*)(void*)> res{
Expand All @@ -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
Expand Down

0 comments on commit 71f1e3e

Please sign in to comment.