Fix generation of amg_config.h with CMAKE

development
sfilippone 1 month ago
parent 04d7122380
commit 0d38955a2d

@ -305,6 +305,13 @@ if(MPI_FOUND)
#include_directories("${MPI_INCLUDE_DIR}")
endif()
# Find AMG constants
include(${CMAKE_CURRENT_LIST_DIR}/cmake/readAMGConst.cmake)
_amg_read_const()
if ("${PSB_LPK_SIZE}" EQUAL 8)
set(CXXMATCHBOXBIT "#define AMG_MATCHBOXP_BIT64")
endif()
#------------------------------------------

@ -0,0 +1,14 @@
macro(_amg_read_const)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/amgprec/amg_base_prec_type.F90" _amg_const_mod)
string(REGEX MATCH "amg_version_major_[ \t]+=[ \t]+([0-9]+)" _amg_version_major_match "${_amg_const_mod}")
set(AMGMAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "amg_version_minor_[ \t]+=[ \t]+([0-9]+)" _amg_version_minor_match "${_amg_const_mod}")
set(AMGMINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "amg_patchlevel_[ \t]+=[ \t]+([0-9]+)" _amg_patchlevel_match "${_amg_const_mod}")
set(AMGPATCH "${CMAKE_MATCH_1}")
string(REGEX MATCH "amg_version_string_[ \t]+=[ \t]+([^ \t]+)" _amg_version_string_match "${_amg_const_mod}")
set(AMGSTRING "${CMAKE_MATCH_1}")
endmacro(_amg_read_const)
Loading…
Cancel
Save