2 # Sets the following variables:
3 # NETGEN_INCLUDE_DIRS - path to the NETGEN include directories
4 # NETGEN_LIBRARIES - path to the NETGEN libraries to be linked against
7 #########################################################################
8 # Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2.1 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with this library; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
29 IF(NOT Netgen_FIND_QUIETLY)
30 MESSAGE(STATUS "Check for Netgen ...")
35 SET(NETGEN_ROOT_DIR $ENV{NETGEN_ROOT_DIR})
38 LIST(APPEND CMAKE_PREFIX_PATH "${NETGEN_ROOT_DIR}")
39 ENDIF(NETGEN_ROOT_DIR)
41 # Windows specific stuff:
42 # Since netgen-5.3.1 uses zlib, try to detect it
44 IF(EXISTS ${NETGEN_ROOT_DIR}/cmake/FindZlib.cmake)
45 FILE(TO_CMAKE_PATH ${NETGEN_ROOT_DIR}/cmake NETGEN_CMAKE_FILES)
46 LIST(APPEND CMAKE_MODULE_PATH ${NETGEN_CMAKE_FILES})
47 SET(ZLIB_ROOT_DIR $ENV{ZLIB_ROOT_DIR})
52 FIND_PATH(_netgen_base_inc_dir nglib.h)
53 SET(NETGEN_INCLUDE_DIRS ${_netgen_base_inc_dir} ${ZLIB_INCLUDE_DIRS})
54 FIND_PATH(_netgen_add_inc_dir occgeom.hpp HINTS ${_netgen_base_inc_dir} PATH_SUFFIXES share/netgen/include)
55 LIST(APPEND NETGEN_INCLUDE_DIRS ${_netgen_add_inc_dir})
56 LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS)
58 FOREACH(_lib nglib csg gen geom2d gprim interface la mesh occ stl)
60 FIND_LIBRARY(NETGEN_${_lib} NAMES ${_lib})
62 LIST(APPEND NETGEN_LIBRARIES ${NETGEN_${_lib}})
67 INCLUDE(FindPackageHandleStandardArgs)
68 FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETGEN REQUIRED_VARS NETGEN_INCLUDE_DIRS NETGEN_LIBRARIES)
70 INCLUDE(CheckCXXSourceCompiles)
75 SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${NETGEN_INCLUDE_DIRS}")
76 SET(CMAKE_REQUIRED_LIBRARIES "${NETGEN_LIBRARIES}")
77 CHECK_CXX_SOURCE_COMPILES("
78 #include <meshing.hpp>
81 netgen::Mesh* ngMesh = 0;
82 ngMesh->CalcLocalH(1.0);
87 IF(NOT Netgen_FIND_QUIETLY)
88 MESSAGE(STATUS "Netgen library: ${NETGEN_LIBRARIES}")
90 SET(NETGEN_DEFINITIONS "-DOCCGEOMETRY")
93 MESSAGE(STATUS "NETGEN V5 or later found")
94 SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNETGEN_V5")
97 #RNV: currently on windows use netgen without thread support.
98 #TODO: check support of the multithreading on windows
100 SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNO_PARALLEL_THREADS")