Support for NETGEN 6.2.
Upstream changed: https://sourceforge.net/p/netgen-mesher/git/ci/7e4892a There is also a pending request to fix NETGEN build, installation and version detection after 6.1: https://sourceforge.net/p/netgen-mesher/git/merge-requests/1/ Just a note: NETGEN development happens on https://gitlab.asc.tuwien.ac.at/jschoeberl/netgen but it is a very hard/strange way to find that out and get in contact with NETGEN developers as well as getting permission to fork the repository there to create a pull request. Maybe some other developer can get in contact with NETGEN developers ...
This commit is contained in:
committed by
wmayer
parent
3296966753
commit
6f6a038418
@@ -107,11 +107,14 @@ ELSE()
|
||||
file(STRINGS ${NETGEN_DIR_include}/mydefs.hpp NETGEN_VERSION
|
||||
REGEX "#define PACKAGE_VERSION.*"
|
||||
)
|
||||
string(REGEX MATCH "[0-9]+" NETGEN_VERSION ${NETGEN_VERSION})
|
||||
# EXECUTE_PROCESS(COMMAND grep -e ".*define.*PACKAGE_VERSION" ${NETGEN_DIR_include}/mydefs.hpp
|
||||
# COMMAND sed -r "s:.*PACKAGE_VERSION \"([0-9]*).*:\\1:g"
|
||||
# OUTPUT_VARIABLE NETGEN_VERSION
|
||||
# OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX MATCHALL "[0-9]+" NETGEN_VERSION ${NETGEN_VERSION})
|
||||
list(LENGTH NETGEN_VERSION NETGEN_VERSION_COUNT)
|
||||
list(GET NETGEN_VERSION 0 NETGEN_VERSION_MAJOR)
|
||||
if(NETGEN_VERSION_COUNT GREATER 1)
|
||||
list(GET NETGEN_VERSION 1 NETGEN_VERSION_MINOR)
|
||||
else()
|
||||
set(NETGEN_VERSION_MINOR 0)
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT NGLIB_LIBRARIES)
|
||||
@@ -125,7 +128,40 @@ IF(NGLIB_INCLUDE_DIR AND NGLIB_LIBRARIES)
|
||||
${NETGEN_DIR_gprim} ${NETGEN_DIR_la} ${NETGEN_DIR_mesh}
|
||||
${NETGEN_DIR_occ} ${NETGEN_DIR_stlgeom})
|
||||
LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS)
|
||||
MESSAGE(STATUS "Found NETGEN version ${NETGEN_VERSION}")
|
||||
MATH(EXPR NETGEN_VERSION "(${NETGEN_VERSION_MAJOR} << 16) + (${NETGEN_VERSION_MINOR} << 8)")
|
||||
MATH(EXPR NETGEN_VERSION_62 "(6 << 16) + (2 << 8)")
|
||||
IF(NOT NETGEN_VERSION LESS NETGEN_VERSION_62) # Version >= 6.2
|
||||
# NETGEN v6.2 or newer requires c++1y/c++14
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG)
|
||||
check_cxx_compiler_flag("-std=c++1y" HAS_CPP1Y_FLAG)
|
||||
if(HAS_CPP14_FLAG)
|
||||
set(NETGEN_CXX_FLAGS "-std=c++14")
|
||||
elseif(HAS_CPP1Y_FLAG)
|
||||
set(NETGEN_CXX_FLAGS "-std=c++1y")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported compiler -- C++1y support or newer required!")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# Clang sometimes fails to include <cstdio>
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${NETGEN_CXX_FLAGS}")
|
||||
check_cxx_source_compiles("#include <cstdio>\nint main(){}" CSTDIO_INCLUDE_TRY1)
|
||||
if(NOT CSTDIO_INCLUDE_TRY1)
|
||||
# Ugly hack to make <stdio.h> building gets function
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -U__cplusplus -D__cplusplus=201103L")
|
||||
check_cxx_source_compiles("#include <cstdio>\nint main(){}" CSTDIO_INCLUDE_TRY2)
|
||||
if(NOT CSTDIO_INCLUDE_TRY2)
|
||||
message(FATAL_ERROR "Cannot #include <cstdio>.")
|
||||
else()
|
||||
set(NETGEN_CXX_FLAGS "${NETGEN_CXX_FLAGS} -U__cplusplus -D__cplusplus=201103L")
|
||||
endif()
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Found NETGEN version ${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}, calculated: ${NETGEN_VERSION}")
|
||||
LIST(APPEND NETGEN_DEFINITIONS -DNETGEN_VERSION=${NETGEN_VERSION})
|
||||
ELSE()
|
||||
SET(NETGEN_FOUND FALSE)
|
||||
|
||||
Reference in New Issue
Block a user