diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2019-06-05 20:19:49 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2019-06-05 20:19:49 +0300 |
commit | 6136fe7d92e386f1a6a6ab227f49c7d6a68abbb3 (patch) | |
tree | dffa47a60127c999fe7761628d0f2407fc6042c1 /src | |
parent | 7a5d3de1c4497efb2d0efa3b6abea6bfdcbac198 (diff) |
Future-proof qhull dependency handling
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/libslic3r/TriangleMesh.cpp | 2 | ||||
-rw-r--r-- | src/qhull/CMakeLists.txt | 23 |
3 files changed, 23 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4f6959623..2f2483eca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,9 +17,6 @@ add_subdirectory(semver) set(LIBNEST2D_UNITTESTS ON CACHE BOOL "Force generating unittests for libnest2d") add_subdirectory(libnest2d) -include_directories(${LIBDIR}/qhull/src) -#message(STATUS ${LIBDIR}/qhull/src) - add_subdirectory(libslic3r) if (SLIC3R_GUI) diff --git a/src/libslic3r/TriangleMesh.cpp b/src/libslic3r/TriangleMesh.cpp index 4d35cabca..6581a8320 100644 --- a/src/libslic3r/TriangleMesh.cpp +++ b/src/libslic3r/TriangleMesh.cpp @@ -578,7 +578,7 @@ TriangleMesh TriangleMesh::convex_hull_3d() const { // iterate through facet's vertices orgQhull::QhullPoint p = vertices[i].point(); - const float* coords = p.coordinates(); + const auto* coords = p.coordinates(); dst_vertices.emplace_back(coords[0], coords[1], coords[2]); } unsigned int size = (unsigned int)dst_vertices.size(); diff --git a/src/qhull/CMakeLists.txt b/src/qhull/CMakeLists.txt index a3e7da126..262214a5c 100644 --- a/src/qhull/CMakeLists.txt +++ b/src/qhull/CMakeLists.txt @@ -8,6 +8,22 @@ # Created by modification of the original qhull CMakeLists. # Lukas Matena (25.7.2018), lukasmatena@seznam.cz +# see bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925540 + +# find_package(Qhull 7.2 QUIET) + +add_library(qhull INTERFACE) + +if(Qhull_FOUND) + +message(STATUS "Using qhull from system.") +if(SLICER_STATIC) + target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhullstatic_r) +else() + target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhull_r) +endif() + +else(Qhull_FOUND) project(qhull) cmake_minimum_required(VERSION 2.6) @@ -112,7 +128,7 @@ set(libqhull_SOURCES ################################################## # combined library (reentrant qhull and qhullcpp) for Slic3r: -set(qhull_STATIC qhull) +set(qhull_STATIC qhullstatic) add_library(${qhull_STATIC} STATIC ${libqhull_SOURCES}) set_target_properties(${qhull_STATIC} PROPERTIES VERSION ${qhull_VERSION}) @@ -124,3 +140,8 @@ endif(UNIX) # LIBDIR is defined in the main xs CMake file: target_include_directories(${qhull_STATIC} PRIVATE ${LIBDIR}/qhull/src) + +target_link_libraries(qhull INTERFACE ${qhull_STATIC}) +target_include_directories(qhull INTERFACE ${LIBDIR}/qhull/src) + +endif() |