[Bf-blender-cvs] [aac2839] master: OSX/cmake: Real fix for T40887, the reason was find_package(OpenMP) silently failing, breaking all other tests following - tested gcc 4.8.1 works again - tested clang-omp in libs works again - i assume atm., if we only use vanilla clang it is the one in darwin libs
Jens Verwiebe
noreply at git.blender.org
Mon Jul 7 19:20:41 CEST 2014
Commit: aac283966f663af78bb6036d107a63de3da29cd7
Author: Jens Verwiebe
Date: Mon Jul 7 19:20:24 2014 +0200
https://developer.blender.org/rBaac283966f663af78bb6036d107a63de3da29cd7
OSX/cmake: Real fix for T40887, the reason was find_package(OpenMP) silently failing, breaking all other tests following
- tested gcc 4.8.1 works again
- tested clang-omp in libs works again
- i assume atm., if we only use vanilla clang it is the one in darwin libs
===================================================================
M CMakeLists.txt
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f404d4c..3d3a8a4 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()
More information about the Bf-blender-cvs
mailing list