Detect OpenMP on macOS with Apple's Clang#13079
Detect OpenMP on macOS with Apple's Clang#13079dcbaker wants to merge 7 commits intomesonbuild:masterfrom
Conversation
5495b0f to
fd7d240
Compare
|
|
||
|
|
||
| class AppleClangCCompiler(ClangCCompiler): | ||
| class AppleClangCCompiler(AppleCompilerMixin, ClangCCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
|
|
||
|
|
||
| class AppleClangCPPCompiler(ClangCPPCompiler): | ||
| class AppleClangCPPCompiler(AppleCompilerMixin, ClangCPPCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
a28f395 to
8ebabc6
Compare
This will be needed by the Apple compiler
In case the OpenMP definition adds things like preprocessor directives or include paths, like when building on MacOS with OpenMP from Homebrew.
It was probably done this way originally since we didn't have the `fatal` keyword argument to avoid triggering the fatal-meson-warnings. While we're here, replace the use of a `if bool` with an `else` on the for loop.
And into the Clang-CL mixin.
Which requires injecting some extra paths and the `-Xpreprocess` flag, as well as extra search paths for libomp and the headers. Fixes: mesonbuild#7435
8ebabc6 to
ce6ea14
Compare
Instead of making the variable optional, just return if we hit the error case, since that's all that's going to happen anyway
|
@lesteve, this seems to be working in our CI, does this this work for you? |
|
Looks like this needs a rebase. Than I can review it |
I can confirm that this PR fixes my original issue. In particular with my minimal reproducer repo https://github.com/lesteve/meson-openmp-osx, OpenMP is detected without having to set any environment variable. Also I checked the compiled binary does indeed use multiple threads. Sorry it took me a while to get back to this ... |
|
Looks like this branch now has conflicts, but quickly looking at this, they seem straightforward to fix. Let me know if there is something I can do to help move this forward! |
|
Could be good to get this to 1.5. I know @dcbaker is a busy guy, and would never not want help. Could you take his branch, rebase it, and add that it supersedes this PR? Might be the quickest way to resolution. |
Thanks @tristan957, I have opened #13350 that does this. |
|
Superseded by #13350 |
This has been opened as a draft because it is probably not sufficient yet, but it's a start.
Fixes #7435