From 25ed5b375d245ab85f6a54d6cea8547b7b488cee Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Wed, 4 May 2022 14:14:04 +0300 Subject: [PATCH] First try at detecting CGAL more robustly. --- .github/workflows/linux.yml | 8 +++++--- cmake/modules/FindCGAL.cmake | 31 +++++++++++++++++++------------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 1921887c90..986bed1d35 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -51,21 +51,22 @@ jobs: # simple parallel debug build using g++ with simplex configuration enabled name: linux debug parallel simplex - runs-on: [ubuntu-18.04] + runs-on: [ubuntu-20.04] steps: - uses: actions/checkout@v2 - name: modules run: | sudo apt-get install -y software-properties-common - sudo add-apt-repository ppa:ginggs/deal.ii-9.2.0-backports + sudo add-apt-repository -y ppa:ginggs/deal.ii-9.3.0-backports sudo apt-get update sudo apt-get install -yq --no-install-recommends \ numdiff \ + libboost-all-dev \ + libcgal-dev \ libp4est-dev \ trilinos-all-dev \ petsc-dev \ - libcgal-dev \ libmetis-dev \ libhdf5-mpi-dev - name: info @@ -79,6 +80,7 @@ jobs: cmake -D CMAKE_BUILD_TYPE=Debug \ -D DEAL_II_CXX_FLAGS='-Werror -std=c++17' \ -D DEAL_II_EARLY_DEPRECATIONS=ON \ + -D DEAL_II_WITH_CGAL="ON" \ -D DEAL_II_WITH_MPI="ON" \ -D DEAL_II_WITH_TRILINOS="ON" \ -D DEAL_II_WITH_PETSC="ON" \ diff --git a/cmake/modules/FindCGAL.cmake b/cmake/modules/FindCGAL.cmake index 494bd72d13..34af36d89a 100644 --- a/cmake/modules/FindCGAL.cmake +++ b/cmake/modules/FindCGAL.cmake @@ -31,29 +31,36 @@ ENDIF() IF(DEAL_II_HAVE_CXX17) # temporarily disable ${CMAKE_SOURCE_DIR}/cmake/modules for module lookup LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/) - FIND_PACKAGE(CGAL 5.0) + SET(CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE ON) + FIND_PACKAGE(CGAL) + # Check version manually. Older binary distros don't do this properly. + IF(CGAL_MAJOR_VERSION LESS 5) + SET(CGAL_FOUND FALSE) + SET(CGAL_INCLUDE_DIRS "-NOTFOUND") + SET(CGAL_LIBRARIES "-NOTFOUND") + MESSAGE(STATUS "CGAL wrappers require CGAL version 5 and above.") + ENDIF() LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/) - IF(NOT CGAL_HEADER_ONLY) - SET(CGAL_LIBS "-NOTFOUND") - MESSAGE(STATUS "CGAL wrappers require header only version of CGAL.") - ELSE() - SET(CGAL_LIBS CGAL::CGAL) - ENDIF(CGAL_HEADER_ONLY) -ELSE(DEAL_II_HAVE_CXX17) + IF(CGAL_FOUND) + GET_TARGET_PROPERTY(CGAL_LIBRARIES CGAL::CGAL INTERFACE_LINK_LIBRARIES) + # Make sure we dont' pass Boost::Boost over to deal.II. + LIST(FILTER CGAL_LIBRARIES EXCLUDE REGEX "::") + ENDIF() +ELSE() SET(CGAL_FOUND FALSE) SET(CGAL_INCLUDE_DIRS "-NOTFOUND") - SET(CGAL_LIBS "-NOTFOUND") + SET(CGAL_LIBRARIES "-NOTFOUND") MESSAGE(STATUS "CGAL wrappers require C++17. Disabling CGAL Support.") -ENDIF(DEAL_II_HAVE_CXX17) +ENDIF() DEAL_II_PACKAGE_HANDLE(CGAL INCLUDE_DIRS REQUIRED CGAL_INCLUDE_DIRS LIBRARIES - OPTIONAL CGAL_LIBS + OPTIONAL CGAL_LIBRARIES USER_INCLUDE_DIRS REQUIRED CGAL_INCLUDE_DIRS CLEAR CGAL_INCLUDE_DIRS - CGAL_LIBS + CGAL_LIBRARIES ) -- 2.39.5