1# 2# Generic Toolchain for OS X + MPI + TBB 3# 4# REQUIREMENTS: 5# - in PATH: 6# mpicc and mpicxx, both using clang as the backend 7# 8# OPTIONS: 9# - environment variables: 10# * MKLROOT: the MKL root directory; if not set, will use /opt/intel/mkl 11# * TBBROOT: the TBB root directory; if not set, will use /opt/intel/tbb 12# 13 14# this is key to avoid RPATH problems 15set(CMAKE_SYSTEM_NAME Darwin) 16 17# Compilers 18set(CMAKE_C_COMPILER clang) 19set(CMAKE_CXX_COMPILER clang++) 20set(MPI_C_COMPILER mpicc) 21set(MPI_CXX_COMPILER mpicxx) 22 23# Compile flags 24set(CMAKE_C_FLAGS_INIT "-std=c99" CACHE STRING "Inital C compile flags") 25set(CMAKE_C_FLAGS_DEBUG "-g -Wall" CACHE STRING "Inital C debug compile flags") 26set(CMAKE_C_FLAGS_MINSIZEREL "-Os -march=native -DNDEBUG" CACHE STRING "Inital C minimum size release compile flags") 27set(CMAKE_C_FLAGS_RELEASE "-O3 -march=native -DNDEBUG" CACHE STRING "Inital C release compile flags") 28set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -Wall" CACHE STRING "Inital C release with debug info compile flags") 29set(CMAKE_CXX_FLAGS_INIT " -stdlib=libc++" CACHE STRING "Inital C++ compile flags") 30set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall" CACHE STRING "Inital C++ debug compile flags") 31set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -march=native -DNDEBUG" CACHE STRING "Inital C++ minimum size release compile flags") 32set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG" CACHE STRING "Inital C++ release compile flags") 33set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -Wall" CACHE STRING "Inital C++ release with debug info compile flags") 34 35# Libraries 36if(EXISTS $ENV{TBBROOT}) 37 set(TBB_ROOT_DIR "$ENV{TBBROOT}" CACHE PATH "TBB root directory") 38else() 39 set(TBB_ROOT_DIR "/opt/intel/tbb" CACHE PATH "TBB root directory") 40endif() 41 42# Set BLAS/LAPACK flags 43set(LAPACK_LIBRARIES "-framework Accelerate" CACHE STRING "LAPACK libraries") 44set(LAPACK_COMPILE_OPTIONS "-framework Accelerate" CACHE STRING "LAPACK compiler options") 45set(INTEGER4 TRUE CACHE BOOL "Set Fortran integer size to 4 bytes") 46 47