Fix qhull compilation on Mac

This commit is contained in:
tamasmeszaros 2019-10-22 09:58:32 +02:00
parent 2d610f9b84
commit bd15efd17a
4 changed files with 42 additions and 114 deletions

View File

@ -53,8 +53,8 @@ find_package(Git REQUIRED)
ExternalProject_Add(dep_qhull
EXCLUDE_FROM_ALL 1
URL "https://github.com/qhull/qhull/archive/v7.2.1.tar.gz"
URL_HASH SHA256=6fc251e0b75467e00943bfb7191e986fce0e1f8f6f0251f9c6ce5a843821ea78
URL "https://github.com/qhull/qhull/archive/v7.3.2.tar.gz"
URL_HASH SHA256=619c8a954880d545194bc03359404ef36a1abd2dde03678089459757fd790cb0
CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
@ -87,6 +87,6 @@ ExternalProject_Add(dep_libigl
-DLIBIGL_WITH_TETGEN=OFF
-DLIBIGL_WITH_TRIANGLE=OFF
-DLIBIGL_WITH_XML=OFF
PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch
PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-mods.patch
)

View File

@ -238,8 +238,8 @@ find_package(Git REQUIRED)
ExternalProject_Add(dep_qhull
EXCLUDE_FROM_ALL 1
URL "https://github.com/qhull/qhull/archive/v7.2.1.tar.gz"
URL_HASH SHA256=6fc251e0b75467e00943bfb7191e986fce0e1f8f6f0251f9c6ce5a843821ea78
URL "https://github.com/qhull/qhull/archive/v7.3.2.tar.gz"
URL_HASH SHA256=619c8a954880d545194bc03359404ef36a1abd2dde03678089459757fd790cb0
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
@ -300,7 +300,7 @@ ExternalProject_Add(dep_libigl
-DLIBIGL_WITH_XML=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_DEBUG_POSTFIX=d
PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch
PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-mods.patch
BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj
INSTALL_COMMAND ""
)

144
deps/qhull-mods.patch vendored
View File

@ -1,121 +1,49 @@
From a31ae4781a4afa60e21c70e5b4ae784bcd447c8a Mon Sep 17 00:00:00 2001
From 7f55a56b3d112f4dffbf21b1722f400c64bf03b1 Mon Sep 17 00:00:00 2001
From: tamasmeszaros <meszaros.q@gmail.com>
Date: Thu, 6 Jun 2019 15:41:43 +0200
Subject: [PATCH] prusa-slicer changes
Date: Mon, 21 Oct 2019 16:52:04 +0200
Subject: [PATCH] Fix the build on macOS
---
CMakeLists.txt | 44 +++++++++++++++++++++++++++++++++++---
Config.cmake.in | 2 ++
src/libqhull_r/qhull_r-exports.def | 2 ++
src/libqhull_r/user_r.h | 2 +-
4 files changed, 46 insertions(+), 4 deletions(-)
create mode 100644 Config.cmake.in
CMakeLists.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59dff41..20c2ec5 100644
index 07d3da2..14df8e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,7 +61,7 @@
# $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
@@ -626,18 +626,18 @@ install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets
include(CMakePackageConfigHelpers)
project(qhull)
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 3.0)
write_basic_package_version_file(
- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfigVersion.cmake"
VERSION ${qhull_VERSION}
COMPATIBILITY AnyNewerVersion
)
# Define qhull_VERSION in CMakeLists.txt, Makefile, qhull-exports.def, qhull_p-exports.def, qhull_r-exports.def, qhull-warn.pri
set(qhull_VERSION2 "2015.2 2016/01/18") # not used, See global.c, global_r.c, rbox.c, rbox_r.c
@@ -610,10 +610,48 @@ add_test(NAME user_eg3
# Define install
# ---------------------------------------
export(EXPORT QhullTargets
- FILE "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullTargets.cmake"
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullTargets.cmake"
NAMESPACE Qhull::
)
-install(TARGETS ${qhull_TARGETS_INSTALL}
+install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ INCLUDES DESTINATION include)
+
+include(CMakePackageConfigHelpers)
+
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake"
+ VERSION ${qhull_VERSION}
+ COMPATIBILITY AnyNewerVersion
+)
+
+export(EXPORT QhullTargets
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullTargets.cmake"
+ NAMESPACE Qhull::
+)
+
+configure_file(Config.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake"
+ @ONLY
+)
+
+set(ConfigPackageLocation lib/cmake/Qhull)
+install(EXPORT QhullTargets
+ FILE
+ QhullTargets.cmake
+ NAMESPACE
+ Qhull::
+ DESTINATION
+ ${ConfigPackageLocation}
+)
+install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake"
+ DESTINATION
+ ${ConfigPackageLocation}
+ COMPONENT
+ Devel
+)
configure_file(${PROJECT_SOURCE_DIR}/build/config.cmake.in
- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfig.cmake"
@ONLY
)
install(FILES ${libqhull_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull)
install(FILES ${libqhull_DOC} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull)
diff --git a/Config.cmake.in b/Config.cmake.in
new file mode 100644
index 0000000..bc92bfe
--- /dev/null
+++ b/Config.cmake.in
@@ -0,0 +1,2 @@
+include("${CMAKE_CURRENT_LIST_DIR}/QhullTargets.cmake")
+
diff --git a/src/libqhull_r/qhull_r-exports.def b/src/libqhull_r/qhull_r-exports.def
index 325d57c..72f6ad0 100644
--- a/src/libqhull_r/qhull_r-exports.def
+++ b/src/libqhull_r/qhull_r-exports.def
@@ -185,6 +185,7 @@ qh_memsetup
qh_memsize
qh_memstatistics
qh_memtotal
+qh_memcheck
qh_merge_degenredundant
qh_merge_nonconvex
qh_mergecycle
@@ -372,6 +373,7 @@ qh_settruncate
qh_setunique
qh_setvoronoi_all
qh_setzero
+qh_setendpointer
qh_sharpnewfacets
qh_skipfacet
qh_skipfilename
diff --git a/src/libqhull_r/user_r.h b/src/libqhull_r/user_r.h
index fc105b9..7cca65a 100644
--- a/src/libqhull_r/user_r.h
+++ b/src/libqhull_r/user_r.h
@@ -139,7 +139,7 @@ Code flags --
REALfloat = 1 all numbers are 'float' type
= 0 all numbers are 'double' type
*/
-#define REALfloat 0
+#define REALfloat 1
#if (REALfloat == 1)
#define realT float
@@ -652,8 +652,8 @@ install(EXPORT QhullTargets
)
install(
FILES
- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfigVersion.cmake"
DESTINATION
${ConfigPackageLocation}
COMPONENT
--
2.16.2.windows.1
2.17.1