Build: Remove OpenMP
It's better for performance to use a single thread pool for all areas of Blender, and this gets us closer to that. Bullet, Quadriflow, Mantaflow and Ceres still contain OpenMP code, but it was already disabled. On macOS, our OpenMP libraries are no longer compatible with the latest Xcode 16.3. By removing OpenMP we no longer have to solve that problem. OpenMP was disabled for bpy module builds on Windows ARM64, which also no longer needs to be solved. Pull Request: https://projects.blender.org/blender/blender/pulls/136865
This commit is contained in:
@@ -407,23 +407,6 @@ mark_as_advanced(WITH_SYSTEM_AUDASPACE)
|
||||
|
||||
set_and_warn_dependency(WITH_AUDASPACE WITH_SYSTEM_AUDASPACE OFF)
|
||||
|
||||
option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" ON)
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(WITH_OPENMP_STATIC "Link OpenMP statically (only used by the release environment)" OFF)
|
||||
mark_as_advanced(WITH_OPENMP_STATIC)
|
||||
elseif(WIN32 AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.1)
|
||||
# Prior to LLVM 19.1, OpenMP was not included in public LLVM builds for Windows ARM64
|
||||
if(WITH_OPENMP)
|
||||
if(WITH_STRICT_BUILD_OPTIONS)
|
||||
message(SEND_ERROR "OpenMP enabled, but LLVM ${CMAKE_CXX_COMPILER_VERSION} detected, minimum of 19.1 required for OpenMP functionality")
|
||||
else()
|
||||
message(STATUS "Disabling OpenMP, LLVM ${CMAKE_CXX_COMPILER_VERSION} detected, minimum of 19.1 required for OpenMP functionality")
|
||||
endif()
|
||||
set(WITH_OPENMP OFF)
|
||||
set(WITH_OPENMP_STATIC OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_X11)
|
||||
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
|
||||
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
|
||||
@@ -1666,45 +1649,6 @@ if(WITH_METAL_BACKEND)
|
||||
endif()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenMP
|
||||
|
||||
if(WITH_OPENMP)
|
||||
if(NOT OPENMP_CUSTOM)
|
||||
find_package(OpenMP)
|
||||
endif()
|
||||
|
||||
set_and_warn_library_found("OpenMP" OPENMP_FOUND WITH_OPENMP)
|
||||
|
||||
if(OPENMP_FOUND)
|
||||
if(NOT WITH_OPENMP_STATIC)
|
||||
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
|
||||
if(DEFINED OpenMP_LINKER_FLAGS)
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
||||
endif()
|
||||
else()
|
||||
# Typically avoid adding flags as defines but we can't
|
||||
# pass OpenMP flags to the linker for static builds, meaning
|
||||
# we can't add any OpenMP related flags to CFLAGS variables
|
||||
# since they're passed to the linker as well.
|
||||
add_definitions("${OpenMP_C_FLAGS}")
|
||||
|
||||
find_library_static(OpenMP_LIBRARIES gomp ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
|
||||
mark_as_advanced(
|
||||
OpenMP_LIBRARIES
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
OpenMP_C_FLAGS
|
||||
OpenMP_CXX_FLAGS
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Bullet
|
||||
|
||||
@@ -2726,14 +2670,6 @@ setup_heavy_lib_pool()
|
||||
include(build_files/cmake/packaging.cmake)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Use Dynamic Loading for OpenMP
|
||||
|
||||
if(WITH_BLENDER)
|
||||
openmp_delayload(blender)
|
||||
endif()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Print Final Configuration
|
||||
|
||||
@@ -2794,7 +2730,6 @@ if(FIRST_RUN)
|
||||
|
||||
info_cfg_text("Compiler Options:")
|
||||
info_cfg_option(WITH_BUILDINFO)
|
||||
info_cfg_option(WITH_OPENMP)
|
||||
|
||||
info_cfg_text("System Options:")
|
||||
info_cfg_option(WITH_INSTALL_PORTABLE)
|
||||
|
||||
@@ -59,9 +59,6 @@ include(cmake/alembic.cmake)
|
||||
include(cmake/opensubdiv.cmake)
|
||||
include(cmake/sdl.cmake)
|
||||
include(cmake/opencollada.cmake)
|
||||
if(APPLE)
|
||||
include(cmake/openmp.cmake)
|
||||
endif()
|
||||
if(UNIX)
|
||||
include(cmake/nasm.cmake)
|
||||
endif()
|
||||
|
||||
@@ -90,7 +90,6 @@ download_source(OPENCOLLADA)
|
||||
download_source(OPENCOLORIO)
|
||||
download_source(MINIZIPNG)
|
||||
download_source(LLVM)
|
||||
download_source(OPENMP)
|
||||
download_source(OPENIMAGEIO)
|
||||
download_source(TIFF)
|
||||
download_source(OSL)
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2002-2022 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
if(APPLE)
|
||||
set(OPENMP_PATCH_COMMAND
|
||||
${PATCH_CMD} -p 1 -d
|
||||
${BUILD_DIR}/openmp/src/external_openmp <
|
||||
${PATCH_DIR}/openmp.diff
|
||||
)
|
||||
else()
|
||||
set(OPENMP_PATCH_COMMAND)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_openmp
|
||||
URL file://${PACKAGE_DIR}/${OPENMP_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
|
||||
PREFIX ${BUILD_DIR}/openmp
|
||||
PATCH_COMMAND ${OPENMP_PATCH_COMMAND}
|
||||
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp
|
||||
${DEFAULT_CMAKE_FLAGS}
|
||||
|
||||
INSTALL_COMMAND
|
||||
cd ${BUILD_DIR}/openmp/src/external_openmp-build &&
|
||||
install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib &&
|
||||
make install
|
||||
|
||||
INSTALL_DIR ${LIBDIR}/openmp
|
||||
)
|
||||
|
||||
add_dependencies(
|
||||
external_openmp
|
||||
ll
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
harvest(external_openmp openmp/lib openmp/lib "libomp.dylib")
|
||||
harvest(external_openmp openmp/include openmp/include "*.h")
|
||||
endif()
|
||||
@@ -274,19 +274,6 @@ set(LLVM_HOMEPAGE https://github.com/llvm/llvm-project/)
|
||||
set(LLVM_LICENSE SPDX:Apache-2.0 WITH LLVM-exception)
|
||||
set(LLVM_COPYRIGHT "Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign. All rights reserved.")
|
||||
|
||||
if(APPLE)
|
||||
# Cloth physics test is crashing due to this bug:
|
||||
# https://bugs.llvm.org/show_bug.cgi?id=50579
|
||||
set(OPENMP_VERSION 9.0.1)
|
||||
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
|
||||
else()
|
||||
set(OPENMP_VERSION ${LLVM_VERSION})
|
||||
set(OPENMP_HASH 5cc01d151821c546bb4ec6fb03d86c29)
|
||||
endif()
|
||||
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
|
||||
set(OPENMP_HASH_TYPE MD5)
|
||||
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
|
||||
|
||||
set(OPENIMAGEIO_VERSION v3.0.3.1)
|
||||
set(OPENIMAGEIO_NAME OpenImageIO)
|
||||
set(OPENIMAGEIO_URI https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/${OPENIMAGEIO_VERSION}.tar.gz)
|
||||
|
||||
@@ -70,7 +70,6 @@ graph[autosize = false, size = "25.7,8.3!", resolution = 300];
|
||||
external_openimageio -- external_robinmap;
|
||||
external_openimageio -- external_openjpeg;
|
||||
external_openimageio -- external_webp;
|
||||
external_openmp -- ll;
|
||||
external_openpgl -- external_tbb;
|
||||
external_opensubdiv -- external_tbb;
|
||||
openvdb -- external_tbb;
|
||||
|
||||
@@ -45,7 +45,6 @@ set(WITH_OPENAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENIMAGEDENOISE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
|
||||
|
||||
@@ -52,7 +52,6 @@ set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENIMAGEDENOISE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ set(WITH_OPENAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENIMAGEDENOISE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
|
||||
|
||||
@@ -88,16 +88,3 @@ endif()
|
||||
# Language Support.
|
||||
|
||||
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# OpenMP Support.
|
||||
|
||||
# OpenMP doesn't work on Windows ARM64 devices due to using an external manifest
|
||||
# Note: This only applies to the bpy module, it works for regular builds.
|
||||
|
||||
# We can't use CMAKE_SYSTEM_PROCESSOR here as it's not set yet,
|
||||
# so fall back to checking the env for vcvarsall's VSCMD_ARG_TGT_ARCH
|
||||
if(WIN32 AND "$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "arm64")
|
||||
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENMP_STATIC OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
@@ -1275,36 +1275,6 @@ function(print_all_vars)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
macro(openmp_delayload
|
||||
projectname
|
||||
)
|
||||
if(MSVC)
|
||||
if(WITH_OPENMP)
|
||||
if(MSVC_CLANG)
|
||||
set(OPENMP_DLL_NAME "libomp")
|
||||
else()
|
||||
set(OPENMP_DLL_NAME "vcomp140")
|
||||
endif()
|
||||
set_property(
|
||||
TARGET ${projectname} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib"
|
||||
)
|
||||
set_property(
|
||||
TARGET ${projectname} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib"
|
||||
)
|
||||
set_property(
|
||||
TARGET ${projectname} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS_RELWITHDEBINFO " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib"
|
||||
)
|
||||
set_property(
|
||||
TARGET ${projectname} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS_MINSIZEREL " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(set_and_warn_dependency
|
||||
_dependency _setting _val)
|
||||
# when $_dependency is disabled, forces $_setting = $_val
|
||||
|
||||
@@ -358,31 +358,6 @@ if(WITH_POTRACE)
|
||||
find_package(Potrace REQUIRED)
|
||||
endif()
|
||||
|
||||
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
|
||||
if(WITH_OPENMP)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
|
||||
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)
|
||||
|
||||
if(WITH_XR_OPENXR)
|
||||
find_package(XR_OpenXR_SDK REQUIRED)
|
||||
endif()
|
||||
@@ -519,8 +494,8 @@ if(PLATFORM_BUNDLED_LIBRARIES)
|
||||
# Environment variables to run precompiled executables that needed libraries.
|
||||
list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths)
|
||||
# Intentionally double "$$" which expands into "$" when instantiated.
|
||||
set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths};$$DYLD_LIBRARY_PATH\"")
|
||||
set(PLATFORM_ENV_INSTALL "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/Blender.app/Contents/Resources/lib/;$$DYLD_LIBRARY_PATH")
|
||||
set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths}:$$DYLD_LIBRARY_PATH\"")
|
||||
set(PLATFORM_ENV_INSTALL "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/Blender.app/Contents/Resources/lib/:$$DYLD_LIBRARY_PATH")
|
||||
unset(_library_paths)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -95,11 +95,6 @@ if(DEFINED LIBDIR)
|
||||
include(platform_old_libs_update)
|
||||
|
||||
set(WITH_STATIC_LIBS ON)
|
||||
# OpenMP usually can't be statically linked into shared libraries,
|
||||
# due to not being compiled with position independent code.
|
||||
if(NOT WITH_PYTHON_MODULE)
|
||||
set(WITH_OPENMP_STATIC ON)
|
||||
endif()
|
||||
set(Boost_NO_BOOST_CMAKE ON)
|
||||
set(Boost_ROOT ${LIBDIR}/boost)
|
||||
set(BOOST_LIBRARYDIR ${LIBDIR}/boost/lib)
|
||||
|
||||
@@ -23,25 +23,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
else()
|
||||
message("Unable to detect the Visual Studio redist directory, copying of the runtime dlls will not work, try running from the visual studio developer prompt.")
|
||||
endif()
|
||||
# 1) CMake has issues detecting openmp support in clang-cl so we have to provide
|
||||
# the right switches here.
|
||||
# 2) While the /openmp switch *should* work, it currently doesn't as for clang 9.0.0
|
||||
# 3) Using the registry to locate llvmroot doesn't work on some installs. When this happens,
|
||||
# attempt to locate openmp in the lib directory of the parent of the clang-cl binary
|
||||
if(WITH_OPENMP)
|
||||
set(OPENMP_CUSTOM ON)
|
||||
set(OPENMP_FOUND ON)
|
||||
set(OpenMP_C_FLAGS "/clang:-fopenmp")
|
||||
set(OpenMP_CXX_FLAGS "/clang:-fopenmp")
|
||||
get_filename_component(LLVMBIN ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||
get_filename_component(LLVMROOT ${LLVMBIN} DIRECTORY)
|
||||
set(CLANG_OPENMP_DLL "${LLVMROOT}/bin/libomp.dll")
|
||||
set(CLANG_OPENMP_LIB "${LLVMROOT}/lib/libomp.lib")
|
||||
if(NOT EXISTS "${CLANG_OPENMP_DLL}")
|
||||
message(FATAL_ERROR "Clang OpenMP library (${CLANG_OPENMP_DLL}) not found.")
|
||||
endif()
|
||||
set(OpenMP_LINKER_FLAGS "\"${CLANG_OPENMP_LIB}\"")
|
||||
endif()
|
||||
if(WITH_WINDOWS_STRIPPED_PDB)
|
||||
message(WARNING "stripped pdb not supported with clang, disabling..")
|
||||
set(WITH_WINDOWS_STRIPPED_PDB OFF)
|
||||
@@ -153,7 +134,6 @@ configure_file(
|
||||
# Always detect CRT paths, but only manually install with WITH_WINDOWS_BUNDLE_CRT.
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
||||
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
|
||||
set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
if(WITH_WINDOWS_BUNDLE_CRT)
|
||||
|
||||
@@ -104,9 +104,6 @@ macro(blender_src_gtest_ex)
|
||||
if(DEFINED PTHREADS_LIBRARIES) # Needed for GLOG.
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${PTHREADS_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_OPENMP AND WITH_OPENMP_STATIC)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenMP_LIBRARIES})
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE bf_intern_libc_compat)
|
||||
endif()
|
||||
|
||||
8
extern/mantaflow/CMakeLists.txt
vendored
8
extern/mantaflow/CMakeLists.txt
vendored
@@ -2,14 +2,6 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Mantaflow triggers a clang-cl compiler error with versions before 9.0.1
|
||||
# Since mantaflow does not appear to be using OpenMP at this point in time,
|
||||
# disable the flag for now. See https://bugs.llvm.org/show_bug.cgi?id=43175 for details.
|
||||
|
||||
if(MSVC_CLANG AND WITH_OPENMP AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.1")
|
||||
remove_cc_flag("-fopenmp")
|
||||
endif()
|
||||
|
||||
set(MANTAVERSION "0.13")
|
||||
|
||||
add_definitions(-DWITH_FLUID=1)
|
||||
|
||||
31
extern/mantaflow/UPDATE.sh
vendored
31
extern/mantaflow/UPDATE.sh
vendored
@@ -19,44 +19,23 @@ WITH_DEPENDENCIES=0
|
||||
# Build with numpy support?
|
||||
USE_NUMPY=0
|
||||
|
||||
# Choose which multithreading platform to use for Mantaflow preprocessing
|
||||
USE_OMP=0
|
||||
USE_TBB=1
|
||||
|
||||
if [[ "$USE_OMP" -eq "1" && "$USE_TBB" -eq "1" ]]; then
|
||||
echo "Cannot build Mantaflow for OpenMP and TBB at the same time"
|
||||
exit 1
|
||||
elif [[ "$USE_OMP" -eq "0" && "$USE_TBB" -eq "0" ]]; then
|
||||
echo "WARNING: Building Mantaflow without multithreading"
|
||||
else
|
||||
if [[ "$USE_OMP" -eq "1" ]]; then
|
||||
echo "Building Mantaflow with OpenMP multithreading"
|
||||
elif [[ "$USE_TBB" -eq "1" ]]; then
|
||||
echo "Building Mantaflow with TBB multithreading"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ==================== 2) BUILD MANTAFLOW ================================================
|
||||
|
||||
# For OpenMP, we need non-default compiler to build Mantaflow on OSX
|
||||
if [[ "$USE_OMP" -eq "1" && "$OSTYPE" == "darwin"* ]]; then
|
||||
export CC=/usr/local/opt/llvm/bin/clang
|
||||
export CXX=/usr/local/opt/llvm/bin/clang++
|
||||
export LDFLAGS=-L/usr/local/opt/llvm/lib
|
||||
fi
|
||||
|
||||
cd $MANTA_INSTALLATION
|
||||
|
||||
# Check-out manta repo from git?
|
||||
if [[ "$CLEAN_REPOSITORY" -eq "1" ]]; then
|
||||
if cd mantaflowgit/; then git pull; else git clone git@bitbucket.org:thunil/mantaflowgit.git; cd mantaflowgit; fi
|
||||
if cd mantaflowgit/; then git pull; else
|
||||
git clone git@bitbucket.org:thunil/mantaflowgit.git
|
||||
cd mantaflowgit
|
||||
fi
|
||||
git checkout develop
|
||||
fi
|
||||
|
||||
MANTA_BUILD_PATH=$MANTA_INSTALLATION/build_blender/
|
||||
mkdir -p $MANTA_BUILD_PATH
|
||||
cd $MANTA_BUILD_PATH
|
||||
cmake ../mantaflowgit -DGUI=0 -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=1 -DPREPDEBUG=1 -DNUMPY=$USE_NUMPY && make -j8
|
||||
cmake ../mantaflowgit -DGUI=0 -DOPENMP=0 -DTBB=1 -DBLENDER=1 -DPREPDEBUG=1 -DNUMPY=$USE_NUMPY && make -j8
|
||||
|
||||
# ==================== 3) COPY MANTAFLOW FILES TO BLENDER ROOT ===========================
|
||||
|
||||
|
||||
@@ -80,12 +80,6 @@ if(WITH_OPENSUBDIV)
|
||||
${Epoxy_LIBRARIES}
|
||||
)
|
||||
|
||||
if(WITH_OPENMP AND WITH_OPENMP_STATIC)
|
||||
list(APPEND LIB
|
||||
${OpenMP_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DNOMINMAX)
|
||||
add_definitions(-D_USE_MATH_DEFINES)
|
||||
|
||||
@@ -55,7 +55,6 @@ struct Scene;
|
||||
#define LOOP_SHOWN_PARTICLES \
|
||||
for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
|
||||
if (!(pa->flag & (PARS_UNEXIST | PARS_NO_DISP)))
|
||||
/* OpenMP: Can only advance one variable within loop definition. */
|
||||
#define LOOP_DYNAMIC_PARTICLES \
|
||||
for (p = 0; p < psys->totpart; p++) \
|
||||
if ((pa = psys->particles + p)->state.time > 0.0f)
|
||||
|
||||
@@ -37,10 +37,4 @@ set(LIB
|
||||
)
|
||||
|
||||
|
||||
if(WITH_OPENMP AND WITH_OPENMP_STATIC)
|
||||
list(APPEND LIB
|
||||
${OpenMP_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_simulation "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
|
||||
@@ -40,12 +40,6 @@ if(WITH_TBB)
|
||||
list(INSERT LIB 0 bf_blenkernel)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENMP AND WITH_OPENMP_STATIC)
|
||||
list(APPEND LIB
|
||||
${OpenMP_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND INC ../../intern/utfconv)
|
||||
endif()
|
||||
@@ -1032,12 +1026,6 @@ elseif(WIN32)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENMP AND MSVC_CLANG)
|
||||
windows_install_shared_manifest(
|
||||
FILES ${CLANG_OPENMP_DLL}
|
||||
ALL
|
||||
)
|
||||
endif()
|
||||
# 4.1 FFTW libs need to be installed, in 4.2 FFTW got turned into a static lib
|
||||
# and the files below no longer exist.
|
||||
if(EXISTS ${LIBDIR}/fftw3/lib/fftw3.dll)
|
||||
|
||||
@@ -87,10 +87,6 @@
|
||||
# include <floatingpoint.h>
|
||||
#endif
|
||||
|
||||
#ifdef _OPENMP
|
||||
# include <omp.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_BINRELOC
|
||||
# include "binreloc.h"
|
||||
#endif
|
||||
@@ -302,18 +298,6 @@ int main(int argc,
|
||||
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||
#endif
|
||||
|
||||
#ifdef _OPENMP
|
||||
# if defined(WIN32) && defined(_MSC_VER)
|
||||
/* We delay loading of OPENMP so we can set the policy here. */
|
||||
_putenv_s("OMP_WAIT_POLICY", "PASSIVE");
|
||||
# endif
|
||||
/* Ensure the OpenMP runtime is initialized as soon as possible to make sure duplicate
|
||||
* `libomp/libiomp5` runtime conflicts are detected as soon as a second runtime is initialized.
|
||||
* Initialization must be done after setting any relevant environment variables, but before
|
||||
* installing signal handlers. */
|
||||
omp_get_max_threads();
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# ifdef USE_WIN32_UNICODE_ARGS
|
||||
/* Win32 Unicode Arguments. */
|
||||
|
||||
Reference in New Issue
Block a user