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

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2019-10-25 16:48:01 +0300
committertamasmeszaros <meszaros.q@gmail.com>2019-10-25 16:48:01 +0300
commit1cc7bd9976dc96eb119c0b80f9c8a9a2dab6aa7c (patch)
treed19ee9d8627036fe1ad000a19b754bcee87ae005 /cmake/modules
parent5c0cd06f2f37bec076d39ad932ca0a0fd40446b5 (diff)
Fix openvdb dependency in libslic3r
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindOpenVDB.cmake56
-rw-r--r--cmake/modules/OpenVDBUtils.cmake8
2 files changed, 45 insertions, 19 deletions
diff --git a/cmake/modules/FindOpenVDB.cmake b/cmake/modules/FindOpenVDB.cmake
index 9afe8a235..dd4ff5b20 100644
--- a/cmake/modules/FindOpenVDB.cmake
+++ b/cmake/modules/FindOpenVDB.cmake
@@ -108,6 +108,18 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
+if(OpenVDB_FIND_QUIETLY)
+ set (_quiet "QUIET")
+else()
+ set (_quiet "")
+endif()
+
+if(OpenVDB_FIND_REQUIRED)
+ set (_required "REQUIRED")
+else()
+ set (_required "")
+endif()
+
# Include utility functions for version information
include(${CMAKE_CURRENT_LIST_DIR}/OpenVDBUtils.cmake)
@@ -146,7 +158,7 @@ set(_OPENVDB_ROOT_SEARCH_DIR "")
# Additionally try and use pkconfig to find OpenVDB
-find_package(PkgConfig)
+find_package(PkgConfig ${_quiet} ${_required})
pkg_check_modules(PC_OpenVDB QUIET OpenVDB)
# ------------------------------------------------------------------------
@@ -250,7 +262,7 @@ OPENVDB_ABI_VERSION_FROM_PRINT(
ABI OpenVDB_ABI
)
-if(NOT OpenVDB_FIND_QUIET)
+if(NOT OpenVDB_FIND_QUIETLY)
if(NOT OpenVDB_ABI)
message(WARNING "Unable to determine OpenVDB ABI version from OpenVDB "
"installation. The library major version \"${OpenVDB_MAJOR_VERSION}\" "
@@ -268,7 +280,17 @@ endif()
# Add standard dependencies
-find_package(IlmBase COMPONENTS Half)
+macro(just_fail msg)
+ set(OpenVDB_FOUND FALSE)
+ if(OpenVDB_FIND_REQUIRED)
+ message(FATAL_ERROR msg)
+ elseif(NOT OpenVDB_FIND_QUIETLY)
+ message(ERROR msg)
+ endif()
+ return()
+endmacro()
+
+find_package(IlmBase QUIET COMPONENTS Half)
if(NOT IlmBase_FOUND)
pkg_check_modules(IlmBase QUIET IlmBase)
endif()
@@ -276,20 +298,20 @@ if (IlmBase_FOUND AND NOT TARGET IlmBase::Half)
message(STATUS "Falling back to IlmBase found by pkg-config...")
find_library(IlmHalf_LIBRARY NAMES Half)
- if(IlmHalf_LIBRARY-NOTFOUND)
- message(FATAL_ERROR "IlmBase::Half can not be found!")
+ if(IlmHalf_LIBRARY-NOTFOUND OR NOT IlmBase_INCLUDE_DIRS)
+ just_fail("IlmBase::Half can not be found!")
endif()
add_library(IlmBase::Half UNKNOWN IMPORTED)
set_target_properties(IlmBase::Half PROPERTIES
IMPORTED_LOCATION "${IlmHalf_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES ${IlmBase_INCLUDE_DIRS})
+ INTERFACE_INCLUDE_DIRECTORIES "${IlmBase_INCLUDE_DIRS}")
elseif(NOT IlmBase_FOUND)
- message(FATAL_ERROR "IlmBase::Half can not be found!")
+ just_fail("IlmBase::Half can not be found!")
endif()
-find_package(TBB REQUIRED COMPONENTS tbb)
-find_package(ZLIB REQUIRED)
-find_package(Boost REQUIRED COMPONENTS iostreams system)
+find_package(TBB ${_quiet} ${_required} COMPONENTS tbb)
+find_package(ZLIB ${_quiet} ${_required})
+find_package(Boost ${_quiet} ${_required} COMPONENTS iostreams system )
# Use GetPrerequisites to see which libraries this OpenVDB lib has linked to
# which we can query for optional deps. This basically runs ldd/otoll/objdump
@@ -350,7 +372,7 @@ unset(_OPENVDB_PREREQUISITE_LIST)
unset(_HAS_DEP)
if(OpenVDB_USES_BLOSC)
- find_package(Blosc )
+ find_package(Blosc QUIET)
if(NOT Blosc_FOUND OR NOT TARGET Blosc::blosc)
message(STATUS "find_package could not find Blosc. Using fallback blosc search...")
find_path(Blosc_INCLUDE_DIR blosc.h)
@@ -362,25 +384,25 @@ if(OpenVDB_USES_BLOSC)
IMPORTED_LOCATION "${Blosc_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES ${Blosc_INCLUDE_DIR})
elseif()
- message(FATAL_ERROR "Blosc library can not be found!")
+ just_fail("Blosc library can not be found!")
endif()
endif()
endif()
if(OpenVDB_USES_LOG4CPLUS)
- find_package(Log4cplus REQUIRED)
+ find_package(Log4cplus ${_quiet} ${_required})
endif()
if(OpenVDB_USES_ILM)
- find_package(IlmBase REQUIRED)
+ find_package(IlmBase ${_quiet} ${_required})
endif()
if(OpenVDB_USES_EXR)
- find_package(OpenEXR REQUIRED)
+ find_package(OpenEXR ${_quiet} ${_required})
endif()
if(UNIX)
- find_package(Threads REQUIRED)
+ find_package(Threads ${_quiet} ${_required})
endif()
# Set deps. Note that the order here is important. If we're building against
@@ -481,7 +503,7 @@ foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
endif()
endforeach()
-if(OpenVDB_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
+if(OpenVDB_FOUND AND NOT OpenVDB_FIND_QUIETLY)
message(STATUS "OpenVDB libraries: ${OpenVDB_LIBRARIES}")
endif()
diff --git a/cmake/modules/OpenVDBUtils.cmake b/cmake/modules/OpenVDBUtils.cmake
index bb3ce6e65..f64eda6f2 100644
--- a/cmake/modules/OpenVDBUtils.cmake
+++ b/cmake/modules/OpenVDBUtils.cmake
@@ -125,7 +125,9 @@ function(OPENVDB_ABI_VERSION_FROM_PRINT OPENVDB_PRINT)
cmake_parse_arguments(_VDB "QUIET" "ABI" "" ${ARGN})
if(NOT EXISTS ${OPENVDB_PRINT})
- message(WARNING "vdb_print not found! ${OPENVDB_PRINT}")
+ if(NOT OpenVDB_FIND_QUIETLY)
+ message(WARNING "vdb_print not found! ${OPENVDB_PRINT}")
+ endif()
return()
endif()
@@ -148,7 +150,9 @@ function(OPENVDB_ABI_VERSION_FROM_PRINT OPENVDB_PRINT)
endif()
if(${_VDB_PRINT_RETURN_STATUS})
- message(WARNING "vdb_print returned with status ${_VDB_PRINT_RETURN_STATUS}")
+ if(NOT OpenVDB_FIND_QUIETLY)
+ message(WARNING "vdb_print returned with status ${_VDB_PRINT_RETURN_STATUS}")
+ endif()
return()
endif()