# - 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
#
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)
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)
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})