diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b22f10016..b6d40a0346 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,6 +191,7 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP add_compile_options(-fsanitize=address -fno-omit-frame-pointer) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan") diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 09e6c75982..49e8ee7bab 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -72,7 +72,7 @@ elseif (APPLE) message(FATAL_ERROR "Could not determine OS X SDK version. Please use -DCMAKE_OSX_DEPLOYMENT_TARGET=") endif () - message("OS X Deployment Target (inferred from default): ${DEP_OSX_TARGET}") + message("OS X Deployment Target (inferred from SDK): ${DEP_OSX_TARGET}") endif () include("deps-macos.cmake") diff --git a/deps/blosc-mods.patch b/deps/blosc-mods.patch index 2289459ab5..9a91b4974c 100644 --- a/deps/blosc-mods.patch +++ b/deps/blosc-mods.patch @@ -1,23 +1,22 @@ -From 24640a466b28dfda26069096554676e8c0b6d090 Mon Sep 17 00:00:00 2001 +From 5669891dfaaa4c814f3ec667ca6bf4e693aea978 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 +Date: Wed, 30 Oct 2019 12:54:52 +0100 +Subject: [PATCH] Blosc 1.17 fixes and cmake config script --- - CMakeLists.txt | 112 ++++++++++++++++++++---------------- - blosc/CMakeLists.txt | 121 ++++++++++----------------------------- + CMakeLists.txt | 105 +++++++++++++++++----------------- + blosc/CMakeLists.txt | 118 +++++++++------------------------------ 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(-) + cmake_config.cmake.in | 24 ++++++++ + internal-complibs/CMakeLists.txt | 35 ++++++++++++ + 7 files changed, 157 insertions(+), 147 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 +index 59d9fab..e9134c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ @@ -29,36 +28,11 @@ index 59d9fab..bdc0dda 100644 if (NOT CMAKE_VERSION VERSION_LESS 3.3) cmake_policy(SET CMP0063 NEW) endif() -@@ -124,55 +124,37 @@ option(PREFER_EXTERNAL_ZSTD +@@ -124,55 +124,30 @@ 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) @@ -107,6 +81,25 @@ index 59d9fab..bdc0dda 100644 - # not found, we will use the included sources for it - set(HAVE_ZSTD TRUE) -endif (NOT DEACTIVATE_ZSTD) ++set(LIBS "") ++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) ++ list(APPEND LIBS ${_pkg}::${_tgt}) ++ endif(NOT DEACTIVATE_${_PKG}) ++endmacro() ++ +set(ZLIB_ROOT $ENV{ZLIB_ROOT}) +use_package(ZLIB ZLIB) +use_package(LZ4 LZ4) @@ -115,7 +108,7 @@ index 59d9fab..bdc0dda 100644 # create the config.h file configure_file ("blosc/config.h.in" "blosc/config.h" ) -@@ -316,6 +298,7 @@ endif() +@@ -316,6 +291,7 @@ endif() # subdirectories @@ -123,7 +116,15 @@ index 59d9fab..bdc0dda 100644 add_subdirectory(blosc) if(BUILD_TESTS) -@@ -338,10 +321,41 @@ if (BLOSC_INSTALL) +@@ -328,7 +304,6 @@ if(BUILD_BENCHMARKS) + add_subdirectory(bench) + endif(BUILD_BENCHMARKS) + +- + # uninstall target + if (BLOSC_INSTALL) + configure_file( +@@ -338,10 +313,38 @@ if (BLOSC_INSTALL) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/blosc.pc" DESTINATION lib/pkgconfig COMPONENT DEV) @@ -157,16 +158,13 @@ index 59d9fab..bdc0dda 100644 + 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 +index 1d1bebe..f554abe 100644 --- a/blosc/CMakeLists.txt +++ b/blosc/CMakeLists.txt @@ -1,52 +1,11 @@ @@ -222,19 +220,17 @@ index 1d1bebe..16aff02 100644 # library sources set(SOURCES blosc.c blosclz.c fastcopy.c shuffle-generic.c bitshuffle-generic.c -@@ -73,53 +32,15 @@ if(WIN32) +@@ -73,53 +32,13 @@ 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 "") ++ list(APPEND LIBS Threads::Threads) 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 "") ++ list(APPEND LIBS Threads::Threads) endif(WIN32) -if(NOT DEACTIVATE_LZ4) @@ -280,7 +276,7 @@ index 1d1bebe..16aff02 100644 # targets if (BUILD_SHARED) add_library(blosc_shared SHARED ${SOURCES}) -@@ -191,14 +112,18 @@ if (BUILD_TESTS) +@@ -191,14 +110,17 @@ if (BUILD_TESTS) endif() endif() @@ -289,8 +285,7 @@ index 1d1bebe..16aff02 100644 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_link_libraries(blosc_shared PRIVATE ${LIBS}) + target_include_directories(blosc_shared PUBLIC $) + target_link_libraries(blosc INTERFACE blosc_shared) endif() @@ -298,19 +293,19 @@ index 1d1bebe..16aff02 100644 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_link_libraries(blosc_shared_testing PRIVATE ${LIBS}) + target_include_directories(blosc_shared_testing PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) endif() if(BUILD_STATIC) -@@ -207,17 +132,31 @@ if(BUILD_STATIC) +@@ -207,17 +129,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}) ++ # With the static library, cmake has to deal with transitive dependencies ++ target_link_libraries(blosc_static PRIVATE ${LIBS}) + target_include_directories(blosc_static PUBLIC $) + if (NOT BUILD_SHARED) + target_link_libraries(blosc INTERFACE blosc_static) @@ -398,24 +393,15 @@ index 7db4bb9..cabc2f8 100644 \ 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 +index 0000000..0f6af24 --- /dev/null +++ b/cmake_config.cmake.in -@@ -0,0 +1,33 @@ +@@ -0,0 +1,24 @@ +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) ++function(_blosc_remap_configs from_Cfg to_Cfg) + string(TOUPPER ${from_Cfg} from_CFG) + string(TOLOWER ${from_Cfg} from_cfg) + @@ -432,21 +418,25 @@ index 0000000..b4ede30 +# 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) ++ _blosc_remap_configs(RelWithDebInfo Release) ++ _blosc_remap_configs(MinSizeRel Release) +endif() diff --git a/internal-complibs/CMakeLists.txt b/internal-complibs/CMakeLists.txt new file mode 100644 -index 0000000..5b23484 +index 0000000..4586efa --- /dev/null +++ b/internal-complibs/CMakeLists.txt -@@ -0,0 +1,30 @@ +@@ -0,0 +1,35 @@ +macro(add_lib_target pkg tgt incdir files) + string(TOUPPER ${pkg} TGT) + if(NOT DEACTIVATE_${TGT} AND NOT ${pkg}_FOUND) ++ add_library(${tgt}_objs OBJECT ${files}) + add_library(${tgt} INTERFACE) ++ target_include_directories(${tgt}_objs PRIVATE $) + target_include_directories(${tgt} INTERFACE $) -+ target_sources(${tgt} INTERFACE "$") ++ #set_target_properties(${tgt} PROPERTIES INTERFACE_SOURCES "$") ++ set_target_properties(${tgt}_objs PROPERTIES POSITION_INDEPENDENT_CODE ON) ++ target_sources(${tgt} INTERFACE "$>") + add_library(${pkg}::${tgt} ALIAS ${tgt}) + + # This creates dummy (empty) interface targets in the exported config. @@ -471,6 +461,7 @@ index 0000000..5b23484 +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 $) ++target_include_directories(Zstd_objs PRIVATE $) \ No newline at end of file -- 2.16.2.windows.1 diff --git a/deps/deps-macos.cmake b/deps/deps-macos.cmake index e6fca8a726..fc08c62903 100644 --- a/deps/deps-macos.cmake +++ b/deps/deps-macos.cmake @@ -6,7 +6,7 @@ set(DEP_WERRORS_SDK "-Werror=partial-availability -Werror=unguarded-availability set(DEP_CMAKE_OPTS "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}" - "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}" + "-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEP_OSX_TARGET}" "-DCMAKE_CXX_FLAGS=${DEP_WERRORS_SDK}" "-DCMAKE_C_FLAGS=${DEP_WERRORS_SDK}" ) @@ -14,28 +14,27 @@ set(DEP_CMAKE_OPTS include("deps-unix-common.cmake") -set(DEP_BOOST_OSX_TARGET "") -if (CMAKE_OSX_DEPLOYMENT_TARGET) - set(DEP_BOOST_OSX_TARGET "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") -endif () - 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.71.0/source/boost_1_71_0.tar.gz" + URL_HASH SHA256=96b34f7468f26a141f6020efb813f1a2f3dfb9797ecf76a7d7cbd843cc95f5bd BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ./bootstrap.sh + --with-toolset=clang --with-libraries=system,iostreams,filesystem,thread,log,locale,regex "--prefix=${DESTDIR}/usr/local" BUILD_COMMAND ./b2 -j ${NPROC} --reconfigure + toolset=clang link=static variant=release threading=multi boost.locale.icu=off - "cflags=-fPIC ${DEP_BOOST_OSX_TARGET}" - "cxxflags=-fPIC ${DEP_BOOST_OSX_TARGET}" + "cflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" + "cxxflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" + "mflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" + "mmflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" install INSTALL_COMMAND "" # b2 does that already ) diff --git a/deps/deps-unix-common.cmake b/deps/deps-unix-common.cmake index 0df535fc31..eae319efc6 100644 --- a/deps/deps-unix-common.cmake +++ b/deps/deps-unix-common.cmake @@ -7,6 +7,8 @@ else () set(TBB_MINGW_WORKAROUND "") endif () +find_package(ZLIB REQUIRED) + ExternalProject_Add(dep_tbb EXCLUDE_FROM_ALL 1 URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz" @@ -59,42 +61,14 @@ ExternalProject_Add(dep_qhull -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local ${DEP_CMAKE_OPTS} - PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/qhull-mods.patch + UPDATE_COMMAND "" + PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/qhull-mods.patch ) -ExternalProject_Add(dep_libigl - EXCLUDE_FROM_ALL 1 - URL "https://github.com/libigl/libigl/archive/v2.0.0.tar.gz" - URL_HASH SHA256=42518e6b106c7209c73435fd260ed5d34edeb254852495b4c95dce2d95401328 - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local - -DLIBIGL_BUILD_PYTHON=OFF - -DLIBIGL_BUILD_TESTS=OFF - -DLIBIGL_BUILD_TUTORIALS=OFF - -DLIBIGL_USE_STATIC_LIBRARY=OFF #${DEP_BUILD_IGL_STATIC} - -DLIBIGL_WITHOUT_COPYLEFT=OFF - -DLIBIGL_WITH_CGAL=OFF - -DLIBIGL_WITH_COMISO=OFF - -DLIBIGL_WITH_CORK=OFF - -DLIBIGL_WITH_EMBREE=OFF - -DLIBIGL_WITH_MATLAB=OFF - -DLIBIGL_WITH_MOSEK=OFF - -DLIBIGL_WITH_OPENGL=OFF - -DLIBIGL_WITH_OPENGL_GLFW=OFF - -DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF - -DLIBIGL_WITH_PNG=OFF - -DLIBIGL_WITH_PYTHON=OFF - -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-mods.patch -) - - ExternalProject_Add(dep_blosc EXCLUDE_FROM_ALL 1 GIT_REPOSITORY https://github.com/Blosc/c-blosc.git - GIT_TAG v1.17.0 + GIT_TAG e63775855294b50820ef44d1b157f4de1cc38d3e #v1.17.0 DEPENDS CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local @@ -105,14 +79,15 @@ ExternalProject_Add(dep_blosc -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 + -DPREFER_EXTERNAL_ZLIB=ON + UPDATE_COMMAND "" + PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${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 + GIT_TAG eae0e337c9f5117e78114fd05f7a415819df413a #v2.4.0 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local -DBUILD_SHARED_LIBS=OFF @@ -121,12 +96,13 @@ ExternalProject_Add(dep_openexr -DPYILMBASE_ENABLE:BOOL=OFF -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF -DOPENEXR_BUILD_UTILS:BOOL=OFF + UPDATE_COMMAND "" ) ExternalProject_Add(dep_openvdb EXCLUDE_FROM_ALL 1 GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git - GIT_TAG v6.2.1 + GIT_TAG aebaf8d95be5e57fd33949281ec357db4a576c2e #v6.2.1 DEPENDS dep_blosc dep_openexr dep_tbb CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local @@ -140,5 +116,6 @@ ExternalProject_Add(dep_openvdb -DOPENVDB_CORE_STATIC=ON -DTBB_STATIC=ON -DOPENVDB_BUILD_VDB_PRINT=ON - PATCH_COMMAND ${GIT_EXECUTABLE} apply ${CMAKE_CURRENT_SOURCE_DIR}/openvdb-mods.patch + UPDATE_COMMAND "" + PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${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 08e10758d3..514a90a9ec 100644 --- a/deps/deps-windows.cmake +++ b/deps/deps-windows.cmake @@ -81,7 +81,6 @@ ExternalProject_Add(dep_boost INSTALL_COMMAND "" # b2 does that already ) - ExternalProject_Add(dep_tbb EXCLUDE_FROM_ALL 1 URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz" @@ -99,22 +98,22 @@ ExternalProject_Add(dep_tbb add_debug_dep(dep_tbb) -ExternalProject_Add(dep_gtest - EXCLUDE_FROM_ALL 1 - URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz" - URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c - CMAKE_GENERATOR "${DEP_MSVC_GEN}" - CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}" - CMAKE_ARGS - -DBUILD_GMOCK=OFF - -Dgtest_force_shared_crt=ON - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - "-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local" - BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj - INSTALL_COMMAND "" -) +# ExternalProject_Add(dep_gtest +# EXCLUDE_FROM_ALL 1 +# URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz" +# URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c +# CMAKE_GENERATOR "${DEP_MSVC_GEN}" +# CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}" +# CMAKE_ARGS +# -DBUILD_GMOCK=OFF +# -Dgtest_force_shared_crt=ON +# -DCMAKE_POSITION_INDEPENDENT_CODE=ON +# "-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local" +# BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj +# INSTALL_COMMAND "" +# ) -add_debug_dep(dep_gtest) +# add_debug_dep(dep_gtest) ExternalProject_Add(dep_cereal EXCLUDE_FROM_ALL 1 @@ -181,7 +180,6 @@ if (${DEP_DEBUG}) ) endif () - if (${DEPS_BITS} EQUAL 32) set(DEP_LIBCURL_TARGET "x86") else () @@ -228,7 +226,8 @@ ExternalProject_Add(dep_qhull -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_DEBUG_POSTFIX=d - PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/qhull-mods.patch + UPDATE_COMMAND "" + PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/qhull-mods.patch BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) @@ -245,41 +244,6 @@ endif () find_package(Git REQUIRED) -ExternalProject_Add(dep_libigl - EXCLUDE_FROM_ALL 1 - URL "https://github.com/libigl/libigl/archive/v2.0.0.tar.gz" - URL_HASH SHA256=42518e6b106c7209c73435fd260ed5d34edeb254852495b4c95dce2d95401328 - CMAKE_GENERATOR "${DEP_MSVC_GEN}" - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local - -DLIBIGL_BUILD_PYTHON=OFF - -DLIBIGL_BUILD_TESTS=OFF - -DLIBIGL_BUILD_TUTORIALS=OFF - -DLIBIGL_USE_STATIC_LIBRARY=OFF #${DEP_BUILD_IGL_STATIC} - -DLIBIGL_WITHOUT_COPYLEFT=OFF - -DLIBIGL_WITH_CGAL=OFF - -DLIBIGL_WITH_COMISO=OFF - -DLIBIGL_WITH_CORK=OFF - -DLIBIGL_WITH_EMBREE=OFF - -DLIBIGL_WITH_MATLAB=OFF - -DLIBIGL_WITH_MOSEK=OFF - -DLIBIGL_WITH_OPENGL=OFF - -DLIBIGL_WITH_OPENGL_GLFW=OFF - -DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF - -DLIBIGL_WITH_PNG=OFF - -DLIBIGL_WITH_PYTHON=OFF - -DLIBIGL_WITH_TETGEN=OFF - -DLIBIGL_WITH_TRIANGLE=OFF - -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-mods.patch - BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj - INSTALL_COMMAND "" -) - -add_debug_dep(dep_libigl) - ExternalProject_Add(dep_wxwidgets EXCLUDE_FROM_ALL 1 GIT_REPOSITORY "https://github.com/prusa3d/wxWidgets" @@ -305,10 +269,13 @@ endif () ExternalProject_Add(dep_blosc EXCLUDE_FROM_ALL 1 + #URL https://github.com/Blosc/c-blosc/archive/v1.17.0.zip + #URL_HASH SHA256=7463a1df566704f212263312717ab2c36b45d45cba6cd0dccebf91b2cc4b4da9 GIT_REPOSITORY https://github.com/Blosc/c-blosc.git - GIT_TAG v1.17.0 + GIT_TAG e63775855294b50820ef44d1b157f4de1cc38d3e #v1.17.0 DEPENDS dep_zlib CMAKE_GENERATOR "${DEP_MSVC_GEN}" + CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local -DBUILD_SHARED_LIBS=OFF @@ -319,6 +286,9 @@ ExternalProject_Add(dep_blosc -DBUILD_TESTS=OFF -DBUILD_BENCHMARKS=OFF -DPREFER_EXTERNAL_ZLIB=ON + -DBLOSC_IS_SUBPROJECT:BOOL=ON + -DBLOSC_INSTALL:BOOL=ON + UPDATE_COMMAND "" 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 "" @@ -329,9 +299,10 @@ 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 + GIT_TAG eae0e337c9f5117e78114fd05f7a415819df413a #v2.4.0 DEPENDS dep_zlib CMAKE_GENERATOR "${DEP_MSVC_GEN}" + CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local -DBUILD_SHARED_LIBS=OFF @@ -340,6 +311,7 @@ ExternalProject_Add(dep_openexr -DPYILMBASE_ENABLE:BOOL=OFF -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF -DOPENEXR_BUILD_UTILS:BOOL=OFF + UPDATE_COMMAND "" BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) @@ -348,10 +320,13 @@ add_debug_dep(dep_openexr) ExternalProject_Add(dep_openvdb EXCLUDE_FROM_ALL 1 + #URL https://github.com/AcademySoftwareFoundation/openvdb/archive/v6.2.1.zip + #URL_HASH SHA256=dc337399dce8e1c9f21f20e97b1ce7e4933cb0a63bb3b8b734d8fcc464aa0c48 GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git - GIT_TAG v6.2.1 - DEPENDS dep_blosc dep_openexr dep_tbb + GIT_TAG aebaf8d95be5e57fd33949281ec357db4a576c2e #v6.2.1 + DEPENDS dep_blosc dep_openexr #dep_tbb dep_boost CMAKE_GENERATOR "${DEP_MSVC_GEN}" + CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local -DCMAKE_DEBUG_POSTFIX=d @@ -365,6 +340,7 @@ ExternalProject_Add(dep_openvdb -DTBB_STATIC=ON -DOPENVDB_BUILD_VDB_PRINT=ON BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj + UPDATE_COMMAND "" PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/openvdb-mods.patch INSTALL_COMMAND "" ) diff --git a/deps/igl-mods.patch b/deps/igl-mods.patch deleted file mode 100644 index b0ff9205d0..0000000000 --- a/deps/igl-mods.patch +++ /dev/null @@ -1,128 +0,0 @@ -diff --git a/cmake/libigl-config.cmake.in b/cmake/libigl-config.cmake.in -index 317c745c..f9808e1e 100644 ---- a/cmake/libigl-config.cmake.in -+++ b/cmake/libigl-config.cmake.in -@@ -2,28 +2,28 @@ - - include(${CMAKE_CURRENT_LIST_DIR}/libigl-export.cmake) - --if (TARGET igl::core) -- if (NOT TARGET Eigen3::Eigen) -- find_package(Eigen3 QUIET) -- if (NOT Eigen3_FOUND) -- # try with PkgCOnfig -- find_package(PkgConfig REQUIRED) -- pkg_check_modules(Eigen3 QUIET IMPORTED_TARGET eigen3) -- endif() -- -- if (NOT Eigen3_FOUND) -- message(FATAL_ERROR "Could not find required dependency Eigen3") -- set(libigl_core_FOUND FALSE) -- else() -- target_link_libraries(igl::core INTERFACE PkgConfig::Eigen3) -- set(libigl_core_FOUND TRUE) -- endif() -- else() -- target_link_libraries(igl::core INTERFACE Eigen3::Eigen) -- set(libigl_core_FOUND TRUE) -- endif() -- --endif() -+# if (TARGET igl::core) -+# if (NOT TARGET Eigen3::Eigen) -+# find_package(Eigen3 QUIET) -+# if (NOT Eigen3_FOUND) -+# # try with PkgCOnfig -+# find_package(PkgConfig REQUIRED) -+# pkg_check_modules(Eigen3 QUIET IMPORTED_TARGET eigen3) -+# endif() -+# -+# if (NOT Eigen3_FOUND) -+# message(FATAL_ERROR "Could not find required dependency Eigen3") -+# set(libigl_core_FOUND FALSE) -+# else() -+# target_link_libraries(igl::core INTERFACE PkgConfig::Eigen3) -+# set(libigl_core_FOUND TRUE) -+# endif() -+# else() -+# target_link_libraries(igl::core INTERFACE Eigen3::Eigen) -+# set(libigl_core_FOUND TRUE) -+# endif() -+# -+# endif() - - check_required_components(libigl) - -diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake -index 4b11007a..47e6c395 100644 ---- a/cmake/libigl.cmake -+++ b/cmake/libigl.cmake -@@ -445,6 +445,7 @@ function(install_dir_files dir_name) - if(NOT LIBIGL_USE_STATIC_LIBRARY) - file(GLOB public_sources - ${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.cpp -+ ${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.c - ) - endif() - list(APPEND files_to_install ${public_sources}) -diff --git a/include/igl/AABB.cpp b/include/igl/AABB.cpp -index 09537335..92e90cb7 100644 ---- a/include/igl/AABB.cpp -+++ b/include/igl/AABB.cpp -@@ -1071,5 +1071,11 @@ template void igl::AABB, 3>::init, 2>::init >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&); - template double igl::AABB, 3>::squared_distance >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, double, int&, Eigen::PlainObjectBase >&) const; -+template float igl::AABB const, 0, Eigen::Stride<0, 0> >, 3>::squared_distance const, 0, Eigen::Stride<0, 0> > >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::Matrix const&, int&, Eigen::PlainObjectBase >&) const; - template bool igl::AABB, 3>::intersect_ray >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, Eigen::Matrix const&, igl::Hit&) const; -+template bool igl::AABB, 3>::intersect_ray >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, Eigen::Matrix const&, std::vector&) const; -+ -+template void igl::AABB const, 0, Eigen::Stride<0, 0> >, 3>::init const, 0, Eigen::Stride<0, 0> > >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&); -+ -+template bool igl::AABB const, 0, Eigen::Stride<0, 0> >, 3>::intersect_ray const, 0, Eigen::Stride<0, 0> > >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::Matrix const&, Eigen::Matrix const&, std::vector >&) const; - #endif -diff --git a/include/igl/barycenter.cpp b/include/igl/barycenter.cpp -index 065f82aa..ec2d96cd 100644 ---- a/include/igl/barycenter.cpp -+++ b/include/igl/barycenter.cpp -@@ -54,4 +54,6 @@ template void igl::barycenter, Eigen::M - template void igl::barycenter, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); - template void igl::barycenter, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); - template void igl::barycenter, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); -+ -+template void igl::barycenter const, 0, Eigen::Stride<0, 0> >, Eigen::Map const, 0, Eigen::Stride<0, 0> >, Eigen::Matrix >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::PlainObjectBase >&); - #endif -diff --git a/include/igl/point_simplex_squared_distance.cpp b/include/igl/point_simplex_squared_distance.cpp -index 2b98bd28..c66d9ae1 100644 ---- a/include/igl/point_simplex_squared_distance.cpp -+++ b/include/igl/point_simplex_squared_distance.cpp -@@ -178,4 +178,6 @@ template void igl::point_simplex_squared_distance<3, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, double, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix::Index, double&, Eigen::MatrixBase >&, Eigen::PlainObjectBase >&); - template void igl::point_simplex_squared_distance<2, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, double, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix::Index, double&, Eigen::MatrixBase >&, Eigen::PlainObjectBase >&); - template void igl::point_simplex_squared_distance<2, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, double, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix::Index, double&, Eigen::MatrixBase >&, Eigen::PlainObjectBase >&); -+ -+template void igl::point_simplex_squared_distance<3, Eigen::Matrix, Eigen::Map const, 0, Eigen::Stride<0, 0> >, Eigen::Map const, 0, Eigen::Stride<0, 0> >, float, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::Map const, 0, Eigen::Stride<0, 0> >::Index, float&, Eigen::MatrixBase >&); - #endif -diff --git a/include/igl/ray_box_intersect.cpp b/include/igl/ray_box_intersect.cpp -index 4a88b89e..b547f8f8 100644 ---- a/include/igl/ray_box_intersect.cpp -+++ b/include/igl/ray_box_intersect.cpp -@@ -147,4 +147,6 @@ IGL_INLINE bool igl::ray_box_intersect( - #ifdef IGL_STATIC_LIBRARY - // Explicit template instantiation - template bool igl::ray_box_intersect, Eigen::Matrix, double>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::AlignedBox const&, double const&, double const&, double&, double&); -+ -+template bool igl::ray_box_intersect, Eigen::Matrix, float>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::AlignedBox const&, float const&, float const&, float&, float&); - #endif -diff --git a/include/igl/ray_mesh_intersect.cpp b/include/igl/ray_mesh_intersect.cpp -index 9a70a22b..4233e722 100644 ---- a/include/igl/ray_mesh_intersect.cpp -+++ b/include/igl/ray_mesh_intersect.cpp -@@ -83,4 +83,7 @@ IGL_INLINE bool igl::ray_mesh_intersect( - template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >&); - template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, igl::Hit&); - template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Block const, 1, -1, false> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 1, -1, false> > const&, igl::Hit&); -+template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Block const, 1, -1, false> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 1, -1, false> > const&, std::vector >&); -+ -+template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Map const, 0, Eigen::Stride<0, 0> >, Eigen::Block const, 0, Eigen::Stride<0, 0> > const, 1, -1, true> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > const, 1, -1, true> > const&, std::vector >&); - #endif diff --git a/deps/openvdb-mods.patch b/deps/openvdb-mods.patch index a05076e986..60687b8d17 100644 --- a/deps/openvdb-mods.patch +++ b/deps/openvdb-mods.patch @@ -1,4 +1,4 @@ -From ee867b9f226412c0f3b83fa01cd43539acc4ed95 Mon Sep 17 00:00:00 2001 +From e48f4a835fe7cb391f9f90945472bd367fb4c4f1 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 @@ -7,17 +7,17 @@ Subject: [PATCH] Build fixes for PrusaSlicer integration CMakeLists.txt | 3 - cmake/FindBlosc.cmake | 218 --------------- cmake/FindCppUnit.cmake | 4 +- - cmake/FindIlmBase.cmake | 337 ----------------------- + cmake/FindIlmBase.cmake | 337 ---------------------- cmake/FindOpenEXR.cmake | 329 ---------------------- cmake/FindOpenVDB.cmake | 19 +- - cmake/FindTBB.cmake | 593 ++++++++++++++++++++-------------------- + cmake/FindTBB.cmake | 605 ++++++++++++++++++++-------------------- 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(-) + 13 files changed, 336 insertions(+), 1213 deletions(-) delete mode 100644 cmake/FindBlosc.cmake delete mode 100644 cmake/FindIlmBase.cmake delete mode 100644 cmake/FindOpenEXR.cmake @@ -1011,10 +1011,10 @@ index 63a2eda..6211071 100644 endforeach() diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake -index bdf9c81..ffdee03 100644 +index bdf9c81..c6bdec9 100644 --- a/cmake/FindTBB.cmake +++ b/cmake/FindTBB.cmake -@@ -1,333 +1,322 @@ +@@ -1,333 +1,332 @@ -# Copyright (c) DreamWorks Animation LLC +# The MIT License (MIT) # @@ -1205,10 +1205,6 @@ index bdf9c81..ffdee03 100644 +# +# 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 @@ -1227,6 +1223,39 @@ index bdf9c81..ffdee03 100644 - foreach(COMPONENT ${TBB_FIND_COMPONENTS}) - if(NOT ${COMPONENT} IN_LIST _TBB_COMPONENT_LIST) - list(APPEND _IGNORED_COMPONENTS ${COMPONENT}) +- endif() +- endforeach() ++unset(TBB_FOUND CACHE) ++unset(TBB_INCLUDE_DIRS CACHE) ++unset(TBB_LIBRARIES) ++unset(TBB_LIBRARIES_DEBUG) ++unset(TBB_LIBRARIES_RELEASE) + +- 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}) +- endif() +-else() +- set(_TBB_COMPONENTS_PROVIDED FALSE) +- set(TBB_FIND_COMPONENTS ${_TBB_COMPONENT_LIST}) +-endif() ++include(FindPackageHandleStandardArgs) ++ ++find_package(Threads QUIET REQUIRED) + +-# Append TBB_ROOT or $ENV{TBB_ROOT} if set (prioritize the direct cmake var) +-set(_TBB_ROOT_SEARCH_DIR "") ++if(NOT TBB_FOUND) + +-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}) + ################################## + # Check the build type + ################################## @@ -1241,7 +1270,8 @@ index bdf9c81..ffdee03 100644 + set(TBB_BUILD_TYPE DEBUG) + else() + set(TBB_BUILD_TYPE RELEASE) -+ endif() + endif() +-endif() + + ################################## + # Set the TBB search directories @@ -1261,7 +1291,53 @@ index bdf9c81..ffdee03 100644 + else() + set(TBB_ARCHITECTURE "ia32") + 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() + # 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") @@ -1273,15 +1349,11 @@ index bdf9c81..ffdee03 100644 + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11") + elseif(MSVC10) + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10") - endif() -- endforeach() ++ endif() -- 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}) +-# ------------------------------------------------------------------------ +-# Search for TBB lib DIR +-# ------------------------------------------------------------------------ + # Add the library path search suffix for the VC independent version of TBB + list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt") + @@ -1332,110 +1404,19 @@ index bdf9c81..ffdee03 100644 + 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() ++ endif() --# Append TBB_ROOT or $ENV{TBB_ROOT} if set (prioritize the direct cmake var) --set(_TBB_ROOT_SEARCH_DIR "") +-set(_TBB_LIBRARYDIR_SEARCH_DIRS "") + ################################## + # 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}) +-# Append to _TBB_LIBRARYDIR_SEARCH_DIRS in priority order + 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 @@ -1444,41 +1425,35 @@ index bdf9c81..ffdee03 100644 - ${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() ++ if(TBB_STATIC) ++ set(TBB_STATIC_SUFFIX "_static") ++ 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) ++ # Find each component ++ foreach(_comp ${TBB_SEARCH_COMPOMPONENTS}) ++ if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};") -# platform branching -+ endif() -+ endforeach() ++ unset(TBB_${_comp}_LIBRARY_DEBUG CACHE) ++ unset(TBB_${_comp}_LIBRARY_RELEASE CACHE) -if(UNIX) - list(INSERT TBB_PATH_SUFFIXES 0 lib/x86_64-linux-gnu) -endif() -+ ################################## -+ # Set compile flags and libraries -+ ################################## ++ # 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}) -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() +- endif() -elseif(WIN32) - if(MSVC10) - set(TBB_VC_DIR vc10) @@ -1498,45 +1473,26 @@ index bdf9c81..ffdee03 100644 - 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() -endif() ++ 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}) -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() ++ 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_LIB_COMPONENTS "") - @@ -1559,19 +1515,84 @@ index bdf9c81..ffdee03 100644 - # 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") ++ if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}") ++ set(TBB_${_comp}_FOUND TRUE) ++ else() ++ set(TBB_${_comp}_FOUND FALSE) + endif() ++ ++ # 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) ++ endif() - endif() +- endif() ++ endforeach() - list(APPEND Tbb_LIB_COMPONENTS ${Tbb_${COMPONENT}_LIBRARY}) -- ++ ################################## ++ # Set compile flags and libraries ++ ################################## + - if(Tbb_${COMPONENT}_LIBRARY) - set(TBB_${COMPONENT}_FOUND TRUE) - else() - set(TBB_${COMPONENT}_FOUND FALSE) ++ 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() ++ ++ if(NOT MSVC AND NOT TBB_LIBRARIES) ++ set(TBB_LIBRARIES ${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() ++ set(TBB_DEFINITIONS "") ++ 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 ++ FAIL_MESSAGE "TBB library cannot be found. Consider set TBBROOT environment variable." ++ 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_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) ++ 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() ++ endif() + +-# ------------------------------------------------------------------------ +-# Cache and set TBB_FOUND +-# ------------------------------------------------------------------------ + mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES) + + unset(TBB_ARCHITECTURE) @@ -1588,18 +1609,8 @@ index bdf9c81..ffdee03 100644 + 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() ++ endif() --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 diff --git a/doc/Dependencies.md b/doc/Dependencies.md index b4b0c348cb..3f6335cb73 100644 --- a/doc/Dependencies.md +++ b/doc/Dependencies.md @@ -1,6 +1,6 @@ # Dependency report for PrusaSlicer ## Possible dynamic linking on Linux -* zlib: This should not be even mentioned in our cmake scripts but due to a bug in the system libraries of gtk it has to be linked to PrusaSlicer. +* zlib: Strict dependency required from the system, linked dynamically. Many other libs depend on zlib. * wxWidgets: searches for wx-3.1 by default, but with cmake option `SLIC3R_WX_STABLE=ON` it will use wx-3.0 bundled with most distros. * libcurl * tbb @@ -10,13 +10,13 @@ * expat * openssl * nlopt -* gtest +* openvdb: This library depends on other libs, namely boost, zlib, openexr, blosc (not strictly), etc... ## External libraries in source tree * ad-mesh: Lots of customization, have to be bundled in the source tree. * avrdude: Like ad-mesh, many customization, need to be in the source tree. * clipper: An important library we have to have full control over it. We also have some slicer specific modifications. -* glu-libtess: This is an extract of the mesa/glu library not oficially available as a package. +* glu-libtess: This is an extract of the mesa/glu library not officially available as a package. * imgui: no packages for debian, author suggests using in the source tree * miniz: No packages, author suggests using in the source tree * qhull: libqhull-dev does not contain libqhullcpp => link errors. Until it is fixed, we will use the builtin version. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925540 @@ -29,5 +29,6 @@ * igl * nanosvg * agg +* catch2: Only Arch has packages for catch2, other distros at most catch (v1.x). Being strictly header only, we bundle this in the source tree. Used for the unit-test suites. diff --git a/doc/How to build - Linux et al.md b/doc/How to build - Linux et al.md index 715b1388b3..9206ae1ed2 100644 --- a/doc/How to build - Linux et al.md +++ b/doc/How to build - Linux et al.md @@ -2,7 +2,7 @@ # Building PrusaSlicer on UNIX/Linux PrusaSlicer uses the CMake build system and requires several dependencies. -The dependencies can be listed in `deps/deps-linux.cmake`, although they don't necessarily need to be as recent +The dependencies can be listed in `deps/deps-linux.cmake` and `deps/deps-unix-common.cmake`, although they don't necessarily need to be as recent as the versions listed - generally versions available on conservative Linux distros such as Debian stable or CentOS should suffice. Perl is not required any more. diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index aed6e41f73..3fa7e1841a 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -375,7 +375,7 @@ public: for(unsigned idx = 0; idx < fixeditems.size(); ++idx) { Item& itm = fixeditems[idx]; - itm.markAsFixedInBin(0); + itm.markAsFixedInBin(itm.binId()); } m_pck.configure(m_pconf); diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index b464a39b82..73dc91c405 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -331,15 +331,18 @@ public: // Let the firmware back up the active speed override value. WipeTowerWriter& speed_override_backup() - { - m_gcode += "M220 B\n"; + { + // This is only supported by Prusa at this point (https://github.com/prusa3d/PrusaSlicer/issues/3114) + if (m_gcode_flavor == gcfMarlin) + m_gcode += "M220 B\n"; return *this; } // Let the firmware restore the active speed override value. WipeTowerWriter& speed_override_restore() { - m_gcode += "M220 R\n"; + if (m_gcode_flavor == gcfMarlin) + m_gcode += "M220 R\n"; return *this; } diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index 8d2a6a8662..678ad9ed28 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -424,14 +424,19 @@ int copy_file(const std::string &from, const std::string &to) static const auto perms = boost::filesystem::owner_read | boost::filesystem::owner_write | boost::filesystem::group_read | boost::filesystem::others_read; // aka 644 // Make sure the file has correct permission both before and after we copy over it. - try { - if (boost::filesystem::exists(target)) - boost::filesystem::permissions(target, perms); - boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists); - boost::filesystem::permissions(target, perms); - } catch (std::exception & /* ex */) { + // NOTE: error_code variants are used here to supress expception throwing. + // Error code of permission() calls is ignored on purpose - if they fail, + // the copy_file() function will fail appropriately and we don't want the permission() + // calls to cause needless failures on permissionless filesystems (ie. FATs on SD cards etc.) + // or when the target file doesn't exist. + boost::system::error_code ec; + boost::filesystem::permissions(target, perms, ec); + boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists, ec); + if (ec) { return -1; } + boost::filesystem::permissions(target, perms, ec); + return 0; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7e8db00bf3..f77b4bd25f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,7 +10,7 @@ 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.") +set(CATCH_EXTRA_ARGS "" 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) diff --git a/tests/catch_main.hpp b/tests/catch_main.hpp new file mode 100644 index 0000000000..5ab71fdd74 --- /dev/null +++ b/tests/catch_main.hpp @@ -0,0 +1,54 @@ +#ifndef CATCH_MAIN +#define CATCH_MAIN + +#define CATCH_CONFIG_EXTERNAL_INTERFACES +#define CATCH_CONFIG_MAIN +#define CATCH_CONFIG_DEFAULT_REPORTER "verboseconsole" +#include + +namespace Catch { +struct VerboseConsoleReporter : public ConsoleReporter { + double duration = 0.; + using ConsoleReporter::ConsoleReporter; + + void testCaseStarting(TestCaseInfo const& _testInfo) override + { + Colour::use(Colour::Cyan); + stream << "Testing "; + Colour::use(Colour::None); + stream << _testInfo.name << std::endl; + ConsoleReporter::testCaseStarting(_testInfo); + } + + void sectionStarting(const SectionInfo &_sectionInfo) override + { + if (_sectionInfo.name != currentTestCaseInfo->name) + stream << _sectionInfo.name << std::endl; + + ConsoleReporter::sectionStarting(_sectionInfo); + } + + void sectionEnded(const SectionStats &_sectionStats) override { + duration += _sectionStats.durationInSeconds; + ConsoleReporter::sectionEnded(_sectionStats); + } + + void testCaseEnded(TestCaseStats const& stats) override + { + if (stats.totals.assertions.allOk()) { + Colour::use(Colour::BrightGreen); + stream << "Passed"; + Colour::use(Colour::None); + stream << " in " << duration << " [seconds]\n" << std::endl; + } + + duration = 0.; + ConsoleReporter::testCaseEnded(stats); + } +}; + +CATCH_REGISTER_REPORTER( "verboseconsole", VerboseConsoleReporter ) + +} // namespace Catch + +#endif // CATCH_MAIN diff --git a/tests/example/example_tests_main.cpp b/tests/example/example_tests_main.cpp index d612f323cb..32e8d02b76 100644 --- a/tests/example/example_tests_main.cpp +++ b/tests/example/example_tests_main.cpp @@ -1,5 +1,5 @@ #define CATCH_CONFIG_MAIN -#include +#include TEST_CASE("Is example succesful", "[example]") { REQUIRE(true); diff --git a/tests/fff_print/fff_print_tests.cpp b/tests/fff_print/fff_print_tests.cpp index 5e9b82f80b..46358e5eba 100644 --- a/tests/fff_print/fff_print_tests.cpp +++ b/tests/fff_print/fff_print_tests.cpp @@ -1,4 +1,3 @@ -#define CATCH_CONFIG_MAIN -#include +#include #include "libslic3r/libslic3r.h" diff --git a/tests/libnest2d/libnest2d_tests_main.cpp b/tests/libnest2d/libnest2d_tests_main.cpp index 252bea47fe..c7259ae537 100644 --- a/tests/libnest2d/libnest2d_tests_main.cpp +++ b/tests/libnest2d/libnest2d_tests_main.cpp @@ -1,9 +1,7 @@ -#define CATCH_CONFIG_MAIN -#include +#include #include - #include #include "printer_parts.hpp" //#include diff --git a/tests/libslic3r/libslic3r_tests.cpp b/tests/libslic3r/libslic3r_tests.cpp index 907304f57a..caf5b3b9ac 100644 --- a/tests/libslic3r/libslic3r_tests.cpp +++ b/tests/libslic3r/libslic3r_tests.cpp @@ -1,5 +1,4 @@ -#define CATCH_CONFIG_MAIN -#include +#include #include "libslic3r/libslic3r.h" diff --git a/tests/sla_print/sla_print_tests.cpp b/tests/sla_print/sla_print_tests.cpp index f41fd3200a..229eb42676 100644 --- a/tests/sla_print/sla_print_tests.cpp +++ b/tests/sla_print/sla_print_tests.cpp @@ -1,5 +1,4 @@ -#define CATCH_CONFIG_MAIN -#include +#include #include #include diff --git a/tests/timeutils/timeutils_tests_main.cpp b/tests/timeutils/timeutils_tests_main.cpp index c3827374e5..9989f98716 100644 --- a/tests/timeutils/timeutils_tests_main.cpp +++ b/tests/timeutils/timeutils_tests_main.cpp @@ -1,5 +1,4 @@ -#define CATCH_CONFIG_MAIN -#include +#include #include "libslic3r/Time.hpp"