Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYBIND11_PLATFORM_ABI_ID Modernization Continued (platforms other than MSVC) #5439

Merged
merged 32 commits into from
Dec 20, 2024
Merged
Changes from 9 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
14f8425
THIS IS JUST A START: First attempt to combine information from PR #4…
rwgk Nov 10, 2024
e46982c
Merge branch 'master' into pybind11_platform_abi_id_cont
rwgk Nov 18, 2024
b72c42d
Include GXX_ABI and USE_CXX in the identifier
cryos Nov 20, 2024
8369fdc
style: pre-commit fixes
pre-commit-ci[bot] Nov 20, 2024
476c322
Use `gxx_abi_1xxx` and simplify the Clang string
cryos Nov 21, 2024
271720f
Error if `_GLIBCXX_USE_CXX11_ABI` is not defined
cryos Nov 21, 2024
970a7eb
Merge branch 'master' into pybind11_platform_abi_id_cont
rwgk Nov 24, 2024
28081fc
Change `usecxx11` to `use_cxx11_abi` for correspondence with `_GLIBCX…
rwgk Nov 24, 2024
fe2dbcb
`PYBIND11_COMPILER_TYPE` overhaul, mainly: replace `_icc`, `_clang`, …
rwgk Nov 24, 2024
9acf764
Merge branch 'master' into pybind11_platform_abi_id_cont
rwgk Nov 25, 2024
9fc9515
Add NVHPC (__PGI) to the list of compilers compatible with system com…
rwgk Nov 25, 2024
d412303
Fix oversight: remove __NVCOMPILER elif branch in PYBIND11_BUILD_ABI …
rwgk Nov 25, 2024
b6ccce3
Revert "Fix oversight: remove __NVCOMPILER elif branch in PYBIND11_BU…
rwgk Nov 26, 2024
a584398
Revert "Add NVHPC (__PGI) to the list of compilers compatible with sy…
rwgk Nov 26, 2024
23a5f2b
Define NVHPC PYBIND11_BUILD_ABI using __GNUC__, __GNUC_MINOR__, _GLIB…
rwgk Nov 26, 2024
8fa10bf
Use _GLIBCXX_USE_CXX11_ABI to detect libstdc++, then assume that NVHP…
rwgk Nov 26, 2024
02daf15
Enhance NVHPC comment and limited future proofing.
rwgk Nov 26, 2024
3f90808
The `PYBIND11_STDLIB` is obsolete but kept around to maintain backwar…
rwgk Dec 1, 2024
b47be2d
Move `PYBIND11_BUILD_TYPE` down in the file, so that the order of mac…
rwgk Dec 1, 2024
e071edc
Introduce `PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE`:
rwgk Dec 2, 2024
ca9e699
Apply suggestion by @isuruf, with revised comments (code is as sugges…
rwgk Dec 3, 2024
41daaa4
Make determination of `PYBIND11_COMPILER_TYPE` `"macos"` or `"glibc"`…
rwgk Dec 3, 2024
e34dc8b
Add `PYBIND11_COMPILER_TYPE` `emscripten`
rwgk Dec 6, 2024
75da5fb
Add `PYBIND11_COMPILER_TYPE` `graalvm`
rwgk Dec 6, 2024
f4cc9b9
Merge branch 'master' into pybind11_platform_abi_id_cont
rwgk Dec 8, 2024
fb38f03
Revert "Add `PYBIND11_COMPILER_TYPE` `graalvm`"
rwgk Dec 12, 2024
09131c5
Revert "Add `PYBIND11_COMPILER_TYPE` `emscripten`"
rwgk Dec 12, 2024
d05ea53
Revert "Make determination of `PYBIND11_COMPILER_TYPE` `"macos"` or `…
rwgk Dec 12, 2024
776d163
Revert "Apply suggestion by @isuruf, with revised comments (code is a…
rwgk Dec 12, 2024
70639c1
Merge branch 'master' into pybind11_platform_abi_id_cont
rwgk Dec 12, 2024
7fb89ca
Merge branch 'master' into pybind11_platform_abi_id_cont
rwgk Dec 12, 2024
738b7ec
Remove `defined(__INTEL_COMPILER)` as suggested by @hpkfft under http…
rwgk Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions include/pybind11/conduit/pybind11_platform_abi_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,18 @@
// A user can manually set this string if they know their
// compiler is compatible.
#ifndef PYBIND11_COMPILER_TYPE
# if defined(_MSC_VER)
# define PYBIND11_COMPILER_TYPE "_msvc"
# elif defined(__INTEL_COMPILER)
# define PYBIND11_COMPILER_TYPE "_icc"
# elif defined(__clang__)
# define PYBIND11_COMPILER_TYPE "_clang"
# elif defined(__PGI)
# define PYBIND11_COMPILER_TYPE "_pgi"
# elif defined(__MINGW32__)
# if defined(__MINGW32__)
# define PYBIND11_COMPILER_TYPE "_mingw"
# elif defined(__CYGWIN__)
# define PYBIND11_COMPILER_TYPE "_gcc_cygwin"
# elif defined(__GNUC__)
# define PYBIND11_COMPILER_TYPE "_gcc"
# elif defined(_MSC_VER)
# define PYBIND11_COMPILER_TYPE "_msvc"
# elif defined(__PGI)
# define PYBIND11_COMPILER_TYPE "_pgi"
# elif defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the interest of simplification, consider removing defined(__INTEL_COMPILER)

