Skip to content

Commit ad45981

Browse files
authored
Merge pull request #3575 from mmuetzel/lapacke-win64
Fix LAPACKE with 64-bit indexing on Windows.
2 parents d5ed695 + aeb561d commit ad45981

28 files changed

+168
-121
lines changed

cmake/fc.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ if (${F_COMPILER} STREQUAL "GFORTRAN")
6767
if (BINARY64)
6868
set(FCOMMON_OPT "${FCOMMON_OPT} -m64")
6969
if (INTERFACE64)
70-
set(FCOMMON_OPT "${FCOMMON_OPT} -fdefault-integer-8")
70+
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
71+
if (WIN32)
72+
set(FCOMMON_OPT "${FCOMMON_OPT} /integer-size:64")
73+
else ()
74+
set(FCOMMON_OPT "${FCOMMON_OPT} -integer-size 64")
75+
endif ()
76+
else ()
77+
set(FCOMMON_OPT "${FCOMMON_OPT} -fdefault-integer-8")
78+
endif ()
7179
endif ()
7280
else ()
7381
set(FCOMMON_OPT "${FCOMMON_OPT} -m32")

lapack-netlib/BLAS/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ add_subdirectory(SRC)
22
if(BUILD_TESTING)
33
add_subdirectory(TESTING)
44
endif()
5-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/blas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/blas.pc @ONLY)
5+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/blas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${BLASLIB}.pc @ONLY)
66
install(FILES
7-
${CMAKE_CURRENT_BINARY_DIR}/blas.pc
7+
${CMAKE_CURRENT_BINARY_DIR}/${BLASLIB}.pc
88
DESTINATION ${PKG_CONFIG_DIR}
99
COMPONENT Development
1010
)

lapack-netlib/BLAS/SRC/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ if(BUILD_COMPLEX16)
9797
endif()
9898
list(REMOVE_DUPLICATES SOURCES)
9999

100-
add_library(blas ${SOURCES})
100+
add_library(${BLASLIB} ${SOURCES})
101101
set_target_properties(
102-
blas PROPERTIES
102+
${BLASLIB} PROPERTIES
103103
VERSION ${LAPACK_VERSION}
104104
SOVERSION ${LAPACK_MAJOR_VERSION}
105105
)
106-
lapack_install_library(blas)
106+
lapack_install_library(${BLASLIB})

lapack-netlib/BLAS/TESTING/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ macro(add_blas_test name src)
22
get_filename_component(baseNAME ${src} NAME_WE)
33
set(TEST_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${baseNAME}.in")
44
add_executable(${name} ${src})
5-
target_link_libraries(${name} blas)
5+
target_link_libraries(${name} ${BLASLIB})
66
if(EXISTS "${TEST_INPUT}")
77
add_test(NAME BLAS-${name} COMMAND "${CMAKE_COMMAND}"
88
-DTEST=$<TARGET_FILE:${name}>

lapack-netlib/BLAS/blas.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Name: BLAS
55
Description: FORTRAN reference implementation of BLAS Basic Linear Algebra Subprograms
66
Version: @LAPACK_VERSION@
77
URL: http://www.netlib.org/blas/
8-
Libs: -L${libdir} -lblas
8+
Libs: -L${libdir} -l@BLASLIB@

lapack-netlib/CBLAS/CMakeLists.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
message(STATUS "CBLAS enable")
22
enable_language(C)
33

4-
set(LAPACK_INSTALL_EXPORT_NAME cblas-targets)
4+
set(LAPACK_INSTALL_EXPORT_NAME ${CBLASLIB}-targets)
55

66
# Create a header file cblas.h for the routines called in my C programs
77
include(FortranCInterface)
@@ -42,15 +42,15 @@ if(BUILD_TESTING)
4242
endif()
4343

4444
if(NOT BLAS_FOUND)
45-
set(ALL_TARGETS ${ALL_TARGETS} blas)
45+
set(ALL_TARGETS ${ALL_TARGETS} ${BLASLIB})
4646
endif()
4747

4848
# Export cblas targets from the
4949
# install tree, if any.
5050
set(_cblas_config_install_guard_target "")
5151
if(ALL_TARGETS)
52-
install(EXPORT cblas-targets
53-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cblas-${LAPACK_VERSION}
52+
install(EXPORT ${CBLASLIB}-targets
53+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
5454
COMPONENT Development
5555
)
5656
# Choose one of the cblas targets to use as a guard for
@@ -61,34 +61,34 @@ endif()
6161
# Export cblas targets from the build tree, if any.
6262
set(_cblas_config_build_guard_target "")
6363
if(ALL_TARGETS)
64-
export(TARGETS ${ALL_TARGETS} FILE cblas-targets.cmake)
64+
export(TARGETS ${ALL_TARGETS} FILE ${CBLASLIB}-targets.cmake)
6565

6666
# Choose one of the cblas targets to use as a guard
6767
# for cblas-config.cmake to load targets from the build tree.
6868
list(GET ALL_TARGETS 0 _cblas_config_build_guard_target)
6969
endif()
7070

7171
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in
72-
${LAPACK_BINARY_DIR}/cblas-config-version.cmake @ONLY)
72+
${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake @ONLY)
7373
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in
74-
${LAPACK_BINARY_DIR}/cblas-config.cmake @ONLY)
74+
${LAPACK_BINARY_DIR}/${CBLASLIB}-config.cmake @ONLY)
7575

