diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 17:40:15 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 18:27:26 +0300 |
commit | 4ff7c5eed6b546ae42692f3a869a5ccc095a9cb4 (patch) | |
tree | 03f8233788ae46e66672f711e3cf42d8d00d01cc /extern/mantaflow/UPDATE.sh | |
parent | 6a3f2b30d206df23120cd212132adea821b6c20e (diff) |
Mantaflow [Part 1]: Added preprocessed Mantaflow source files
Includes preprocessed Mantaflow source files for both OpenMP and TBB (if OpenMP is not present, TBB files will be used instead).
These files come directly from the Mantaflow repository. Future updates to the core fluid solver will take place by updating the files.
Reviewed By: sergey, mont29
Maniphest Tasks: T59995
Differential Revision: https://developer.blender.org/D3850
Diffstat (limited to 'extern/mantaflow/UPDATE.sh')
-rw-r--r-- | extern/mantaflow/UPDATE.sh | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/extern/mantaflow/UPDATE.sh b/extern/mantaflow/UPDATE.sh new file mode 100644 index 00000000000..28d96cdf6d8 --- /dev/null +++ b/extern/mantaflow/UPDATE.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# +# ======================================================================================== +# UPDATING MANTAFLOW INSIDE BLENDER +# ======================================================================================== + +# ==================== 1) ENVIRONMENT SETUP ============================================= + +# YOUR INSTALLATION PATHS GO HERE: +MANTA_INSTALLATION=/Users/sebbas/Developer/Mantaflow/mantaflowDevelop +BLENDER_INSTALLATION=/Users/sebbas/Developer/Blender/fluid-mantaflow + +# Try to check out Mantaflow repository before building? +CLEAN_REPOSITORY=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 + git checkout develop +fi + +MANTA_BUILD_PATH=$MANTA_INSTALLATION/mantaflowgit/build_blender/ +mkdir -p $MANTA_BUILD_PATH +cd $MANTA_BUILD_PATH +cmake .. -DGUI=OFF -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=ON -DPREPDEBUG=ON && make -j8 + +# ==================== 3) COPY MANTAFLOW FILES TO BLENDER ROOT =========================== + +mkdir -p $BLENDER_INSTALLATION/blender/tmp/dependencies/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/dependencies/cnpy "$_" +mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/util "$_" +mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/pwrapper "$_" +mkdir -p $BLENDER_INSTALLATION/blender/tmp/preprocessed/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/build_blender/pp/source/. "$_" + +# Remove some files that are not need in Blender +rm $BLENDER_INSTALLATION/blender/tmp/dependencies/cnpy/example1.cpp +rm $BLENDER_INSTALLATION/blender/tmp/helper/pwrapper/pymain.cpp +rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/*.reg +rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/python/*.reg +rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/fileio/*.reg + +# ==================== 4) CLANG-FORMAT =================================================== + +cd $BLENDER_INSTALLATION/blender/tmp/ + +echo "Applying clang format to Mantaflow source files" +find . -iname *.h -o -iname *.cpp | xargs clang-format --verbose -i -style=file +find . -iname *.h -o -iname *.cpp | xargs dos2unix --verbose + +# ==================== 5) MOVE MANTAFLOW FILES TO EXTERN/ ================================ + +BLENDER_MANTA_EXTERN=$BLENDER_INSTALLATION/blender/extern/mantaflow/ +BLENDER_TMP=$BLENDER_INSTALLATION/blender/tmp +BLENDER_TMP_DEP=$BLENDER_TMP/dependencies +BLENDER_TMP_HLP=$BLENDER_TMP/helper +BLENDER_TMP_PP=$BLENDER_TMP/preprocessed + +# Move files from tmp dir to extern/ +cp -Rf $BLENDER_TMP_DEP $BLENDER_MANTA_EXTERN +cp -Rf $BLENDER_TMP_HLP $BLENDER_MANTA_EXTERN +cp -Rf $BLENDER_TMP_PP $BLENDER_MANTA_EXTERN + +# Copy the Mantaflow license and readme files as well +cp -Rf $MANTA_INSTALLATION/mantaflowgit/LICENSE $BLENDER_MANTA_EXTERN +cp -Rf $MANTA_INSTALLATION/mantaflowgit/README.md $BLENDER_MANTA_EXTERN + +# Cleanup left over dir +rm -r $BLENDER_TMP + +echo "Successfully copied new Mantaflow files to" $BLENDER_INSTALLATION/blender/extern/mantaflow/ + +# ==================== 6) CHECK CMAKE SETUP ============================================== + +# Make sure that all files copied from Mantaflow are listed in intern/mantaflow/CMakeLists.txt +# Especially if new source files / plugins were added to Mantaflow. |