Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2020-07-17 17:11:21 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2020-07-17 17:11:21 +0300
commit893eb30730c14d0040f5484958289e8fe1d3c4b2 (patch)
tree079bc58a3fa889fb61522cf380bcbb1aea066ef7 /extern
parent0cdc75ccd28c607677c302014cd40df542d85d35 (diff)
Fluid: Numpy support for Mantaflow build system
Adjusted the fluid build system so that plugins that depend on numpy can be compiled as well. Note that in this commit numpy support is still disabled. It can be enabled by re-running the Mantaflow update script with USE_NUMPY=1 and enabling WITH_MANTA_NUMPY in extern/mantaflow/CMakeLists.txt. This will happen in a future commit.
Diffstat (limited to 'extern')
-rw-r--r--extern/mantaflow/CMakeLists.txt36
-rw-r--r--extern/mantaflow/UPDATE.sh5
2 files changed, 32 insertions, 9 deletions
diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt
index 712aeb238c9..9f66b42c6bf 100644
--- a/extern/mantaflow/CMakeLists.txt
+++ b/extern/mantaflow/CMakeLists.txt
@@ -39,6 +39,9 @@ add_definitions(-DWITH_FLUID=1)
# Make sure that dependencies exist before enabling this option by updating the source files in extern/
set(WITH_MANTA_DEPENDENCIES 0)
+# Enable Mantaflow numpy support
+set(WITH_MANTA_NUMPY 0)
+
if(NOT WITH_MANTA_DEPENDENCIES)
add_definitions(-DNO_CNPY=1)
endif()
@@ -72,6 +75,10 @@ if(WIN32)
add_definitions(-D_USE_MATH_DEFINES)
endif()
+if(WITH_MANTA_NUMPY AND WITH_PYTHON_INSTALL_NUMPY)
+ add_definitions(-DNUMPY=1)
+endif()
+
set(INC
${MANTA_PP}
${MANTA_PP}/fileio
@@ -79,14 +86,25 @@ set(INC
${MANTA_PP}/plugin
${MANTA_HLP}/pwrapper
${MANTA_HLP}/util
- ${MANTA_DEP}/cnpy
)
+if(WITH_MANTA_DEPENDENCIES)
+ list(APPEND INC
+ ${MANTA_DEP}/cnpy
+ )
+endif()
+
set(INC_SYS
${PYTHON_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
+if(WITH_MANTA_NUMPY AND WITH_PYTHON_INSTALL_NUMPY)
+ list(APPEND INC_SYS
+ ${PYTHON_NUMPY_INCLUDE_DIRS}
+ )
+endif()
+
if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
@@ -168,14 +186,10 @@ set(SRC
${MANTA_PP}/plugin/initplugins.cpp
${MANTA_PP}/plugin/kepsilon.cpp
${MANTA_PP}/plugin/meshplugins.cpp
-# TODO (sebbas): add numpy to libraries
-# ${MANTA_PP}/plugin/numpyconvert.cpp
${MANTA_PP}/plugin/pressure.cpp
${MANTA_PP}/plugin/ptsplugins.cpp
${MANTA_PP}/plugin/secondaryparticles.cpp
${MANTA_PP}/plugin/surfaceturbulence.cpp
-# TODO (sebbas): add numpy to libraries
-# ${MANTA_PP}/plugin/tfplugins.cpp
${MANTA_PP}/plugin/vortexplugins.cpp
${MANTA_PP}/plugin/waveletturbulence.cpp
${MANTA_PP}/plugin/waves.cpp
@@ -200,9 +214,6 @@ set(SRC
${MANTA_PP}/vortexsheet.h.reg.cpp
${MANTA_HLP}/pwrapper/manta.h
-# TODO (sebbas): add numpy to libraries
-# ${MANTA_HLP}/pwrapper/numpyWrap.cpp
-# ${MANTA_HLP}/pwrapper/numpyWrap.h
${MANTA_HLP}/pwrapper/pclass.cpp
${MANTA_HLP}/pwrapper/pclass.h
${MANTA_HLP}/pwrapper/pconvert.cpp
@@ -235,6 +246,15 @@ if(WITH_MANTA_DEPENDENCIES)
)
endif()
+if(WITH_MANTA_NUMPY AND WITH_PYTHON_INSTALL_NUMPY)
+ list(APPEND SRC
+ ${MANTA_PP}/plugin/numpyconvert.cpp
+ ${MANTA_PP}/plugin/tfplugins.cpp
+ ${MANTA_HLP}/pwrapper/numpyWrap.cpp
+ ${MANTA_HLP}/pwrapper/numpyWrap.h
+ )
+endif()
+
set(LIB
${PYTHON_LINKFLAGS}
${PYTHON_LIBRARIES}
diff --git a/extern/mantaflow/UPDATE.sh b/extern/mantaflow/UPDATE.sh
index 62395fde7cd..aed4e2a9b71 100644
--- a/extern/mantaflow/UPDATE.sh
+++ b/extern/mantaflow/UPDATE.sh
@@ -16,6 +16,9 @@ CLEAN_REPOSITORY=0
# Skip copying dependency files?
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
@@ -53,7 +56,7 @@ 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 && make -j8
+cmake ../mantaflowgit -DGUI=0 -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=1 -DPREPDEBUG=1 -DNUMPY=$USE_NUMPY && make -j8
# ==================== 3) COPY MANTAFLOW FILES TO BLENDER ROOT ===========================