From: vsr Date: Thu, 25 Mar 2021 17:18:34 +0000 (+0300) Subject: bos #18711 Adapt NETGEN detection procedure for version 6x: manage case when NETGEN... X-Git-Tag: V9_7_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f3fc9371298248adf596e09af7b797faa7b55592;p=tools%2Fconfiguration.git bos #18711 Adapt NETGEN detection procedure for version 6x: manage case when NETGEN has cmake CONFIG file --- diff --git a/cmake/FindNetgen.cmake b/cmake/FindNetgen.cmake index 9dc57f5..4a9d6c7 100644 --- a/cmake/FindNetgen.cmake +++ b/cmake/FindNetgen.cmake @@ -1,5 +1,6 @@ # - Find NETGEN # Sets the following variables: +# NETGEN_DEFINITIONS - compile flags # NETGEN_INCLUDE_DIRS - path to the NETGEN include directories # NETGEN_LIBRARIES - path to the NETGEN libraries to be linked against # @@ -51,9 +52,14 @@ ENDIF() FIND_PATH(_netgen_base_inc_dir nglib.h) SET(NETGEN_INCLUDE_DIRS ${_netgen_base_inc_dir} ${ZLIB_INCLUDE_DIRS}) -FIND_PATH(_netgen_add_inc_dir occgeom.hpp HINTS ${_netgen_base_inc_dir} PATH_SUFFIXES share/netgen/include include) -LIST(APPEND NETGEN_INCLUDE_DIRS ${_netgen_add_inc_dir}) -LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS) +FIND_PATH(_netgen_add_inc_dir1 occgeom.hpp HINTS ${_netgen_base_inc_dir} PATH_SUFFIXES share/netgen/include include) +IF(_netgen_add_inc_dir1) + LIST(APPEND NETGEN_INCLUDE_DIRS ${_netgen_add_inc_dir1}) +ENDIF() +FIND_PATH(_netgen_add_inc_dir2 exception.hpp HINTS ${_netgen_base_inc_dir} PATH_SUFFIXES share/netgen/include share/netgen/include/core include include/core) +IF(_netgen_add_inc_dir2) + LIST(APPEND NETGEN_INCLUDE_DIRS ${_netgen_add_inc_dir2}) +ENDIF() FOREACH(_lib nglib csg gen geom2d gprim interface la mesh occ stl ngcore) @@ -105,13 +111,6 @@ IF(NETGEN_FOUND) ENDIF() SET(NETGEN_DEFINITIONS "-DOCCGEOMETRY") - IF(NETGEN_V5) - MESSAGE(STATUS "NETGEN V5 found") - SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNETGEN_V5") - ELSEIF(NETGEN_V6) - MESSAGE(STATUS "NETGEN V6 or newer found") - ENDIF() - #RNV: currently on windows use netgen without thread support. #TODO: check support of the multithreading on windows IF(WIN32) diff --git a/cmake/FindSalomeNetgen.cmake b/cmake/FindSalomeNetgen.cmake index d47ec39..e5ba53e 100644 --- a/cmake/FindSalomeNetgen.cmake +++ b/cmake/FindSalomeNetgen.cmake @@ -20,6 +20,43 @@ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Netgen NETGEN_INCLUDE_DIRS 1) MARK_AS_ADVANCED(NETGEN_INCLUDE_DIRS NETGEN_LIBRARIES) +# process case when netgen is found in config mode +IF(NOT NETGEN_DEFINITIONS AND NETGEN_COMPILE_DEFINITIONS) + SET(NETGEN_DEFINITIONS) + FOREACH(_ng_def ${NETGEN_COMPILE_DEFINITIONS}) + LIST(APPEND NETGEN_DEFINITIONS "-D${_ng_def}") + ENDFOREACH() +ENDIF() +IF(NOT NETGEN_LIBRARIES) + SET(NETGEN_LIBRARIES) + FOREACH(_ng_lib nglib csg gen geom2d gprim interface la mesh occ stl ngcore) + IF(TARGET ${_ng_lib}) + LIST(APPEND NETGEN_LIBRARIES "${_ng_lib}") + ENDIF() + ENDFOREACH() +ENDIF() +IF(NOT NETGEN_V5 AND NOT NETGEN_V6 AND NETGEN_VERSION_MAJOR) + IF(NETGEN_VERSION_MAJOR VERSION_EQUAL 6) + SET(NETGEN_V6 ON) + ELSEIF(NETGEN_VERSION_MAJOR VERSION_EQUAL 5) + SET(NETGEN_V5 ON) + ENDIF() +ENDIF() +IF(NETGEN_INCLUDE_DIR AND NETGEN_INCLUDE_DIRS) + LIST(APPEND NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIR}/core) +ENDIF() +IF(NETGEN_INCLUDE_DIRS) + LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS) +ENDIF() + +IF(NETGEN_V6) + MESSAGE(STATUS "NETGEN V6 or newer found") + SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNETGEN_V6") +ELSEIF(NETGEN_V5) + MESSAGE(STATUS "NETGEN V5 found") + SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNETGEN_V5") +ENDIF() + IF(NETGEN_FOUND) SALOME_ACCUMULATE_HEADERS(NETGEN_INCLUDE_DIRS) SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${NETGEN_LIBRARIES})