blob: 68122123b3efd8a9f1e62d8315d55acac738b8f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
message(STATUS "LAPACKE enable")
enable_language(C)
set(LAPACK_INSTALL_EXPORT_NAME lapacke-targets)
# Create a header file lapacke_mangling.h for the routines called in my C programs
include(FortranCInterface)
## Ensure that the fortran compiler and c compiler specified are compatible
FortranCInterface_VERIFY()
FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/lapacke_mangling.h
MACRO_NAMESPACE "LAPACK_"
SYMBOL_NAMESPACE "LAPACK_")
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
configure_file(include/lapacke_mangling_with_flags.h.in
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
endif()
if(WIN32 AND NOT UNIX)
add_definitions(-DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE)
message(STATUS "Windows BUILD")
endif()
get_directory_property(DirDefs COMPILE_DEFINITIONS)
include_directories(include ${LAPACK_BINARY_DIR}/include)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(utils)
macro(append_subdir_files variable dirname)
get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable})
foreach(depfile ${holder})
list(APPEND ${variable} "${dirname}/${depfile}")
endforeach()
endmacro()
append_subdir_files(LAPACKE_INCLUDE "include")
append_subdir_files(SOURCES "src")
append_subdir_files(DEPRECATED "src")
append_subdir_files(EXTENDED "src")
append_subdir_files(MATGEN "src")
append_subdir_files(UTILS "utils")
if(BUILD_DEPRECATED)
list(APPEND SOURCES ${DEPRECATED})
endif()
if(USE_XBLAS)
list(APPEND SOURCES ${EXTENDED})
endif()
if(LAPACKE_WITH_TMG)
list(APPEND SOURCES ${MATGEN})
endif()
list(APPEND SOURCES ${UTILS})
add_library(lapacke ${SOURCES})
set_target_properties(
lapacke PROPERTIES
LINKER_LANGUAGE C
VERSION ${LAPACK_VERSION}
SOVERSION ${LAPACK_MAJOR_VERSION}
)
if(LAPACKE_WITH_TMG)
target_link_libraries(lapacke PRIVATE tmglib)
endif()
target_link_libraries(lapacke PRIVATE ${LAPACK_LIBRARIES})
lapack_install_library(lapacke)
install(FILES ${LAPACKE_INCLUDE} ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(BUILD_TESTING)
add_subdirectory(example)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapacke.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc @ONLY)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc
DESTINATION ${PKG_CONFIG_DIR}
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-version.cmake.in
${LAPACK_BINARY_DIR}/lapacke-config-version.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-build.cmake.in
${LAPACK_BINARY_DIR}/lapacke-config.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-install.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/lapacke-config.cmake @ONLY)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/lapacke-config.cmake
${LAPACK_BINARY_DIR}/lapacke-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lapacke-${LAPACK_VERSION}
)
install(EXPORT lapacke-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lapacke-${LAPACK_VERSION})
|