create INDEX64 target

This commit is contained in:
Aisha Tammy 2020-11-01 02:43:56 +00:00 committed by Markus Mützel
parent 34ecd967a5
commit 3efbf968f1
23 changed files with 133 additions and 115 deletions

View File

@ -2,9 +2,9 @@ add_subdirectory(SRC)
if(BUILD_TESTING) if(BUILD_TESTING)
add_subdirectory(TESTING) add_subdirectory(TESTING)
endif() endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/blas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/blas.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/blas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${BLASLIB}.pc @ONLY)
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/blas.pc ${CMAKE_CURRENT_BINARY_DIR}/${BLASLIB}.pc
DESTINATION ${PKG_CONFIG_DIR} DESTINATION ${PKG_CONFIG_DIR}
COMPONENT Development COMPONENT Development
) )

View File

@ -97,10 +97,10 @@ if(BUILD_COMPLEX16)
endif() endif()
list(REMOVE_DUPLICATES SOURCES) list(REMOVE_DUPLICATES SOURCES)
add_library(blas ${SOURCES}) add_library(${BLASLIB} ${SOURCES})
set_target_properties( set_target_properties(
blas PROPERTIES ${BLASLIB} PROPERTIES
VERSION ${LAPACK_VERSION} VERSION ${LAPACK_VERSION}
SOVERSION ${LAPACK_MAJOR_VERSION} SOVERSION ${LAPACK_MAJOR_VERSION}
) )
lapack_install_library(blas) lapack_install_library(${BLASLIB})

View File

@ -2,7 +2,7 @@ macro(add_blas_test name src)
get_filename_component(baseNAME ${src} NAME_WE) get_filename_component(baseNAME ${src} NAME_WE)
set(TEST_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${baseNAME}.in") set(TEST_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${baseNAME}.in")
add_executable(${name} ${src}) add_executable(${name} ${src})
target_link_libraries(${name} blas) target_link_libraries(${name} ${BLASLIB})
if(EXISTS "${TEST_INPUT}") if(EXISTS "${TEST_INPUT}")
add_test(NAME BLAS-${name} COMMAND "${CMAKE_COMMAND}" add_test(NAME BLAS-${name} COMMAND "${CMAKE_COMMAND}"
-DTEST=$<TARGET_FILE:${name}> -DTEST=$<TARGET_FILE:${name}>

View File

@ -5,4 +5,4 @@ Name: BLAS
Description: FORTRAN reference implementation of BLAS Basic Linear Algebra Subprograms Description: FORTRAN reference implementation of BLAS Basic Linear Algebra Subprograms
Version: @LAPACK_VERSION@ Version: @LAPACK_VERSION@
URL: http://www.netlib.org/blas/ URL: http://www.netlib.org/blas/
Libs: -L${libdir} -lblas Libs: -L${libdir} -l@BLASLIB@

View File

@ -1,7 +1,7 @@
message(STATUS "CBLAS enable") message(STATUS "CBLAS enable")
enable_language(C) enable_language(C)
set(LAPACK_INSTALL_EXPORT_NAME cblas-targets) set(LAPACK_INSTALL_EXPORT_NAME ${CBLASLIB}-targets)
# Create a header file cblas.h for the routines called in my C programs # Create a header file cblas.h for the routines called in my C programs
include(FortranCInterface) include(FortranCInterface)
@ -42,15 +42,15 @@ if(BUILD_TESTING)
endif() endif()
if(NOT BLAS_FOUND) if(NOT BLAS_FOUND)
set(ALL_TARGETS ${ALL_TARGETS} blas) set(ALL_TARGETS ${ALL_TARGETS} ${BLASLIB})
endif() endif()
# Export cblas targets from the # Export cblas targets from the
# install tree, if any. # install tree, if any.
set(_cblas_config_install_guard_target "") set(_cblas_config_install_guard_target "")
if(ALL_TARGETS) if(ALL_TARGETS)
install(EXPORT cblas-targets install(EXPORT ${CBLASLIB}-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cblas-${LAPACK_VERSION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
COMPONENT Development COMPONENT Development
) )
# Choose one of the cblas targets to use as a guard for # Choose one of the cblas targets to use as a guard for
@ -61,7 +61,7 @@ endif()
# Export cblas targets from the build tree, if any. # Export cblas targets from the build tree, if any.
set(_cblas_config_build_guard_target "") set(_cblas_config_build_guard_target "")
if(ALL_TARGETS) if(ALL_TARGETS)
export(TARGETS ${ALL_TARGETS} FILE cblas-targets.cmake) export(TARGETS ${ALL_TARGETS} FILE ${CBLASLIB}-targets.cmake)
# Choose one of the cblas targets to use as a guard # Choose one of the cblas targets to use as a guard
# for cblas-config.cmake to load targets from the build tree. # for cblas-config.cmake to load targets from the build tree.
@ -69,26 +69,26 @@ if(ALL_TARGETS)
endif() endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in
${LAPACK_BINARY_DIR}/cblas-config-version.cmake @ONLY) ${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in
${LAPACK_BINARY_DIR}/cblas-config.cmake @ONLY) ${LAPACK_BINARY_DIR}/${CBLASLIB}-config.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc @ONLY)
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cblas.pc ${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc
DESTINATION ${PKG_CONFIG_DIR} DESTINATION ${PKG_CONFIG_DIR}
) )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake @ONLY)
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake
${LAPACK_BINARY_DIR}/cblas-config-version.cmake ${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cblas-${LAPACK_VERSION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
) )
#install(EXPORT cblas-targets #install(EXPORT ${CBLASLIB}-targets
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cblas-${LAPACK_VERSION} # DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
# COMPONENT Development # COMPONENT Development
# ) # )

