Merge branch 'master' of https://github.com/Prusa3d/PrusaSlicer
This commit is contained in:
commit
4ae0f3a61c
@ -271,19 +271,28 @@ if(NOT SLIC3R_STATIC)
|
||||
endif()
|
||||
|
||||
function(slic3r_remap_configs targets from_Cfg to_Cfg)
|
||||
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()
|
||||
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)
|
||||
list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets)
|
||||
|
||||
# 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_targets}
|
||||
@ -388,6 +397,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 COMPONENTS 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)
|
||||
|
490
cmake/modules/FindOpenVDB.cmake
Normal file
490
cmake/modules/FindOpenVDB.cmake
Normal file
@ -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 <libs>...] # 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. <prefix>/include
|
||||
``OPENVDB_LIBRARYDIR``
|
||||
Preferred library directory e.g. <prefix>/lib
|
||||
``SYSTEM_LIBRARY_PATHS``
|
||||
Paths appended to all include and lib searches.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
# Monitoring <PackageName>_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 $<LINK_ONLY:Blosc::blosc>)
|
||||
else()
|
||||
list(APPEND _OPENVDB_HIDDEN_DEPENDENCIES Blosc::blosc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPENVDB_USE_STATIC_LIBS)
|
||||
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES $<LINK_ONLY:ZLIB::ZLIB>)
|
||||
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)
|
@ -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}
|
||||
@ -265,6 +276,7 @@ if(NOT TBB_FOUND)
|
||||
set(TBB_LIBRARIES ${TBB_LIBRARIES_RELEASE})
|
||||
endif()
|
||||
|
||||
set(TBB_DEFINITIONS "")
|
||||
if (MSVC AND TBB_STATIC)
|
||||
set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE)
|
||||
endif ()
|
||||
@ -273,6 +285,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)
|
||||
|
||||
@ -283,6 +296,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)
|
||||
@ -294,11 +309,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)
|
||||
|
166
cmake/modules/OpenVDBUtils.cmake
Normal file
166
cmake/modules/OpenVDBUtils.cmake
Normal file
@ -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 ( <header_path>
|
||||
VERSION [<version>]
|
||||
MAJOR [<version>]
|
||||
MINOR [<version>]
|
||||
PATCH [<version>] )
|
||||
|
||||
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 ( <vdb_print>
|
||||
[QUIET]
|
||||
ABI [<version>] )
|
||||
|
||||
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()
|
2
deps/CMakeLists.txt
vendored
2
deps/CMakeLists.txt
vendored
@ -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
|
||||
)
|
||||
|
||||
|
477
deps/blosc-mods.patch
vendored
Normal file
477
deps/blosc-mods.patch
vendored
Normal file
@ -0,0 +1,477 @@
|
||||
From 24640a466b28dfda26069096554676e8c0b6d090 Mon Sep 17 00:00:00 2001
|
||||
From: tamasmeszaros <meszaros.q@gmail.com>
|
||||
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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
+ 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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
+ 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 $<BUILD_INTERFACE:${incdir}>)
|
||||
+ target_sources(${tgt} INTERFACE "$<BUILD_INTERFACE:${files}>")
|
||||
+ 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 $<BUILD_INTERFACE:${ZSTD_DIR}/common>)
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.16.2.windows.1
|
||||
|
8
deps/deps-linux.cmake
vendored
8
deps/deps-linux.cmake
vendored
@ -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)
|
4
deps/deps-macos.cmake
vendored
4
deps/deps-macos.cmake
vendored
@ -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)
|
52
deps/deps-unix-common.cmake
vendored
52
deps/deps-unix-common.cmake
vendored
@ -90,3 +90,55 @@ ExternalProject_Add(dep_libigl
|
||||
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
|
||||
)
|
154
deps/deps-windows.cmake
vendored
154
deps/deps-windows.cmake
vendored
@ -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
|
||||
@ -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 "")
|
||||
@ -305,15 +278,7 @@ ExternalProject_Add(dep_libigl
|
||||
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 ()
|
1771
deps/openvdb-mods.patch
vendored
Normal file
1771
deps/openvdb-mods.patch
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,2 +1,2 @@
|
||||
add_subdirectory(slabasebed)
|
||||
add_subdirectory(slasupporttree)
|
||||
add_subdirectory(openvdb)
|
||||
|
2
sandboxes/openvdb/CMakeLists.txt
Normal file
2
sandboxes/openvdb/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
add_executable(openvdb_example openvdb_example.cpp)
|
||||
target_link_libraries(openvdb_example libslic3r)
|
37
sandboxes/openvdb/openvdb_example.cpp
Normal file
37
sandboxes/openvdb/openvdb_example.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <openvdb/openvdb.h>
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -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})
|
@ -1,85 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include <libslic3r/libslic3r.h>
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
#include <libslic3r/Tesselate.hpp>
|
||||
#include <libslic3r/ClipperUtils.hpp>
|
||||
#include <libslic3r/SLA/SLABasePool.hpp>
|
||||
#include <libslic3r/SLA/SLABoilerPlate.hpp>
|
||||
#include <libnest2d/tools/benchmark.h>
|
||||
|
||||
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;
|
||||
}
|
@ -222,6 +222,7 @@ target_link_libraries(libslic3r
|
||||
qhull
|
||||
semver
|
||||
TBB::tbb
|
||||
# OpenVDB::openvdb
|
||||
${CMAKE_DL_LIBS}
|
||||
)
|
||||
|
||||
|
@ -114,8 +114,17 @@ public:
|
||||
|
||||
m_serializing = true;
|
||||
|
||||
// Following is needed to know which to be turn on, but not actually modify
|
||||
// m_current prematurely, so activate_gizmo is not confused.
|
||||
EType old_current = m_current;
|
||||
ar(m_current);
|
||||
EType new_current = m_current;
|
||||
m_current = old_current;
|
||||
|
||||
// activate_gizmo call sets m_current and calls set_state for the gizmo
|
||||
// it does nothing in case the gizmo is already activated
|
||||
// it can safely be called for Undefined gizmo
|
||||
activate_gizmo(new_current);
|
||||
if (m_current != Undefined)
|
||||
m_gizmos[m_current]->load(ar);
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ target_include_directories(Catch2 INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
add_library(Catch2::Catch2 ALIAS Catch2)
|
||||
include(Catch)
|
||||
|
||||
set(CATCH_EXTRA_ARGS "--durations yes" CACHE STRING "Extra arguments for catch2 test suites.")
|
||||
|
||||
add_library(test_common INTERFACE)
|
||||
target_compile_definitions(test_common INTERFACE TEST_DATA_DIR=R"\(${TEST_DATA_DIR}\)" CATCH_CONFIG_FAST_COMPILE)
|
||||
target_link_libraries(test_common INTERFACE Catch2::Catch2)
|
||||
@ -25,3 +27,4 @@ add_subdirectory(libslic3r)
|
||||
add_subdirectory(timeutils)
|
||||
add_subdirectory(fff_print)
|
||||
add_subdirectory(sla_print)
|
||||
# add_subdirectory(example)
|
||||
|
@ -1,8 +1,6 @@
|
||||
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp)
|
||||
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r
|
||||
#${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES}
|
||||
)
|
||||
target_link_libraries(${_TEST_NAME}_tests test_common)
|
||||
|
||||
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS})
|
@ -19,4 +19,4 @@ target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
|
||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||
|
||||
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS})
|
||||
|
@ -4,4 +4,4 @@ target_link_libraries(${_TEST_NAME}_tests test_common libnest2d )
|
||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||
|
||||
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS})
|
||||
|
@ -13,4 +13,4 @@ target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
|
||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||
|
||||
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS})
|
||||
|
@ -4,4 +4,4 @@ target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
|
||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||
|
||||
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS})
|
||||
|
@ -8,4 +8,4 @@ target_link_libraries(${_TEST_NAME}_tests test_common)
|
||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||
|
||||
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
|
||||
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS})
|
||||
|
Loading…
Reference in New Issue
Block a user