Future-proof qhull dependency handling

This commit is contained in:
tamasmeszaros 2019-06-05 19:19:49 +02:00
parent 7a5d3de1c4
commit 6136fe7d92
7 changed files with 150 additions and 5 deletions

View file

@ -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)

View file

@ -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();

View file

@ -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()