diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f404d4c79f7..3d3a8a4cc79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1889,18 +1889,22 @@ elseif(APPLE) if(WITH_OPENMP) execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VENDOR) string(SUBSTRING "${COMPILER_VENDOR}" 0 5 VENDOR_NAME) # truncate output - if(${VENDOR_NAME} MATCHES "Apple") # Apple does not support OpenMP yet + if(${VENDOR_NAME} MATCHES "Apple") # Apple does not support OpenMP reliable with gcc and not with clang set(WITH_OPENMP OFF) else() # vanilla gcc or clang_omp support OpenMP - message(STATUS "Using special OpenMP enabled compiler !") - set(OPENMP_FOUND ON) - set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE) - set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE) - include_directories(${LIBDIR}/openmp/include) - link_directories(${LIBDIR}/openmp/lib) - # This is a workaround for our helperbinaries ( datatoc, masgfmt, ... ), - # They are linked also to omp lib, so we need it in builddir for runtime exexcution, TODO: remove all unneeded dependencies from these - execute_process(COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES} ${LIBDIR}/openmp/lib/libiomp5.dylib ${CMAKE_BINARY_DIR}/bin/libiomp5.dylib) # for intermediate binaries, lib id is @loader_path + message(STATUS "Using special OpenMP enabled compiler !") # letting find_package(OpenMP) module work for gcc + string(SUBSTRING "${CMAKE_C_COMPILER}" 0 5 CLANG_OMP) + message(STATUS "Using clang-omp from darwin libs "${CLANG_OMP}) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") # clang-omp in darwin libs + set(OPENMP_FOUND ON) + set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE) + set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE) + include_directories(${LIBDIR}/openmp/include) + link_directories(${LIBDIR}/openmp/lib) + # This is a workaround for our helperbinaries ( datatoc, masgfmt, ... ), + # They are linked also to omp lib, so we need it in builddir for runtime exexcution, TODO: remove all unneeded dependencies from these + execute_process(COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES} ${LIBDIR}/openmp/lib/libiomp5.dylib ${CMAKE_BINARY_DIR}/bin/libiomp5.dylib) # for intermediate binaries, lib id @loader_path + endif() endif() endif() @@ -2027,15 +2031,11 @@ blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}") #----------------------------------------------------------------------------- # Configure OpenMP. -if(WITH_OPENMP) +if(WITH_OPENMP AND ( NOT APPLE AND NOT C_COMPILER_ID MATCHES "Clang")) # only vanilla gcc can use this find_module, older pre clang Apple gcc have broken omp anyway ! find_package(OpenMP) if(OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - - if(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode") - set(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES") - endif() else() set(WITH_OPENMP OFF) endif() |