macOS: Disable OpenMP when using Xcode 16.3 / LLVM 17
The precompiled library uses incompatible ABI with this version, leading to linking errors. There is no easy short-term solution: as per documentation the OpenMP library must match LLVM version. It is hard to achieve in a way that both older and newer LLVM versions are supported: it would need to be multiple OpenMP libraries pre-compiled and chosen at the build time. There are not that many places left in Blender when OpenMP is still used, so it seems better to invest in getting of those remaining cases. The most challenging one would be Eigen, but need to check whether the code-paths that are used from Eigen even contain OpenMP. Pull Request: https://projects.blender.org/blender/blender/pulls/136828
This commit is contained in:
committed by
Sergey Sharybin
parent
484c1b8cd1
commit
a7e78dccb9
@@ -361,15 +361,24 @@ endif()
|
||||
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
|
||||
if(WITH_OPENMP)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
# Use OpenMP from our precompiled libraries.
|
||||
message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
|
||||
set(OPENMP_CUSTOM ON)
|
||||
set(OPENMP_FOUND ON)
|
||||
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
|
||||
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
|
||||
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
|
||||
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
|
||||
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
|
||||
if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 17.0)
|
||||
if(WITH_STRICT_BUILD_OPTIONS)
|
||||
message(SEND_ERROR "OpenMP library is not compatible with the current Clang version")
|
||||
else()
|
||||
message(WARNING "OpenMP library is not compatible with the current Clang version, disabling")
|
||||
endif()
|
||||
set(WITH_OPENMP OFF)
|
||||
else()
|
||||
# Use OpenMP from our precompiled libraries.
|
||||
message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
|
||||
set(OPENMP_CUSTOM ON)
|
||||
set(OPENMP_FOUND ON)
|
||||
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
|
||||
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
|
||||
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
|
||||
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
|
||||
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
add_bundled_libraries(openmp/lib)
|
||||
|
||||
Reference in New Issue
Block a user