Skip to content

Commit

Permalink
Merge pull request Reference-LAPACK#939 from ACSimon33/nagfor_fix
Browse files Browse the repository at this point in the history
Fixed Fortran preprocessor flag for NAG Fortran compiler
  • Loading branch information
langou committed Nov 15, 2023
2 parents d58d59a + b29d751 commit 4b8a925
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions BLAS/SRC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,24 @@ if(BUILD_INDEX64_EXT_API)
set_target_properties(${BLASLIB}_64_obj PROPERTIES POSITION_INDEPENDENT_CODE ON)
#Add _64 suffix to all Fortran functions via macros
foreach(F IN LISTS SOURCES_64_F)
if(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
set(COPT_64_F -fpp)
else()
set(COPT_64_F -cpp)
file(STRINGS ${F} ${F}.lst)
list(FILTER ${F}.lst INCLUDE REGEX "subroutine|SUBROUTINE|external|EXTERNAL|function|FUNCTION")
list(FILTER ${F}.lst EXCLUDE REGEX "^!.*")
list(FILTER ${F}.lst EXCLUDE REGEX "^[*].*")
list(FILTER ${F}.lst EXCLUDE REGEX "end|END")
foreach(FUNC IN LISTS ${F}.lst)
string(REGEX REPLACE "^[a-zA-Z0-9_ *]*(subroutine|SUBROUTINE|external|EXTERNAL|function|FUNCTION)[ ]*[*]?" "" FUNC ${FUNC})
string(REGEX REPLACE "[(][a-zA-Z0-9_, )]*$" "" FUNC ${FUNC})
string(STRIP ${FUNC} FUNC)
list(APPEND COPT_64_F "-D${FUNC}=${FUNC}_64")
endforeach()
list(REMOVE_DUPLICATES COPT_64_F)
set_source_files_properties(${F} PROPERTIES COMPILE_OPTIONS "${COPT_64_F}")
endif()
file(STRINGS ${F} ${F}.lst)
list(FILTER ${F}.lst INCLUDE REGEX "subroutine|SUBROUTINE|external|EXTERNAL|function|FUNCTION")
list(FILTER ${F}.lst EXCLUDE REGEX "^!.*")
list(FILTER ${F}.lst EXCLUDE REGEX "^[*].*")
list(FILTER ${F}.lst EXCLUDE REGEX "end|END")
foreach(FUNC IN LISTS ${F}.lst)
string(REGEX REPLACE "^[a-zA-Z0-9_ *]*(subroutine|SUBROUTINE|external|EXTERNAL|function|FUNCTION)[ ]*[*]?" "" FUNC ${FUNC})
string(REGEX REPLACE "[(][a-zA-Z0-9_, )]*$" "" FUNC ${FUNC})
string(STRIP ${FUNC} FUNC)
list(APPEND COPT_64_F "-D${FUNC}=${FUNC}_64")
endforeach()
list(REMOVE_DUPLICATES COPT_64_F)
set_source_files_properties(${F} PROPERTIES COMPILE_OPTIONS "${COPT_64_F}")
endforeach()
endif()

Expand Down

0 comments on commit 4b8a925

Please sign in to comment.