View File

@ -5,6 +5,6 @@ Name: CBLAS
Description: C Standard Interface to BLAS Basic Linear Algebra Subprograms Description: C Standard Interface to BLAS Basic Linear Algebra Subprograms
Version: @LAPACK_VERSION@ Version: @LAPACK_VERSION@
URL: http://www.netlib.org/blas/#_cblas URL: http://www.netlib.org/blas/#_cblas
Libs: -L${libdir} -lcblas Libs: -L${libdir} -l@CBLASLIB@
Cflags: -I${includedir} Cflags: -I${includedir}
Requires.private: blas Requires.private: @BLASLIB@

View File

@ -4,11 +4,11 @@ find_package(LAPACK NO_MODULE)
# Load lapack targets from the build tree, including lapacke targets. # Load lapack targets from the build tree, including lapacke targets.
if(NOT TARGET lapacke) if(NOT TARGET lapacke)
include("@LAPACK_BINARY_DIR@/lapack-targets.cmake") include("@LAPACK_BINARY_DIR@/@LAPACKLIB@-targets.cmake")
endif() endif()
# Report cblas header search locations from build tree. # Report cblas header search locations from build tree.
set(CBLAS_INCLUDE_DIRS "@LAPACK_BINARY_DIR@/include") set(CBLAS_INCLUDE_DIRS "@LAPACK_BINARY_DIR@/include")
# Report cblas libraries. # Report cblas libraries.
set(CBLAS_LIBRARIES cblas) set(CBLAS_LIBRARIES @CBLASLIB@)

View File

@ -5,19 +5,19 @@ get_filename_component(_CBLAS_PREFIX "${_CBLAS_PREFIX}" PATH)
get_filename_component(_CBLAS_PREFIX "${_CBLAS_PREFIX}" PATH) get_filename_component(_CBLAS_PREFIX "${_CBLAS_PREFIX}" PATH)
# Load the LAPACK package with which we were built. # Load the LAPACK package with which we were built.
set(LAPACK_DIR "${_CBLAS_PREFIX}/@CMAKE_INSTALL_LIBDIR@/cmake/lapack-@LAPACK_VERSION@") set(LAPACK_DIR "${_CBLAS_PREFIX}/@CMAKE_INSTALL_LIBDIR@/cmake/@LAPACKLIB@-@LAPACK_VERSION@")
find_package(LAPACK NO_MODULE) find_package(LAPACK NO_MODULE)
# Load lapacke targets from the install tree. # Load lapacke targets from the install tree.
if(NOT TARGET cblas) if(NOT TARGET @CBLASLIB@)
include(${_CBLAS_SELF_DIR}/cblas-targets.cmake) include(${_CBLAS_SELF_DIR}/@CBLASLIB@-targets.cmake)
endif() endif()
# Report lapacke header search locations. # Report lapacke header search locations.
set(CBLAS_INCLUDE_DIRS ${_CBLAS_PREFIX}/include) set(CBLAS_INCLUDE_DIRS ${_CBLAS_PREFIX}/include)
# Report lapacke libraries. # Report lapacke libraries.
set(CBLAS_LIBRARIES cblas) set(CBLAS_LIBRARIES @CBLASLIB@)
unset(_CBLAS_PREFIX) unset(_CBLAS_PREFIX)
unset(_CBLAS_SELF_DIR) unset(_CBLAS_SELF_DIR)

