-
Notifications
You must be signed in to change notification settings - Fork 494
Update omp detection for macOS #15040
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,57 @@ | ||
| # Copyright 2019-2026 CERN and copyright holders of ALICE O2. | ||
| # See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| # All rights not expressly granted are reserved. | ||
| # | ||
| # This software is distributed under the terms of the GNU General Public | ||
| # License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| # | ||
| # In applying this license CERN does not waive the privileges and immunities | ||
| # granted to it by virtue of its status as an Intergovernmental Organization | ||
| # or submit itself to any jurisdiction. | ||
|
|
||
| find_library(OpenMP_LIBRARY | ||
| NAMES omp | ||
| NAMES omp libomp | ||
| HINTS | ||
| /opt/homebrew/opt/libomp/lib | ||
| /opt/homebrew/lib | ||
| /usr/local/opt/libomp/lib | ||
| /usr/local/lib | ||
| ) | ||
|
|
||
| find_path(OpenMP_INCLUDE_DIR | ||
| omp.h | ||
| NAMES omp.h | ||
| HINTS | ||
| /opt/homebrew/opt/libomp/include | ||
| /opt/homebrew/include | ||
| /usr/local/opt/libomp/include | ||
| /usr/local/include | ||
| ) | ||
|
|
||
| mark_as_advanced(OpenMP_LIBRARY OpenMP_INCLUDE_DIR) | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(OpenMP DEFAULT_MSG | ||
| OpenMP_LIBRARY OpenMP_INCLUDE_DIR) | ||
| find_package_handle_standard_args( | ||
| OpenMPMacOS | ||
| DEFAULT_MSG | ||
| OpenMP_LIBRARY OpenMP_INCLUDE_DIR | ||
| ) | ||
|
|
||
| if (OpenMP_FOUND) | ||
| if (OpenMPMacOS_FOUND) | ||
| set(OpenMP_LIBRARIES ${OpenMP_LIBRARY}) | ||
| set(OpenMP_INCLUDE_DIRS ${OpenMP_INCLUDE_DIR}) | ||
| set(OpenMP_COMPILE_OPTIONS -Xpreprocessor -fopenmp) | ||
|
|
||
| set(OpenMP_CXX_FOUND True) | ||
| set(OpenMPMacOS_FOUND True) | ||
| add_library(OpenMP::OpenMP_CXX SHARED IMPORTED) | ||
| set(OpenMP_CXX_FOUND TRUE) | ||
| set(OpenMP_FOUND TRUE) | ||
|
|
||
| add_library(OpenMP::OpenMP_CXX INTERFACE IMPORTED) | ||
| set_target_properties(OpenMP::OpenMP_CXX PROPERTIES | ||
| IMPORTED_LOCATION ${OpenMP_LIBRARIES} | ||
| INTERFACE_INCLUDE_DIRECTORIES "${OpenMP_INCLUDE_DIRS}" | ||
| INTERFACE_COMPILE_OPTIONS "${OpenMP_COMPILE_OPTIONS}" | ||
| INTERFACE_COMPILE_OPTIONS "-Xclang;-fopenmp" | ||
| INTERFACE_LINK_LIBRARIES "${OpenMP_LIBRARIES}" | ||
| ) | ||
| message(STATUS | ||
| "Found OpenMP (macOS workaround): " | ||
| "library=${OpenMP_LIBRARY}, " | ||
| "include=${OpenMP_INCLUDE_DIR}" | ||
| ) | ||
| endif() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not have "/opt/homebrew/lib" or "/usr/local/lib" in the hints. If that happens to be selected, then it becomes impossible to override single packages. I would prefer if the OpenMP support and detection is driven from the outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. Just to understand
/opt/homebrew/opt/libomp/libis fine though, no right? How do you imagine the support be driven from the outside, in the recipe?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,
/opt/homebrew/opt/libomp/libis fine. For support driven from the outside I mean via some-DOPENMP_DIR=$(brew --prefix libomp)