Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-09 10:20:46

0001 #pragma once
0002 
0003 // Copyright (c) 2024 The pybind Community.
0004 
0005 // To maximize reusability:
0006 // DO NOT ADD CODE THAT REQUIRES C++ EXCEPTION HANDLING.
0007 
0008 #include "wrap_include_python_h.h"
0009 
0010 // Implementation details. DO NOT USE ELSEWHERE. (Unfortunately we cannot #undef them.)
0011 // This is duplicated here to maximize portability.
0012 #define PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x) #x
0013 #define PYBIND11_PLATFORM_ABI_ID_TOSTRING(x) PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x)
0014 
0015 #ifdef PYBIND11_COMPILER_TYPE
0016 //   // To maintain backward compatibility (see PR #5439).
0017 #    define PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE ""
0018 #else
0019 #    define PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE "_"
0020 #    if defined(__MINGW32__)
0021 #        define PYBIND11_COMPILER_TYPE "mingw"
0022 #    elif defined(__CYGWIN__)
0023 #        define PYBIND11_COMPILER_TYPE "gcc_cygwin"
0024 #    elif defined(_MSC_VER)
0025 #        define PYBIND11_COMPILER_TYPE "msvc"
0026 #    elif defined(__clang__) || defined(__GNUC__)
0027 #        define PYBIND11_COMPILER_TYPE "system" // Assumed compatible with system compiler.
0028 #    else
0029 #        error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE."
0030 #    endif
0031 #endif
0032 
0033 // PR #5439 made this macro obsolete. However, there are many manipulations of this macro in the
0034 // wild. Therefore, to maintain backward compatibility, it is kept around.
0035 #ifndef PYBIND11_STDLIB
0036 #    define PYBIND11_STDLIB ""
0037 #endif
0038 
0039 #ifndef PYBIND11_BUILD_ABI
0040 #    if defined(_MSC_VER)                 // See PR #4953.
0041 #        if defined(_MT) && defined(_DLL) // Corresponding to CL command line options /MD or /MDd.
0042 #            if (_MSC_VER) / 100 == 19
0043 #                define PYBIND11_BUILD_ABI "_md_mscver19"
0044 #            else
0045 #                error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE."
0046 #            endif
0047 #        elif defined(_MT) // Corresponding to CL command line options /MT or /MTd.
0048 #            define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_MSC_VER)
0049 #        else
0050 #            if (_MSC_VER) / 100 == 19
0051 #                define PYBIND11_BUILD_ABI "_none_mscver19"
0052 #            else
0053 #                error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE."
0054 #            endif
0055 #        endif
0056 #    elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html
0057 #        define PYBIND11_BUILD_ABI                                                                \
0058             "_libcpp_abi" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION)
0059 #    elif defined(_GLIBCXX_USE_CXX11_ABI) // See PR #5439.
0060 #        if defined(__NVCOMPILER)
0061 //           // Assume that NVHPC is in the 1xxx ABI family.
0062 //           // THIS ASSUMPTION IS NOT FUTURE PROOF but apparently the best we can do.
0063 //           // Please let us know if there is a way to validate the assumption here.
0064 #        elif !defined(__GXX_ABI_VERSION)
0065 #            error                                                                                \
0066                 "Unknown platform or compiler (_GLIBCXX_USE_CXX11_ABI): PLEASE REVISE THIS CODE."
0067 #        endif
0068 #        if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION < 1002 || __GXX_ABI_VERSION >= 2000
0069 #            error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE."
0070 #        endif
0071 #        define PYBIND11_BUILD_ABI                                                                \
0072             "_libstdcpp_gxx_abi_1xxx_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(           \
0073                 _GLIBCXX_USE_CXX11_ABI)
0074 #    else
0075 #        error "Unknown platform or compiler: PLEASE REVISE THIS CODE."
0076 #    endif
0077 #endif
0078 
0079 // On MSVC, debug and release builds are not ABI-compatible!
0080 #if defined(_MSC_VER) && defined(_DEBUG)
0081 #    define PYBIND11_BUILD_TYPE "_debug"
0082 #else
0083 #    define PYBIND11_BUILD_TYPE ""
0084 #endif
0085 
0086 #define PYBIND11_PLATFORM_ABI_ID                                                                  \
0087     PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE