fix: allow the ABI string to be forced (#2602)

This commit is contained in:
Henry Schreiner 2020-10-16 17:23:36 -04:00 committed by GitHub
parent 6364b732e9
commit 064362fbb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,49 +154,60 @@ struct type_info {
/// On MSVC, debug and release builds are not ABI-compatible! /// On MSVC, debug and release builds are not ABI-compatible!
#if defined(_MSC_VER) && defined(_DEBUG) #if defined(_MSC_VER) && defined(_DEBUG)
# define PYBIND11_BUILD_TYPE "_debug" # define PYBIND11_BUILD_TYPE "_debug"
#else #else
# define PYBIND11_BUILD_TYPE "" # define PYBIND11_BUILD_TYPE ""
#endif #endif
/// Let's assume that different compilers are ABI-incompatible. /// Let's assume that different compilers are ABI-incompatible.
#if defined(_MSC_VER) /// A user can manually set this string if they know their
# define PYBIND11_COMPILER_TYPE "_msvc" /// compiler is compatible.
#elif defined(__INTEL_COMPILER) #ifndef PYBIND11_COMPILER_TYPE
# define PYBIND11_COMPILER_TYPE "_icc" # if defined(_MSC_VER)
#elif defined(__clang__) # define PYBIND11_COMPILER_TYPE "_msvc"
# define PYBIND11_COMPILER_TYPE "_clang" # elif defined(__INTEL_COMPILER)
#elif defined(__PGI) # define PYBIND11_COMPILER_TYPE "_icc"
# define PYBIND11_COMPILER_TYPE "_pgi" # elif defined(__clang__)
#elif defined(__MINGW32__) # define PYBIND11_COMPILER_TYPE "_clang"
# define PYBIND11_COMPILER_TYPE "_mingw" # elif defined(__PGI)
#elif defined(__CYGWIN__) # define PYBIND11_COMPILER_TYPE "_pgi"
# define PYBIND11_COMPILER_TYPE "_gcc_cygwin" # elif defined(__MINGW32__)
#elif defined(__GNUC__) # define PYBIND11_COMPILER_TYPE "_mingw"
# define PYBIND11_COMPILER_TYPE "_gcc" # elif defined(__CYGWIN__)
#else # define PYBIND11_COMPILER_TYPE "_gcc_cygwin"
# define PYBIND11_COMPILER_TYPE "_unknown" # elif defined(__GNUC__)
# define PYBIND11_COMPILER_TYPE "_gcc"
# else
# define PYBIND11_COMPILER_TYPE "_unknown"
# endif
#endif #endif
#if defined(_LIBCPP_VERSION) /// Also standard libs
# define PYBIND11_STDLIB "_libcpp" #ifndef PYBIND11_STDLIB
#elif defined(__GLIBCXX__) || defined(__GLIBCPP__) # if defined(_LIBCPP_VERSION)
# define PYBIND11_STDLIB "_libstdcpp" # define PYBIND11_STDLIB "_libcpp"
#else # elif defined(__GLIBCXX__) || defined(__GLIBCPP__)
# define PYBIND11_STDLIB "" # define PYBIND11_STDLIB "_libstdcpp"
# else
# define PYBIND11_STDLIB ""
# endif
#endif #endif
/// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility. /// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility.
#if defined(__GXX_ABI_VERSION) #ifndef PYBIND11_BUILD_ABI
# define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION) # if defined(__GXX_ABI_VERSION)
#else # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION)
# define PYBIND11_BUILD_ABI "" # else
# define PYBIND11_BUILD_ABI ""
# endif
#endif #endif
#if defined(WITH_THREAD) #ifndef PYBIND11_INTERNALS_KIND
# define PYBIND11_INTERNALS_KIND "" # if defined(WITH_THREAD)
#else # define PYBIND11_INTERNALS_KIND ""
# define PYBIND11_INTERNALS_KIND "_without_thread" # else
# define PYBIND11_INTERNALS_KIND "_without_thread"
# endif
#endif #endif
#define PYBIND11_INTERNALS_ID "__pybind11_internals_v" \ #define PYBIND11_INTERNALS_ID "__pybind11_internals_v" \