View File

@ -1,8 +1,8 @@
add_executable(xexample1_CBLAS cblas_example1.c) add_executable(xexample1_CBLAS cblas_example1.c)
add_executable(xexample2_CBLAS cblas_example2.c) add_executable(xexample2_CBLAS cblas_example2.c)
target_link_libraries(xexample1_CBLAS cblas) target_link_libraries(xexample1_CBLAS ${CBLASLIB})
target_link_libraries(xexample2_CBLAS cblas ${BLAS_LIBRARIES}) target_link_libraries(xexample2_CBLAS ${CBLASLIB} ${BLAS_LIBRARIES})
add_test(example1_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample1_CBLAS) add_test(example1_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample1_CBLAS)
add_test(example2_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample2_CBLAS) add_test(example2_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample2_CBLAS)

View File

@ -11,7 +11,7 @@ int main ( )
double *a, *x, *y; double *a, *x, *y;
double alpha, beta; double alpha, beta;
int m, n, lda, incx, incy, i; CBLAS_INDEX m, n, lda, incx, incy, i;
Layout = CblasColMajor; Layout = CblasColMajor;
transa = CblasNoTrans; transa = CblasNoTrans;

View File

@ -9,7 +9,7 @@
int main (int argc, char **argv ) int main (int argc, char **argv )
{ {
int rout=-1,info=0,m,n,k,lda,ldb,ldc; CBLAS_INDEX rout=-1,info=0,m,n,k,lda,ldb,ldc;
double A[2] = {0.0,0.0}, double A[2] = {0.0,0.0},
B[2] = {0.0,0.0}, B[2] = {0.0,0.0},
C[2] = {0.0,0.0}, C[2] = {0.0,0.0},

View File

@ -113,16 +113,16 @@ if(BUILD_COMPLEX16)
endif() endif()
list(REMOVE_DUPLICATES SOURCES) list(REMOVE_DUPLICATES SOURCES)
add_library(cblas ${SOURCES}) add_library(${CBLASLIB} ${SOURCES})
set_target_properties( set_target_properties(
cblas PROPERTIES ${CBLASLIB} PROPERTIES
LINKER_LANGUAGE C LINKER_LANGUAGE C
VERSION ${LAPACK_VERSION} VERSION ${LAPACK_VERSION}
SOVERSION ${LAPACK_MAJOR_VERSION} SOVERSION ${LAPACK_MAJOR_VERSION}
) )
target_include_directories(cblas PUBLIC target_include_directories(${CBLASLIB} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
target_link_libraries(cblas PRIVATE ${BLAS_LIBRARIES}) target_link_libraries(${CBLASLIB} PRIVATE ${BLAS_LIBRARIES})
lapack_install_library(cblas) lapack_install_library(${CBLASLIB})

View File

@ -52,9 +52,9 @@ if(BUILD_SINGLE)
add_executable(xscblat2 c_sblat2.f ${STESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xscblat2 c_sblat2.f ${STESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
add_executable(xscblat3 c_sblat3.f ${STESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xscblat3 c_sblat3.f ${STESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
target_link_libraries(xscblat1 cblas) target_link_libraries(xscblat1 ${CBLASLIB})
target_link_libraries(xscblat2 cblas) target_link_libraries(xscblat2 ${CBLASLIB})
target_link_libraries(xscblat3 cblas) target_link_libraries(xscblat3 ${CBLASLIB})
add_cblas_test(stest1.out "" xscblat1) add_cblas_test(stest1.out "" xscblat1)
add_cblas_test(stest2.out sin2 xscblat2) add_cblas_test(stest2.out sin2 xscblat2)
@ -66,9 +66,9 @@ if(BUILD_DOUBLE)
add_executable(xdcblat2 c_dblat2.f ${DTESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xdcblat2 c_dblat2.f ${DTESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
add_executable(xdcblat3 c_dblat3.f ${DTESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xdcblat3 c_dblat3.f ${DTESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
target_link_libraries(xdcblat1 cblas) target_link_libraries(xdcblat1 ${CBLASLIB})
target_link_libraries(xdcblat2 cblas) target_link_libraries(xdcblat2 ${CBLASLIB})
target_link_libraries(xdcblat3 cblas) target_link_libraries(xdcblat3 ${CBLASLIB})
add_cblas_test(dtest1.out "" xdcblat1) add_cblas_test(dtest1.out "" xdcblat1)
add_cblas_test(dtest2.out din2 xdcblat2) add_cblas_test(dtest2.out din2 xdcblat2)
@ -80,9 +80,9 @@ if(BUILD_COMPLEX)
add_executable(xccblat2 c_cblat2.f ${CTESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xccblat2 c_cblat2.f ${CTESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
add_executable(xccblat3 c_cblat3.f ${CTESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xccblat3 c_cblat3.f ${CTESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
target_link_libraries(xccblat1 cblas ${BLAS_LIBRARIES}) target_link_libraries(xccblat1 ${CBLASLIB} ${BLAS_LIBRARIES})
target_link_libraries(xccblat2 cblas) target_link_libraries(xccblat2 ${CBLASLIB})
target_link_libraries(xccblat3 cblas) target_link_libraries(xccblat3 ${CBLASLIB})
add_cblas_test(ctest1.out "" xccblat1) add_cblas_test(ctest1.out "" xccblat1)
add_cblas_test(ctest2.out cin2 xccblat2) add_cblas_test(ctest2.out cin2 xccblat2)
@ -94,9 +94,9 @@ if(BUILD_COMPLEX16)
add_executable(xzcblat2 c_zblat2.f ${ZTESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xzcblat2 c_zblat2.f ${ZTESTL2O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
add_executable(xzcblat3 c_zblat3.f ${ZTESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h) add_executable(xzcblat3 c_zblat3.f ${ZTESTL3O} ${LAPACK_BINARY_DIR}/include/cblas_test.h)
target_link_libraries(xzcblat1 cblas) target_link_libraries(xzcblat1 ${CBLASLIB})
target_link_libraries(xzcblat2 cblas) target_link_libraries(xzcblat2 ${CBLASLIB})
target_link_libraries(xzcblat3 cblas) target_link_libraries(xzcblat3 ${CBLASLIB})
add_cblas_test(ztest1.out "" xzcblat1) add_cblas_test(ztest1.out "" xzcblat1)
add_cblas_test(ztest2.out zin2 xzcblat2) add_cblas_test(ztest2.out zin2 xzcblat2)

View File

@ -1,7 +1,7 @@
# Load lapack targets from the build tree if necessary. # Load lapack targets from the build tree if necessary.
set(_LAPACK_TARGET "@_lapack_config_build_guard_target@") set(_LAPACK_TARGET "@_lapack_config_build_guard_target@")
if(_LAPACK_TARGET AND NOT TARGET "${_LAPACK_TARGET}") if(_LAPACK_TARGET AND NOT TARGET "${_LAPACK_TARGET}")
include("@LAPACK_BINARY_DIR@/lapack-targets.cmake") include("@LAPACK_BINARY_DIR@/@LAPACKLIB@-targets.cmake")
endif() endif()
unset(_LAPACK_TARGET) unset(_LAPACK_TARGET)

View File

@ -4,7 +4,7 @@ get_filename_component(_LAPACK_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Load lapack targets from the install tree if necessary. # Load lapack targets from the install tree if necessary.
set(_LAPACK_TARGET "@_lapack_config_install_guard_target@") set(_LAPACK_TARGET "@_lapack_config_install_guard_target@")
if(_LAPACK_TARGET AND NOT TARGET "${_LAPACK_TARGET}") if(_LAPACK_TARGET AND NOT TARGET "${_LAPACK_TARGET}")
include("${_LAPACK_SELF_DIR}/lapack-targets.cmake") include("${_LAPACK_SELF_DIR}/@LAPACKLIB@-targets.cmake")
endif() endif()
unset(_LAPACK_TARGET) unset(_LAPACK_TARGET)

View File

@ -44,6 +44,24 @@ endif()
# By default static library # By default static library
option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# By default build index32 library
option(BUILD_INDEX64 "Build Index-64 API libraries" OFF)
if(BUILD_INDEX64)
set(BLASLIB "blas64")
set(CBLASLIB "cblas64")
set(LAPACKLIB "lapack64")
set(LAPACKELIB "lapacke64")
set(TMGLIB "tmglib64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWeirdNEC -DLAPACK_ILP64 -DHAVE_LAPACK_CONFIG_H")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8")
else()
set(BLASLIB "blas")
set(CBLASLIB "cblas")
set(LAPACKLIB "lapack")
set(LAPACKELIB "lapacke")
set(TMGLIB "tmglib")
endif()
include(GNUInstallDirs) include(GNUInstallDirs)
# Updated OSX RPATH settings # Updated OSX RPATH settings
@ -73,10 +91,10 @@ include(PreventInBuildInstalls)
if(UNIX) if(UNIX)
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel) if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
list(APPEND CMAKE_Fortran_FLAGS "-fp-model strict") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
endif() endif()
if(CMAKE_Fortran_COMPILER_ID STREQUAL XL) if(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
list(APPEND CMAKE_Fortran_FLAGS "-qnosave -qstrict=none") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none")
endif() endif()
# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler. # Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin # This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
@ -112,7 +130,7 @@ endif()
# -------------------------------------------------- # --------------------------------------------------
set(LAPACK_INSTALL_EXPORT_NAME lapack-targets) set(LAPACK_INSTALL_EXPORT_NAME ${LAPACKLIB}-targets)
macro(lapack_install_library lib) macro(lapack_install_library lib)
install(TARGETS ${lib} install(TARGETS ${lib}
@ -220,7 +238,7 @@ endif()
if(NOT BLAS_FOUND) if(NOT BLAS_FOUND)
message(STATUS "Using supplied NETLIB BLAS implementation") message(STATUS "Using supplied NETLIB BLAS implementation")
add_subdirectory(BLAS) add_subdirectory(BLAS)
set(BLAS_LIBRARIES blas) set(BLAS_LIBRARIES ${BLASLIB})
else() else()
set(CMAKE_EXE_LINKER_FLAGS set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}" "${CMAKE_EXE_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}"
@ -279,7 +297,7 @@ endif()
# Neither user specified or optimized LAPACK libraries can be used # Neither user specified or optimized LAPACK libraries can be used
if(NOT LATESTLAPACK_FOUND) if(NOT LATESTLAPACK_FOUND)
message(STATUS "Using supplied NETLIB LAPACK implementation") message(STATUS "Using supplied NETLIB LAPACK implementation")
set(LAPACK_LIBRARIES lapack) set(LAPACK_LIBRARIES ${LAPACKLIB})
add_subdirectory(SRC) add_subdirectory(SRC)
else() else()
set(CMAKE_EXE_LINKER_FLAGS set(CMAKE_EXE_LINKER_FLAGS
@ -371,23 +389,23 @@ include(CPack)
# -------------------------------------------------- # --------------------------------------------------
if(NOT BLAS_FOUND) if(NOT BLAS_FOUND)
set(ALL_TARGETS ${ALL_TARGETS} blas) set(ALL_TARGETS ${ALL_TARGETS} ${BLASLIB})
endif() endif()
if(NOT LATESTLAPACK_FOUND) if(NOT LATESTLAPACK_FOUND)
set(ALL_TARGETS ${ALL_TARGETS} lapack) set(ALL_TARGETS ${ALL_TARGETS} ${LAPACKLIB})
endif() endif()
if(BUILD_TESTING OR LAPACKE_WITH_TMG) if(BUILD_TESTING OR LAPACKE_WITH_TMG)
set(ALL_TARGETS ${ALL_TARGETS} tmglib) set(ALL_TARGETS ${ALL_TARGETS} ${TMGLIB})
endif() endif()
# Export lapack targets, not including lapacke, from the # Export lapack targets, not including lapacke, from the
# install tree, if any. # install tree, if any.
set(_lapack_config_install_guard_target "") set(_lapack_config_install_guard_target "")
if(ALL_TARGETS) if(ALL_TARGETS)
install(EXPORT lapack-targets install(EXPORT ${LAPACKLIB}-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lapack-${LAPACK_VERSION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKLIB}-${LAPACK_VERSION}
COMPONENT Development COMPONENT Development
) )
@ -398,18 +416,18 @@ endif()
# Include cblas in targets exported from the build tree. # Include cblas in targets exported from the build tree.
if(CBLAS) if(CBLAS)
set(ALL_TARGETS ${ALL_TARGETS} cblas) set(ALL_TARGETS ${ALL_TARGETS} ${CBLASLIB})
endif() endif()
# Include lapacke in targets exported from the build tree. # Include lapacke in targets exported from the build tree.
if(LAPACKE) if(LAPACKE)
set(ALL_TARGETS ${ALL_TARGETS} lapacke) set(ALL_TARGETS ${ALL_TARGETS} ${LAPACKELIB})
endif() endif()
# Export lapack and lapacke targets from the build tree, if any. # Export lapack and lapacke targets from the build tree, if any.
set(_lapack_config_build_guard_target "") set(_lapack_config_build_guard_target "")
if(ALL_TARGETS) if(ALL_TARGETS)
export(TARGETS ${ALL_TARGETS} FILE lapack-targets.cmake) export(TARGETS ${ALL_TARGETS} FILE ${LAPACKLIB}-targets.cmake)
# Choose one of the lapack or lapacke targets to use as a guard # Choose one of the lapack or lapacke targets to use as a guard
# for lapack-config.cmake to load targets from the build tree. # for lapack-config.cmake to load targets from the build tree.
@ -417,30 +435,30 @@ if(ALL_TARGETS)
endif() endif()
configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-build.cmake.in configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-build.cmake.in
${LAPACK_BINARY_DIR}/lapack-config.cmake @ONLY) ${LAPACK_BINARY_DIR}/${LAPACKLIB}-config.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapack.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lapack.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapack.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}.pc @ONLY)
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/lapack.pc ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}.pc
DESTINATION ${PKG_CONFIG_DIR} DESTINATION ${PKG_CONFIG_DIR}
COMPONENT Development COMPONENT Development
) )
configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-install.cmake.in configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-install.cmake.in
${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake @ONLY) ${LAPACK_BINARY_DIR}/CMakeFiles/${LAPACKLIB}-config.cmake @ONLY)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
write_basic_package_version_file( write_basic_package_version_file(
${LAPACK_BINARY_DIR}/lapack-config-version.cmake ${LAPACK_BINARY_DIR}/${LAPACKLIB}-config-version.cmake
VERSION ${LAPACK_VERSION} VERSION ${LAPACK_VERSION}
COMPATIBILITY SameMajorVersion COMPATIBILITY SameMajorVersion
) )
install(FILES install(FILES
${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake ${LAPACK_BINARY_DIR}/CMakeFiles/${LAPACKLIB}-config.cmake
${LAPACK_BINARY_DIR}/lapack-config-version.cmake ${LAPACK_BINARY_DIR}/${LAPACKLIB}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lapack-${LAPACK_VERSION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKLIB}-${LAPACK_VERSION}
COMPONENT Development COMPONENT Development
) )

View File

@ -1,7 +1,7 @@
message(STATUS "LAPACKE enable") message(STATUS "LAPACKE enable")
enable_language(C) enable_language(C)
set(LAPACK_INSTALL_EXPORT_NAME lapacke-targets) set(LAPACK_INSTALL_EXPORT_NAME ${LAPACKELIB}-targets)
# Create a header file lapacke_mangling.h for the routines called in my C programs # Create a header file lapacke_mangling.h for the routines called in my C programs
include(FortranCInterface) include(FortranCInterface)
@ -72,28 +72,28 @@ if(LAPACKE_WITH_TMG)
endif() endif()
list(APPEND SOURCES ${UTILS}) list(APPEND SOURCES ${UTILS})
add_library(lapacke ${SOURCES}) add_library(${LAPACKELIB} ${SOURCES})
set_target_properties( set_target_properties(
lapacke PROPERTIES ${LAPACKELIB} PROPERTIES
LINKER_LANGUAGE C LINKER_LANGUAGE C
VERSION ${LAPACK_VERSION} VERSION ${LAPACK_VERSION}
SOVERSION ${LAPACK_MAJOR_VERSION} SOVERSION ${LAPACK_MAJOR_VERSION}
) )
target_include_directories(lapacke PUBLIC target_include_directories(${LAPACKELIB} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
if(WIN32 AND NOT UNIX) if(WIN32 AND NOT UNIX)
target_compile_definitions(lapacke PUBLIC HAVE_LAPACK_CONFIG_H LAPACK_COMPLEX_STRUCTURE) target_compile_definitions(${LAPACKELIB} PUBLIC HAVE_LAPACK_CONFIG_H LAPACK_COMPLEX_STRUCTURE)
message(STATUS "Windows BUILD") message(STATUS "Windows BUILD")
endif() endif()
if(LAPACKE_WITH_TMG) if(LAPACKE_WITH_TMG)
target_link_libraries(lapacke PRIVATE tmglib) target_link_libraries(${LAPACKELIB} PRIVATE ${TMGLIB})
endif() endif()
target_link_libraries(lapacke PRIVATE ${LAPACK_LIBRARIES}) target_link_libraries(${LAPACKELIB} PRIVATE ${LAPACK_LIBRARIES})
lapack_install_library(lapacke) lapack_install_library(${LAPACKELIB})
install( install(
FILES ${LAPACKE_INCLUDE} ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h FILES ${LAPACKE_INCLUDE} ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
@ -105,28 +105,28 @@ if(BUILD_TESTING)
endif() endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapacke.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapacke.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKELIB}.pc @ONLY)
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKELIB}.pc
DESTINATION ${PKG_CONFIG_DIR} DESTINATION ${PKG_CONFIG_DIR}
COMPONENT Development COMPONENT Development
) )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-version.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-version.cmake.in
${LAPACK_BINARY_DIR}/lapacke-config-version.cmake @ONLY) ${LAPACK_BINARY_DIR}/${LAPACKELIB}-config-version.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-build.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-build.cmake.in
${LAPACK_BINARY_DIR}/lapacke-config.cmake @ONLY) ${LAPACK_BINARY_DIR}/${LAPACKELIB}-config.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-install.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-install.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/lapacke-config.cmake @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${LAPACKELIB}-config.cmake @ONLY)
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/lapacke-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${LAPACKELIB}-config.cmake
${LAPACK_BINARY_DIR}/lapacke-config-version.cmake ${LAPACK_BINARY_DIR}/${LAPACKELIB}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lapacke-${LAPACK_VERSION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKELIB}-${LAPACK_VERSION}
COMPONENT Development COMPONENT Development
) )
install(EXPORT lapacke-targets install(EXPORT ${LAPACKELIB}-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lapacke-${LAPACK_VERSION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKELIB}-${LAPACK_VERSION}
COMPONENT Development COMPONENT Development
) )

View File

@ -3,8 +3,8 @@ set(LAPACK_DIR "@LAPACK_BINARY_DIR@")
find_package(LAPACK NO_MODULE) find_package(LAPACK NO_MODULE)
# Load lapack targets from the build tree, including lapacke targets. # Load lapack targets from the build tree, including lapacke targets.
if(NOT TARGET lapacke) if(NOT TARGET @LAPACKELIB@)
include("@LAPACK_BINARY_DIR@/lapack-targets.cmake") include("@LAPACK_BINARY_DIR@/@LAPACKLIB@-targets.cmake")
endif() endif()
# Hint for project building against lapack # Hint for project building against lapack
@ -14,4 +14,4 @@ set(LAPACKE_Fortran_COMPILER_ID ${LAPACK_Fortran_COMPILER_ID})
set(LAPACKE_INCLUDE_DIRS "@LAPACK_BINARY_DIR@/include") set(LAPACKE_INCLUDE_DIRS "@LAPACK_BINARY_DIR@/include")
# Report lapacke libraries. # Report lapacke libraries.
set(LAPACKE_LIBRARIES lapacke ${LAPACK_LIBRARIES}) set(LAPACKE_LIBRARIES @LAPACKELIB@ ${LAPACK_LIBRARIES})

View File

@ -5,12 +5,12 @@ get_filename_component(_LAPACKE_PREFIX "${_LAPACKE_PREFIX}" PATH)
get_filename_component(_LAPACKE_PREFIX "${_LAPACKE_PREFIX}" PATH) get_filename_component(_LAPACKE_PREFIX "${_LAPACKE_PREFIX}" PATH)
# Load the LAPACK package with which we were built. # Load the LAPACK package with which we were built.
set(LAPACK_DIR "${_LAPACKE_PREFIX}/@CMAKE_INSTALL_LIBDIR@/cmake/lapack-@LAPACK_VERSION@") set(LAPACK_DIR "${_LAPACKE_PREFIX}/@CMAKE_INSTALL_LIBDIR@/cmake/@LAPACK@-@LAPACK_VERSION@")
find_package(LAPACK NO_MODULE) find_package(LAPACK NO_MODULE)
# Load lapacke targets from the install tree. # Load lapacke targets from the install tree.
if(NOT TARGET lapacke) if(NOT TARGET @LAPACKELIB@)
include(${_LAPACKE_SELF_DIR}/lapacke-targets.cmake) include(${_LAPACKE_SELF_DIR}/@LAPACKELIB@-targets.cmake)
endif() endif()
# Hint for project building against lapack # Hint for project building against lapack
@ -20,7 +20,7 @@ set(LAPACKE_Fortran_COMPILER_ID ${LAPACK_Fortran_COMPILER_ID})
set(LAPACKE_INCLUDE_DIRS ${_LAPACKE_PREFIX}/include) set(LAPACKE_INCLUDE_DIRS ${_LAPACKE_PREFIX}/include)
# Report lapacke libraries. # Report lapacke libraries.
set(LAPACKE_LIBRARIES lapacke ${LAPACK_LIBRARIES}) set(LAPACKE_LIBRARIES @LAPACKELIB@ ${LAPACK_LIBRARIES})
unset(_LAPACKE_PREFIX) unset(_LAPACKE_PREFIX)
unset(_LAPACKE_SELF_DIR) unset(_LAPACKE_SELF_DIR)

View File

@ -3,10 +3,10 @@ add_executable(xexample_DGESV_colmajor example_DGESV_colmajor.c lapacke_example_
add_executable(xexample_DGELS_rowmajor example_DGELS_rowmajor.c lapacke_example_aux.c lapacke_example_aux.h) add_executable(xexample_DGELS_rowmajor example_DGELS_rowmajor.c lapacke_example_aux.c lapacke_example_aux.h)
add_executable(xexample_DGELS_colmajor example_DGELS_colmajor.c lapacke_example_aux.c lapacke_example_aux.h) add_executable(xexample_DGELS_colmajor example_DGELS_colmajor.c lapacke_example_aux.c lapacke_example_aux.h)
target_link_libraries(xexample_DGESV_rowmajor lapacke) target_link_libraries(xexample_DGESV_rowmajor ${LAPACKELIB})
target_link_libraries(xexample_DGESV_colmajor lapacke) target_link_libraries(xexample_DGESV_colmajor ${LAPACKELIB})
target_link_libraries(xexample_DGELS_rowmajor lapacke) target_link_libraries(xexample_DGELS_rowmajor ${LAPACKELIB})
target_link_libraries(xexample_DGELS_colmajor lapacke) target_link_libraries(xexample_DGELS_colmajor ${LAPACKELIB})
add_test(example_DGESV_rowmajor ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample_DGESV_rowmajor) add_test(example_DGESV_rowmajor ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample_DGESV_rowmajor)
add_test(example_DGESV_colmajor ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample_DGESV_colmajor) add_test(example_DGESV_colmajor ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample_DGESV_colmajor)

View File

@ -5,6 +5,6 @@ Name: LAPACKE
Description: C Standard Interface to LAPACK Linear Algebra PACKage Description: C Standard Interface to LAPACK Linear Algebra PACKage
Version: @LAPACK_VERSION@ Version: @LAPACK_VERSION@
URL: http://www.netlib.org/lapack/#_standard_c_language_apis_for_lapack URL: http://www.netlib.org/lapack/#_standard_c_language_apis_for_lapack
Libs: -L${libdir} -llapacke Libs: -L${libdir} -l@LAPACKELIB@
Cflags: -I${includedir} Cflags: -I${includedir}
Requires.private: lapack Requires.private: @LAPACKLIB@

View File

@ -500,21 +500,21 @@ if(BUILD_COMPLEX16)
endif() endif()
list(REMOVE_DUPLICATES SOURCES) list(REMOVE_DUPLICATES SOURCES)
add_library(lapack ${SOURCES}) add_library(${LAPACKLIB} ${SOURCES})
set_target_properties( set_target_properties(
lapack PROPERTIES ${LAPACKLIB} PROPERTIES
VERSION ${LAPACK_VERSION} VERSION ${LAPACK_VERSION}
SOVERSION ${LAPACK_MAJOR_VERSION} SOVERSION ${LAPACK_MAJOR_VERSION}
) )
if(USE_XBLAS) if(USE_XBLAS)
target_link_libraries(lapack PRIVATE ${XBLAS_LIBRARY}) target_link_libraries(${LAPACKLIB} PRIVATE ${XBLAS_LIBRARY})
endif() endif()
target_link_libraries(lapack PRIVATE ${BLAS_LIBRARIES}) target_link_libraries(${LAPACKLIB} PRIVATE ${BLAS_LIBRARIES})
if(_is_coverage_build) if(_is_coverage_build)
target_link_libraries(lapack PRIVATE gcov) target_link_libraries(${LAPACKLIB} PRIVATE gcov)
add_coverage(lapack) add_coverage(${LAPACKLIB})
endif() endif()
lapack_install_library(lapack) lapack_install_library(${LAPACKLIB})

View File

@ -47,6 +47,6 @@ if(BUILD_COMPLEX16)
endif() endif()
list(REMOVE_DUPLICATES SOURCES) list(REMOVE_DUPLICATES SOURCES)
add_library(tmglib ${SOURCES}) add_library(${TMGLIB} ${SOURCES})
target_link_libraries(tmglib ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}) target_link_libraries(${TMGLIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
lapack_install_library(tmglib) lapack_install_library(${TMGLIB})