From 2bc0fdf26c12f479bb083a45fb4cc89480edf2c1 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Thu, 28 Jan 2021 12:31:48 +0100 Subject: [PATCH] Add support for gmsh api in cmake. --- cmake/configure/configure_gmsh.cmake | 1 + cmake/modules/FindGMSH.cmake | 38 ++++++++++++++++++++++++++-- include/deal.II/base/config.h.in | 3 +++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/cmake/configure/configure_gmsh.cmake b/cmake/configure/configure_gmsh.cmake index 9418a815bc..75e7404d90 100644 --- a/cmake/configure/configure_gmsh.cmake +++ b/cmake/configure/configure_gmsh.cmake @@ -18,3 +18,4 @@ # CONFIGURE_FEATURE(GMSH) +SET(DEAL_II_GMSH_WITH_API ${GMSH_WITH_API}) diff --git a/cmake/modules/FindGMSH.cmake b/cmake/modules/FindGMSH.cmake index b346ca374c..3a715dc97d 100644 --- a/cmake/modules/FindGMSH.cmake +++ b/cmake/modules/FindGMSH.cmake @@ -19,18 +19,52 @@ # This module exports # # GMSH_EXECUTABLE +# GMSH_LIBRARY +# GMSH_INCLUDE_DIR +# GMSH_WITH_API # SET(GMSH_DIR "" CACHE PATH "An optional hint to a Gmsh installation containing the gmsh executable") SET_IF_EMPTY(GMSH_DIR "$ENV{GMSH_DIR}") +SET(GMSH_LIBRARY_DIR "" CACHE PATH "An optional hint to a Gmsh SDK installation") +SET_IF_EMPTY(GMSH_LIBRARY_DIR "$ENV{GMSH_DIR}") + DEAL_II_FIND_PROGRAM(GMSH_EXE gmsh${CMAKE_EXECUTABLE_SUFFIX} HINTS ${GMSH_DIR} PATH_SUFFIXES bin ) +DEAL_II_FIND_LIBRARY(GMSH_LIBRARY + NAMES gmsh + HINTS ${GMSH_LIBRARY_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib + ) + +DEAL_II_FIND_PATH(GMSH_INCLUDE_DIR gmsh.h + HINTS ${GMSH_LIBRARY_DIR} + PATH_SUFFIXES include + ) + +IF(GMSH_LIBRARY MATCHES "-NOTFOUND" OR + GMSH_INCLUDE_DIR MATCHES "-NOTFOUND") + SET(GMSH_WITH_API FALSE) +ELSE() + SET(GMSH_WITH_API TRUE) +ENDIF() + DEAL_II_PACKAGE_HANDLE(GMSH - EXECUTABLE REQUIRED GMSH_EXE + EXECUTABLE + REQUIRED GMSH_EXE + LIBRARIES + OPTIONAL GMSH_LIBRARY + INCLUDE_DIRS + OPTIONAL GMSH_INCLUDE_DIR + USER_INCLUDE_DIRS + OPTIONAL GMSH_INCLUDE_DIR CLEAR - GMSH_EXE + GMSH_EXE + GMSH_LIBRARY + GMSH_INCLUDE_DIR + GMSH_WITH_API ) diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 27e0d959e1..fba8f32f69 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -192,6 +192,9 @@ /* cmake/modules/FindARPACK.cmake */ #cmakedefine DEAL_II_ARPACK_WITH_PARPACK +/* cmake/modules/FindGMSH.cmake */ +#cmakedefine DEAL_II_GMSH_WITH_API + /* cmake/modules/FindPETSC.cmake */ #cmakedefine DEAL_II_PETSC_WITH_COMPLEX #cmakedefine DEAL_II_PETSC_WITH_HYPRE -- 2.39.5