-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
511 lines (421 loc) · 17.5 KB
/
CMakeLists.txt
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
cmake_minimum_required(VERSION 3.9.0)
INCLUDE(libcscutils/CMakeModules/CheckPolicy.cmake)
CheckPolicy(CMP0048 NEW)
PROJECT(FlexiBLAS LANGUAGES C Fortran VERSION 3.4.4)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0069 NEW)
#
# FlexiBLAS version setup
#
SET(FLEXIBLAS_VERSION "${FlexiBLAS_VERSION}")
SET(FLEXIBLAS_VERSION_MAJOR ${FlexiBLAS_VERSION_MAJOR})
SET(FLEXIBLAS_VERSION_MINOR ${FlexiBLAS_VERSION_MINOR})
SET(FLEXIBLAS_VERSION_PATCH ${FlexiBLAS_VERSION_PATCH})
IF ( NOT FLEXIBLAS_VERSION_PATCH )
SET(FLEXIBLAS_VERSION_PATCH "0")
ENDIF()
SET(FLEXIBLAS_YEARS "2013-2024")
MESSAGE(STATUS "Configuring FlexiBLAS ${FlexiBLAS_VERSION_MAJOR}.${FlexiBLAS_VERSION_MINOR}.${FlexiBLAS_VERSION_PATCH}")
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/libcscutils/CMakeModules ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
INCLUDE (CheckFeatureNeeded)
INCLUDE (PreventInSourceBuilds)
INCLUDE (PreventInBuildInstalls)
INCLUDE (CMakeHelpers)
INCLUDE (CheckIPOSupported)
#
# Options
#
OPTION(TESTS "Enable Tests" ON)
OPTION(CBLAS "Enable CBLAS Interface" ON )
OPTION(INTEGER8 "Use 8 Byte Integer" OFF)
OPTION(BUILD_SHARED_LIBS "Enable Shared Library" ON)
OPTION(LAPACK "Enable LAPACK Support" ON)
OPTION(DEV "Development Build" OFF)
OPTION(MKL_BUILDER "Build MKL support with Intel MKLs Custom library builder" OFF)
OPTION(EXAMPLES "Build Examples" ON)
OPTION(BLAS_AUTO_DETECT "Enabled the BLAS auto detection during configuration" ON)
OPTION(LINK_OPENMP "Link OpenMP to FlexiBLAS" OFF)
OPTION(LTO "Enable Link Time Optimization / IPO" ON)
IF (NOT DEFINED FLEXIBLAS_DEFAULT_BLAS)
SET(FLEXIBLAS_DEFAULT_BLAS "NETLIB")
ELSE()
STRING (TOUPPER "${FLEXIBLAS_DEFAULT_BLAS}" FLEXIBLAS_DEFAULT_BLAS)
ENDIF()
#
# build type
#
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE "Release" )
ENDIF( NOT CMAKE_BUILD_TYPE )
IF ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
SET ( DEBUG "ON" )
ENDIF ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
#
# Paths
#
INCLUDE(GNUInstallDirs)
IF(DEFINED SYSCONFDIR)
SET(CMAKE_INSTALL_FULL_SYSCONFDIR ${SYSCONFDIR})
ENDIF()
MESSAGE(STATUS "SYSCONFDIR: ${CMAKE_INSTALL_FULL_SYSCONFDIR}")
MESSAGE(STATUS "LIBDIR: ${CMAKE_INSTALL_FULL_LIBDIR}")
MESSAGE(STATUS "BINDIR: ${CMAKE_INSTALL_FULL_BINDIR}")
MESSAGE(STATUS "INCLUDEDIR: ${CMAKE_INSTALL_FULL_INCLUDEDIR}")
MESSAGE(STATUS "MANDIR: ${CMAKE_INSTALL_FULL_MANDIR}")
MESSAGE(STATUS "Compiler_ID: ${CMAKE_C_COMPILER_ID}")
MESSAGE(STATUS "FCompiler_ID: ${CMAKE_Fortran_COMPILER_ID}")
#
# Compiler Settings
#
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
INCLUDE(CCompilerSettings)
INCLUDE(FortranCompilerSettings)
# Check C Compiler Version
IF ( CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0.0" )
MESSAGE_COLOR(STATUS COLOR_BOLD_RED "Your gcc is older than version 5.0.0. LAPACK will be loaded using DEEPBIND")
ADD_DEFINITIONS(-DLAPACK_DEEP_BIND)
ENDIF()
IF ( (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
OR (CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM" AND CMAKE_Fortran_COMPILER_ID STREQUAL "Intel"))
MESSAGE_COLOR(FATAL_ERROR COLOR_BOLD_RED "Mixing Classic and LLVM based Intel compilers is not possible. Specify proper C and Fortran Compilers.")
ENDIF()
INCLUDE(ccache)
#SET(BUILD_SHARED_LIBS ON)
SET(LIBS m)
INCLUDE(CheckCCompilerFlag)
INCLUDE(CheckFortranCompilerFlag)
INCLUDE(EnablePedanticC)
INCLUDE(EnableStrictPrototypesC)
INCLUDE(EnableCastQual)
IF (LTO STREQUAL ON )
check_ipo_supported(RESULT IPO_SUPPORT OUTPUT IPO_OUTPUT LANGUAGES C Fortran)
IF (IPO_SUPPORT)
MESSAGE(STATUS "LTO/IPO enabled.")
SET(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
ELSE()
MESSAGE(STATUS "IPO_SUPPORT not available: ${IPO_OUTPUT}")
ENDIF()
ENDIF()
SET(CMAKE_C_STANDARD_REQUIRED 1)
SET(CMAKE_C_STANDARD 99)
IF ( ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
check_c_compiler_flag("-fstack-protector-strong" C_STACK_PROTECTOR)
check_c_compiler_flag("-fstack-clash-protection" C_STACK_CLASH)
check_c_compiler_flag("-Wlto-type-mismatch" C_W_LTO_TYPE_MISMATCH)
check_c_compiler_flag("-Wunused-parameter" C_W_UNUSED_PARAMETER)
check_c_compiler_flag("-Wunused-but-set-parameter" C_W_UNUSED_BUT_SET_PARAMETER)
check_fortran_compiler_flag("-fstack-protector-strong" FC_STACK_PROTECTOR)
check_fortran_compiler_flag("-fstack-clash-protection" FC_STACK_CLASH)
check_fortran_compiler_flag("-Wlto-type-mismatch" FC_W_LTO_TYPE_MISMATCH)
check_fortran_compiler_flag("-Wunused-parameter" FC_W_UNUSED_PARAMETER)
check_fortran_compiler_flag("-Wunused-but-set-parameter" FC_W_UNUSED_BUT_SET_PARAMETER)
IF(C_STACK_PROTECTOR)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong")
ENDIF()
IF (C_STACK_CLASH)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-clash-protection")
ENDIF()
IF (C_W_LTO_TYPE_MISMATCH)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlto-type-mismatch")
ENDIF()
IF (C_W_UNUSED_PARAMETER)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter")
ENDIF()
IF (C_W_UNUSED_BUT_SET_PARAMETER)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-parameter")
ENDIF()
IF(FC_STACK_PROTECTOR)
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fstack-protector-strong")
ENDIF()
IF (FC_STACK_CLASH)
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fstack-clash-protection")
ENDIF()
IF (FC_W_LTO_TYPE_MISMATCH)
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wlto-type-mismatch")
ENDIF()
IF (FC_W_UNUSED_PARAMETER)
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wunused-parameter")
ENDIF()
IF (FC_W_UNUSED_BUT_SET_PARAMETER)
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wunused-but-set-parameter")
ENDIF()
ENDIF()
IF (DEBUG STREQUAL ON)
SET( CMAKE_BUILD_TYPE "Debug" )
SET ( DEBUG TRUE)
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDEBUG")
ENDIF (DEBUG STREQUAL ON )
IF (LINK_OPENMP)
FIND_PACKAGE(OpenMP REQUIRED)
if(NOT TARGET OpenMP::OpenMP_C)
find_package(Threads REQUIRED)
add_library(OpenMP::OpenMP_C IMPORTED INTERFACE)
set_property(TARGET OpenMP::OpenMP_C
PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_C_FLAGS})
# Only works if the same flag is passed to the linker; use CMake 3.9+ otherwise (Intel, AppleClang)
set_property(TARGET OpenMP::OpenMP_C
PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_C_FLAGS} Threads::Threads)
endif()
ENDIF()
IF (NOT DEFINED ABI)
IF ( ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM")
SET(ABI "Intel" CACHE STRING "ABI of the Fortran Interface")
ELSEIF ( ${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI" )
SET(ABI "Intel" CACHE STRING "ABI of the Fortran Interface")
ELSEIF ( ${CMAKE_Fortran_COMPILER_ID} STREQUAL "XL" )
SET(ABI "XL" CACHE STREQUAL "ABI of the Fortran Interface")
ELSE()
SET(USE_INTERFACE_INTEL FALSE)
SET(ABI "GNU" CACHE STRING "ABI of the Fortran Interface")
ENDIF()
ELSE()
IF (NOT ( ABI STREQUAL "GNU" OR ABI STREQUAL "Intel" OR ABI STREQUAL "XL"))
MESSAGE(FATAL_ERROR "ABI must be GNU or Intel")
ENDIF()
ENDIF()
IF ( ABI STREQUAL "Intel")
SET(FLEXIBLAS_ABI_INTEL TRUE)
SET(USE_INTERFACE_INTEL TRUE)
ELSEIF ( ABI STREQUAL "XL" )
SET(FLEXIBLAS_ABI_IBM TRUE)
ELSE ()
SET (FLEXIBLAS_ABI_GNU TRUE)
SET(USE_INTERFACE_INTEL FALSE)
ENDIF()
# Name Mangling
include(FortranCInterface)
FortranCInterface_HEADER(${PROJECT_BINARY_DIR}/include/flexiblas_fortran_mangle.h
MACRO_NAMESPACE "FC_"
SYMBOL_NAMESPACE "FC_")
FortranCInterface_VERIFY()
include(CheckThreadLocal)
IF (DEFINED FALLBACK)
SET (FALLBACK_NAME "${FALLBACK}")
ELSE()
SET (FALLBACK_NAME FALSE)
ENDIF()
SET ( INCLUDE_DIR ${INCLUDE_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR} )
LIST(REMOVE_DUPLICATES INCLUDE_DIR)
IF (APPLE)
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64 ")
SET ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic -Wl,-export_dynamic")
ELSE()
IF (WIN32)
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64 -Wall")
ELSE ()
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
IF ( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic -Wl,--export-dynamic")
ENDIF()
# SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64 ")
ENDIF()
ENDIF()
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64 ")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#
# Check Some files
#
INCLUDE (CheckIncludeFiles)
IF (WIN32)
MESSAGE(STATUS "Building Windows Version" )
IF (MINGW)
MESSAGE(STATUS "Using MingW Compiler")
ENDIF()
SET(DL_LIB "")
ELSE()
# CHECK_INCLUDE_FILES (stdatomic.h HAVE_STDATOMIC_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (sys/sysmacro.h HAVE_SYSMACRO_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
INCLUDE (CheckSymbolExists)
CHECK_SYMBOL_EXISTS(RTLD_GLOBAL "dlfcn.h" HAVE_RTLD_GLOBAL)
CHECK_SYMBOL_EXISTS(RTLD_DEEPBIND "dlfcn.h" HAVE_RTLD_DEEPBIND)
CHECK_SYMBOL_EXISTS(RTLD_NOW "dlfcn.h" HAVE_RTLD_NOW)
CHECK_SYMBOL_EXISTS(RTLD_NODELETE "dlfcn.h" HAVE_RTLD_NODELETE)
INCLUDE (CheckFunctionExists)
CHECK_FUNCTION_EXISTS(dlopen DLOPEN_C)
SET(__CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
SET(CMAKE_REQUIRED_LIBRARIES dl)
CHECK_FUNCTION_EXISTS(dlopen DLOPEN_DL)
SET(CMAKE_REQUIRED_LIBRARIES ${__CMAKE_REQUIRED_LIBRARIES})
IF (DLOPEN_DL)
SET(LIBS ${LIBS} dl)
SET(DL_LIB dl)
ENDIF()
IF (NOT ( DLOPEN_DL OR DLOPEN_C ) )
MESSAGE(ERROR "No dlopen function found")
ENDIF()
IF ( NOT HAVE_DLFCN_H )
MESSAGE(FATAL_ERROR "dlfcn.h not found, aborting")
ENDIF()
IF ( NOT HAVE_RTLD_NODELETE )
MESSAGE(WARNING "RTLD_NODELETE not found in your C library. Consider setting -DLINK_OPENMP=ON")
ENDIF()
ENDIF()
INCLUDE(CheckAttributeExists)
Check_Attribute_Exists( constructor HAVE_ATTR_CONSTRUCTOR)
Check_Attribute_Exists( "alias(\"foo\")" HAVE_ATTR_ALIAS)
Check_Attribute_Exists( "visibility(\"hidden\")" HAVE_ATTR_HIDDEN)
Check_Attribute_Exists( "visibility(\"default\")" HAVE_ATTR_DEFAULT)
Check_Attribute_Exists( unused HAVE_ATTR_UNUSED )
SET(EXTRA_BLAS "")
### libcscutils
SET(CSCUTILS_FEATURES "inifile;ds")
SET(CSCUTILS_OBJECT TRUE)
add_subdirectory(libcscutils)
SET(LIBS ${LIBS})
SET(INCLUDE_DIR ${INCLUDE_DIR} "${PROJECT_SOURCE_DIR}/libcscutils/include" "${PROJECT_BINARY_DIR}/libcscutils/include")
IF (CBLAS STREQUAL ON)
ADD_DEFINITIONS(-DFLEXIBLAS_CBLAS)
ENDIF()
### Setup Integer8 option
IF ( INTEGER8 STREQUAL ON )
ADD_DEFINITIONS(-DINTEGER8)
SET(FLEXIBLAS_INTEGER8 TRUE)
SET(FLEXIBLAS_INCLUDE_PREFIX "flexiblas64")
SET(FLEXIBLAS_LIBRARY_DIR "flexiblas64")
SET(FLEXIBLAS_PKG_CONFIG "flexiblas64.pc")
SET(FLEXIBLAS_API_PKG_CONFIG "flexiblas64_api.pc")
SET(FLEXIBLAS_LIBRARY_NAME "flexiblas64")
set(flexiblasname flexiblas64)
SET (FLEXIBLASRC flexiblas64rc)
SET (FLEXIBLAS_RC "flexiblas64rc")
SET (FLEXIBLAS_RC_DIR "flexiblas64rc.d")
SET (FLEXIBLAS_PREFIX "flexiblas64")
IF ( ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
MESSAGE(STATUS "Setting GNU Compiler Flags")
SET(I8_FLAGS "-fdefault-integer-8 ")
ELSEIF (${CMAKE_C_COMPILER_ID} STREQUAL "Intel" )
SET ( I8_FLAGS "-i8 ")
ELSEIF (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" )
SET ( I8_FLAGS "-i8 ")
ENDIF()
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${I8_FLAGS}")
SET (FLEXIBLAS_FC_I8FLAG "${I8_FLAGS}")
ELSE()
SET(FLEXIBLAS_INTEGER8 FALSE)
SET(FLEXIBLAS_INCLUDE_PREFIX "flexiblas")
SET(FLEXIBLAS_PKG_CONFIG "flexiblas.pc")
SET(FLEXIBLAS_API_PKG_CONFIG "flexiblas_api.pc")
SET(FLEXIBLAS_LIBRARY_DIR "flexiblas")
SET(FLEXIBLAS_LIBRARY_NAME "flexiblas")
set(flexiblasname flexiblas)
SET (FLEXIBLASRC flexiblasrc)
SET (FLEXIBLAS_RC "flexiblasrc")
SET (FLEXIBLAS_RC_DIR "flexiblasrc.d")
SET (FLEXIBLAS_PREFIX "flexiblas")
ENDIF (INTEGER8 STREQUAL ON)
FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${FLEXIBLAS_RC_DIR}")
IF (DEV STREQUAL ON)
SET ( FLEXIBLAS_DEFAULT_LIB_PATH "${CMAKE_BINARY_DIR}/lib:${CMAKE_BINARY_DIR}/contributed/netlib-blas:${CMAKE_BINARY_DIR}/contributed/:${CMAKE_BINARY_DIR}/src:")
SET ( CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_BINARY_DIR}")
ELSE()
SET ( FLEXIBLAS_DEFAULT_LIB_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/${flexiblasname}/")
ENDIF()
# Check for Serveral Functions
CHECK_FEATURE_NEEDED(strdup string.h HAVE_STRDUP STRDUP_FEATURE)
IF( HAVE_STRDUP )
ADD_DEFINITIONS("${STRDUP_FEATURE}")
ELSE ()
MESSAGE(FATAL_ERROR "strdup not found")
ENDIF()
CHECK_FEATURE_NEEDED(realpath stdlib.h HAVE_REALPATH REALPATH_FEATURE)
IF( HAVE_REALPATH )
ADD_DEFINITIONS("${REALPATH_FEATURE}")
ELSE ()
MESSAGE(FATAL_ERROR "realpath not found")
ENDIF()
### Add Source
INCLUDE(lapack)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/include/flexiblas_config.h)
add_subdirectory(src)
IF(EXAMPLES STREQUAL "ON")
add_subdirectory(examples)
ENDIF()
IF(EXISTS tools/lapack_checks)
add_subdirectory(tools/lapack_checks)
ENDIF()
### Install
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${FLEXIBLASRC} DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR} PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ )
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/blas_gnu.h
${CMAKE_SOURCE_DIR}/include/blas_intel.h
${CMAKE_BINARY_DIR}/include/flexiblas_config.h
${CMAKE_BINARY_DIR}/include/flexiblas_api.h
${CMAKE_BINARY_DIR}/include/flexiblas_fortran_mangle.h
DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/${FLEXIBLAS_INCLUDE_PREFIX}/)
IF(LAPACK STREQUAL ON)
INSTALL(FILES ${CMAKE_BINARY_DIR}/include/lapack.h
${CMAKE_BINARY_DIR}/include/flexiblas_real_lapack.h
DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/${FLEXIBLAS_INCLUDE_PREFIX}/)
ENDIF()
INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/flexiblas_backend.h
${CMAKE_SOURCE_DIR}/src/flexiblas_real_calls.h
${CMAKE_SOURCE_DIR}/src/flexiblas_real_cblas_calls.h
${CMAKE_SOURCE_DIR}/src/flexiblas_dummy_fortran.h
${CMAKE_SOURCE_DIR}/src/flexiblas_dummy_cblas.h
${CMAKE_SOURCE_DIR}/src/flexiblas_mgmt.h
${CMAKE_SOURCE_DIR}/src/flexiblas_fortran_char_len.h
DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/${FLEXIBLAS_INCLUDE_PREFIX}/)
IF(CBLAS STREQUAL ON)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/cblas.h DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/${FLEXIBLAS_INCLUDE_PREFIX}/)
ENDIF()
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
### Setup PKG_CONFIG
set(prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(PKG_CONFIG_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
set(includedir ${CMAKE_INSTALL_PREFIX}/include/${FLEXIBLAS_INCLUDE_PREFIX}/)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/flexiblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${FLEXIBLAS_PKG_CONFIG})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/flexiblas_api.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${FLEXIBLAS_API_PKG_CONFIG})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${FLEXIBLAS_PKG_CONFIG} DESTINATION ${PKG_CONFIG_DIR} )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${FLEXIBLAS_API_PKG_CONFIG} DESTINATION ${PKG_CONFIG_DIR} )
### Setup Man Pages
install(DIRECTORY doc/man/ DESTINATION ${CMAKE_INSTALL_FULL_MANDIR} FILES_MATCHING PATTERN "*.[1-9]")
IF (INTEGER8 STREQUAL ON)
install(FILES doc/man/man1/flexiblas.1 DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1/ RENAME flexiblas64.1)
ENDIF()
IF ( TESTS )
SET(PYTHON_IGNORE_LIBRARY ON)
FIND_PACKAGE(PythonInterp)
ENABLE_TESTING()
add_subdirectory(test)
ENDIF (TESTS)
#
# Final Status
#
MESSAGE(STATUS "------------------------------------------------")
MESSAGE(STATUS " Final Configuration Status ")
MESSAGE(STATUS "------------------------------------------------")
MESSAGE(STATUS "Build 8 byte integer: ${INTEGER8}")
MESSAGE(STATUS "Build CBLAS interface: ${CBLAS}")
MESSAGE(STATUS "Install path: ${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS "Extra BLAS search path: ${FLEXIBLAS_DEFAULT_LIB_PATH}")
MESSAGE(STATUS "LAPACK Support: ${LAPACK}")
IF(LAPACK)
MESSAGE(STATUS "LAPACK_API_VERSION: ${LAPACK_API_VERSION}")
ENDIF()
MESSAGE(STATUS "ABI: ${ABI}")
MESSAGE(STATUS "Interface to Extra BLAS Libraries:")
FOREACH(EBLAS ${EXTRA_BLAS})
MESSAGE(STATUS " ${${EBLAS}_BLAS_LIBRARIES} - ${EBLAS} ")
ENDFOREACH()
MESSAGE(STATUS "Default BLAS: ${FLEXIBLAS_DEFAULT}")
MESSAGE(STATUS "")
MESSAGE(STATUS "Compiler Options:")
MESSAGE(STATUS " CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
MESSAGE(STATUS " CMAKE_C_FLAGS_RELEASE = ${CMAKE_C_FLAGS_RELEASE}")
MESSAGE(STATUS " CMAKE_C_FLAGS_DEBUG = ${CMAKE_C_FLAGS_DEBUG}")
MESSAGE(STATUS " CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
MESSAGE(STATUS " CMAKE_Fortran_FLAGS_RELEASE = ${CMAKE_Fortran_FLAGS_RELEASE}")
MESSAGE(STATUS " CMAKE_Fortran_FLAGS_DEBUG = ${CMAKE_Fortran_FLAGS_DEBUG}")
MESSAGE(STATUS "------------------------------------------------")
IF ( DEV STREQUAL ON )
MESSAGE (WARNING "- This is an development build and can not be install. Please set add -DDEV=OFF to cmake. -")
ENDIF()