The Intel classic compilers, icc for C and icpc for C++, define __GNUC__ as well as __INTEL_COMPILER.
The last version was 2021.10 and it stopped shipping in 2023.

The "Intel(R) oneAPI DPC++/C++ Compilers", icx for C and icpx for C++, do not define __INTEL_COMPILER.
They do define all of these: __GNUC__, __clang__, __INTEL_CLANG_COMPILER, and __INTEL_LLVM_COMPILER.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 738b7ec

Thanks @hpkfft for the suggestion!

# define PYBIND11_COMPILER_TYPE "_system" // Assumed compatible with system compiler.
# else
# define PYBIND11_COMPILER_TYPE "_unknown"
# error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE."
# endif
#endif

Expand All @@ -54,9 +50,7 @@
#endif

#ifndef PYBIND11_BUILD_ABI
# if defined(__GXX_ABI_VERSION) // Linux/OSX.
# define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_PLATFORM_ABI_ID_TOSTRING(__GXX_ABI_VERSION)
# elif defined(_MSC_VER) // See PR #4953.
# if defined(_MSC_VER) // See PR #4953.
# if defined(_MT) && defined(_DLL) // Corresponding to CL command line options /MD or /MDd.
# if (_MSC_VER) / 100 == 19
# define PYBIND11_BUILD_ABI "_md_mscver19"
Expand All @@ -72,8 +66,21 @@
# error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE."
# endif
# endif
# elif defined(__NVCOMPILER) // NVHPC (PGI-based).
# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB?
# elif defined(__NVCOMPILER) // NVHPC (PGI-based).
# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB?
# elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html
# define PYBIND11_BUILD_ABI "_abi" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION)
# elif defined(__GXX_ABI_VERSION)
# if __GXX_ABI_VERSION >= 1002 && __GXX_ABI_VERSION < 2000
# if !defined(_GLIBCXX_USE_CXX11_ABI)
# error "UNEXPECTED: _GLIBCXX_USE_CXX11_ABI not defined: PLEASE REVISE THIS CODE."
# endif
# define PYBIND11_BUILD_ABI \
"_gxx_abi_1xxx_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING( \
_GLIBCXX_USE_CXX11_ABI)
# else
# error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE."
# endif
# else
# error "Unknown platform or compiler: PLEASE REVISE THIS CODE."
# endif
Expand Down