Using openmp in an Xcode command line project

Hi,

I just wanted to share this with the group. While I found Xcode - Homebrew directions, I didn’t find any Xcode - Macports directions.

This brief set of steps worked for me.

  1. In Macports, I installed llvm clang 3.7 with openmp support:

sudo port install llvm-3.7

sudo port install ld64 +ld64_xcode

sudo port install clang-3.7 +openmp

  1. In Xcode project, I added user-defined settings ‘CC’ with value set to “/opt/local/bin/clang-mp-3.7” (clang path).

  2. Add “-fopenmp” to “Other C Flags”

  3. Open folder “/opt/local/lib/libomp” and drag libomp.dylib to Xcode project. This will add the library to the project.

  4. Test openmp functionality.

Hope this helps,
Jan-Michael

Hi,

Sorry, but I forgot to add a couple steps.

  1. Set “Enable Modules (C and Objective-C” to NO

  2. Add “/opt/local/include” to “Header Search Paths” Add “/opt/local/lib” to “Library Search Paths”.

  3. OpenMP headers can be added via: #include <libomp/omp.h>

Thanks,
Jan-Michael

Hi Jan-Michael,

Thank you for summarizing and posting this – I’m sure this will come handy for quite a few people!

Yours,
Andrey