Skip to content

Commit

Permalink
cmake: added FindQhull.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
ole00 committed Jul 12, 2022
1 parent a295c06 commit c11b224
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
36 changes: 36 additions & 0 deletions cmake/modules/FindQhull.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
set(_q "")
if(QHULL_FIND_QUIETLY)
set(_q QUIET)
endif()
find_package(QHULL ${QHULL_FIND_VERSION} CONFIG ${_q})

if(NOT QHULL_FIND_QUIETLY)
if (NOT QHULL_FOUND)
message(STATUS "Falling back to MODULE search for QHULL...")
else()
message(STATUS "QHULL found in ${QHULL_DIR}")
endif()
endif()

if (NOT QHULL_FOUND)
set(_modpath ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "")
include(CheckIncludeFileCXX)

add_library(qhull INTERFACE)
add_library(orgQhull::Qhull::qhull_r ALIAS qhull)
add_library(orgQhull::Qhull::qhullcpp ALIAS qhull)
if(SLIC3R_STATIC)
slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhullstatic_r" RelWithDebInfo Release)
target_link_libraries(qhull INTERFACE qhullcpp qhullstatic_r)
else()
slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhull_r" RelWithDebInfo Release)
target_link_libraries(qhull INTERFACE qhullcpp qhull_r)
endif()

target_include_directories(qhull INTERFACE include)

set(CMAKE_MODULE_PATH ${_modpath})

CHECK_INCLUDE_FILE_CXX("libqhullcpp/Qhull.h" QHULL_FOUND)
endif()
8 changes: 0 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ add_subdirectory(qoi)
add_subdirectory(libnest2d)

find_package(Qhull 7.2 REQUIRED)
add_library(qhull INTERFACE)
if(SLIC3R_STATIC)
slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhullstatic_r" RelWithDebInfo Release)
target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhullstatic_r)
else()
slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhull_r" RelWithDebInfo Release)
target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhull_r)
endif()

add_subdirectory(libslic3r)

Expand Down

0 comments on commit c11b224

Please sign in to comment.