Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vdb_examples containing a fluid solver #1653

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ include(GNUInstallDirs)
option(OPENVDB_BUILD_CORE "Enable the core OpenVDB library. Both static and shared versions are enabled by default" ON)
option(OPENVDB_BUILD_BINARIES "Enable the vdb binaries. Only vdb_print is enabled by default" ON)
option(OPENVDB_BUILD_PYTHON_MODULE "Build the pyopenvdb Python module" OFF)
option(OPENVDB_BUILD_EXAMPLES "Build OpenVDB examples" OFF)
option(OPENVDB_BUILD_UNITTESTS "Build the OpenVDB unit tests" OFF)
option(OPENVDB_BUILD_DOCS "Build the OpenVDB documentation" OFF)
option(OPENVDB_BUILD_HOUDINI_PLUGIN "Build the Houdini plugin" OFF)
Expand Down Expand Up @@ -331,6 +332,7 @@ if(NOT (
OPENVDB_BUILD_AX_UNITTESTS OR
OPENVDB_BUILD_PYTHON_MODULE OR
OPENVDB_BUILD_UNITTESTS OR
OPENVDB_BUILD_EXAMPLES OR
OPENVDB_BUILD_HOUDINI_PLUGIN OR
OPENVDB_BUILD_HOUDINI_ABITESTS OR
OPENVDB_BUILD_MAYA_PLUGIN OR
Expand Down Expand Up @@ -368,7 +370,7 @@ include(cmake/config/OpenVDBCXX.cmake)
# * On Windows, we follow SideFX's example in using Tbbmalloc due to the challenges
# of injecting into the Windows runtime to replace the system allocator.

if((OPENVDB_BUILD_BINARIES OR OPENVDB_BUILD_UNITTESTS) AND CONCURRENT_MALLOC STREQUAL "Auto")
if((OPENVDB_BUILD_BINARIES OR OPENVDB_BUILD_UNITTESTS OR OPENVDB_BUILD_EXAMPLES) AND CONCURRENT_MALLOC STREQUAL "Auto")
if(WIN32 OR APPLE OR USE_MAYA)
set(CONCURRENT_MALLOC "Tbbmalloc")
else()
Expand Down Expand Up @@ -423,6 +425,7 @@ set(NEEDS_OPENVDB OFF)
if(OPENVDB_BUILD_AX OR
OPENVDB_BUILD_BINARIES OR
OPENVDB_BUILD_UNITTESTS OR
OPENVDB_BUILD_EXAMPLES OR
OPENVDB_BUILD_HOUDINI_PLUGIN OR
OPENVDB_BUILD_MAYA_PLUGIN OR
OPENVDB_BUILD_PYTHON_MODULE OR
Expand Down Expand Up @@ -548,6 +551,10 @@ if(OPENVDB_BUILD_UNITTESTS)
add_subdirectory(openvdb/openvdb/unittest)
endif()

if(OPENVDB_BUILD_EXAMPLES)
add_subdirectory(vdb_examples)
endif()

# Tests the vdb_ax binary so needs to come after openvdb_cmd
if(OPENVDB_BUILD_AX_UNITTESTS)
add_subdirectory(openvdb_ax/openvdb_ax/test)
Expand Down
54 changes: 54 additions & 0 deletions vdb_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## Copyright Contributors to the OpenVDB Project
# SPDX-License-Identifier: MPL-2.0
#
#[=======================================================================[

CMake Configuration for OpenVDB Examples

#]=======================================================================]

cmake_minimum_required(VERSION 3.18)
project(OpenVDBExamples LANGUAGES CXX)

include(GNUInstallDirs)

###### OpenVDB Binary Component Options

option(OPENVDB_BUILD_VDB_EXAMPLE_FLUIDS "Build vdb_example_fluids" OFF)

#########################################################################

message(STATUS "----------------------------------------------------")
message(STATUS "----------- Configuring OpenVDBExamples ------------")
message(STATUS "----------------------------------------------------")

##########################################################################

# Collect lib dependencies shared by all binaries

if(NOT OPENVDB_BUILD_CORE)
# @note Could also use the openvdb_je target here, but we just opt to
# handle the value of CONCURRENT_MALLOC outside of this branching for
# both cases
set(OPENVDB_LIB OpenVDB::openvdb)
else()
set(OPENVDB_LIB openvdb)
endif()

set(OPENVDB_BINARIES_DEPENDENT_LIBS
${OPENVDB_LIB}
)

if(CONCURRENT_MALLOC STREQUAL "Jemalloc")
find_package(Jemalloc REQUIRED)
list(APPEND OPENVDB_BINARIES_DEPENDENT_LIBS Jemalloc::jemalloc)
elseif(CONCURRENT_MALLOC STREQUAL "Tbbmalloc")
find_package(TBB ${MINIMUM_TBB_VERSION} REQUIRED COMPONENTS tbbmalloc)
list(APPEND OPENVDB_BINARIES_DEPENDENT_LIBS TBB::tbbmalloc)
endif()

##########################################################################

if (OPENVDB_BUILD_VDB_EXAMPLE_FLUIDS)
add_subdirectory(vdb_example_fluids)
endif()
19 changes: 19 additions & 0 deletions vdb_examples/vdb_example_fluids/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright Contributors to the OpenVDB Project
# SPDX-License-Identifier: MPL-2.0
#
#[=======================================================================[

CMake Configuration for VDB Example Fluids

#]=======================================================================]

cmake_minimum_required(VERSION 3.18)
project(VDBExampleFluids LANGUAGES CXX)

include(GNUInstallDirs)

set(SOURCE_FILES main.cc)
add_executable(vdb_example_fluids ${SOURCE_FILES})
target_link_libraries(vdb_example_fluids ${OPENVDB_BINARIES_DEPENDENT_LIBS})

install(TARGETS vdb_example_fluids RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Loading
Loading