Skip to content

Commit 21299d2

Browse files
committed
Enable Index-64 extended API only for Intel and GNU compilers
Other compilers might not fully support preprocessing
1 parent 40ca7a2 commit 21299d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+51
-104
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ else()
107107
set(LAPACKELIB "lapacke")
108108
set(TMGLIB "tmglib")
109109
endif()
110-
# By default build standard API and extended _64 API
110+
# By default build extended _64 API for supported compilers only
111+
set(INDEX64_EXT_API_COMPILERS "Intel|GNU")
111112
option(BUILD_INDEX64_EXT_API "Build Index-64 API as extended API with _64 suffix" ON)
113+
message(STATUS "Build Index-64 API as extended API with _64 suffix: ${BUILD_INDEX64_EXT_API}")
112114

113115
include(GNUInstallDirs)
114116

SRC/CMakeLists.txt

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -535,26 +535,33 @@ set_target_properties(
535535
)
536536

537537
if(BUILD_INDEX64_EXT_API)
538-
set(SOURCES_64)
539-
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj)
540-
file(COPY ${SOURCES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj)
541-
file(GLOB SOURCES_64 ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj/*.*)
542-
list(REMOVE_ITEM SOURCES_64 la_xisnan.F90)
543-
foreach(F IN LISTS SOURCES_64)
544-
set(FFILE "")
545-
file(READ ${F} FFILE)
546-
file(WRITE ${F} "#include \"lapack_64.h\"\n")
547-
file(APPEND ${F} "${FFILE}")
548-
endforeach()
549-
file(COPY lapack_64.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj)
550-
add_library(${LAPACKLIB}_64_obj OBJECT ${SOURCES_64})
551-
target_link_libraries(${LAPACKLIB}_64_obj mod_files)
552-
target_compile_options(${LAPACKLIB}_64_obj PRIVATE ${FOPT_ILP64} -DLAPACK_64)
553-
set_target_properties(
554-
${LAPACKLIB}_64_obj PROPERTIES
555-
POSITION_INDEPENDENT_CODE ON
556-
Fortran_PREPROCESS ON
557-
)
538+
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES ${INDEX64_EXT_API_COMPILERS})
539+
message(STATUS "Build Index-64 API as extended API with _64 suffix: skipped (unsupported Fortran compiler)")
540+
# Disable extended API for LAPACK and LAPACKE as it depends on LAPACK build.
541+
set(BUILD_INDEX64_EXT_API OFF)
542+
set(BUILD_INDEX64_EXT_API OFF PARENT_SCOPE)
543+
else()
544+
set(SOURCES_64)
545+
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj)
546+
file(COPY ${SOURCES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj)
547+
file(GLOB SOURCES_64 ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj/*.*)
548+
list(REMOVE_ITEM SOURCES_64 la_xisnan.F90)
549+
foreach(F IN LISTS SOURCES_64)
550+
set(FFILE "")
551+
file(READ ${F} FFILE)
552+
file(WRITE ${F} "#include \"lapack_64.h\"\n")
553+
file(APPEND ${F} "${FFILE}")
554+
endforeach()
555+
file(COPY lapack_64.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_64_obj)
556+
add_library(${LAPACKLIB}_64_obj OBJECT ${SOURCES_64})
557+
target_link_libraries(${LAPACKLIB}_64_obj mod_files)
558+
target_compile_options(${LAPACKLIB}_64_obj PRIVATE ${FOPT_ILP64} -DLAPACK_64)
559+
set_target_properties(
560+
${LAPACKLIB}_64_obj PROPERTIES
561+
POSITION_INDEPENDENT_CODE ON
562+
Fortran_PREPROCESS ON
563+
)
564+
endif()
558565
endif()
559566

560567
add_library(${LAPACKLIB}

SRC/chetrd_hb2st.F

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "lapack_64.h"
21
*> \brief \b CHETRD_HB2ST reduces a complex Hermitian band matrix A to real symmetric tridiagonal form T
32
*
43
* =========== DOCUMENTATION ===========

SRC/iparam2stage.F

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "lapack_64.h"
21
*> \brief \b IPARAM2STAGE
32
*
43
* =========== DOCUMENTATION ===========

SRC/ssytrd_sb2st.F

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "lapack_64.h"
21
*> \brief \b SSYTRD_SB2ST reduces a real symmetric band matrix A to real symmetric tridiagonal form T
32
*
43
* =========== DOCUMENTATION ===========

SRC/zhetrd_hb2st.F

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "lapack_64.h"
21
*> \brief \b ZHETRD_HB2ST reduces a complex Hermitian band matrix A to real symmetric tridiagonal form T
32
*
43
* =========== DOCUMENTATION ===========

TESTING/MATGEN/CMakeLists.txt

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,31 @@ set_target_properties(
5555
)
5656

5757
if(BUILD_INDEX64_EXT_API)
58-
set(SOURCES_64)
59-
list(APPEND SOURCES_64 ${SOURCES})
60-
add_library(${TMGLIB}_64_obj OBJECT ${SOURCES_64})
61-
target_compile_options(${TMGLIB}_64_obj PRIVATE ${FOPT_ILP64} -DMATGEN_64)
62-
set_target_properties(
58+
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES ${INDEX64_EXT_API_COMPILERS})
59+
message(STATUS "Build Index-64 API as extended API with _64 suffix: skipped (unsupported Fortran compiler)")
60+
# Disable extended API for MATGEN and LAPACK.
61+
set(BUILD_INDEX64_EXT_API OFF)
62+
set(BUILD_INDEX64_EXT_API OFF PARENT_SCOPE)
63+
else()
64+
set(SOURCES_64)
65+
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${TMGLIB}_64_obj)
66+
file(COPY ${SOURCES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${TMGLIB}_64_obj)
67+
file(GLOB SOURCES_64 ${CMAKE_CURRENT_BINARY_DIR}/${TMGLIB}_64_obj/*.*)
68+
foreach(F IN LISTS SOURCES_64)
69+
set(FFILE "")
70+
file(READ ${F} FFILE)
71+
file(WRITE ${F} "#include \"matgen_64.h\"\n")
72+
file(APPEND ${F} "${FFILE}")
73+
endforeach()
74+
file(COPY matgen_64.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${TMGLIB}_64_obj)
75+
add_library(${TMGLIB}_64_obj OBJECT ${SOURCES_64})
76+
target_compile_options(${TMGLIB}_64_obj PRIVATE ${FOPT_ILP64} -DMATGEN_64)
77+
set_target_properties(
6378
${TMGLIB}_64_obj PROPERTIES
6479
POSITION_INDEPENDENT_CODE ON
6580
Fortran_PREPROCESS ON
6681
)
82+
endif()
6783
endif()
6884

6985
add_library(${TMGLIB}

TESTING/MATGEN/clagge.f

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "matgen_64.h"
21
*> \brief \b CLAGGE
32
*
43
* =========== DOCUMENTATION ===========

TESTING/MATGEN/claghe.f

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "matgen_64.h"
21
*> \brief \b CLAGHE
32
*
43
* =========== DOCUMENTATION ===========

TESTING/MATGEN/clagsy.f

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "matgen_64.h"
21
*> \brief \b CLAGSY
32
*
43
* =========== DOCUMENTATION ===========

0 commit comments

Comments
 (0)