@@ -15,12 +15,12 @@ include(FetchContent)
15
15
FetchContent_Declare (
16
16
blaspp
17
17
GIT_REPOSITORY https://github.com/icl-utk-edu/blaspp
18
- GIT_TAG f8f983d5b45a8f366aae41fbe9888b14cbae20f8 # v2023.08.25
18
+ GIT_TAG 91dd418fa910498cc03dee397826099914cc3185 # v2023.08.25 +
19
19
)
20
20
FetchContent_Declare (
21
21
lapackpp
22
22
GIT_REPOSITORY https://github.com/icl-utk-edu/lapackpp
23
- GIT_TAG 62680a16a9aba2a426e3d089dd13e18bfd140c74 # v2023.08.25
23
+ GIT_TAG 88088c33cd9467475e8f139f42d158620f11e64d # v2023.08.25 +
24
24
)
25
25
26
26
# Allow setting a prefix for the library names
@@ -402,22 +402,8 @@ endif()
402
402
option (BLAS++ "Build BLAS++" OFF )
403
403
option (LAPACK++ "Build LAPACK++" OFF )
404
404
405
-
406
- function (_display_cpp_implementation_msg name )
407
- string (TOLOWER ${name} name_lc )
408
- message (STATUS "${name} ++ enable" )
409
- message (STATUS "----------------" )
410
- message (STATUS "Thank you for your interest in ${name} ++, a newly developed C++ API for ${name} library" )
411
- message (STATUS "The objective of ${name} ++ is to provide a convenient, performance oriented API for development in the C++ language, that, for the most part, preserves established conventions, while, at the same time, takes advantages of modern C++ features, such as: namespaces, templates, exceptions, etc." )
412
- message (
STATUS "For support ${name} ++ related question, please email: [email protected] " )
413
- message (STATUS "----------------" )
414
- endfunction ()
415
-
416
405
if (BLAS++ OR LAPACK++ )
417
-
418
- if (BLAS++ )
419
- _display_cpp_implementation_msg ("BLAS" )
420
- endif ()
406
+ message (
STATUS "BLAS++ enabled; for support, email [email protected] " )
421
407
422
408
# Check if population has already been performed
423
409
FetchContent_GetProperties (blaspp )
@@ -426,16 +412,35 @@ if (BLAS++ OR LAPACK++)
426
412
FetchContent_Populate (blaspp )
427
413
endif ()
428
414
429
- # For static builds, we may need to link against a Fortran library
430
- set (BLAS_Fortran_LIB "" )
431
- if (NOT BLAS_FOUND AND NOT BUILD_SHARED_LIBS )
415
+ # Determine Fortran runtime library.
416
+ # todo: CMake ought to know this already -- how to access?
417
+ set ( Fortran_LIB "" )
418
+ if (NOT BUILD_SHARED_LIBS )
432
419
if (CMAKE_Fortran_COMPILER_ID MATCHES GNU )
433
- set (BLAS_Fortran_LIB ";-lgfortran" )
420
+ set ( Fortran_LIB ";-lgfortran" )
434
421
else ()
435
422
# TODO: This is incomplete. Fill in the other cases.
436
- set (BLAS_Fortran_LIB "" )
437
423
endif ()
438
424
endif ()
425
+ message ( DEBUG "Fortran_LIB '${Fortran_LIB} '" )
426
+
427
+ if (NOT BLAS_FOUND )
428
+ # Link with Reference BLAS.
429
+ set ( BLAS_LIBS "$<TARGET_FILE:${BLASLIB} >${Fortran_LIB} " )
430
+ else ()
431
+ # Link with optimized BLAS.
432
+ set ( BLAS_LIBS "${BLAS_LIBRARIES} " )
433
+ endif ()
434
+ message ( DEBUG "BLAS_LIBS '${BLAS_LIBS} '" )
435
+
436
+ if (NOT LATESTLAPACK_FOUND )
437
+ # Link with Reference LAPACK.
438
+ set ( LAPACK_LIBS "$<TARGET_FILE:${LAPACKLIB} >${Fortran_LIB} " )
439
+ else ()
440
+ # Link with optimized BLAS.
441
+ set ( LAPACK_LIBS "${LAPACK_LIBRARIES} " )
442
+ endif ()
443
+ message ( DEBUG "LAPACK_LIBS '${LAPACK_LIBS} '" )
439
444
440
445
# Adds target blaspp
441
446
add_custom_target ( blaspp ALL DEPENDS blaspp-cmd )
@@ -444,48 +449,19 @@ if (BLAS++ OR LAPACK++)
444
449
COMMENT "Building BLAS++" )
445
450
446
451
# Set up information about the BLAS and LAPACK libraries
447
- if (NOT BLAS_FOUND )
448
- if (NOT LATESTLAPACK_FOUND )
449
- add_custom_command ( OUTPUT blaspp-cmd APPEND
450
- COMMAND ${CMAKE_COMMAND}
451
- -B "${blaspp_BINARY_DIR} "
452
- -D BLAS_LIBRARIES= "$<TARGET_FILE:${BLASLIB} >${BLAS_Fortran_LIB} "
453
- -D LAPACK_LIBRARIES= "$<TARGET_FILE:${LAPACKLIB} >" )
454
- else ()
455
- add_custom_command ( OUTPUT blaspp-cmd APPEND
456
- COMMAND ${CMAKE_COMMAND}
457
- -B "${blaspp_BINARY_DIR} "
458
- -D BLAS_LIBRARIES= "$<TARGET_FILE:${BLASLIB} >${BLAS_Fortran_LIB} "
459
- -D LAPACK_LIBRARIES= "${LAPACK_LIBRARIES} " )
460
- endif ()
461
- else ()
462
- if (NOT LATESTLAPACK_FOUND )
463
- add_custom_command ( OUTPUT blaspp-cmd APPEND
464
- COMMAND ${CMAKE_COMMAND}
465
- -B "${blaspp_BINARY_DIR} "
466
- -D BLAS_LIBRARIES= "${BLAS_LIBRARIES} "
467
- -D LAPACK_LIBRARIES= "$<TARGET_FILE:${LAPACKLIB} >${BLAS_Fortran_LIB} " )
468
- else ()
469
- add_custom_command ( OUTPUT blaspp-cmd APPEND
470
- COMMAND ${CMAKE_COMMAND}
471
- -B "${blaspp_BINARY_DIR} "
472
- -D BLAS_LIBRARIES= "${BLAS_LIBRARIES} "
473
- -D LAPACK_LIBRARIES= "${LAPACK_LIBRARIES} " )
474
- endif ()
475
- endif ()
476
-
477
- # Setup remaining configuration options and installation
478
452
add_custom_command ( OUTPUT blaspp-cmd APPEND
479
453
COMMAND ${CMAKE_COMMAND}
480
- -B "${blaspp_BINARY_DIR} "
481
- -D CMAKE_INSTALL_PREFIX = "${blaspp_BINARY_DIR} "
482
- -D CMAKE_INSTALL_LIBDIR= "${PROJECT_BINARY_DIR} /lib"
483
- -D blas_libraries_cached= ""
484
- -D lapack_libraries_cached= ""
485
- -D build_tests=OFF
486
- -D BUILD_SHARED_LIBS =${BUILD_SHARED_LIBS}
454
+ -B "${blaspp_BINARY_DIR} "
455
+ -D CMAKE_INSTALL_PREFIX = "${LAPACK_BINARY_DIR} "
456
+ -D BLAS_LIBRARIES= "${BLAS_LIBS} "
457
+ -D LAPACK_LIBRARIES= "${LAPACK_LIBS} "
458
+ -D build_tests=OFF
459
+ -D CMAKE_BUILD_TYPE =${CMAKE_BUILD_TYPE}
460
+ -D BUILD_SHARED_LIBS =${BUILD_SHARED_LIBS}
461
+
487
462
COMMAND ${CMAKE_COMMAND}
488
463
--build "${blaspp_BINARY_DIR} "
464
+ --config ${CMAKE_BUILD_TYPE}
489
465
--target install
490
466
)
491
467
@@ -499,7 +475,7 @@ if (BLAS++ OR LAPACK++)
499
475
endif ()
500
476
501
477
if (LAPACK++ )
502
- _display_cpp_implementation_msg ( "LAPACK" )
478
+ message ( STATUS "LAPACK++ enabled; for support, email [email protected] " )
503
479
504
480
# Check if population has already been performed
505
481
FetchContent_GetProperties (lapackpp )
@@ -514,30 +490,20 @@ if (LAPACK++)
514
490
WORKING_DIRECTORY "${lapackpp_SOURCE_DIR} "
515
491
COMMENT "Building LAPACK++" )
516
492
517
- # Set up information about the LAPACK library
518
- if (NOT LATESTLAPACK_FOUND )
519
- add_custom_command ( OUTPUT lapackpp-cmd APPEND
520
- COMMAND ${CMAKE_COMMAND}
521
- -B "${lapackpp_BINARY_DIR} "
522
- -D LAPACK_LIBRARIES= "$<TARGET_FILE:${LAPACKLIB} >${BLAS_Fortran_LIB} " )
523
- else ()
524
- add_custom_command ( OUTPUT lapackpp-cmd APPEND
525
- COMMAND ${CMAKE_COMMAND}
526
- -B "${lapackpp_BINARY_DIR} "
527
- -D LAPACK_LIBRARIES= "${LAPACK_LIBRARIES} " )
528
- endif ()
529
-
530
493
# Setup remaining configuration options and installation
531
494
add_custom_command ( OUTPUT lapackpp-cmd APPEND
532
495
COMMAND ${CMAKE_COMMAND}
533
- -B "${lapackpp_BINARY_DIR} "
534
- -D CMAKE_INSTALL_PREFIX = "${lapackpp_BINARY_DIR} "
535
- -D CMAKE_INSTALL_LIBDIR= "${PROJECT_BINARY_DIR} /lib"
536
- -D lapack_libraries_cached= ""
537
- -D build_tests=OFF
538
- -D BUILD_SHARED_LIBS =${BUILD_SHARED_LIBS}
496
+ -B "${lapackpp_BINARY_DIR} "
497
+ -D CMAKE_INSTALL_PREFIX = "${LAPACK_BINARY_DIR} "
498
+ -D blaspp_DIR= "${PROJECT_BINARY_DIR} /lib/cmake/blaspp"
499
+ -D LAPACK_LIBRARIES= "${LAPACK_LIBS} "
500
+ -D build_tests=OFF
501
+ -D CMAKE_BUILD_TYPE =${CMAKE_BUILD_TYPE}
502
+ -D BUILD_SHARED_LIBS =${BUILD_SHARED_LIBS}
503
+
539
504
COMMAND ${CMAKE_COMMAND}
540
505
--build "${lapackpp_BINARY_DIR} "
506
+ --config ${CMAKE_BUILD_TYPE}
541
507
--target install
542
508
)
543
509
@@ -650,37 +616,26 @@ install(FILES
650
616
DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/${LAPACKLIB}-${LAPACK_VERSION}
651
617
COMPONENT Development
652
618
)
619
+
653
620
if (LAPACK++ )
654
621
install (
655
622
DIRECTORY "${LAPACK_BINARY_DIR} /lib/"
656
623
DESTINATION "${CMAKE_INSTALL_LIBDIR}${LAPACK_BINARY_PATH_SUFFIX} "
657
- FILES_MATCHING REGEX "liblapackpp.(a|so)$"
658
- )
659
- install (
660
- DIRECTORY "${lapackpp_BINARY_DIR} /include/"
661
- DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} "
662
- FILES_MATCHING REGEX "\\ .(h|hh)$"
663
- )
664
- install (
665
- FILES "${CMAKE_CURRENT_BINARY_DIR} /lib/cmake/lapackpp/lapackppConfig.cmake"
666
- "${CMAKE_CURRENT_BINARY_DIR} /lib/cmake/lapackpp/lapackppConfigVersion.cmake"
667
- DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/"
624
+ FILES_MATCHING REGEX "lapackpp"
668
625
)
669
-
670
626
endif ()
627
+
671
628
if (BLAS++ )
672
- install (
673
- FILES "${CMAKE_CURRENT_BINARY_DIR} /lib/cmake/blaspp/blasppConfig.cmake"
674
- "${CMAKE_CURRENT_BINARY_DIR} /lib/cmake/blaspp/blasppConfigVersion.cmake"
675
- DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/"
676
- )
677
629
install (
678
630
DIRECTORY "${LAPACK_BINARY_DIR} /lib/"
679
631
DESTINATION ${CMAKE_INSTALL_LIBDIR}
680
- FILES_MATCHING REGEX "libblaspp.(a|so)$ "
632
+ FILES_MATCHING REGEX "blaspp "
681
633
)
634
+ endif ()
635
+
636
+ if (BLAS++ OR LAPACK++ )
682
637
install (
683
- DIRECTORY "${blaspp_BINARY_DIR } /include/"
638
+ DIRECTORY "${LAPACK_BINARY_DIR } /include/"
684
639
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} "
685
640
FILES_MATCHING REGEX "\\ .(h|hh)$"
686
641
)
0 commit comments