Skip to content

Commit

Permalink
Search for a better openvdb find module if available
Browse files Browse the repository at this point in the history
Solves prusa3d#6681, alternative path for openvdb installation can be specified via cache variable
  • Loading branch information
tamasmeszaros committed Jul 15, 2021
1 parent 062031a commit e650759
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0)
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)

set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")

set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")

set(IS_CROSS_COMPILE FALSE)
Expand Down Expand Up @@ -492,13 +494,17 @@ find_package(NLopt 1.4 REQUIRED)
if(SLIC3R_STATIC)
set(OPENVDB_USE_STATIC_LIBS ON)
set(USE_BLOSC TRUE)
endif()
endif ()

find_package(OpenVDB 5.0 REQUIRED COMPONENTS openvdb)
find_package(OpenVDB 5.0 COMPONENTS openvdb)
if(OpenVDB_FOUND)
slic3r_remap_configs(IlmBase::Half RelWithDebInfo Release)
slic3r_remap_configs(Blosc::blosc RelWithDebInfo Release)
endif()
else ()
message(FATAL_ERROR "OpenVDB could not be found with the bundled find module. "
"You can try to specify the find module location of your "
"OpenVDB installation with the OPENVDB_FIND_MODULE_PATH cache variable.")
endif ()

set(TOP_LEVEL_PROJECT_DIR ${PROJECT_SOURCE_DIR})
function(prusaslicer_copy_dlls target)
Expand Down
21 changes: 21 additions & 0 deletions cmake/modules/FindOpenVDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ may be provided to tell this module where to look.
#]=======================================================================]

# If an explicit openvdb module path was specified, that will be used
if (OPENVDB_FIND_MODULE_PATH)
set(_module_path_bak ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH ${OPENVDB_FIND_MODULE_PATH})
find_package(
OpenVDB ${OpenVDB_FIND_VERSION} QUIET
COMPONENTS
${OpenVDB_FIND_COMPONENTS}
)

set(CMAKE_MODULE_PATH ${_module_path_bak})
if (OpenVDB_FOUND)
return()
endif ()

if (NOT OpenVDB_FIND_QUIETLY)
message(STATUS "Using bundled find module for OpenVDB")
endif ()
endif ()
# ###########################################################################

cmake_minimum_required(VERSION 3.3)
# Monitoring <PackageName>_ROOT variables
if(POLICY CMP0074)
Expand Down

0 comments on commit e650759

Please sign in to comment.