diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b1d73f89..1c704a04b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,7 +254,8 @@ if(NOT WIN32) # boost::process was introduced first in version 1.64.0 set(MINIMUM_BOOST_VERSION "1.64.0") endif() -find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex) +set(_boost_components "system;filesystem;thread;log;locale;regex") +find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components}) add_library(boost_libs INTERFACE) add_library(boost_headeronly INTERFACE) @@ -268,23 +269,41 @@ if(NOT SLIC3R_STATIC) target_compile_definitions(boost_headeronly INTERFACE BOOST_LOG_DYN_LINK) endif() +function(slic3r_remap_configs targets from_Cfg to_Cfg) + if(MSVC) + string(TOUPPER ${from_Cfg} from_CFG) + + foreach(tgt ${targets}) + if(TARGET ${tgt}) + set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg}) + endif() + endforeach() + endif() +endfunction() + if(TARGET Boost::system) message(STATUS "Boost::boost exists") target_link_libraries(boost_headeronly INTERFACE Boost::boost) + + # Only from cmake 3.12 + # list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets) + set(_boost_targets "") + foreach(comp ${_boost_components}) + list(APPEND _boost_targets "Boost::${comp}") + endforeach() + target_link_libraries(boost_libs INTERFACE boost_headeronly # includes the custom compile definitions as well - Boost::system - Boost::filesystem - Boost::thread - Boost::log - Boost::locale - Boost::regex + ${_boost_targets} ) + slic3r_remap_configs("${_boost_targets}" RelWithDebInfo Release) else() target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS}) target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES}) endif() + + # Find and configure intel-tbb if(SLIC3R_STATIC) set(TBB_STATIC 1) @@ -377,6 +396,14 @@ add_custom_target(pot find_package(NLopt 1.4 REQUIRED) +if(SLIC3R_STATIC) + set(OPENVDB_USE_STATIC_LIBS ON) + set(USE_BLOSC TRUE) +endif() + +find_package(OpenVDB 5.0 REQUIRED openvdb) +slic3r_remap_configs(IlmBase::Half RelWithDebInfo Release) + # libslic3r, PrusaSlicer GUI and the PrusaSlicer executable. add_subdirectory(src) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT PrusaSlicer_app_console) diff --git a/cmake/modules/FindOpenVDB.cmake b/cmake/modules/FindOpenVDB.cmake new file mode 100644 index 000000000..9afe8a235 --- /dev/null +++ b/cmake/modules/FindOpenVDB.cmake @@ -0,0 +1,490 @@ +# Copyright (c) DreamWorks Animation LLC +# +# All rights reserved. This software is distributed under the +# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ ) +# +# Redistributions of source code must retain the above copyright +# and license notice and the following restrictions and disclaimer. +# +# * Neither the name of DreamWorks Animation nor the names of +# its contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE +# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00. +# +#[=======================================================================[.rst: + +FindOpenVDB +----------- + +Find OpenVDB include dirs, libraries and settings + +Use this module by invoking find_package with the form:: + + find_package(OpenVDB + [version] [EXACT] # Minimum or EXACT version + [REQUIRED] # Fail with error if OpenVDB is not found + [COMPONENTS ...] # OpenVDB libraries by their canonical name + # e.g. "openvdb" for "libopenvdb" + ) + +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +``OpenVDB::openvdb`` + The core openvdb library target. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``OpenVDB_FOUND`` + True if the system has the OpenVDB library. +``OpenVDB_VERSION`` + The version of the OpenVDB library which was found. +``OpenVDB_INCLUDE_DIRS`` + Include directories needed to use OpenVDB. +``OpenVDB_LIBRARIES`` + Libraries needed to link to OpenVDB. +``OpenVDB_LIBRARY_DIRS`` + OpenVDB library directories. +``OpenVDB_DEFINITIONS`` + Definitions to use when compiling code that uses OpenVDB. +``OpenVDB_{COMPONENT}_FOUND`` + True if the system has the named OpenVDB component. +``OpenVDB_USES_BLOSC`` + True if the OpenVDB Library has been built with blosc support +``OpenVDB_USES_LOG4CPLUS`` + True if the OpenVDB Library has been built with log4cplus support +``OpenVDB_USES_EXR`` + True if the OpenVDB Library has been built with openexr support +``OpenVDB_ABI`` + Set if this module was able to determine the ABI number the located + OpenVDB Library was built against. Unset otherwise. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``OpenVDB_INCLUDE_DIR`` + The directory containing ``openvdb/version.h``. +``OpenVDB_{COMPONENT}_LIBRARY`` + Individual component libraries for OpenVDB + +Hints +^^^^^ + +Instead of explicitly setting the cache variables, the following variables +may be provided to tell this module where to look. + +``OPENVDB_ROOT`` + Preferred installation prefix. +``OPENVDB_INCLUDEDIR`` + Preferred include directory e.g. /include +``OPENVDB_LIBRARYDIR`` + Preferred library directory e.g. /lib +``SYSTEM_LIBRARY_PATHS`` + Paths appended to all include and lib searches. + +#]=======================================================================] + +cmake_minimum_required(VERSION 3.3) +# Monitoring _ROOT variables +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + +# Include utility functions for version information +include(${CMAKE_CURRENT_LIST_DIR}/OpenVDBUtils.cmake) + +mark_as_advanced( + OpenVDB_INCLUDE_DIR + OpenVDB_LIBRARY +) + +set(_OPENVDB_COMPONENT_LIST + openvdb +) + +if(OpenVDB_FIND_COMPONENTS) + set(OPENVDB_COMPONENTS_PROVIDED TRUE) + set(_IGNORED_COMPONENTS "") + foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS}) + if(NOT ${COMPONENT} IN_LIST _OPENVDB_COMPONENT_LIST) + list(APPEND _IGNORED_COMPONENTS ${COMPONENT}) + endif() + endforeach() + + if(_IGNORED_COMPONENTS) + message(STATUS "Ignoring unknown components of OpenVDB:") + foreach(COMPONENT ${_IGNORED_COMPONENTS}) + message(STATUS " ${COMPONENT}") + endforeach() + list(REMOVE_ITEM OpenVDB_FIND_COMPONENTS ${_IGNORED_COMPONENTS}) + endif() +else() + set(OPENVDB_COMPONENTS_PROVIDED FALSE) + set(OpenVDB_FIND_COMPONENTS ${_OPENVDB_COMPONENT_LIST}) +endif() + +# Append OPENVDB_ROOT or $ENV{OPENVDB_ROOT} if set (prioritize the direct cmake var) +set(_OPENVDB_ROOT_SEARCH_DIR "") + +# Additionally try and use pkconfig to find OpenVDB + +find_package(PkgConfig) +pkg_check_modules(PC_OpenVDB QUIET OpenVDB) + +# ------------------------------------------------------------------------ +# Search for OpenVDB include DIR +# ------------------------------------------------------------------------ + +set(_OPENVDB_INCLUDE_SEARCH_DIRS "") +list(APPEND _OPENVDB_INCLUDE_SEARCH_DIRS + ${OPENVDB_INCLUDEDIR} + ${_OPENVDB_ROOT_SEARCH_DIR} + ${PC_OpenVDB_INCLUDE_DIRS} + ${SYSTEM_LIBRARY_PATHS} +) + +# Look for a standard OpenVDB header file. +find_path(OpenVDB_INCLUDE_DIR openvdb/version.h + PATHS ${_OPENVDB_INCLUDE_SEARCH_DIRS} + PATH_SUFFIXES include +) + +OPENVDB_VERSION_FROM_HEADER("${OpenVDB_INCLUDE_DIR}/openvdb/version.h" + VERSION OpenVDB_VERSION + MAJOR OpenVDB_MAJOR_VERSION + MINOR OpenVDB_MINOR_VERSION + PATCH OpenVDB_PATCH_VERSION +) + +# ------------------------------------------------------------------------ +# Search for OPENVDB lib DIR +# ------------------------------------------------------------------------ + +set(_OPENVDB_LIBRARYDIR_SEARCH_DIRS "") + +# Append to _OPENVDB_LIBRARYDIR_SEARCH_DIRS in priority order + +list(APPEND _OPENVDB_LIBRARYDIR_SEARCH_DIRS + ${OPENVDB_LIBRARYDIR} + ${_OPENVDB_ROOT_SEARCH_DIR} + ${PC_OpenVDB_LIBRARY_DIRS} + ${SYSTEM_LIBRARY_PATHS} +) + +# Build suffix directories + +set(OPENVDB_PATH_SUFFIXES + lib64 + lib +) + +# Static library setup +if(UNIX AND OPENVDB_USE_STATIC_LIBS) + set(_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +endif() + +set(OpenVDB_LIB_COMPONENTS "") + +foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS}) + set(LIB_NAME ${COMPONENT}) + find_library(OpenVDB_${COMPONENT}_LIBRARY ${LIB_NAME} lib${LIB_NAME} + PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS} + PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES} + ) + list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY}) + + if(OpenVDB_${COMPONENT}_LIBRARY) + set(OpenVDB_${COMPONENT}_FOUND TRUE) + else() + set(OpenVDB_${COMPONENT}_FOUND FALSE) + endif() +endforeach() + +if(UNIX AND OPENVDB_USE_STATIC_LIBS) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + unset(_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) +endif() + +# ------------------------------------------------------------------------ +# Cache and set OPENVDB_FOUND +# ------------------------------------------------------------------------ + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenVDB + FOUND_VAR OpenVDB_FOUND + REQUIRED_VARS + OpenVDB_INCLUDE_DIR + OpenVDB_LIB_COMPONENTS + VERSION_VAR OpenVDB_VERSION + HANDLE_COMPONENTS +) + +# ------------------------------------------------------------------------ +# Determine ABI number +# ------------------------------------------------------------------------ + +# Set the ABI number the library was built against. Uses vdb_print +find_program(OPENVDB_PRINT vdb_print PATHS ${OpenVDB_INCLUDE_DIR} ) + +OPENVDB_ABI_VERSION_FROM_PRINT( + "${OPENVDB_PRINT}" + ABI OpenVDB_ABI +) + +if(NOT OpenVDB_FIND_QUIET) + if(NOT OpenVDB_ABI) + message(WARNING "Unable to determine OpenVDB ABI version from OpenVDB " + "installation. The library major version \"${OpenVDB_MAJOR_VERSION}\" " + "will be inferred. If this is not correct, use " + "add_definitions(-DOPENVDB_ABI_VERSION_NUMBER=N)" + ) + else() + message(STATUS "OpenVDB ABI Version: ${OpenVDB_ABI}") + endif() +endif() + +# ------------------------------------------------------------------------ +# Handle OpenVDB dependencies +# ------------------------------------------------------------------------ + +# Add standard dependencies + +find_package(IlmBase COMPONENTS Half) +if(NOT IlmBase_FOUND) + pkg_check_modules(IlmBase QUIET IlmBase) +endif() +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!") + endif() + + add_library(IlmBase::Half UNKNOWN IMPORTED) + set_target_properties(IlmBase::Half PROPERTIES + IMPORTED_LOCATION "${IlmHalf_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES ${IlmBase_INCLUDE_DIRS}) +elseif(NOT IlmBase_FOUND) + message(FATAL_ERROR "IlmBase::Half can not be found!") +endif() +find_package(TBB REQUIRED COMPONENTS tbb) +find_package(ZLIB REQUIRED) +find_package(Boost 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 +# etc to track deps. We could use a vdb_config binary tools here to improve +# this process + +include(GetPrerequisites) + +set(_EXCLUDE_SYSTEM_PREREQUISITES 1) +set(_RECURSE_PREREQUISITES 0) +set(_OPENVDB_PREREQUISITE_LIST) + +if(NOT OPENVDB_USE_STATIC_LIBS) +get_prerequisites(${OpenVDB_openvdb_LIBRARY} + _OPENVDB_PREREQUISITE_LIST + ${_EXCLUDE_SYSTEM_PREREQUISITES} + ${_RECURSE_PREREQUISITES} + "" + "${SYSTEM_LIBRARY_PATHS}" +) +endif() + +unset(_EXCLUDE_SYSTEM_PREREQUISITES) +unset(_RECURSE_PREREQUISITES) + +# As the way we resolve optional libraries relies on library file names, use +# the configuration options from the main CMakeLists.txt to allow users +# to manually identify the requirements of OpenVDB builds if they know them. + +set(OpenVDB_USES_BLOSC ${USE_BLOSC}) +set(OpenVDB_USES_LOG4CPLUS ${USE_LOG4CPLUS}) +set(OpenVDB_USES_ILM ${USE_EXR}) +set(OpenVDB_USES_EXR ${USE_EXR}) + +# Search for optional dependencies + +foreach(PREREQUISITE ${_OPENVDB_PREREQUISITE_LIST}) + set(_HAS_DEP) + get_filename_component(PREREQUISITE ${PREREQUISITE} NAME) + + string(FIND ${PREREQUISITE} "blosc" _HAS_DEP) + if(NOT ${_HAS_DEP} EQUAL -1) + set(OpenVDB_USES_BLOSC ON) + endif() + + string(FIND ${PREREQUISITE} "log4cplus" _HAS_DEP) + if(NOT ${_HAS_DEP} EQUAL -1) + set(OpenVDB_USES_LOG4CPLUS ON) + endif() + + string(FIND ${PREREQUISITE} "IlmImf" _HAS_DEP) + if(NOT ${_HAS_DEP} EQUAL -1) + set(OpenVDB_USES_ILM ON) + endif() +endforeach() + +unset(_OPENVDB_PREREQUISITE_LIST) +unset(_HAS_DEP) + +if(OpenVDB_USES_BLOSC) + find_package(Blosc ) + 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) + find_library(Blosc_LIBRARY NAMES blosc) + if (Blosc_INCLUDE_DIR AND Blosc_LIBRARY) + set(Blosc_FOUND TRUE) + add_library(Blosc::blosc UNKNOWN IMPORTED) + set_target_properties(Blosc::blosc PROPERTIES + IMPORTED_LOCATION "${Blosc_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES ${Blosc_INCLUDE_DIR}) + elseif() + message(FATAL_ERROR "Blosc library can not be found!") + endif() + endif() +endif() + +if(OpenVDB_USES_LOG4CPLUS) + find_package(Log4cplus REQUIRED) +endif() + +if(OpenVDB_USES_ILM) + find_package(IlmBase REQUIRED) +endif() + +if(OpenVDB_USES_EXR) + find_package(OpenEXR REQUIRED) +endif() + +if(UNIX) + find_package(Threads REQUIRED) +endif() + +# Set deps. Note that the order here is important. If we're building against +# Houdini 17.5 we must include OpenEXR and IlmBase deps first to ensure the +# users chosen namespaced headers are correctly prioritized. Otherwise other +# include paths from shared installs (including houdini) may pull in the wrong +# headers + +set(_OPENVDB_VISIBLE_DEPENDENCIES + Boost::iostreams + Boost::system + IlmBase::Half +) + +set(_OPENVDB_DEFINITIONS) +if(OpenVDB_ABI) + list(APPEND _OPENVDB_DEFINITIONS "-DOPENVDB_ABI_VERSION_NUMBER=${OpenVDB_ABI}") +endif() + +if(OpenVDB_USES_EXR) + list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Imath + OpenEXR::IlmImf + ) + list(APPEND _OPENVDB_DEFINITIONS "-DOPENVDB_TOOLS_RAYTRACER_USE_EXR") +endif() + +if(OpenVDB_USES_LOG4CPLUS) + list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES Log4cplus::log4cplus) + list(APPEND _OPENVDB_DEFINITIONS "-DOPENVDB_USE_LOG4CPLUS") +endif() + +list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES + TBB::tbb +) +if(UNIX) + list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES + Threads::Threads + ) +endif() + +set(_OPENVDB_HIDDEN_DEPENDENCIES) + +if(OpenVDB_USES_BLOSC) + if(OPENVDB_USE_STATIC_LIBS) + list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES $) + else() + list(APPEND _OPENVDB_HIDDEN_DEPENDENCIES Blosc::blosc) + endif() +endif() + +if(OPENVDB_USE_STATIC_LIBS) + list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES $) +else() + list(APPEND _OPENVDB_HIDDEN_DEPENDENCIES ZLIB::ZLIB) +endif() + +# ------------------------------------------------------------------------ +# Configure imported target +# ------------------------------------------------------------------------ + +set(OpenVDB_LIBRARIES + ${OpenVDB_LIB_COMPONENTS} +) +set(OpenVDB_INCLUDE_DIRS ${OpenVDB_INCLUDE_DIR}) + +set(OpenVDB_DEFINITIONS) +list(APPEND OpenVDB_DEFINITIONS "${PC_OpenVDB_CFLAGS_OTHER}") +list(APPEND OpenVDB_DEFINITIONS "${_OPENVDB_DEFINITIONS}") +list(REMOVE_DUPLICATES OpenVDB_DEFINITIONS) + +set(OpenVDB_LIBRARY_DIRS "") +foreach(LIB ${OpenVDB_LIB_COMPONENTS}) + get_filename_component(_OPENVDB_LIBDIR ${LIB} DIRECTORY) + list(APPEND OpenVDB_LIBRARY_DIRS ${_OPENVDB_LIBDIR}) +endforeach() +list(REMOVE_DUPLICATES OpenVDB_LIBRARY_DIRS) + +foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS}) + if(NOT TARGET OpenVDB::${COMPONENT}) + add_library(OpenVDB::${COMPONENT} UNKNOWN IMPORTED) + set_target_properties(OpenVDB::${COMPONENT} PROPERTIES + IMPORTED_LOCATION "${OpenVDB_${COMPONENT}_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${OpenVDB_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_INCLUDE_DIR}" + IMPORTED_LINK_DEPENDENT_LIBRARIES "${_OPENVDB_HIDDEN_DEPENDENCIES}" # non visible deps + INTERFACE_LINK_LIBRARIES "${_OPENVDB_VISIBLE_DEPENDENCIES}" # visible deps (headers) + INTERFACE_COMPILE_FEATURES cxx_std_11 + ) + + if (OPENVDB_USE_STATIC_LIBS) + set_target_properties(OpenVDB::${COMPONENT} PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "OPENVDB_STATICLIB;OPENVDB_OPENEXR_STATICLIB" + ) + endif() + endif() +endforeach() + +if(OpenVDB_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + message(STATUS "OpenVDB libraries: ${OpenVDB_LIBRARIES}") +endif() + +unset(_OPENVDB_DEFINITIONS) +unset(_OPENVDB_VISIBLE_DEPENDENCIES) +unset(_OPENVDB_HIDDEN_DEPENDENCIES) diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index b09bafda3..3b9f46b96 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -93,8 +93,16 @@ # This module will also create the "tbb" target that may be used when building # executables and libraries. +unset(TBB_FOUND CACHE) +unset(TBB_INCLUDE_DIRS CACHE) +unset(TBB_LIBRARIES) +unset(TBB_LIBRARIES_DEBUG) +unset(TBB_LIBRARIES_RELEASE) + include(FindPackageHandleStandardArgs) +find_package(Threads QUIET REQUIRED) + if(NOT TBB_FOUND) ################################## @@ -215,6 +223,9 @@ if(NOT TBB_FOUND) foreach(_comp ${TBB_SEARCH_COMPOMPONENTS}) if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};") + unset(TBB_${_comp}_LIBRARY_DEBUG CACHE) + unset(TBB_${_comp}_LIBRARY_RELEASE CACHE) + # Search for the libraries find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}${TBB_STATIC_SUFFIX} HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} @@ -261,6 +272,7 @@ if(NOT TBB_FOUND) set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}") endif() + set(TBB_DEFINITIONS "") if (MSVC AND TBB_STATIC) set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE) endif () @@ -269,6 +281,7 @@ if(NOT TBB_FOUND) find_package_handle_standard_args(TBB REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES + FAIL_MESSAGE "TBB library cannot be found. Consider set TBBROOT environment variable." HANDLE_COMPONENTS VERSION_VAR TBB_VERSION) @@ -279,6 +292,8 @@ if(NOT TBB_FOUND) if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND) add_library(TBB::tbb UNKNOWN IMPORTED) set_target_properties(TBB::tbb PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS}" + INTERFACE_LINK_LIBRARIES "Threads::Threads;${CMAKE_DL_LIBS}" INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS} IMPORTED_LOCATION ${TBB_LIBRARIES}) if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG) @@ -290,11 +305,6 @@ if(NOT TBB_FOUND) IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE} ) endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - find_package(Threads QUIET REQUIRED) - set_target_properties(TBB::tbb PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS};Threads::Threads") - endif() endif() mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES) diff --git a/cmake/modules/OpenVDBUtils.cmake b/cmake/modules/OpenVDBUtils.cmake new file mode 100644 index 000000000..bb3ce6e65 --- /dev/null +++ b/cmake/modules/OpenVDBUtils.cmake @@ -0,0 +1,166 @@ +# Copyright (c) DreamWorks Animation LLC +# +# All rights reserved. This software is distributed under the +# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ ) +# +# Redistributions of source code must retain the above copyright +# and license notice and the following restrictions and disclaimer. +# +# * Neither the name of DreamWorks Animation nor the names of +# its contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE +# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00. +# +#[=======================================================================[.rst: + +OpenVDBUtils.cmake +------------------ + +A utility CMake file which provides helper functions for configuring an +OpenVDB installation. + +Use this module by invoking include with the form:: + + include ( OpenVDBUtils ) + + +The following functions are provided: + +``OPENVDB_VERSION_FROM_HEADER`` + + OPENVDB_VERSION_FROM_HEADER ( + VERSION [] + MAJOR [] + MINOR [] + PATCH [] ) + + Parse the provided version file to retrieve the current OpenVDB + version information. The file is expected to be a version.h file + as found in the following path of an OpenVDB repository: + openvdb/version.h + + If the file does not exist, variables are unmodified. + +``OPENVDB_ABI_VERSION_FROM_PRINT`` + + OPENVDB_ABI_VERSION_FROM_PRINT ( + [QUIET] + ABI [] ) + + Retrieve the ABI version that an installation of OpenVDB was compiled + for using the provided vdb_print binary. Parses the result of: + vdb_print --version + + If the binary does not exist or fails to launch, variables are + unmodified. + +#]=======================================================================] + + +function(OPENVDB_VERSION_FROM_HEADER OPENVDB_VERSION_FILE) + cmake_parse_arguments(_VDB "" "VERSION;MAJOR;MINOR;PATCH" "" ${ARGN}) + + if(NOT EXISTS ${OPENVDB_VERSION_FILE}) + return() + endif() + + file(STRINGS "${OPENVDB_VERSION_FILE}" openvdb_version_str + REGEX "^#define[\t ]+OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER[\t ]+.*" + ) + string(REGEX REPLACE "^.*OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1" + _OpenVDB_MAJOR_VERSION "${openvdb_version_str}" + ) + + file(STRINGS "${OPENVDB_VERSION_FILE}" openvdb_version_str + REGEX "^#define[\t ]+OPENVDB_LIBRARY_MINOR_VERSION_NUMBER[\t ]+.*" + ) + string(REGEX REPLACE "^.*OPENVDB_LIBRARY_MINOR_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1" + _OpenVDB_MINOR_VERSION "${openvdb_version_str}" + ) + + file(STRINGS "${OPENVDB_VERSION_FILE}" openvdb_version_str + REGEX "^#define[\t ]+OPENVDB_LIBRARY_PATCH_VERSION_NUMBER[\t ]+.*" + ) + string(REGEX REPLACE "^.*OPENVDB_LIBRARY_PATCH_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1" + _OpenVDB_PATCH_VERSION "${openvdb_version_str}" + ) + unset(openvdb_version_str) + + if(_VDB_VERSION) + set(${_VDB_VERSION} + ${_OpenVDB_MAJOR_VERSION}.${_OpenVDB_MINOR_VERSION}.${_OpenVDB_PATCH_VERSION} + PARENT_SCOPE + ) + endif() + if(_VDB_MAJOR) + set(${_VDB_MAJOR} ${_OpenVDB_MAJOR_VERSION} PARENT_SCOPE) + endif() + if(_VDB_MINOR) + set(${_VDB_MINOR} ${_OpenVDB_MINOR_VERSION} PARENT_SCOPE) + endif() + if(_VDB_PATCH) + set(${_VDB_PATCH} ${_OpenVDB_PATCH_VERSION} PARENT_SCOPE) + endif() +endfunction() + + +######################################################################## +######################################################################## + + +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}") + return() + endif() + + set(_VDB_PRINT_VERSION_STRING "") + set(_VDB_PRINT_RETURN_STATUS "") + + if(${_VDB_QUIET}) + execute_process(COMMAND ${OPENVDB_PRINT} "--version" + RESULT_VARIABLE _VDB_PRINT_RETURN_STATUS + OUTPUT_VARIABLE _VDB_PRINT_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else() + execute_process(COMMAND ${OPENVDB_PRINT} "--version" + RESULT_VARIABLE _VDB_PRINT_RETURN_STATUS + OUTPUT_VARIABLE _VDB_PRINT_VERSION_STRING + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() + + if(${_VDB_PRINT_RETURN_STATUS}) + message(WARNING "vdb_print returned with status ${_VDB_PRINT_RETURN_STATUS}") + return() + endif() + + set(_OpenVDB_ABI) + string(REGEX REPLACE ".*abi([0-9]*).*" "\\1" _OpenVDB_ABI ${_VDB_PRINT_VERSION_STRING}) + if(${_OpenVDB_ABI} STREQUAL ${_VDB_PRINT_VERSION_STRING}) + set(_OpenVDB_ABI "") + endif() + unset(_VDB_PRINT_RETURN_STATUS) + unset(_VDB_PRINT_VERSION_STRING) + + if(_VDB_ABI) + set(${_VDB_ABI} ${_OpenVDB_ABI} PARENT_SCOPE) + endif() +endfunction() diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 90ad6f0fa..09e6c7598 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -96,6 +96,7 @@ if (MSVC) dep_nlopt # dep_qhull # Experimental dep_zlib # on Windows we still need zlib + dep_openvdb ) else() @@ -110,6 +111,7 @@ else() dep_cereal dep_nlopt dep_qhull + dep_openvdb # dep_libigl # Not working, static build has different Eigen ) diff --git a/deps/blosc-mods.patch b/deps/blosc-mods.patch new file mode 100644 index 000000000..2289459ab --- /dev/null +++ b/deps/blosc-mods.patch @@ -0,0 +1,477 @@ +From 24640a466b28dfda26069096554676e8c0b6d090 Mon Sep 17 00:00:00 2001 +From: tamasmeszaros +Date: Tue, 22 Oct 2019 11:29:05 +0200 +Subject: [PATCH] Install.dll in prefix/bin and add config export to cmake + build + +--- + CMakeLists.txt | 112 ++++++++++++++++++++---------------- + blosc/CMakeLists.txt | 121 ++++++++++----------------------------- + cmake/FindLZ4.cmake | 6 +- + cmake/FindSnappy.cmake | 8 ++- + cmake/FindZstd.cmake | 8 ++- + cmake_config.cmake.in | 33 +++++++++++ + internal-complibs/CMakeLists.txt | 30 ++++++++++ + 7 files changed, 173 insertions(+), 145 deletions(-) + create mode 100644 cmake_config.cmake.in + create mode 100644 internal-complibs/CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 59d9fab..bdc0dda 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -71,7 +71,7 @@ + # DEV: static includes blosc.a and blosc.h + + +-cmake_minimum_required(VERSION 2.8.12) ++cmake_minimum_required(VERSION 3.1) # Threads::Threads target available from 3.1 + if (NOT CMAKE_VERSION VERSION_LESS 3.3) + cmake_policy(SET CMP0063 NEW) + endif() +@@ -124,55 +124,37 @@ option(PREFER_EXTERNAL_ZSTD + + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") + ++set(PRIVATE_LIBS "") ++set(PUBLIC_LIBS "") ++set(PUBLIC_PACKAGES "" CACHE INTERNAL "") ++macro(use_package _pkg _tgt) ++ string(TOUPPER ${_pkg} _PKG) ++ if(NOT DEACTIVATE_${_PKG}) ++ if(PREFER_EXTERNAL_${_PKG}) ++ find_package(${_pkg}) ++ if (NOT ${_pkg}_FOUND ) ++ message(STATUS "No ${_pkg} found. Using internal sources.") ++ endif() ++ else() ++ message(STATUS "Using ${_pkg} internal sources.") ++ endif(PREFER_EXTERNAL_${_PKG}) ++ # HAVE_${_pkg} will be set to true because even if the library is ++ # not found, we will use the included sources for it ++ set(HAVE_${_PKG} TRUE) ++ if (${_pkg}_FOUND) ++ list(APPEND PUBLIC_LIBS ${_pkg}::${_tgt}) ++ set(PUBLIC_PACKAGES "${PUBLIC_PACKAGES};${_pkg}" CACHE INTERNAL "") ++ else() ++ list(APPEND PRIVATE_LIBS ${_pkg}::${_tgt}) ++ endif() ++ endif(NOT DEACTIVATE_${_PKG}) ++endmacro() + +-if(NOT DEACTIVATE_LZ4) +- if(PREFER_EXTERNAL_LZ4) +- find_package(LZ4) +- else() +- message(STATUS "Using LZ4 internal sources.") +- endif(PREFER_EXTERNAL_LZ4) +- # HAVE_LZ4 will be set to true because even if the library is +- # not found, we will use the included sources for it +- set(HAVE_LZ4 TRUE) +-endif(NOT DEACTIVATE_LZ4) +- +-if(NOT DEACTIVATE_SNAPPY) +- if(PREFER_EXTERNAL_SNAPPY) +- find_package(Snappy) +- else() +- message(STATUS "Using Snappy internal sources.") +- endif(PREFER_EXTERNAL_SNAPPY) +- # HAVE_SNAPPY will be set to true because even if the library is not found, +- # we will use the included sources for it +- set(HAVE_SNAPPY TRUE) +-endif(NOT DEACTIVATE_SNAPPY) +- +-if(NOT DEACTIVATE_ZLIB) +- # import the ZLIB_ROOT environment variable to help finding the zlib library +- if(PREFER_EXTERNAL_ZLIB) +- set(ZLIB_ROOT $ENV{ZLIB_ROOT}) +- find_package(ZLIB) +- if (NOT ZLIB_FOUND ) +- message(STATUS "No zlib found. Using internal sources.") +- endif (NOT ZLIB_FOUND ) +- else() +- message(STATUS "Using zlib internal sources.") +- endif(PREFER_EXTERNAL_ZLIB) +- # HAVE_ZLIB will be set to true because even if the library is not found, +- # we will use the included sources for it +- set(HAVE_ZLIB TRUE) +-endif(NOT DEACTIVATE_ZLIB) +- +-if (NOT DEACTIVATE_ZSTD) +- if (PREFER_EXTERNAL_ZSTD) +- find_package(Zstd) +- else () +- message(STATUS "Using ZSTD internal sources.") +- endif (PREFER_EXTERNAL_ZSTD) +- # HAVE_ZSTD will be set to true because even if the library is +- # not found, we will use the included sources for it +- set(HAVE_ZSTD TRUE) +-endif (NOT DEACTIVATE_ZSTD) ++set(ZLIB_ROOT $ENV{ZLIB_ROOT}) ++use_package(ZLIB ZLIB) ++use_package(LZ4 LZ4) ++use_package(Snappy snappy) ++use_package(Zstd Zstd) + + # create the config.h file + configure_file ("blosc/config.h.in" "blosc/config.h" ) +@@ -316,6 +298,7 @@ endif() + + + # subdirectories ++add_subdirectory(internal-complibs) + add_subdirectory(blosc) + + if(BUILD_TESTS) +@@ -338,10 +321,41 @@ if (BLOSC_INSTALL) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/blosc.pc" + DESTINATION lib/pkgconfig COMPONENT DEV) + ++ configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/cmake_config.cmake.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfig.cmake" ++ @ONLY) ++ + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) ++ ++ include(CMakePackageConfigHelpers) ++ write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfigVersion.cmake" ++ VERSION ${BLOSC_VERSION_MAJOR}.${BLOSC_VERSION_MINOR}.${BLOSC_VERSION_PATCH} ++ COMPATIBILITY AnyNewerVersion ++ ) ++ ++ export(EXPORT BloscTargets ++ FILE "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscTargets.cmake" ++ NAMESPACE Blosc::) ++ ++ install(EXPORT BloscTargets ++ FILE BloscTargets.cmake ++ NAMESPACE Blosc:: ++ DESTINATION lib/cmake/Blosc ++ EXPORT_LINK_INTERFACE_LIBRARIES) ++ ++ install(FILES ++ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfig.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfigVersion.cmake" ++ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLZ4.cmake" ++ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindZstd.cmake" ++ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindSnappy.cmake" ++ DESTINATION lib/cmake/Blosc COMPONENT DEV) ++ + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + endif() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 1d1bebe..16aff02 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -1,52 +1,11 @@ + # a simple way to detect that we are using CMAKE + add_definitions(-DUSING_CMAKE) + +-set(INTERNAL_LIBS ${PROJECT_SOURCE_DIR}/internal-complibs) +- + # Hide symbols by default unless they're specifically exported. + # This makes it easier to keep the set of exported symbols the + # same across all compilers/platforms. + set(CMAKE_C_VISIBILITY_PRESET hidden) + +-# includes +-set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) +-if(NOT DEACTIVATE_LZ4) +- if (LZ4_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_INCLUDE_DIR}) +- else(LZ4_FOUND) +- set(LZ4_LOCAL_DIR ${INTERNAL_LIBS}/lz4-1.9.1) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_LOCAL_DIR}) +- endif(LZ4_FOUND) +-endif(NOT DEACTIVATE_LZ4) +- +-if(NOT DEACTIVATE_SNAPPY) +- if (SNAPPY_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${SNAPPY_INCLUDE_DIR}) +- else(SNAPPY_FOUND) +- set(SNAPPY_LOCAL_DIR ${INTERNAL_LIBS}/snappy-1.1.1) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${SNAPPY_LOCAL_DIR}) +- endif(SNAPPY_FOUND) +-endif(NOT DEACTIVATE_SNAPPY) +- +-if(NOT DEACTIVATE_ZLIB) +- if (ZLIB_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) +- else(ZLIB_FOUND) +- set(ZLIB_LOCAL_DIR ${INTERNAL_LIBS}/zlib-1.2.8) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_LOCAL_DIR}) +- endif(ZLIB_FOUND) +-endif(NOT DEACTIVATE_ZLIB) +- +-if (NOT DEACTIVATE_ZSTD) +- if (ZSTD_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIR}) +- else (ZSTD_FOUND) +- set(ZSTD_LOCAL_DIR ${INTERNAL_LIBS}/zstd-1.4.1) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_LOCAL_DIR} ${ZSTD_LOCAL_DIR}/common) +- endif (ZSTD_FOUND) +-endif (NOT DEACTIVATE_ZSTD) +- +-include_directories(${BLOSC_INCLUDE_DIRS}) + + # library sources + set(SOURCES blosc.c blosclz.c fastcopy.c shuffle-generic.c bitshuffle-generic.c +@@ -73,53 +32,15 @@ if(WIN32) + message(STATUS "using the internal pthread library for win32 systems.") + set(SOURCES ${SOURCES} win32/pthread.c) + else(NOT Threads_FOUND) +- set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ list(APPEND PUBLIC_LIBS Threads::Threads) ++ set(PUBLIC_PACKAGES "${PUBLIC_PACKAGES};Threads" CACHE INTERNAL "") + endif(NOT Threads_FOUND) + else(WIN32) + find_package(Threads REQUIRED) +- set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ list(APPEND PUBLIC_LIBS Threads::Threads) ++ set(PUBLIC_PACKAGES "${PUBLIC_PACKAGES};Threads" CACHE INTERNAL "") + endif(WIN32) + +-if(NOT DEACTIVATE_LZ4) +- if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) +- else(LZ4_FOUND) +- file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) +- set(SOURCES ${SOURCES} ${LZ4_FILES}) +- endif(LZ4_FOUND) +-endif(NOT DEACTIVATE_LZ4) +- +-if(NOT DEACTIVATE_SNAPPY) +- if(SNAPPY_FOUND) +- set(LIBS ${LIBS} ${SNAPPY_LIBRARY}) +- else(SNAPPY_FOUND) +- file(GLOB SNAPPY_FILES ${SNAPPY_LOCAL_DIR}/*.cc) +- set(SOURCES ${SOURCES} ${SNAPPY_FILES}) +- endif(SNAPPY_FOUND) +-endif(NOT DEACTIVATE_SNAPPY) +- +-if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) +- else(ZLIB_FOUND) +- file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) +- set(SOURCES ${SOURCES} ${ZLIB_FILES}) +- endif(ZLIB_FOUND) +-endif(NOT DEACTIVATE_ZLIB) +- +-if (NOT DEACTIVATE_ZSTD) +- if (ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) +- else (ZSTD_FOUND) +- file(GLOB ZSTD_FILES +- ${ZSTD_LOCAL_DIR}/common/*.c +- ${ZSTD_LOCAL_DIR}/compress/*.c +- ${ZSTD_LOCAL_DIR}/decompress/*.c) +- set(SOURCES ${SOURCES} ${ZSTD_FILES}) +- endif (ZSTD_FOUND) +-endif (NOT DEACTIVATE_ZSTD) +- +- + # targets + if (BUILD_SHARED) + add_library(blosc_shared SHARED ${SOURCES}) +@@ -191,14 +112,18 @@ if (BUILD_TESTS) + endif() + endif() + ++add_library(blosc INTERFACE) ++ + if (BUILD_SHARED) +- target_link_libraries(blosc_shared ${LIBS}) +- target_include_directories(blosc_shared PUBLIC ${BLOSC_INCLUDE_DIRS}) ++ target_link_libraries(blosc_shared PUBLIC ${PUBLIC_LIBS}) ++ target_link_libraries(blosc_shared PRIVATE ${PRIVATE_LIBS}) ++ target_include_directories(blosc_shared PUBLIC $) ++ target_link_libraries(blosc INTERFACE blosc_shared) + endif() + + if (BUILD_TESTS) +- target_link_libraries(blosc_shared_testing ${LIBS}) +- target_include_directories(blosc_shared_testing PUBLIC ${BLOSC_INCLUDE_DIRS}) ++ target_link_libraries(blosc_shared_testing ${PUBLIC_LIBS} ${PRIVATE_LIBS}) ++ target_include_directories(blosc_shared_testing PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + if(BUILD_STATIC) +@@ -207,17 +132,31 @@ if(BUILD_STATIC) + if (MSVC) + set_target_properties(blosc_static PROPERTIES PREFIX lib) + endif() +- target_link_libraries(blosc_static ${LIBS}) +- target_include_directories(blosc_static PUBLIC ${BLOSC_INCLUDE_DIRS}) ++ target_link_libraries(blosc_static PUBLIC ${PUBLIC_LIBS}) ++ target_link_libraries(blosc_static PRIVATE ${PRIVATE_LIBS}) ++ target_include_directories(blosc_static PUBLIC $) ++ if (NOT BUILD_SHARED) ++ target_link_libraries(blosc INTERFACE blosc_static) ++ endif() + endif(BUILD_STATIC) + ++ + # install + if(BLOSC_INSTALL) + install(FILES blosc.h blosc-export.h DESTINATION include COMPONENT DEV) ++ set(_inst_libs "blosc") + if(BUILD_SHARED) +- install(TARGETS blosc_shared DESTINATION ${lib_dir} COMPONENT LIB) ++ list(APPEND _inst_libs blosc_shared) + endif(BUILD_SHARED) + if(BUILD_STATIC) +- install(TARGETS blosc_static DESTINATION ${lib_dir} COMPONENT DEV) ++ list(APPEND _inst_libs blosc_static) + endif(BUILD_STATIC) ++ ++ install(TARGETS ${_inst_libs} ++ EXPORT BloscTargets ++ LIBRARY DESTINATION ${lib_dir} ++ ARCHIVE DESTINATION ${lib_dir} ++ RUNTIME DESTINATION bin ++ COMPONENT DEV ++ INCLUDES DESTINATION include) + endif(BLOSC_INSTALL) +diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake +index e581a80..05de6ef 100644 +--- a/cmake/FindLZ4.cmake ++++ b/cmake/FindLZ4.cmake +@@ -5,6 +5,10 @@ find_library(LZ4_LIBRARY NAMES lz4) + if (LZ4_INCLUDE_DIR AND LZ4_LIBRARY) + set(LZ4_FOUND TRUE) + message(STATUS "Found LZ4 library: ${LZ4_LIBRARY}") ++ add_library(LZ4::LZ4 UNKNOWN IMPORTED) ++ set_target_properties(LZ4::LZ4 PROPERTIES ++ IMPORTED_LOCATION ${LZ4_LIBRARY} ++ INTERFACE_INCLUDE_DIRECTORIES ${LZ4_INCLUDE_DIR}) + else () + message(STATUS "No LZ4 library found. Using internal sources.") +-endif () ++endif () +\ No newline at end of file +diff --git a/cmake/FindSnappy.cmake b/cmake/FindSnappy.cmake +index 688d4d5..21dbee1 100644 +--- a/cmake/FindSnappy.cmake ++++ b/cmake/FindSnappy.cmake +@@ -3,8 +3,12 @@ find_path(SNAPPY_INCLUDE_DIR snappy-c.h) + find_library(SNAPPY_LIBRARY NAMES snappy) + + if (SNAPPY_INCLUDE_DIR AND SNAPPY_LIBRARY) +- set(SNAPPY_FOUND TRUE) ++ set(Snappy_FOUND TRUE) ++ add_library(Snappy::snappy UNKNOWN IMPORTED) ++ set_target_properties(Snappy::snappy PROPERTIES ++ IMPORTED_LOCATION ${SNAPPY_LIBRARY} ++ INTERFACE_INCLUDE_DIRECTORIES ${SNAPPY_INCLUDE_DIR}) + message(STATUS "Found SNAPPY library: ${SNAPPY_LIBRARY}") + else () + message(STATUS "No snappy found. Using internal sources.") +-endif () ++endif () +\ No newline at end of file +diff --git a/cmake/FindZstd.cmake b/cmake/FindZstd.cmake +index 7db4bb9..cabc2f8 100644 +--- a/cmake/FindZstd.cmake ++++ b/cmake/FindZstd.cmake +@@ -3,8 +3,12 @@ find_path(ZSTD_INCLUDE_DIR zstd.h) + find_library(ZSTD_LIBRARY NAMES zstd) + + if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY) +- set(ZSTD_FOUND TRUE) ++ set(Zstd_FOUND TRUE) ++ add_library(Zstd::Zstd UNKNOWN IMPORTED) ++ set_target_properties(Zstd::Zstd PROPERTIES ++ IMPORTED_LOCATION ${ZSTD_LIBRARY} ++ INTERFACE_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIR}) + message(STATUS "Found Zstd library: ${ZSTD_LIBRARY}") + else () + message(STATUS "No Zstd library found. Using internal sources.") +-endif () ++endif () +\ No newline at end of file +diff --git a/cmake_config.cmake.in b/cmake_config.cmake.in +new file mode 100644 +index 0000000..b4ede30 +--- /dev/null ++++ b/cmake_config.cmake.in +@@ -0,0 +1,33 @@ ++include(CMakeFindDependencyMacro) ++ ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) ++ ++set(_deps "@PUBLIC_PACKAGES@") ++ ++foreach(pkg ${_deps}) ++ # no minimum versions are required by upstream ++ find_dependency(${pkg}) ++endforeach() ++ ++include("${CMAKE_CURRENT_LIST_DIR}/BloscTargets.cmake") ++ ++function(remap_configs from_Cfg to_Cfg) ++ string(TOUPPER ${from_Cfg} from_CFG) ++ string(TOLOWER ${from_Cfg} from_cfg) ++ ++ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/BloscTargets-${from_cfg}.cmake) ++ foreach(tgt IN ITEMS blosc_static blosc_shared blosc) ++ if(TARGET Blosc::${tgt}) ++ set_target_properties(Blosc::${tgt} PROPERTIES ++ MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg}) ++ endif() ++ endforeach() ++ endif() ++endfunction() ++ ++# MSVC will try to link RelWithDebInfo or MinSizeRel target with debug config ++# if no matching installation is present which would result in link errors. ++if(MSVC) ++ remap_configs(RelWithDebInfo Release) ++ remap_configs(MinSizeRel Release) ++endif() +diff --git a/internal-complibs/CMakeLists.txt b/internal-complibs/CMakeLists.txt +new file mode 100644 +index 0000000..5b23484 +--- /dev/null ++++ b/internal-complibs/CMakeLists.txt +@@ -0,0 +1,30 @@ ++macro(add_lib_target pkg tgt incdir files) ++ string(TOUPPER ${pkg} TGT) ++ if(NOT DEACTIVATE_${TGT} AND NOT ${pkg}_FOUND) ++ add_library(${tgt} INTERFACE) ++ target_include_directories(${tgt} INTERFACE $) ++ target_sources(${tgt} INTERFACE "$") ++ add_library(${pkg}::${tgt} ALIAS ${tgt}) ++ ++ # This creates dummy (empty) interface targets in the exported config. ++ install(TARGETS ${tgt} EXPORT BloscTargets INCLUDES DESTINATION include) ++ endif() ++ unset(TGT) ++endmacro() ++ ++set(ZLIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zlib-1.2.8) ++file(GLOB ZLIB_FILES ${ZLIB_DIR}/*.c) ++add_lib_target(ZLIB ZLIB ${ZLIB_DIR} "${ZLIB_FILES}") ++ ++set(SNAPPY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/snappy-1.1.1) ++file(GLOB SNAPPY_FILES ${SNAPPY_DIR}/*.cc) ++add_lib_target(Snappy snappy ${SNAPPY_DIR} "${SNAPPY_FILES}") ++ ++set(LZ4_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lz4-1.9.1) ++file(GLOB LZ4_FILES ${LZ4_DIR}/*.c) ++add_lib_target(LZ4 LZ4 ${LZ4_DIR} "${LZ4_FILES}") ++ ++set(ZSTD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zstd-1.4.1) ++file(GLOB ZSTD_FILES ${ZSTD_DIR}/common/*.c ${ZSTD_DIR}/compress/*.c ${ZSTD_DIR}/decompress/*.c) ++add_lib_target(Zstd Zstd ${ZSTD_DIR} "${ZSTD_FILES}") ++target_include_directories(Zstd INTERFACE $) +\ No newline at end of file +-- +2.16.2.windows.1 + diff --git a/deps/deps-linux.cmake b/deps/deps-linux.cmake index 03e8e12d5..f5571d470 100644 --- a/deps/deps-linux.cmake +++ b/deps/deps-linux.cmake @@ -5,11 +5,11 @@ include("deps-unix-common.cmake") ExternalProject_Add(dep_boost EXCLUDE_FROM_ALL 1 - URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz" - URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60 + URL "https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz" + URL_HASH SHA256=882b48708d211a5f48e60b0124cf5863c1534cd544ecd0664bb534a4b5d506e9 BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ./bootstrap.sh - --with-libraries=system,filesystem,thread,log,locale,regex + --with-libraries=system,iostreams,filesystem,thread,log,locale,regex "--prefix=${DESTDIR}/usr/local" BUILD_COMMAND ./b2 -j ${NPROC} @@ -123,3 +123,5 @@ ExternalProject_Add(dep_wxwidgets BUILD_COMMAND make "-j${NPROC}" && make -C locale allmo INSTALL_COMMAND make install ) + +add_dependencies(dep_openvdb dep_boost) \ No newline at end of file diff --git a/deps/deps-macos.cmake b/deps/deps-macos.cmake index d22e4a2e2..e6fca8a72 100644 --- a/deps/deps-macos.cmake +++ b/deps/deps-macos.cmake @@ -25,7 +25,7 @@ ExternalProject_Add(dep_boost URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60 BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ./bootstrap.sh - --with-libraries=system,filesystem,thread,log,locale,regex + --with-libraries=system,iostreams,filesystem,thread,log,locale,regex "--prefix=${DESTDIR}/usr/local" BUILD_COMMAND ./b2 -j ${NPROC} @@ -114,3 +114,5 @@ ExternalProject_Add(dep_wxwidgets BUILD_COMMAND make "-j${NPROC}" && PATH=/usr/local/opt/gettext/bin/:$ENV{PATH} make -C locale allmo INSTALL_COMMAND make install ) + +add_dependencies(dep_openvdb dep_boost) \ No newline at end of file diff --git a/deps/deps-unix-common.cmake b/deps/deps-unix-common.cmake index 6e559d05a..0df535fc3 100644 --- a/deps/deps-unix-common.cmake +++ b/deps/deps-unix-common.cmake @@ -53,8 +53,8 @@ find_package(Git REQUIRED) ExternalProject_Add(dep_qhull EXCLUDE_FROM_ALL 1 - URL "https://github.com/qhull/qhull/archive/v7.2.1.tar.gz" - URL_HASH SHA256=6fc251e0b75467e00943bfb7191e986fce0e1f8f6f0251f9c6ce5a843821ea78 + URL "https://github.com/qhull/qhull/archive/v7.3.2.tar.gz" + URL_HASH SHA256=619c8a954880d545194bc03359404ef36a1abd2dde03678089459757fd790cb0 CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local @@ -87,6 +87,58 @@ ExternalProject_Add(dep_libigl -DLIBIGL_WITH_TETGEN=OFF -DLIBIGL_WITH_TRIANGLE=OFF -DLIBIGL_WITH_XML=OFF - PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch + PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-mods.patch ) + +ExternalProject_Add(dep_blosc + EXCLUDE_FROM_ALL 1 + GIT_REPOSITORY https://github.com/Blosc/c-blosc.git + GIT_TAG v1.17.0 + DEPENDS + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_DEBUG_POSTFIX=d + -DBUILD_SHARED=OFF + -DBUILD_STATIC=ON + -DBUILD_TESTS=OFF + -DBUILD_BENCHMARKS=OFF + -DPREFER_EXTERNAL_ZLIB=OFF + PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/blosc-mods.patch +) + +ExternalProject_Add(dep_openexr + EXCLUDE_FROM_ALL 1 + GIT_REPOSITORY https://github.com/openexr/openexr.git + GIT_TAG v2.4.0 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DBUILD_TESTING=OFF + -DPYILMBASE_ENABLE:BOOL=OFF + -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF + -DOPENEXR_BUILD_UTILS:BOOL=OFF +) + +ExternalProject_Add(dep_openvdb + EXCLUDE_FROM_ALL 1 + GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git + GIT_TAG v6.2.1 + DEPENDS dep_blosc dep_openexr dep_tbb + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DCMAKE_DEBUG_POSTFIX=d + -DCMAKE_PREFIX_PATH=${DESTDIR}/usr/local + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DOPENVDB_BUILD_PYTHON_MODULE=OFF + -DUSE_BLOSC=ON + -DOPENVDB_CORE_SHARED=OFF + -DOPENVDB_CORE_STATIC=ON + -DTBB_STATIC=ON + -DOPENVDB_BUILD_VDB_PRINT=ON + PATCH_COMMAND ${GIT_EXECUTABLE} apply ${CMAKE_CURRENT_SOURCE_DIR}/openvdb-mods.patch +) \ No newline at end of file diff --git a/deps/deps-windows.cmake b/deps/deps-windows.cmake index 85013fbdd..08e10758d 100644 --- a/deps/deps-windows.cmake +++ b/deps/deps-windows.cmake @@ -43,6 +43,18 @@ else () set(DEP_BOOST_DEBUG "") endif () +macro(add_debug_dep _dep) +if (${DEP_DEBUG}) + ExternalProject_Get_Property(${_dep} BINARY_DIR) + ExternalProject_Add_Step(${_dep} build_debug + DEPENDEES build + DEPENDERS install + COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj + WORKING_DIRECTORY "${BINARY_DIR}" + ) +endif () +endmacro() + ExternalProject_Add(dep_boost EXCLUDE_FROM_ALL 1 URL "https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz" @@ -52,6 +64,7 @@ ExternalProject_Add(dep_boost BUILD_COMMAND b2.exe -j "${NPROC}" --with-system + --with-iostreams --with-filesystem --with-thread --with-log @@ -83,16 +96,8 @@ ExternalProject_Add(dep_tbb BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) -if (${DEP_DEBUG}) - ExternalProject_Get_Property(dep_tbb BINARY_DIR) - ExternalProject_Add_Step(dep_tbb build_debug - DEPENDEES build - DEPENDERS install - COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj - WORKING_DIRECTORY "${BINARY_DIR}" - ) -endif () +add_debug_dep(dep_tbb) ExternalProject_Add(dep_gtest EXCLUDE_FROM_ALL 1 @@ -108,16 +113,8 @@ ExternalProject_Add(dep_gtest BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) -if (${DEP_DEBUG}) - ExternalProject_Get_Property(dep_gtest BINARY_DIR) - ExternalProject_Add_Step(dep_gtest build_debug - DEPENDEES build - DEPENDERS install - COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj - WORKING_DIRECTORY "${BINARY_DIR}" - ) -endif () +add_debug_dep(dep_gtest) ExternalProject_Add(dep_cereal EXCLUDE_FROM_ALL 1 @@ -132,7 +129,6 @@ ExternalProject_Add(dep_cereal INSTALL_COMMAND "" ) - ExternalProject_Add(dep_nlopt EXCLUDE_FROM_ALL 1 URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz" @@ -151,16 +147,8 @@ ExternalProject_Add(dep_nlopt BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) -if (${DEP_DEBUG}) - ExternalProject_Get_Property(dep_nlopt BINARY_DIR) - ExternalProject_Add_Step(dep_nlopt build_debug - DEPENDEES build - DEPENDERS install - COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj - WORKING_DIRECTORY "${BINARY_DIR}" - ) -endif () +add_debug_dep(dep_nlopt) ExternalProject_Add(dep_zlib EXCLUDE_FROM_ALL 1 @@ -176,15 +164,9 @@ ExternalProject_Add(dep_zlib BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) -if (${DEP_DEBUG}) - ExternalProject_Get_Property(dep_zlib BINARY_DIR) - ExternalProject_Add_Step(dep_zlib build_debug - DEPENDEES build - DEPENDERS install - COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj - WORKING_DIRECTORY "${BINARY_DIR}" - ) -endif () + +add_debug_dep(dep_zlib) + # The following steps are unfortunately needed to remove the _static suffix on libraries ExternalProject_Add_Step(dep_zlib fix_static DEPENDEES install @@ -238,8 +220,8 @@ find_package(Git REQUIRED) ExternalProject_Add(dep_qhull EXCLUDE_FROM_ALL 1 - URL "https://github.com/qhull/qhull/archive/v7.2.1.tar.gz" - URL_HASH SHA256=6fc251e0b75467e00943bfb7191e986fce0e1f8f6f0251f9c6ce5a843821ea78 + URL "https://github.com/qhull/qhull/archive/v7.3.2.tar.gz" + URL_HASH SHA256=619c8a954880d545194bc03359404ef36a1abd2dde03678089459757fd790cb0 CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local @@ -251,16 +233,7 @@ ExternalProject_Add(dep_qhull INSTALL_COMMAND "" ) -if (${DEP_DEBUG}) - ExternalProject_Get_Property(dep_qhull BINARY_DIR) - ExternalProject_Add_Step(dep_qhull build_debug - DEPENDEES build - DEPENDERS install - COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj - WORKING_DIRECTORY "${BINARY_DIR}" - ) -endif () - +add_debug_dep(dep_qhull) if (${DEPS_BITS} EQUAL 32) set(DEP_WXWIDGETS_TARGET "") @@ -300,20 +273,12 @@ ExternalProject_Add(dep_libigl -DLIBIGL_WITH_XML=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_DEBUG_POSTFIX=d - PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch + PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-mods.patch BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) -if (${DEP_DEBUG}) - ExternalProject_Get_Property(dep_libigl BINARY_DIR) - ExternalProject_Add_Step(dep_libigl build_debug - DEPENDEES build - DEPENDERS install - COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj - WORKING_DIRECTORY "${BINARY_DIR}" - ) -endif () +add_debug_dep(dep_libigl) ExternalProject_Add(dep_wxwidgets EXCLUDE_FROM_ALL 1 @@ -337,3 +302,80 @@ if (${DEP_DEBUG}) WORKING_DIRECTORY "${SOURCE_DIR}" ) endif () + +ExternalProject_Add(dep_blosc + EXCLUDE_FROM_ALL 1 + GIT_REPOSITORY https://github.com/Blosc/c-blosc.git + GIT_TAG v1.17.0 + DEPENDS dep_zlib + CMAKE_GENERATOR "${DEP_MSVC_GEN}" + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_DEBUG_POSTFIX=d + -DBUILD_SHARED=OFF + -DBUILD_STATIC=ON + -DBUILD_TESTS=OFF + -DBUILD_BENCHMARKS=OFF + -DPREFER_EXTERNAL_ZLIB=ON + PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/blosc-mods.patch + BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj + INSTALL_COMMAND "" +) + +add_debug_dep(dep_blosc) + +ExternalProject_Add(dep_openexr + EXCLUDE_FROM_ALL 1 + GIT_REPOSITORY https://github.com/openexr/openexr.git + GIT_TAG v2.4.0 + DEPENDS dep_zlib + CMAKE_GENERATOR "${DEP_MSVC_GEN}" + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DBUILD_TESTING=OFF + -DPYILMBASE_ENABLE:BOOL=OFF + -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF + -DOPENEXR_BUILD_UTILS:BOOL=OFF + BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj + INSTALL_COMMAND "" +) + +add_debug_dep(dep_openexr) + +ExternalProject_Add(dep_openvdb + EXCLUDE_FROM_ALL 1 + GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git + GIT_TAG v6.2.1 + DEPENDS dep_blosc dep_openexr dep_tbb + CMAKE_GENERATOR "${DEP_MSVC_GEN}" + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DCMAKE_DEBUG_POSTFIX=d + -DCMAKE_PREFIX_PATH=${DESTDIR}/usr/local + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DOPENVDB_BUILD_PYTHON_MODULE=OFF + -DUSE_BLOSC=ON + -DOPENVDB_CORE_SHARED=OFF + -DOPENVDB_CORE_STATIC=ON + -DTBB_STATIC=ON + -DOPENVDB_BUILD_VDB_PRINT=ON + BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj + PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/openvdb-mods.patch + INSTALL_COMMAND "" +) + +if (${DEP_DEBUG}) + ExternalProject_Get_Property(dep_openvdb BINARY_DIR) + ExternalProject_Add_Step(dep_openvdb build_debug + DEPENDEES build + DEPENDERS install + COMMAND ${CMAKE_COMMAND} ../dep_openvdb -DOPENVDB_BUILD_VDB_PRINT=OFF + COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj + WORKING_DIRECTORY "${BINARY_DIR}" + ) +endif () \ No newline at end of file diff --git a/deps/igl-fixes.patch b/deps/igl-mods.patch similarity index 100% rename from deps/igl-fixes.patch rename to deps/igl-mods.patch diff --git a/deps/openvdb-mods.patch b/deps/openvdb-mods.patch new file mode 100644 index 000000000..a05076e98 --- /dev/null +++ b/deps/openvdb-mods.patch @@ -0,0 +1,1771 @@ +From ee867b9f226412c0f3b83fa01cd43539acc4ed95 Mon Sep 17 00:00:00 2001 +From: tamasmeszaros +Date: Wed, 16 Oct 2019 17:42:50 +0200 +Subject: [PATCH] Build fixes for PrusaSlicer integration + +--- + CMakeLists.txt | 3 - + cmake/FindBlosc.cmake | 218 --------------- + cmake/FindCppUnit.cmake | 4 +- + cmake/FindIlmBase.cmake | 337 ----------------------- + cmake/FindOpenEXR.cmake | 329 ---------------------- + cmake/FindOpenVDB.cmake | 19 +- + cmake/FindTBB.cmake | 593 ++++++++++++++++++++-------------------- + openvdb/CMakeLists.txt | 13 +- + openvdb/Grid.cc | 3 + + openvdb/PlatformConfig.h | 9 +- + openvdb/cmd/CMakeLists.txt | 4 +- + openvdb/unittest/CMakeLists.txt | 3 +- + openvdb/unittest/TestFile.cc | 2 +- + 13 files changed, 325 insertions(+), 1212 deletions(-) + delete mode 100644 cmake/FindBlosc.cmake + delete mode 100644 cmake/FindIlmBase.cmake + delete mode 100644 cmake/FindOpenEXR.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 580b353..6d364c1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -267,12 +267,9 @@ endif() + + if(OPENVDB_INSTALL_CMAKE_MODULES) + set(OPENVDB_CMAKE_MODULES +- cmake/FindBlosc.cmake + cmake/FindCppUnit.cmake + cmake/FindJemalloc.cmake +- cmake/FindIlmBase.cmake + cmake/FindLog4cplus.cmake +- cmake/FindOpenEXR.cmake + cmake/FindOpenVDB.cmake + cmake/FindTBB.cmake + cmake/OpenVDBGLFW3Setup.cmake +diff --git a/cmake/FindBlosc.cmake b/cmake/FindBlosc.cmake +deleted file mode 100644 +index 5aacfdd..0000000 +--- a/cmake/FindBlosc.cmake ++++ /dev/null +@@ -1,218 +0,0 @@ +-# Copyright (c) DreamWorks Animation LLC +-# +-# All rights reserved. This software is distributed under the +-# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ ) +-# +-# Redistributions of source code must retain the above copyright +-# and license notice and the following restrictions and disclaimer. +-# +-# * Neither the name of DreamWorks Animation nor the names of +-# its contributors may be used to endorse or promote products derived +-# from this software without specific prior written permission. +-# +-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, +-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE +-# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00. +-# +-#[=======================================================================[.rst: +- +-FindBlosc +---------- +- +-Find Blosc include dirs and libraries +- +-Use this module by invoking find_package with the form:: +- +- find_package(Blosc +- [version] [EXACT] # Minimum or EXACT version e.g. 1.5.0 +- [REQUIRED] # Fail with error if Blosc is not found +- ) +- +-IMPORTED Targets +-^^^^^^^^^^^^^^^^ +- +-``Blosc::blosc`` +- This module defines IMPORTED target Blosc::Blosc, if Blosc has been found. +- +-Result Variables +-^^^^^^^^^^^^^^^^ +- +-This will define the following variables: +- +-``Blosc_FOUND`` +- True if the system has the Blosc library. +-``Blosc_VERSION`` +- The version of the Blosc library which was found. +-``Blosc_INCLUDE_DIRS`` +- Include directories needed to use Blosc. +-``Blosc_LIBRARIES`` +- Libraries needed to link to Blosc. +-``Blosc_LIBRARY_DIRS`` +- Blosc library directories. +- +-Cache Variables +-^^^^^^^^^^^^^^^ +- +-The following cache variables may also be set: +- +-``Blosc_INCLUDE_DIR`` +- The directory containing ``blosc.h``. +-``Blosc_LIBRARY`` +- The path to the Blosc library. +- +-Hints +-^^^^^ +- +-Instead of explicitly setting the cache variables, the following variables +-may be provided to tell this module where to look. +- +-``BLOSC_ROOT`` +- Preferred installation prefix. +-``BLOSC_INCLUDEDIR`` +- Preferred include directory e.g. /include +-``BLOSC_LIBRARYDIR`` +- Preferred library directory e.g. /lib +-``SYSTEM_LIBRARY_PATHS`` +- Paths appended to all include and lib searches. +- +-#]=======================================================================] +- +-mark_as_advanced( +- Blosc_INCLUDE_DIR +- Blosc_LIBRARY +-) +- +-# Append BLOSC_ROOT or $ENV{BLOSC_ROOT} if set (prioritize the direct cmake var) +-set(_BLOSC_ROOT_SEARCH_DIR "") +- +-if(BLOSC_ROOT) +- list(APPEND _BLOSC_ROOT_SEARCH_DIR ${BLOSC_ROOT}) +-else() +- set(_ENV_BLOSC_ROOT $ENV{BLOSC_ROOT}) +- if(_ENV_BLOSC_ROOT) +- list(APPEND _BLOSC_ROOT_SEARCH_DIR ${_ENV_BLOSC_ROOT}) +- endif() +-endif() +- +-# Additionally try and use pkconfig to find blosc +- +-find_package(PkgConfig) +-pkg_check_modules(PC_Blosc QUIET blosc) +- +-# ------------------------------------------------------------------------ +-# Search for blosc include DIR +-# ------------------------------------------------------------------------ +- +-set(_BLOSC_INCLUDE_SEARCH_DIRS "") +-list(APPEND _BLOSC_INCLUDE_SEARCH_DIRS +- ${BLOSC_INCLUDEDIR} +- ${_BLOSC_ROOT_SEARCH_DIR} +- ${PC_Blosc_INCLUDE_DIRS} +- ${SYSTEM_LIBRARY_PATHS} +-) +- +-# Look for a standard blosc header file. +-find_path(Blosc_INCLUDE_DIR blosc.h +- NO_DEFAULT_PATH +- PATHS ${_BLOSC_INCLUDE_SEARCH_DIRS} +- PATH_SUFFIXES include +-) +- +-if(EXISTS "${Blosc_INCLUDE_DIR}/blosc.h") +- file(STRINGS "${Blosc_INCLUDE_DIR}/blosc.h" +- _blosc_version_major_string REGEX "#define BLOSC_VERSION_MAJOR +[0-9]+ " +- ) +- string(REGEX REPLACE "#define BLOSC_VERSION_MAJOR +([0-9]+).*$" "\\1" +- _blosc_version_major_string "${_blosc_version_major_string}" +- ) +- string(STRIP "${_blosc_version_major_string}" Blosc_VERSION_MAJOR) +- +- file(STRINGS "${Blosc_INCLUDE_DIR}/blosc.h" +- _blosc_version_minor_string REGEX "#define BLOSC_VERSION_MINOR +[0-9]+ " +- ) +- string(REGEX REPLACE "#define BLOSC_VERSION_MINOR +([0-9]+).*$" "\\1" +- _blosc_version_minor_string "${_blosc_version_minor_string}" +- ) +- string(STRIP "${_blosc_version_minor_string}" Blosc_VERSION_MINOR) +- +- unset(_blosc_version_major_string) +- unset(_blosc_version_minor_string) +- +- set(Blosc_VERSION ${Blosc_VERSION_MAJOR}.${Blosc_VERSION_MINOR}) +-endif() +- +-# ------------------------------------------------------------------------ +-# Search for blosc lib DIR +-# ------------------------------------------------------------------------ +- +-set(_BLOSC_LIBRARYDIR_SEARCH_DIRS "") +-list(APPEND _BLOSC_LIBRARYDIR_SEARCH_DIRS +- ${BLOSC_LIBRARYDIR} +- ${_BLOSC_ROOT_SEARCH_DIR} +- ${PC_Blosc_LIBRARY_DIRS} +- ${SYSTEM_LIBRARY_PATHS} +-) +- +-# Static library setup +-if(UNIX AND BLOSC_USE_STATIC_LIBS) +- set(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +-endif() +- +-set(BLOSC_PATH_SUFFIXES +- lib64 +- lib +-) +- +-find_library(Blosc_LIBRARY blosc +- NO_DEFAULT_PATH +- PATHS ${_BLOSC_LIBRARYDIR_SEARCH_DIRS} +- PATH_SUFFIXES ${BLOSC_PATH_SUFFIXES} +-) +- +-if(UNIX AND BLOSC_USE_STATIC_LIBS) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ${_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +- unset(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) +-endif() +- +-# ------------------------------------------------------------------------ +-# Cache and set Blosc_FOUND +-# ------------------------------------------------------------------------ +- +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args(Blosc +- FOUND_VAR Blosc_FOUND +- REQUIRED_VARS +- Blosc_LIBRARY +- Blosc_INCLUDE_DIR +- VERSION_VAR Blosc_VERSION +-) +- +-if(Blosc_FOUND) +- set(Blosc_LIBRARIES ${Blosc_LIBRARY}) +- set(Blosc_INCLUDE_DIRS ${Blosc_INCLUDE_DIR}) +- set(Blosc_DEFINITIONS ${PC_Blosc_CFLAGS_OTHER}) +- +- get_filename_component(Blosc_LIBRARY_DIRS ${Blosc_LIBRARY} DIRECTORY) +- +- if(NOT TARGET Blosc::blosc) +- add_library(Blosc::blosc UNKNOWN IMPORTED) +- set_target_properties(Blosc::blosc PROPERTIES +- IMPORTED_LOCATION "${Blosc_LIBRARIES}" +- INTERFACE_COMPILE_DEFINITIONS "${Blosc_DEFINITIONS}" +- INTERFACE_INCLUDE_DIRECTORIES "${Blosc_INCLUDE_DIRS}" +- ) +- endif() +-elseif(Blosc_FIND_REQUIRED) +- message(FATAL_ERROR "Unable to find Blosc") +-endif() +diff --git a/cmake/FindCppUnit.cmake b/cmake/FindCppUnit.cmake +index e2beb93..a891624 100644 +--- a/cmake/FindCppUnit.cmake ++++ b/cmake/FindCppUnit.cmake +@@ -125,7 +125,7 @@ list(APPEND _CPPUNIT_INCLUDE_SEARCH_DIRS + + # Look for a standard cppunit header file. + find_path(CppUnit_INCLUDE_DIR cppunit/Portability.h +- NO_DEFAULT_PATH ++ # NO_DEFAULT_PATH + PATHS ${_CPPUNIT_INCLUDE_SEARCH_DIRS} + PATH_SUFFIXES include + ) +@@ -177,7 +177,7 @@ set(CPPUNIT_PATH_SUFFIXES + ) + + find_library(CppUnit_LIBRARY cppunit +- NO_DEFAULT_PATH ++ # NO_DEFAULT_PATH + PATHS ${_CPPUNIT_LIBRARYDIR_SEARCH_DIRS} + PATH_SUFFIXES ${CPPUNIT_PATH_SUFFIXES} + ) +diff --git a/cmake/FindIlmBase.cmake b/cmake/FindIlmBase.cmake +deleted file mode 100644 +index 9dbc252..0000000 +--- a/cmake/FindIlmBase.cmake ++++ /dev/null +@@ -1,337 +0,0 @@ +-# Copyright (c) DreamWorks Animation LLC +-# +-# All rights reserved. This software is distributed under the +-# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ ) +-# +-# Redistributions of source code must retain the above copyright +-# and license notice and the following restrictions and disclaimer. +-# +-# * Neither the name of DreamWorks Animation nor the names of +-# its contributors may be used to endorse or promote products derived +-# from this software without specific prior written permission. +-# +-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, +-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE +-# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00. +-# +-#[=======================================================================[.rst: +- +-FindIlmBase +------------ +- +-Find IlmBase include dirs and libraries +- +-Use this module by invoking find_package with the form:: +- +- find_package(IlmBase +- [version] [EXACT] # Minimum or EXACT version +- [REQUIRED] # Fail with error if IlmBase is not found +- [COMPONENTS ...] # IlmBase libraries by their canonical name +- # e.g. "Half" for "libHalf" +- ) +- +-IMPORTED Targets +-^^^^^^^^^^^^^^^^ +- +-``IlmBase::Half`` +- The Half library target. +-``IlmBase::Iex`` +- The Iex library target. +-``IlmBase::IexMath`` +- The IexMath library target. +-``IlmBase::IlmThread`` +- The IlmThread library target. +-``IlmBase::Imath`` +- The Imath library target. +- +-Result Variables +-^^^^^^^^^^^^^^^^ +- +-This will define the following variables: +- +-``IlmBase_FOUND`` +- True if the system has the IlmBase library. +-``IlmBase_VERSION`` +- The version of the IlmBase library which was found. +-``IlmBase_INCLUDE_DIRS`` +- Include directories needed to use IlmBase. +-``IlmBase_LIBRARIES`` +- Libraries needed to link to IlmBase. +-``IlmBase_LIBRARY_DIRS`` +- IlmBase library directories. +-``IlmBase_{COMPONENT}_FOUND`` +- True if the system has the named IlmBase component. +- +-Cache Variables +-^^^^^^^^^^^^^^^ +- +-The following cache variables may also be set: +- +-``IlmBase_INCLUDE_DIR`` +- The directory containing ``IlmBase/config-auto.h``. +-``IlmBase_{COMPONENT}_LIBRARY`` +- Individual component libraries for IlmBase +-``IlmBase_{COMPONENT}_DLL`` +- Individual component dlls for IlmBase on Windows. +- +-Hints +-^^^^^ +- +-Instead of explicitly setting the cache variables, the following variables +-may be provided to tell this module where to look. +- +-``ILMBASE_ROOT`` +- Preferred installation prefix. +-``ILMBASE_INCLUDEDIR`` +- Preferred include directory e.g. /include +-``ILMBASE_LIBRARYDIR`` +- Preferred library directory e.g. /lib +-``SYSTEM_LIBRARY_PATHS`` +- Paths appended to all include and lib searches. +- +-#]=======================================================================] +- +-# Support new if() IN_LIST operator +-if(POLICY CMP0057) +- cmake_policy(SET CMP0057 NEW) +-endif() +- +-mark_as_advanced( +- IlmBase_INCLUDE_DIR +- IlmBase_LIBRARY +-) +- +-set(_ILMBASE_COMPONENT_LIST +- Half +- Iex +- IexMath +- IlmThread +- Imath +-) +- +-if(IlmBase_FIND_COMPONENTS) +- set(ILMBASE_COMPONENTS_PROVIDED TRUE) +- set(_IGNORED_COMPONENTS "") +- foreach(COMPONENT ${IlmBase_FIND_COMPONENTS}) +- if(NOT ${COMPONENT} IN_LIST _ILMBASE_COMPONENT_LIST) +- list(APPEND _IGNORED_COMPONENTS ${COMPONENT}) +- endif() +- endforeach() +- +- if(_IGNORED_COMPONENTS) +- message(STATUS "Ignoring unknown components of IlmBase:") +- foreach(COMPONENT ${_IGNORED_COMPONENTS}) +- message(STATUS " ${COMPONENT}") +- endforeach() +- list(REMOVE_ITEM IlmBase_FIND_COMPONENTS ${_IGNORED_COMPONENTS}) +- endif() +-else() +- set(ILMBASE_COMPONENTS_PROVIDED FALSE) +- set(IlmBase_FIND_COMPONENTS ${_ILMBASE_COMPONENT_LIST}) +-endif() +- +-# Append ILMBASE_ROOT or $ENV{ILMBASE_ROOT} if set (prioritize the direct cmake var) +-set(_ILMBASE_ROOT_SEARCH_DIR "") +- +-if(ILMBASE_ROOT) +- list(APPEND _ILMBASE_ROOT_SEARCH_DIR ${ILMBASE_ROOT}) +-else() +- set(_ENV_ILMBASE_ROOT $ENV{ILMBASE_ROOT}) +- if(_ENV_ILMBASE_ROOT) +- list(APPEND _ILMBASE_ROOT_SEARCH_DIR ${_ENV_ILMBASE_ROOT}) +- endif() +-endif() +- +-# Additionally try and use pkconfig to find IlmBase +- +-find_package(PkgConfig) +-pkg_check_modules(PC_IlmBase QUIET IlmBase) +- +-# ------------------------------------------------------------------------ +-# Search for IlmBase include DIR +-# ------------------------------------------------------------------------ +- +-set(_ILMBASE_INCLUDE_SEARCH_DIRS "") +-list(APPEND _ILMBASE_INCLUDE_SEARCH_DIRS +- ${ILMBASE_INCLUDEDIR} +- ${_ILMBASE_ROOT_SEARCH_DIR} +- ${PC_IlmBase_INCLUDEDIR} +- ${SYSTEM_LIBRARY_PATHS} +-) +- +-# Look for a standard IlmBase header file. +-find_path(IlmBase_INCLUDE_DIR IlmBaseConfig.h +- NO_DEFAULT_PATH +- PATHS ${_ILMBASE_INCLUDE_SEARCH_DIRS} +- PATH_SUFFIXES include/OpenEXR OpenEXR +-) +- +-if(EXISTS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h") +- # Get the ILMBASE version information from the config header +- file(STRINGS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h" +- _ilmbase_version_major_string REGEX "#define ILMBASE_VERSION_MAJOR " +- ) +- string(REGEX REPLACE "#define ILMBASE_VERSION_MAJOR" "" +- _ilmbase_version_major_string "${_ilmbase_version_major_string}" +- ) +- string(STRIP "${_ilmbase_version_major_string}" IlmBase_VERSION_MAJOR) +- +- file(STRINGS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h" +- _ilmbase_version_minor_string REGEX "#define ILMBASE_VERSION_MINOR " +- ) +- string(REGEX REPLACE "#define ILMBASE_VERSION_MINOR" "" +- _ilmbase_version_minor_string "${_ilmbase_version_minor_string}" +- ) +- string(STRIP "${_ilmbase_version_minor_string}" IlmBase_VERSION_MINOR) +- +- unset(_ilmbase_version_major_string) +- unset(_ilmbase_version_minor_string) +- +- set(IlmBase_VERSION ${IlmBase_VERSION_MAJOR}.${IlmBase_VERSION_MINOR}) +-endif() +- +-# ------------------------------------------------------------------------ +-# Search for ILMBASE lib DIR +-# ------------------------------------------------------------------------ +- +-set(_ILMBASE_LIBRARYDIR_SEARCH_DIRS "") +- +-# Append to _ILMBASE_LIBRARYDIR_SEARCH_DIRS in priority order +- +-list(APPEND _ILMBASE_LIBRARYDIR_SEARCH_DIRS +- ${ILMBASE_LIBRARYDIR} +- ${_ILMBASE_ROOT_SEARCH_DIR} +- ${PC_IlmBase_LIBDIR} +- ${SYSTEM_LIBRARY_PATHS} +-) +- +-# Build suffix directories +- +-set(ILMBASE_PATH_SUFFIXES +- lib64 +- lib +-) +- +-if(UNIX) +- list(INSERT ILMBASE_PATH_SUFFIXES 0 lib/x86_64-linux-gnu) +-endif() +- +-set(_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +- +-# library suffix handling +-if(WIN32) +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.lib" +- ) +-else() +- if(ILMBASE_USE_STATIC_LIBS) +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.a" +- ) +- else() +- if(APPLE) +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.dylib" +- ) +- else() +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.so" +- ) +- endif() +- endif() +-endif() +- +-set(IlmBase_LIB_COMPONENTS "") +- +-foreach(COMPONENT ${IlmBase_FIND_COMPONENTS}) +- find_library(IlmBase_${COMPONENT}_LIBRARY ${COMPONENT} +- NO_DEFAULT_PATH +- PATHS ${_ILMBASE_LIBRARYDIR_SEARCH_DIRS} +- PATH_SUFFIXES ${ILMBASE_PATH_SUFFIXES} +- ) +- list(APPEND IlmBase_LIB_COMPONENTS ${IlmBase_${COMPONENT}_LIBRARY}) +- +- if(WIN32 AND NOT ILMBASE_USE_STATIC_LIBS) +- set(_ILMBASE_TMP ${CMAKE_FIND_LIBRARY_SUFFIXES}) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") +- find_library(IlmBase_${COMPONENT}_DLL ${COMPONENT} +- NO_DEFAULT_PATH +- PATHS ${_ILMBASE_LIBRARYDIR_SEARCH_DIRS} +- PATH_SUFFIXES bin +- ) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ILMBASE_TMP}) +- unset(_ILMBASE_TMP) +- endif() +- +- if(IlmBase_${COMPONENT}_LIBRARY) +- set(IlmBase_${COMPONENT}_FOUND TRUE) +- else() +- set(IlmBase_${COMPONENT}_FOUND FALSE) +- endif() +-endforeach() +- +-# reset lib suffix +- +-set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +-unset(_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) +- +-# ------------------------------------------------------------------------ +-# Cache and set ILMBASE_FOUND +-# ------------------------------------------------------------------------ +- +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args(IlmBase +- FOUND_VAR IlmBase_FOUND +- REQUIRED_VARS +- IlmBase_INCLUDE_DIR +- IlmBase_LIB_COMPONENTS +- VERSION_VAR IlmBase_VERSION +- HANDLE_COMPONENTS +-) +- +-if(IlmBase_FOUND) +- set(IlmBase_LIBRARIES ${IlmBase_LIB_COMPONENTS}) +- +- # We have to add both include and include/OpenEXR to the include +- # path in case OpenEXR and IlmBase are installed separately +- +- set(IlmBase_INCLUDE_DIRS) +- list(APPEND IlmBase_INCLUDE_DIRS +- ${IlmBase_INCLUDE_DIR}/../ +- ${IlmBase_INCLUDE_DIR} +- ) +- set(IlmBase_DEFINITIONS ${PC_IlmBase_CFLAGS_OTHER}) +- +- set(IlmBase_LIBRARY_DIRS "") +- foreach(LIB ${IlmBase_LIB_COMPONENTS}) +- get_filename_component(_ILMBASE_LIBDIR ${LIB} DIRECTORY) +- list(APPEND IlmBase_LIBRARY_DIRS ${_ILMBASE_LIBDIR}) +- endforeach() +- list(REMOVE_DUPLICATES IlmBase_LIBRARY_DIRS) +- +- # Configure imported targets +- +- foreach(COMPONENT ${IlmBase_FIND_COMPONENTS}) +- if(NOT TARGET IlmBase::${COMPONENT}) +- add_library(IlmBase::${COMPONENT} UNKNOWN IMPORTED) +- set_target_properties(IlmBase::${COMPONENT} PROPERTIES +- IMPORTED_LOCATION "${IlmBase_${COMPONENT}_LIBRARY}" +- INTERFACE_COMPILE_OPTIONS "${IlmBase_DEFINITIONS}" +- INTERFACE_INCLUDE_DIRECTORIES "${IlmBase_INCLUDE_DIRS}" +- ) +- endif() +- endforeach() +- +-elseif(IlmBase_FIND_REQUIRED) +- message(FATAL_ERROR "Unable to find IlmBase") +-endif() +diff --git a/cmake/FindOpenEXR.cmake b/cmake/FindOpenEXR.cmake +deleted file mode 100644 +index 339c1a2..0000000 +--- a/cmake/FindOpenEXR.cmake ++++ /dev/null +@@ -1,329 +0,0 @@ +-# Copyright (c) DreamWorks Animation LLC +-# +-# All rights reserved. This software is distributed under the +-# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ ) +-# +-# Redistributions of source code must retain the above copyright +-# and license notice and the following restrictions and disclaimer. +-# +-# * Neither the name of DreamWorks Animation nor the names of +-# its contributors may be used to endorse or promote products derived +-# from this software without specific prior written permission. +-# +-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, +-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE +-# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00. +-# +-#[=======================================================================[.rst: +- +-FindOpenEXR +------------ +- +-Find OpenEXR include dirs and libraries +- +-Use this module by invoking find_package with the form:: +- +- find_package(OpenEXR +- [version] [EXACT] # Minimum or EXACT version +- [REQUIRED] # Fail with error if OpenEXR is not found +- [COMPONENTS ...] # OpenEXR libraries by their canonical name +- # e.g. "IlmImf" for "libIlmImf" +- ) +- +-IMPORTED Targets +-^^^^^^^^^^^^^^^^ +- +-``OpenEXR::IlmImf`` +- The IlmImf library target. +-``OpenEXR::IlmImfUtil`` +- The IlmImfUtil library target. +- +-Result Variables +-^^^^^^^^^^^^^^^^ +- +-This will define the following variables: +- +-``OpenEXR_FOUND`` +- True if the system has the OpenEXR library. +-``OpenEXR_VERSION`` +- The version of the OpenEXR library which was found. +-``OpenEXR_INCLUDE_DIRS`` +- Include directories needed to use OpenEXR. +-``OpenEXR_LIBRARIES`` +- Libraries needed to link to OpenEXR. +-``OpenEXR_LIBRARY_DIRS`` +- OpenEXR library directories. +-``OpenEXR_DEFINITIONS`` +- Definitions to use when compiling code that uses OpenEXR. +-``OpenEXR_{COMPONENT}_FOUND`` +- True if the system has the named OpenEXR component. +- +-Cache Variables +-^^^^^^^^^^^^^^^ +- +-The following cache variables may also be set: +- +-``OpenEXR_INCLUDE_DIR`` +- The directory containing ``OpenEXR/config-auto.h``. +-``OpenEXR_{COMPONENT}_LIBRARY`` +- Individual component libraries for OpenEXR +-``OpenEXR_{COMPONENT}_DLL`` +- Individual component dlls for OpenEXR on Windows. +- +-Hints +-^^^^^ +- +-Instead of explicitly setting the cache variables, the following variables +-may be provided to tell this module where to look. +- +-``OPENEXR_ROOT`` +- Preferred installation prefix. +-``OPENEXR_INCLUDEDIR`` +- Preferred include directory e.g. /include +-``OPENEXR_LIBRARYDIR`` +- Preferred library directory e.g. /lib +-``SYSTEM_LIBRARY_PATHS`` +- Paths appended to all include and lib searches. +- +-#]=======================================================================] +- +-# Support new if() IN_LIST operator +-if(POLICY CMP0057) +- cmake_policy(SET CMP0057 NEW) +-endif() +- +-mark_as_advanced( +- OpenEXR_INCLUDE_DIR +- OpenEXR_LIBRARY +-) +- +-set(_OPENEXR_COMPONENT_LIST +- IlmImf +- IlmImfUtil +-) +- +-if(OpenEXR_FIND_COMPONENTS) +- set(OPENEXR_COMPONENTS_PROVIDED TRUE) +- set(_IGNORED_COMPONENTS "") +- foreach(COMPONENT ${OpenEXR_FIND_COMPONENTS}) +- if(NOT ${COMPONENT} IN_LIST _OPENEXR_COMPONENT_LIST) +- list(APPEND _IGNORED_COMPONENTS ${COMPONENT}) +- endif() +- endforeach() +- +- if(_IGNORED_COMPONENTS) +- message(STATUS "Ignoring unknown components of OpenEXR:") +- foreach(COMPONENT ${_IGNORED_COMPONENTS}) +- message(STATUS " ${COMPONENT}") +- endforeach() +- list(REMOVE_ITEM OpenEXR_FIND_COMPONENTS ${_IGNORED_COMPONENTS}) +- endif() +-else() +- set(OPENEXR_COMPONENTS_PROVIDED FALSE) +- set(OpenEXR_FIND_COMPONENTS ${_OPENEXR_COMPONENT_LIST}) +-endif() +- +-# Append OPENEXR_ROOT or $ENV{OPENEXR_ROOT} if set (prioritize the direct cmake var) +-set(_OPENEXR_ROOT_SEARCH_DIR "") +- +-if(OPENEXR_ROOT) +- list(APPEND _OPENEXR_ROOT_SEARCH_DIR ${OPENEXR_ROOT}) +-else() +- set(_ENV_OPENEXR_ROOT $ENV{OPENEXR_ROOT}) +- if(_ENV_OPENEXR_ROOT) +- list(APPEND _OPENEXR_ROOT_SEARCH_DIR ${_ENV_OPENEXR_ROOT}) +- endif() +-endif() +- +-# Additionally try and use pkconfig to find OpenEXR +- +-find_package(PkgConfig) +-pkg_check_modules(PC_OpenEXR QUIET OpenEXR) +- +-# ------------------------------------------------------------------------ +-# Search for OpenEXR include DIR +-# ------------------------------------------------------------------------ +- +-set(_OPENEXR_INCLUDE_SEARCH_DIRS "") +-list(APPEND _OPENEXR_INCLUDE_SEARCH_DIRS +- ${OPENEXR_INCLUDEDIR} +- ${_OPENEXR_ROOT_SEARCH_DIR} +- ${PC_OpenEXR_INCLUDEDIR} +- ${SYSTEM_LIBRARY_PATHS} +-) +- +-# Look for a standard OpenEXR header file. +-find_path(OpenEXR_INCLUDE_DIR OpenEXRConfig.h +- NO_DEFAULT_PATH +- PATHS ${_OPENEXR_INCLUDE_SEARCH_DIRS} +- PATH_SUFFIXES include/OpenEXR OpenEXR +-) +- +-if(EXISTS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h") +- # Get the EXR version information from the config header +- file(STRINGS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h" +- _openexr_version_major_string REGEX "#define OPENEXR_VERSION_MAJOR " +- ) +- string(REGEX REPLACE "#define OPENEXR_VERSION_MAJOR" "" +- _openexr_version_major_string "${_openexr_version_major_string}" +- ) +- string(STRIP "${_openexr_version_major_string}" OpenEXR_VERSION_MAJOR) +- +- file(STRINGS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h" +- _openexr_version_minor_string REGEX "#define OPENEXR_VERSION_MINOR " +- ) +- string(REGEX REPLACE "#define OPENEXR_VERSION_MINOR" "" +- _openexr_version_minor_string "${_openexr_version_minor_string}" +- ) +- string(STRIP "${_openexr_version_minor_string}" OpenEXR_VERSION_MINOR) +- +- unset(_openexr_version_major_string) +- unset(_openexr_version_minor_string) +- +- set(OpenEXR_VERSION ${OpenEXR_VERSION_MAJOR}.${OpenEXR_VERSION_MINOR}) +-endif() +- +-# ------------------------------------------------------------------------ +-# Search for OPENEXR lib DIR +-# ------------------------------------------------------------------------ +- +-set(_OPENEXR_LIBRARYDIR_SEARCH_DIRS "") +- +-# Append to _OPENEXR_LIBRARYDIR_SEARCH_DIRS in priority order +- +-list(APPEND _OPENEXR_LIBRARYDIR_SEARCH_DIRS +- ${OPENEXR_LIBRARYDIR} +- ${_OPENEXR_ROOT_SEARCH_DIR} +- ${PC_OpenEXR_LIBDIR} +- ${SYSTEM_LIBRARY_PATHS} +-) +- +-# Build suffix directories +- +-set(OPENEXR_PATH_SUFFIXES +- lib64 +- lib +-) +- +-if(UNIX ) +- list(INSERT OPENEXR_PATH_SUFFIXES 0 lib/x86_64-linux-gnu) +-endif() +- +-set(_OPENEXR_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +- +-# library suffix handling +-if(WIN32) +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.lib" +- ) +-else() +- if(OPENEXR_USE_STATIC_LIBS) +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.a" +- ) +- else() +- if(APPLE) +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.dylib" +- ) +- else() +- list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES +- "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.so" +- ) +- endif() +- endif() +-endif() +- +-set(OpenEXR_LIB_COMPONENTS "") +- +-foreach(COMPONENT ${OpenEXR_FIND_COMPONENTS}) +- find_library(OpenEXR_${COMPONENT}_LIBRARY ${COMPONENT} +- NO_DEFAULT_PATH +- PATHS ${_OPENEXR_LIBRARYDIR_SEARCH_DIRS} +- PATH_SUFFIXES ${OPENEXR_PATH_SUFFIXES} +- ) +- list(APPEND OpenEXR_LIB_COMPONENTS ${OpenEXR_${COMPONENT}_LIBRARY}) +- +- if(WIN32 AND NOT OPENEXR_USE_STATIC_LIBS) +- set(_OPENEXR_TMP ${CMAKE_FIND_LIBRARY_SUFFIXES}) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") +- find_library(OpenEXR_${COMPONENT}_DLL ${COMPONENT} +- NO_DEFAULT_PATH +- PATHS ${_OPENEXR_LIBRARYDIR_SEARCH_DIRS} +- PATH_SUFFIXES bin +- ) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OPENEXR_TMP}) +- unset(_OPENEXR_TMP) +- endif() +- +- if(OpenEXR_${COMPONENT}_LIBRARY) +- set(OpenEXR_${COMPONENT}_FOUND TRUE) +- else() +- set(OpenEXR_${COMPONENT}_FOUND FALSE) +- endif() +-endforeach() +- +-# reset lib suffix +- +-set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OPENEXR_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +-unset(_OPENEXR_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) +- +-# ------------------------------------------------------------------------ +-# Cache and set OPENEXR_FOUND +-# ------------------------------------------------------------------------ +- +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args(OpenEXR +- FOUND_VAR OpenEXR_FOUND +- REQUIRED_VARS +- OpenEXR_INCLUDE_DIR +- OpenEXR_LIB_COMPONENTS +- VERSION_VAR OpenEXR_VERSION +- HANDLE_COMPONENTS +-) +- +-if(OpenEXR_FOUND) +- set(OpenEXR_LIBRARIES ${OpenEXR_LIB_COMPONENTS}) +- +- # We have to add both include and include/OpenEXR to the include +- # path in case OpenEXR and IlmBase are installed separately +- +- set(OpenEXR_INCLUDE_DIRS) +- list(APPEND OpenEXR_INCLUDE_DIRS +- ${OpenEXR_INCLUDE_DIR}/../ +- ${OpenEXR_INCLUDE_DIR} +- ) +- set(OpenEXR_DEFINITIONS ${PC_OpenEXR_CFLAGS_OTHER}) +- +- set(OpenEXR_LIBRARY_DIRS "") +- foreach(LIB ${OpenEXR_LIB_COMPONENTS}) +- get_filename_component(_OPENEXR_LIBDIR ${LIB} DIRECTORY) +- list(APPEND OpenEXR_LIBRARY_DIRS ${_OPENEXR_LIBDIR}) +- endforeach() +- list(REMOVE_DUPLICATES OpenEXR_LIBRARY_DIRS) +- +- # Configure imported target +- +- foreach(COMPONENT ${OpenEXR_FIND_COMPONENTS}) +- if(NOT TARGET OpenEXR::${COMPONENT}) +- add_library(OpenEXR::${COMPONENT} UNKNOWN IMPORTED) +- set_target_properties(OpenEXR::${COMPONENT} PROPERTIES +- IMPORTED_LOCATION "${OpenEXR_${COMPONENT}_LIBRARY}" +- INTERFACE_COMPILE_OPTIONS "${OpenEXR_DEFINITIONS}" +- INTERFACE_INCLUDE_DIRECTORIES "${OpenEXR_INCLUDE_DIRS}" +- ) +- endif() +- endforeach() +-elseif(OpenEXR_FIND_REQUIRED) +- message(FATAL_ERROR "Unable to find OpenEXR") +-endif() +diff --git a/cmake/FindOpenVDB.cmake b/cmake/FindOpenVDB.cmake +index 63a2eda..6211071 100644 +--- a/cmake/FindOpenVDB.cmake ++++ b/cmake/FindOpenVDB.cmake +@@ -244,7 +244,7 @@ set(OpenVDB_LIB_COMPONENTS "") + + foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS}) + set(LIB_NAME ${COMPONENT}) +- find_library(OpenVDB_${COMPONENT}_LIBRARY ${LIB_NAME} ++ find_library(OpenVDB_${COMPONENT}_LIBRARY ${LIB_NAME} lib${LIB_NAME} + NO_DEFAULT_PATH + PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS} + PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES} +@@ -282,16 +282,13 @@ find_package_handle_standard_args(OpenVDB + # ------------------------------------------------------------------------ + + # Set the ABI number the library was built against. Uses vdb_print ++find_program(OPENVDB_PRINT vdb_print ++ PATHS ${_OPENVDB_INSTALL}/bin ${OpenVDB_INCLUDE_DIR} ++ NO_DEFAULT_PATH) + + if(_OPENVDB_INSTALL) + OPENVDB_ABI_VERSION_FROM_PRINT( +- "${_OPENVDB_INSTALL}/bin/vdb_print" +- ABI OpenVDB_ABI +- ) +-else() +- # Try and find vdb_print from the include path +- OPENVDB_ABI_VERSION_FROM_PRINT( +- "${OpenVDB_INCLUDE_DIR}/../bin/vdb_print" ++ "${OPENVDB_PRINT}" + ABI OpenVDB_ABI + ) + endif() +@@ -472,6 +469,12 @@ foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS}) + INTERFACE_LINK_LIBRARIES "${_OPENVDB_VISIBLE_DEPENDENCIES}" # visible deps (headers) + INTERFACE_COMPILE_FEATURES cxx_std_11 + ) ++ ++ if (OPENVDB_USE_STATIC_LIBS) ++ set_target_properties(OpenVDB::${COMPONENT} PROPERTIES ++ INTERFACE_COMPILE_DEFINITIONS "OPENVDB_STATICLIB;OPENVDB_OPENEXR_STATICLIB" ++ ) ++ endif() + endif() + endforeach() + +diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake +index bdf9c81..ffdee03 100644 +--- a/cmake/FindTBB.cmake ++++ b/cmake/FindTBB.cmake +@@ -1,333 +1,322 @@ +-# Copyright (c) DreamWorks Animation LLC ++# The MIT License (MIT) + # +-# All rights reserved. This software is distributed under the +-# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ ) ++# Copyright (c) 2015 Justus Calvin ++# ++# Permission is hereby granted, free of charge, to any person obtaining a copy ++# of this software and associated documentation files (the "Software"), to deal ++# in the Software without restriction, including without limitation the rights ++# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++# copies of the Software, and to permit persons to whom the Software is ++# furnished to do so, subject to the following conditions: ++# ++# The above copyright notice and this permission notice shall be included in all ++# copies or substantial portions of the Software. ++# ++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++# SOFTWARE. ++ + # +-# Redistributions of source code must retain the above copyright +-# and license notice and the following restrictions and disclaimer. ++# FindTBB ++# ------- + # +-# * Neither the name of DreamWorks Animation nor the names of +-# its contributors may be used to endorse or promote products derived +-# from this software without specific prior written permission. ++# Find TBB include directories and libraries. + # +-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, +-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE +-# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00. ++# Usage: + # +-#[=======================================================================[.rst: +- +-FindTBB +-------- +- +-Find Tbb include dirs and libraries +- +-Use this module by invoking find_package with the form:: +- +- find_package(TBB +- [version] [EXACT] # Minimum or EXACT version +- [REQUIRED] # Fail with error if Tbb is not found +- [COMPONENTS ...] # Tbb libraries by their canonical name +- # e.g. "tbb" for "libtbb" +- ) +- +-IMPORTED Targets +-^^^^^^^^^^^^^^^^ +- +-``TBB::tbb`` +- The tbb library target. +-``TBB::tbbmalloc`` +- The tbbmalloc library target. +-``TBB::tbbmalloc_proxy`` +- The tbbmalloc_proxy library target. +- +-Result Variables +-^^^^^^^^^^^^^^^^ +- +-This will define the following variables: +- +-``Tbb_FOUND`` +- True if the system has the Tbb library. +-``Tbb_VERSION`` +- The version of the Tbb library which was found. +-``Tbb_INCLUDE_DIRS`` +- Include directories needed to use Tbb. +-``Tbb_LIBRARIES`` +- Libraries needed to link to Tbb. +-``Tbb_LIBRARY_DIRS`` +- Tbb library directories. +-``TBB_{COMPONENT}_FOUND`` +- True if the system has the named TBB component. +- +-Cache Variables +-^^^^^^^^^^^^^^^ +- +-The following cache variables may also be set: +- +-``Tbb_INCLUDE_DIR`` +- The directory containing ``tbb/tbb_stddef.h``. +-``Tbb_{COMPONENT}_LIBRARY`` +- Individual component libraries for Tbb +- +-Hints +-^^^^^ +- +-Instead of explicitly setting the cache variables, the following variables +-may be provided to tell this module where to look. +- +-``TBB_ROOT`` +- Preferred installation prefix. +-``TBB_INCLUDEDIR`` +- Preferred include directory e.g. /include +-``TBB_LIBRARYDIR`` +- Preferred library directory e.g. /lib +-``SYSTEM_LIBRARY_PATHS`` +- Paths appended to all include and lib searches. +- +-#]=======================================================================] +- +-# Support new if() IN_LIST operator +-if(POLICY CMP0057) +- cmake_policy(SET CMP0057 NEW) +-endif() ++# find_package(TBB [major[.minor]] [EXACT] ++# [QUIET] [REQUIRED] ++# [[COMPONENTS] [components...]] ++# [OPTIONAL_COMPONENTS components...]) ++# ++# where the allowed components are tbbmalloc and tbb_preview. Users may modify ++# the behavior of this module with the following variables: ++# ++# * TBB_ROOT_DIR - The base directory the of TBB installation. ++# * TBB_INCLUDE_DIR - The directory that contains the TBB headers files. ++# * TBB_LIBRARY - The directory that contains the TBB library files. ++# * TBB__LIBRARY - The path of the TBB the corresponding TBB library. ++# These libraries, if specified, override the ++# corresponding library search results, where ++# may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug, ++# tbb_preview, or tbb_preview_debug. ++# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will ++# be used instead of the release version. ++# * TBB_STATIC - Static linking of libraries with a _static suffix. ++# For example, on Windows a tbb_static.lib will be searched for ++# instead of tbb.lib. ++# ++# Users may modify the behavior of this module with the following environment ++# variables: ++# ++# * TBB_INSTALL_DIR ++# * TBBROOT ++# * LIBRARY_PATH ++# ++# This module will set the following variables: ++# ++# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or ++# don’t want to use TBB. ++# * TBB__FOUND - If False, optional part of TBB sytem is ++# not available. ++# * TBB_VERSION - The full version string ++# * TBB_VERSION_MAJOR - The major version ++# * TBB_VERSION_MINOR - The minor version ++# * TBB_INTERFACE_VERSION - The interface version number defined in ++# tbb/tbb_stddef.h. ++# * TBB__LIBRARY_RELEASE - The path of the TBB release version of ++# , where may be tbb, tbb_debug, ++# tbbmalloc, tbbmalloc_debug, tbb_preview, or ++# tbb_preview_debug. ++# * TBB__LIBRARY_DEGUG - The path of the TBB release version of ++# , where may be tbb, tbb_debug, ++# tbbmalloc, tbbmalloc_debug, tbb_preview, or ++# tbb_preview_debug. ++# ++# The following varibles should be used to build and link with TBB: ++# ++# * TBB_INCLUDE_DIRS - The include directory for TBB. ++# * TBB_LIBRARIES - The libraries to link against to use TBB. ++# * TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB. ++# * TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB. ++# * TBB_DEFINITIONS - Definitions to use when compiling code that uses ++# TBB. ++# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that ++# uses TBB. ++# * TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that ++# uses TBB. ++# ++# This module will also create the "tbb" target that may be used when building ++# executables and libraries. ++ ++include(FindPackageHandleStandardArgs) ++ ++if(NOT TBB_FOUND) + +-mark_as_advanced( +- Tbb_INCLUDE_DIR +- Tbb_LIBRARY +-) +- +-set(_TBB_COMPONENT_LIST +- tbb +- tbbmalloc +- tbbmalloc_proxy +-) +- +-if(TBB_FIND_COMPONENTS) +- set(_TBB_COMPONENTS_PROVIDED TRUE) +- set(_IGNORED_COMPONENTS "") +- foreach(COMPONENT ${TBB_FIND_COMPONENTS}) +- if(NOT ${COMPONENT} IN_LIST _TBB_COMPONENT_LIST) +- list(APPEND _IGNORED_COMPONENTS ${COMPONENT}) ++ ################################## ++ # Check the build type ++ ################################## ++ ++ if(NOT DEFINED TBB_USE_DEBUG_BUILD) ++ if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)") ++ set(TBB_BUILD_TYPE DEBUG) ++ else() ++ set(TBB_BUILD_TYPE RELEASE) ++ endif() ++ elseif(TBB_USE_DEBUG_BUILD) ++ set(TBB_BUILD_TYPE DEBUG) ++ else() ++ set(TBB_BUILD_TYPE RELEASE) ++ endif() ++ ++ ################################## ++ # Set the TBB search directories ++ ################################## ++ ++ # Define search paths based on user input and environment variables ++ set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT}) ++ ++ # Define the search directories based on the current platform ++ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB" ++ "C:/Program Files (x86)/Intel/TBB") ++ ++ # Set the target architecture ++ if(CMAKE_SIZEOF_VOID_P EQUAL 8) ++ set(TBB_ARCHITECTURE "intel64") ++ else() ++ set(TBB_ARCHITECTURE "ia32") ++ endif() ++ ++ # Set the TBB search library path search suffix based on the version of VC ++ if(WINDOWS_STORE) ++ set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui") ++ elseif(MSVC14) ++ set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14") ++ elseif(MSVC12) ++ set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12") ++ elseif(MSVC11) ++ set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11") ++ elseif(MSVC10) ++ set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10") + endif() +- endforeach() + +- if(_IGNORED_COMPONENTS) +- message(STATUS "Ignoring unknown components of TBB:") +- foreach(COMPONENT ${_IGNORED_COMPONENTS}) +- message(STATUS " ${COMPONENT}") +- endforeach() +- list(REMOVE_ITEM TBB_FIND_COMPONENTS ${_IGNORED_COMPONENTS}) ++ # Add the library path search suffix for the VC independent version of TBB ++ list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt") ++ ++ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") ++ # OS X ++ set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") ++ ++ # TODO: Check to see which C++ library is being used by the compiler. ++ if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0) ++ # The default C++ library on OS X 10.9 and later is libc++ ++ set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib") ++ else() ++ set(TBB_LIB_PATH_SUFFIX "lib") ++ endif() ++ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ # Linux ++ set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") ++ ++ # TODO: Check compiler version to see the suffix should be /gcc4.1 or ++ # /gcc4.1. For now, assume that the compiler is more recent than ++ # gcc 4.4.x or later. ++ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") ++ set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4") ++ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") ++ set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4") ++ endif() ++ endif() ++ ++ ################################## ++ # Find the TBB include dir ++ ################################## ++ ++ find_path(TBB_INCLUDE_DIRS tbb/tbb.h ++ HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR} ++ PATHS ${TBB_DEFAULT_SEARCH_DIR} ++ PATH_SUFFIXES include) ++ ++ ################################## ++ # Set version strings ++ ################################## ++ ++ if(TBB_INCLUDE_DIRS) ++ file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file) ++ string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" ++ TBB_VERSION_MAJOR "${_tbb_version_file}") ++ string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" ++ TBB_VERSION_MINOR "${_tbb_version_file}") ++ string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" ++ TBB_INTERFACE_VERSION "${_tbb_version_file}") ++ set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") + endif() +-else() +- set(_TBB_COMPONENTS_PROVIDED FALSE) +- set(TBB_FIND_COMPONENTS ${_TBB_COMPONENT_LIST}) +-endif() + +-# Append TBB_ROOT or $ENV{TBB_ROOT} if set (prioritize the direct cmake var) +-set(_TBB_ROOT_SEARCH_DIR "") ++ ################################## ++ # Find TBB components ++ ################################## + +-if(TBB_ROOT) +- list(APPEND _TBB_ROOT_SEARCH_DIR ${TBB_ROOT}) +-else() +- set(_ENV_TBB_ROOT $ENV{TBB_ROOT}) +- if(_ENV_TBB_ROOT) +- list(APPEND _TBB_ROOT_SEARCH_DIR ${_ENV_TBB_ROOT}) ++ if(TBB_VERSION VERSION_LESS 4.3) ++ set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb) ++ else() ++ set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb) + endif() +-endif() + +-# Additionally try and use pkconfig to find Tbb +- +-find_package(PkgConfig) +-pkg_check_modules(PC_Tbb QUIET tbb) +- +-# ------------------------------------------------------------------------ +-# Search for tbb include DIR +-# ------------------------------------------------------------------------ +- +-set(_TBB_INCLUDE_SEARCH_DIRS "") +-list(APPEND _TBB_INCLUDE_SEARCH_DIRS +- ${TBB_INCLUDEDIR} +- ${_TBB_ROOT_SEARCH_DIR} +- ${PC_Tbb_INCLUDE_DIRS} +- ${SYSTEM_LIBRARY_PATHS} +-) +- +-# Look for a standard tbb header file. +-find_path(Tbb_INCLUDE_DIR tbb/tbb_stddef.h +- NO_DEFAULT_PATH +- PATHS ${_TBB_INCLUDE_SEARCH_DIRS} +- PATH_SUFFIXES include +-) +- +-if(EXISTS "${Tbb_INCLUDE_DIR}/tbb/tbb_stddef.h") +- file(STRINGS "${Tbb_INCLUDE_DIR}/tbb/tbb_stddef.h" +- _tbb_version_major_string REGEX "#define TBB_VERSION_MAJOR " +- ) +- string(REGEX REPLACE "#define TBB_VERSION_MAJOR" "" +- _tbb_version_major_string "${_tbb_version_major_string}" +- ) +- string(STRIP "${_tbb_version_major_string}" Tbb_VERSION_MAJOR) +- +- file(STRINGS "${Tbb_INCLUDE_DIR}/tbb/tbb_stddef.h" +- _tbb_version_minor_string REGEX "#define TBB_VERSION_MINOR " +- ) +- string(REGEX REPLACE "#define TBB_VERSION_MINOR" "" +- _tbb_version_minor_string "${_tbb_version_minor_string}" +- ) +- string(STRIP "${_tbb_version_minor_string}" Tbb_VERSION_MINOR) +- +- unset(_tbb_version_major_string) +- unset(_tbb_version_minor_string) +- +- set(Tbb_VERSION ${Tbb_VERSION_MAJOR}.${Tbb_VERSION_MINOR}) +-endif() ++ if(TBB_STATIC) ++ set(TBB_STATIC_SUFFIX "_static") ++ endif() ++ ++ # Find each component ++ foreach(_comp ${TBB_SEARCH_COMPOMPONENTS}) ++ if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};") + +-# ------------------------------------------------------------------------ +-# Search for TBB lib DIR +-# ------------------------------------------------------------------------ ++ # Search for the libraries ++ find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}${TBB_STATIC_SUFFIX} ++ HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} ++ PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH ++ PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) + +-set(_TBB_LIBRARYDIR_SEARCH_DIRS "") ++ find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}${TBB_STATIC_SUFFIX}_debug ++ HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} ++ PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH ++ PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) + +-# Append to _TBB_LIBRARYDIR_SEARCH_DIRS in priority order ++ if(TBB_${_comp}_LIBRARY_DEBUG) ++ list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}") ++ endif() ++ if(TBB_${_comp}_LIBRARY_RELEASE) ++ list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}") ++ endif() ++ if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY) ++ set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}") ++ endif() + +-set(_TBB_LIBRARYDIR_SEARCH_DIRS "") +-list(APPEND _TBB_LIBRARYDIR_SEARCH_DIRS +- ${TBB_LIBRARYDIR} +- ${_TBB_ROOT_SEARCH_DIR} +- ${PC_Tbb_LIBRARY_DIRS} +- ${SYSTEM_LIBRARY_PATHS} +-) ++ if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}") ++ set(TBB_${_comp}_FOUND TRUE) ++ else() ++ set(TBB_${_comp}_FOUND FALSE) ++ endif() + +-set(TBB_PATH_SUFFIXES +- lib64 +- lib +-) ++ # Mark internal variables as advanced ++ mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE) ++ mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG) ++ mark_as_advanced(TBB_${_comp}_LIBRARY) + +-# platform branching ++ endif() ++ endforeach() + +-if(UNIX) +- list(INSERT TBB_PATH_SUFFIXES 0 lib/x86_64-linux-gnu) +-endif() ++ ################################## ++ # Set compile flags and libraries ++ ################################## + +-if(APPLE) +- if(TBB_FOR_CLANG) +- list(INSERT TBB_PATH_SUFFIXES 0 lib/libc++) ++ set(TBB_DEFINITIONS_RELEASE "") ++ set(TBB_DEFINITIONS_DEBUG "TBB_USE_DEBUG=1") ++ ++ if(TBB_LIBRARIES_${TBB_BUILD_TYPE}) ++ set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}") + endif() +-elseif(WIN32) +- if(MSVC10) +- set(TBB_VC_DIR vc10) +- elseif(MSVC11) +- set(TBB_VC_DIR vc11) +- elseif(MSVC12) +- set(TBB_VC_DIR vc12) +- endif() +- list(INSERT TBB_PATH_SUFFIXES 0 lib/intel64/${TBB_VC_DIR}) +-else() +- if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) +- if(TBB_MATCH_COMPILER_VERSION) +- string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${CMAKE_CXX_COMPILER_VERSION}) +- list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) +- list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR) +- list(INSERT TBB_PATH_SUFFIXES 0 lib/intel64/gcc${GCC_MAJOR}.${GCC_MINOR}) +- else() +- list(INSERT TBB_PATH_SUFFIXES 0 lib/intel64/gcc4.4) +- endif() ++ ++ if(NOT MSVC AND NOT TBB_LIBRARIES) ++ set(TBB_LIBRARIES ${TBB_LIBRARIES_RELEASE}) + endif() +-endif() + +-if(UNIX AND TBB_USE_STATIC_LIBS) +- set(_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +-endif() ++ if (MSVC AND TBB_STATIC) ++ set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE) ++ endif () ++ ++ unset (TBB_STATIC_SUFFIX) ++ ++ find_package_handle_standard_args(TBB ++ REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES ++ HANDLE_COMPONENTS ++ VERSION_VAR TBB_VERSION) ++ ++ ################################## ++ # Create targets ++ ################################## ++ ++ if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND) ++ add_library(TBB::tbb UNKNOWN IMPORTED) ++ set_target_properties(TBB::tbb PROPERTIES ++ INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS} ++ IMPORTED_LOCATION ${TBB_LIBRARIES}) ++ if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG) ++ set_target_properties(TBB::tbb PROPERTIES ++ INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS};$<$,$>:${TBB_DEFINITIONS_DEBUG}>;$<$:${TBB_DEFINITIONS_RELEASE}>" ++ IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG} ++ IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_RELEASE} ++ IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE} ++ IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE} ++ ) ++ endif() + +-set(Tbb_LIB_COMPONENTS "") +- +-foreach(COMPONENT ${TBB_FIND_COMPONENTS}) +- find_library(Tbb_${COMPONENT}_LIBRARY ${COMPONENT} +- NO_DEFAULT_PATH +- PATHS ${_TBB_LIBRARYDIR_SEARCH_DIRS} +- PATH_SUFFIXES ${TBB_PATH_SUFFIXES} +- ) +- +- # On Unix, TBB sometimes uses linker scripts instead of symlinks, so parse the linker script +- # and correct the library name if so +- if(UNIX AND EXISTS ${Tbb_${COMPONENT}_LIBRARY}) +- # Ignore files where the first four bytes equals the ELF magic number +- file(READ ${Tbb_${COMPONENT}_LIBRARY} Tbb_${COMPONENT}_HEX OFFSET 0 LIMIT 4 HEX) +- if(NOT ${Tbb_${COMPONENT}_HEX} STREQUAL "7f454c46") +- # Read the first 1024 bytes of the library and match against an "INPUT (file)" regex +- file(READ ${Tbb_${COMPONENT}_LIBRARY} Tbb_${COMPONENT}_ASCII OFFSET 0 LIMIT 1024) +- if("${Tbb_${COMPONENT}_ASCII}" MATCHES "INPUT \\(([^(]+)\\)") +- # Extract the directory and apply the matched text (in brackets) +- get_filename_component(Tbb_${COMPONENT}_DIR "${Tbb_${COMPONENT}_LIBRARY}" DIRECTORY) +- set(Tbb_${COMPONENT}_LIBRARY "${Tbb_${COMPONENT}_DIR}/${CMAKE_MATCH_1}") +- endif() ++ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ find_package(Threads QUIET REQUIRED) ++ set_target_properties(TBB::tbb PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS};Threads::Threads") + endif() + endif() + +- list(APPEND Tbb_LIB_COMPONENTS ${Tbb_${COMPONENT}_LIBRARY}) +- +- if(Tbb_${COMPONENT}_LIBRARY) +- set(TBB_${COMPONENT}_FOUND TRUE) +- else() +- set(TBB_${COMPONENT}_FOUND FALSE) ++ mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES) ++ ++ unset(TBB_ARCHITECTURE) ++ unset(TBB_BUILD_TYPE) ++ unset(TBB_LIB_PATH_SUFFIX) ++ unset(TBB_DEFAULT_SEARCH_DIR) ++ ++ if(TBB_DEBUG) ++ message(STATUS " TBB_FOUND = ${TBB_FOUND}") ++ message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}") ++ message(STATUS " TBB_DEFINITIONS = ${TBB_DEFINITIONS}") ++ message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}") ++ message(STATUS " TBB_DEFINITIONS_DEBUG = ${TBB_DEFINITIONS_DEBUG}") ++ message(STATUS " TBB_LIBRARIES_DEBUG = ${TBB_LIBRARIES_DEBUG}") ++ message(STATUS " TBB_DEFINITIONS_RELEASE = ${TBB_DEFINITIONS_RELEASE}") ++ message(STATUS " TBB_LIBRARIES_RELEASE = ${TBB_LIBRARIES_RELEASE}") + endif() +-endforeach() + +-if(UNIX AND TBB_USE_STATIC_LIBS) +- set(CMAKE_FIND_LIBRARY_SUFFIXES ${_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +- unset(_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) +-endif() +- +-# ------------------------------------------------------------------------ +-# Cache and set TBB_FOUND +-# ------------------------------------------------------------------------ +- +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args(TBB +- FOUND_VAR TBB_FOUND +- REQUIRED_VARS +- Tbb_INCLUDE_DIR +- Tbb_LIB_COMPONENTS +- VERSION_VAR Tbb_VERSION +- HANDLE_COMPONENTS +-) +- +-if(TBB_FOUND) +- set(Tbb_LIBRARIES +- ${Tbb_LIB_COMPONENTS} +- ) +- set(Tbb_INCLUDE_DIRS ${Tbb_INCLUDE_DIR}) +- set(Tbb_DEFINITIONS ${PC_Tbb_CFLAGS_OTHER}) +- +- set(Tbb_LIBRARY_DIRS "") +- foreach(LIB ${Tbb_LIB_COMPONENTS}) +- get_filename_component(_TBB_LIBDIR ${LIB} DIRECTORY) +- list(APPEND Tbb_LIBRARY_DIRS ${_TBB_LIBDIR}) +- endforeach() +- list(REMOVE_DUPLICATES Tbb_LIBRARY_DIRS) +- +- # Configure imported targets +- +- foreach(COMPONENT ${TBB_FIND_COMPONENTS}) +- if(NOT TARGET TBB::${COMPONENT}) +- add_library(TBB::${COMPONENT} UNKNOWN IMPORTED) +- set_target_properties(TBB::${COMPONENT} PROPERTIES +- IMPORTED_LOCATION "${Tbb_${COMPONENT}_LIBRARY}" +- INTERFACE_COMPILE_OPTIONS "${Tbb_DEFINITIONS}" +- INTERFACE_INCLUDE_DIRECTORIES "${Tbb_INCLUDE_DIR}" +- ) +- endif() +- endforeach() +-elseif(TBB_FIND_REQUIRED) +- message(FATAL_ERROR "Unable to find TBB") + endif() +diff --git a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt +index 89301bd..df27aae 100644 +--- a/openvdb/CMakeLists.txt ++++ b/openvdb/CMakeLists.txt +@@ -78,7 +78,7 @@ else() + endif() + + find_package(TBB ${MINIMUM_TBB_VERSION} REQUIRED COMPONENTS tbb) +-if(${Tbb_VERSION} VERSION_LESS FUTURE_MINIMUM_TBB_VERSION) ++if(${TBB_VERSION} VERSION_LESS FUTURE_MINIMUM_TBB_VERSION) + message(DEPRECATION "Support for TBB versions < ${FUTURE_MINIMUM_TBB_VERSION} " + "is deprecated and will be removed.") + endif() +@@ -185,11 +185,6 @@ if(WIN32) + endif() + endif() + +-# @todo Should be target definitions +-if(WIN32) +- add_definitions(-D_WIN32 -DNOMINMAX -DOPENVDB_DLL) +-endif() +- + ##### Core library configuration + + set(OPENVDB_LIBRARY_SOURCE_FILES +@@ -374,10 +369,16 @@ set(OPENVDB_LIBRARY_UTIL_INCLUDE_FILES + + if(OPENVDB_CORE_SHARED) + add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES}) ++ if(WIN32) ++ target_compile_definitions(openvdb_shared PUBLIC OPENVDB_DLL) ++ endif() + endif() + + if(OPENVDB_CORE_STATIC) + add_library(openvdb_static STATIC ${OPENVDB_LIBRARY_SOURCE_FILES}) ++ if(WIN32) ++ target_compile_definitions(openvdb_static PUBLIC OPENVDB_STATICLIB) ++ endif() + endif() + + # Alias either the shared or static library to the generic OpenVDB +diff --git a/openvdb/Grid.cc b/openvdb/Grid.cc +index 0015f81..cb6084a 100644 +--- a/openvdb/Grid.cc ++++ b/openvdb/Grid.cc +@@ -35,6 +35,9 @@ + #include + #include + ++// WTF??? Somehow from stdlib.h ++#undef min ++#undef max + + namespace openvdb { + OPENVDB_USE_VERSION_NAMESPACE +diff --git a/openvdb/PlatformConfig.h b/openvdb/PlatformConfig.h +index 20ad9a3..c2dd1ef 100644 +--- a/openvdb/PlatformConfig.h ++++ b/openvdb/PlatformConfig.h +@@ -44,9 +44,12 @@ + + // By default, assume that we're dynamically linking OpenEXR, unless + // OPENVDB_OPENEXR_STATICLIB is defined. +- #if !defined(OPENVDB_OPENEXR_STATICLIB) && !defined(OPENEXR_DLL) +- #define OPENEXR_DLL +- #endif ++ // Meszaros Tamas: Why? OpenEXR and its imported targets have OPENEXR_DLL ++ // in INTERFACE_COMPILE_DEFINITIONS if build with it. ++ // #if !defined(OPENVDB_OPENEXR_STATICLIB) && !defined(OPENEXR_DLL) ++ // #define OPENEXR_DLL ++ // static_assert(false, "This is bad: OPENEXR_DLL"); ++ // #endif + + #endif // _WIN32 + +diff --git a/openvdb/cmd/CMakeLists.txt b/openvdb/cmd/CMakeLists.txt +index 57fbec0..55b3850 100644 +--- a/openvdb/cmd/CMakeLists.txt ++++ b/openvdb/cmd/CMakeLists.txt +@@ -74,8 +74,9 @@ if(WIN32) + endif() + endif() + ++# @todo Should be target definitions + if(WIN32) +- add_definitions(-D_WIN32 -DNOMINMAX -DOPENVDB_DLL) ++ add_definitions(-D_WIN32 -DNOMINMAX) + endif() + + # rpath handling +@@ -88,7 +89,6 @@ if(OPENVDB_ENABLE_RPATH) + ${IlmBase_LIBRARY_DIRS} + ${Log4cplus_LIBRARY_DIRS} + ${Blosc_LIBRARY_DIRS} +- ${Tbb_LIBRARY_DIRS} + ) + if(OPENVDB_BUILD_CORE) + list(APPEND RPATHS ${CMAKE_INSTALL_PREFIX}/lib) +diff --git a/openvdb/unittest/CMakeLists.txt b/openvdb/unittest/CMakeLists.txt +index c9e0c34..7e261c0 100644 +--- a/openvdb/unittest/CMakeLists.txt ++++ b/openvdb/unittest/CMakeLists.txt +@@ -71,8 +71,9 @@ if(WIN32) + link_directories(${Boost_LIBRARY_DIR}) + endif() + ++# @todo Should be target definitions + if(WIN32) +- add_definitions(-D_WIN32 -DNOMINMAX -DOPENVDB_DLL) ++ add_definitions(-D_WIN32 -DNOMINMAX) + endif() + + ##### VDB unit tests +diff --git a/openvdb/unittest/TestFile.cc b/openvdb/unittest/TestFile.cc +index df51830..0ab0c12 100644 +--- a/openvdb/unittest/TestFile.cc ++++ b/openvdb/unittest/TestFile.cc +@@ -2573,7 +2573,7 @@ TestFile::testBlosc() + outdata(new char[decompbufbytes]); + + for (int compcode = 0; compcode <= BLOSC_ZLIB; ++compcode) { +- char* compname = nullptr; ++ const char* compname = nullptr; + if (0 > blosc_compcode_to_compname(compcode, &compname)) continue; + /// @todo This changes the compressor setting globally. + if (blosc_set_compressor(compname) < 0) continue; +-- +2.16.2.windows.1 + diff --git a/deps/qhull-mods.patch b/deps/qhull-mods.patch index 94aeeca2f..70f7be6a7 100644 --- a/deps/qhull-mods.patch +++ b/deps/qhull-mods.patch @@ -1,121 +1,49 @@ -From a31ae4781a4afa60e21c70e5b4ae784bcd447c8a Mon Sep 17 00:00:00 2001 +From 7f55a56b3d112f4dffbf21b1722f400c64bf03b1 Mon Sep 17 00:00:00 2001 From: tamasmeszaros -Date: Thu, 6 Jun 2019 15:41:43 +0200 -Subject: [PATCH] prusa-slicer changes +Date: Mon, 21 Oct 2019 16:52:04 +0200 +Subject: [PATCH] Fix the build on macOS --- - CMakeLists.txt | 44 +++++++++++++++++++++++++++++++++++--- - Config.cmake.in | 2 ++ - src/libqhull_r/qhull_r-exports.def | 2 ++ - src/libqhull_r/user_r.h | 2 +- - 4 files changed, 46 insertions(+), 4 deletions(-) - create mode 100644 Config.cmake.in + CMakeLists.txt | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 59dff41..20c2ec5 100644 +index 07d3da2..14df8e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -61,7 +61,7 @@ - # $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $ +@@ -626,18 +626,18 @@ install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets + include(CMakePackageConfigHelpers) - project(qhull) --cmake_minimum_required(VERSION 2.6) -+cmake_minimum_required(VERSION 3.0) + write_basic_package_version_file( +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfigVersion.cmake" + VERSION ${qhull_VERSION} + COMPATIBILITY AnyNewerVersion + ) - # Define qhull_VERSION in CMakeLists.txt, Makefile, qhull-exports.def, qhull_p-exports.def, qhull_r-exports.def, qhull-warn.pri - set(qhull_VERSION2 "2015.2 2016/01/18") # not used, See global.c, global_r.c, rbox.c, rbox_r.c -@@ -610,10 +610,48 @@ add_test(NAME user_eg3 - # Define install - # --------------------------------------- + export(EXPORT QhullTargets +- FILE "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullTargets.cmake" ++ FILE "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullTargets.cmake" + NAMESPACE Qhull:: + ) --install(TARGETS ${qhull_TARGETS_INSTALL} -+install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} -- ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) -+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} -+ INCLUDES DESTINATION include) -+ -+include(CMakePackageConfigHelpers) -+ -+write_basic_package_version_file( -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" -+ VERSION ${qhull_VERSION} -+ COMPATIBILITY AnyNewerVersion -+) -+ -+export(EXPORT QhullTargets -+ FILE "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullTargets.cmake" -+ NAMESPACE Qhull:: -+) -+ -+configure_file(Config.cmake.in -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" -+ @ONLY -+) -+ -+set(ConfigPackageLocation lib/cmake/Qhull) -+install(EXPORT QhullTargets -+ FILE -+ QhullTargets.cmake -+ NAMESPACE -+ Qhull:: -+ DESTINATION -+ ${ConfigPackageLocation} -+) -+install( -+ FILES -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" -+ DESTINATION -+ ${ConfigPackageLocation} -+ COMPONENT -+ Devel -+) + configure_file(${PROJECT_SOURCE_DIR}/build/config.cmake.in +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfig.cmake" + @ONLY + ) - install(FILES ${libqhull_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull) - install(FILES ${libqhull_DOC} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull) -diff --git a/Config.cmake.in b/Config.cmake.in -new file mode 100644 -index 0000000..bc92bfe ---- /dev/null -+++ b/Config.cmake.in -@@ -0,0 +1,2 @@ -+include("${CMAKE_CURRENT_LIST_DIR}/QhullTargets.cmake") -+ -diff --git a/src/libqhull_r/qhull_r-exports.def b/src/libqhull_r/qhull_r-exports.def -index 325d57c..72f6ad0 100644 ---- a/src/libqhull_r/qhull_r-exports.def -+++ b/src/libqhull_r/qhull_r-exports.def -@@ -185,6 +185,7 @@ qh_memsetup - qh_memsize - qh_memstatistics - qh_memtotal -+qh_memcheck - qh_merge_degenredundant - qh_merge_nonconvex - qh_mergecycle -@@ -372,6 +373,7 @@ qh_settruncate - qh_setunique - qh_setvoronoi_all - qh_setzero -+qh_setendpointer - qh_sharpnewfacets - qh_skipfacet - qh_skipfilename -diff --git a/src/libqhull_r/user_r.h b/src/libqhull_r/user_r.h -index fc105b9..7cca65a 100644 ---- a/src/libqhull_r/user_r.h -+++ b/src/libqhull_r/user_r.h -@@ -139,7 +139,7 @@ Code flags -- - REALfloat = 1 all numbers are 'float' type - = 0 all numbers are 'double' type - */ --#define REALfloat 0 -+#define REALfloat 1 - - #if (REALfloat == 1) - #define realT float +@@ -652,8 +652,8 @@ install(EXPORT QhullTargets + ) + install( + FILES +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfig.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfigVersion.cmake" + DESTINATION + ${ConfigPackageLocation} + COMPONENT -- -2.16.2.windows.1 +2.17.1 diff --git a/sandboxes/CMakeLists.txt b/sandboxes/CMakeLists.txt index 5905c438e..3372698c3 100644 --- a/sandboxes/CMakeLists.txt +++ b/sandboxes/CMakeLists.txt @@ -1,2 +1,2 @@ -add_subdirectory(slabasebed) add_subdirectory(slasupporttree) +add_subdirectory(openvdb) diff --git a/sandboxes/openvdb/CMakeLists.txt b/sandboxes/openvdb/CMakeLists.txt new file mode 100644 index 000000000..184452e83 --- /dev/null +++ b/sandboxes/openvdb/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(openvdb_example openvdb_example.cpp) +target_link_libraries(openvdb_example libslic3r) diff --git a/sandboxes/openvdb/openvdb_example.cpp b/sandboxes/openvdb/openvdb_example.cpp new file mode 100644 index 000000000..0df60d8aa --- /dev/null +++ b/sandboxes/openvdb/openvdb_example.cpp @@ -0,0 +1,37 @@ +#include +#include + +int main() +{ + // Initialize the OpenVDB library. This must be called at least + // once per program and may safely be called multiple times. + openvdb::initialize(); + // Create an empty floating-point grid with background value 0. + openvdb::FloatGrid::Ptr grid = openvdb::FloatGrid::create(); + std::cout << "Testing random access:" << std::endl; + // Get an accessor for coordinate-based access to voxels. + openvdb::FloatGrid::Accessor accessor = grid->getAccessor(); + // Define a coordinate with large signed indices. + openvdb::Coord xyz(1000, -200000000, 30000000); + // Set the voxel value at (1000, -200000000, 30000000) to 1. + accessor.setValue(xyz, 1.0); + // Verify that the voxel value at (1000, -200000000, 30000000) is 1. + std::cout << "Grid" << xyz << " = " << accessor.getValue(xyz) << std::endl; + // Reset the coordinates to those of a different voxel. + xyz.reset(1000, 200000000, -30000000); + // Verify that the voxel value at (1000, 200000000, -30000000) is + // the background value, 0. + std::cout << "Grid" << xyz << " = " << accessor.getValue(xyz) << std::endl; + // Set the voxel value at (1000, 200000000, -30000000) to 2. + accessor.setValue(xyz, 2.0); + // Set the voxels at the two extremes of the available coordinate space. + // For 32-bit signed coordinates these are (-2147483648, -2147483648, -2147483648) + // and (2147483647, 2147483647, 2147483647). + accessor.setValue(openvdb::Coord::min(), 3.0f); + accessor.setValue(openvdb::Coord::max(), 4.0f); + std::cout << "Testing sequential access:" << std::endl; + // Print all active ("on") voxels by means of an iterator. + for (openvdb::FloatGrid::ValueOnCIter iter = grid->cbeginValueOn(); iter; ++iter) { + std::cout << "Grid" << iter.getCoord() << " = " << *iter << std::endl; + } +} diff --git a/sandboxes/slabasebed/CMakeLists.txt b/sandboxes/slabasebed/CMakeLists.txt deleted file mode 100644 index 9d731a133..000000000 --- a/sandboxes/slabasebed/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(slabasebed EXCLUDE_FROM_ALL slabasebed.cpp) -target_link_libraries(slabasebed libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS}) diff --git a/sandboxes/slabasebed/slabasebed.cpp b/sandboxes/slabasebed/slabasebed.cpp deleted file mode 100644 index 1996a1eb8..000000000 --- a/sandboxes/slabasebed/slabasebed.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -const std::string USAGE_STR = { - "Usage: slabasebed stlfilename.stl" -}; - -namespace Slic3r { namespace sla { - -Contour3D create_pad(const Polygons &ground_layer, - const ExPolygons &holes = {}, - const PadConfig& cfg = PadConfig()); - -Contour3D walls(const Polygon& floor_plate, const Polygon& ceiling, - double floor_z_mm, double ceiling_z_mm, - double offset_difference_mm, ThrowOnCancel thr); - -void offset(ExPolygon& sh, coord_t distance); - -} -} - -int main(const int argc, const char *argv[]) { - using namespace Slic3r; - using std::cout; using std::endl; - - if(argc < 2) { - cout << USAGE_STR << endl; - return EXIT_SUCCESS; - } - - TriangleMesh model; - Benchmark bench; - - model.ReadSTLFile(argv[1]); - model.align_to_origin(); - - ExPolygons ground_slice; - sla::pad_plate(model, ground_slice, 0.1f); - if(ground_slice.empty()) return EXIT_FAILURE; - - ground_slice = offset_ex(ground_slice, 0.5); - ExPolygon gndfirst; gndfirst = ground_slice.front(); - sla::breakstick_holes(gndfirst, 0.5, 10, 0.3); - - sla::Contour3D mesh; - - bench.start(); - - sla::PadConfig cfg; - cfg.min_wall_height_mm = 0; - cfg.edge_radius_mm = 0; - mesh = sla::create_pad(to_polygons(ground_slice), {}, cfg); - - bench.stop(); - - cout << "Base pool creation time: " << std::setprecision(10) - << bench.getElapsedSec() << " seconds." << endl; - - for(auto& trind : mesh.indices) { - Vec3d p0 = mesh.points[size_t(trind[0])]; - Vec3d p1 = mesh.points[size_t(trind[1])]; - Vec3d p2 = mesh.points[size_t(trind[2])]; - Vec3d p01 = p1 - p0; - Vec3d p02 = p2 - p0; - auto a = p01.cross(p02).norm() / 2.0; - if(std::abs(a) < 1e-6) std::cout << "degenerate triangle" << std::endl; - } - - // basepool.write_ascii("out.stl"); - - std::fstream outstream("out.obj", std::fstream::out); - mesh.to_obj(outstream); - - return EXIT_SUCCESS; -} diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index cbaa24e9c..fb13acc85 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -222,6 +222,7 @@ target_link_libraries(libslic3r qhull semver TBB::tbb + OpenVDB::openvdb ${CMAKE_DL_LIBS} ) diff --git a/src/qhull/CMakeLists.txt b/src/qhull/CMakeLists.txt index 9ca0bdff2..ab9aba9af 100644 --- a/src/qhull/CMakeLists.txt +++ b/src/qhull/CMakeLists.txt @@ -18,11 +18,13 @@ if(Qhull_FOUND) message(STATUS "Using qhull from system.") if(SLIC3R_STATIC) + slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhullstatic_r" RelWithDebInfo Release) target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhullstatic_r) else() + slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhull_r" RelWithDebInfo Release) target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhull_r) endif() - + else(Qhull_FOUND) project(qhull)