7676

77-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc @ONLY)
77+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc @ONLY)
7878
install(FILES
79-
${CMAKE_CURRENT_BINARY_DIR}/cblas.pc
79+
${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc
8080
DESTINATION ${PKG_CONFIG_DIR}
8181
)
8282

8383
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in
84-
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake @ONLY)
84+
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake @ONLY)
8585
install(FILES
86-
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake
87-
${LAPACK_BINARY_DIR}/cblas-config-version.cmake
88-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cblas-${LAPACK_VERSION}
86+
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake
87+
${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake
88+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
8989
)
9090

91-
#install(EXPORT cblas-targets
92-
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cblas-${LAPACK_VERSION}
91+
#install(EXPORT ${CBLASLIB}-targets
92+
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
9393
# COMPONENT Development
9494
# )

lapack-netlib/CBLAS/cblas.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Name: CBLAS
55
Description: C Standard Interface to BLAS Basic Linear Algebra Subprograms
66
Version: @LAPACK_VERSION@
77
URL: http://www.netlib.org/blas/#_cblas
8-
Libs: -L${libdir} -lcblas
8+
Libs: -L${libdir} -l@CBLASLIB@
99
Cflags: -I${includedir}
10-
Requires.private: blas
10+
Requires.private: @BLASLIB@

lapack-netlib/CBLAS/cmake/cblas-config-build.cmake.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ find_package(LAPACK NO_MODULE)
44

55
# Load lapack targets from the build tree, including lapacke targets.
66
if(NOT TARGET lapacke)
7-
include("@LAPACK_BINARY_DIR@/lapack-targets.cmake")
7+
include("@LAPACK_BINARY_DIR@/@LAPACKLIB@-targets.cmake")
88
endif()
99

1010
# Report cblas header search locations from build tree.
1111
set(CBLAS_INCLUDE_DIRS "@LAPACK_BINARY_DIR@/include")
1212

1313
# Report cblas libraries.
14-
set(CBLAS_LIBRARIES cblas)
14+
set(CBLAS_LIBRARIES @CBLASLIB@)

lapack-netlib/CBLAS/cmake/cblas-config-install.cmake.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ get_filename_component(_CBLAS_PREFIX "${_CBLAS_PREFIX}" PATH)
55
get_filename_component(_CBLAS_PREFIX "${_CBLAS_PREFIX}" PATH)
66

77
# Load the LAPACK package with which we were built.
8-
set(LAPACK_DIR "${_CBLAS_PREFIX}/@CMAKE_INSTALL_LIBDIR@/cmake/lapack-@LAPACK_VERSION@")
8+
set(LAPACK_DIR "${_CBLAS_PREFIX}/@CMAKE_INSTALL_LIBDIR@/cmake/@LAPACKLIB@-@LAPACK_VERSION@")
99
find_package(LAPACK NO_MODULE)
1010

1111
# Load lapacke targets from the install tree.
12-
if(NOT TARGET cblas)
13-
include(${_CBLAS_SELF_DIR}/cblas-targets.cmake)
12+
if(NOT TARGET @CBLASLIB@)
13+
include(${_CBLAS_SELF_DIR}/@CBLASLIB@-targets.cmake)
1414
endif()
1515

1616
# Report lapacke header search locations.
1717
set(CBLAS_INCLUDE_DIRS ${_CBLAS_PREFIX}/include)
1818

1919
# Report lapacke libraries.
20-
set(CBLAS_LIBRARIES cblas)
20+
set(CBLAS_LIBRARIES @CBLASLIB@)
2121

2222
unset(_CBLAS_PREFIX)
2323
unset(_CBLAS_SELF_DIR)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
add_executable(xexample1_CBLAS cblas_example1.c)
22
add_executable(xexample2_CBLAS cblas_example2.c)
33

4-
target_link_libraries(xexample1_CBLAS cblas)
5-
target_link_libraries(xexample2_CBLAS cblas ${BLAS_LIBRARIES})
4+
target_link_libraries(xexample1_CBLAS ${CBLASLIB})
5+
target_link_libraries(xexample2_CBLAS ${CBLASLIB} ${BLAS_LIBRARIES})
66

77
add_test(example1_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample1_CBLAS)
88
add_test(example2_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample2_CBLAS)

0 commit comments

Comments
 (0)