Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented May 20, 2024

This PR fixes the issue linking the OpenMP library on macOS, especially when using the macOS default C compiler: AppleClang. This is done by linking the library using the syntax like target_link_libraries(hello OpenMP::OpenMP_C), instead of manually updating the CMAKE_EXE_LINKER_FLAGS/CMAKE_SHARED_LINKER_FLAGS cmake variables.

xref: https://gist.github.com/scivision/16c2ca1dc250f54d34f1a1a35596f4a0

In our macOS CI, we also need to define OpenMP_ROOT so that cmake can find the OpenMP header and library correctly.

A new test is also added to make sure that OpenMP is enabled in our CI:

gmt grdsample @earth_relief_01d -R0/20/0/20 -I30m -Gtopo_30m.nc -x2

Closes #1926.

@seisman seisman force-pushed the openmp branch 4 times, most recently from 0a4c776 to 69d5481 Compare May 22, 2024 04:45
@seisman seisman changed the title Simplify the OpenMP linking cmake: Simplify the linking of OpenMP library in CMake and set OpenMP_ROOT for macOS CI May 22, 2024
@seisman seisman marked this pull request as ready for review May 22, 2024 05:08
@seisman seisman requested a review from joa-quim May 22, 2024 06:16
@seisman seisman added the maintenance Boring but important stuff for the core devs label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Boring but important stuff for the core devs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenMP support on macOS

3 participants