You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 3.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. message(STATUS "CBLAS enable")
  2. enable_language(C)
  3. set(LAPACK_INSTALL_EXPORT_NAME ${CBLASLIB}-targets)
  4. # Create a header file cblas.h for the routines called in my C programs
  5. include(FortranCInterface)
  6. ## Ensure that the fortran compiler and c compiler specified are compatible
  7. FortranCInterface_VERIFY()
  8. FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/cblas_mangling.h
  9. MACRO_NAMESPACE "F77_"
  10. SYMBOL_NAMESPACE "F77_")
  11. if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
  12. message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
  13. configure_file(include/lapacke_mangling_with_flags.h.in
  14. ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
  15. configure_file(include/cblas_mangling_with_flags.h.in
  16. ${LAPACK_BINARY_DIR}/include/cblas_mangling.h)
  17. endif()
  18. include_directories(include ${LAPACK_BINARY_DIR}/include)
  19. add_subdirectory(include)
  20. add_subdirectory(src)
  21. macro(append_subdir_files variable dirname)
  22. get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable})
  23. foreach(depfile ${holder})
  24. list(APPEND ${variable} "${dirname}/${depfile}")
  25. endforeach()
  26. endmacro()
  27. append_subdir_files(CBLAS_INCLUDE "include")
  28. install(FILES ${CBLAS_INCLUDE} ${LAPACK_BINARY_DIR}/include/cblas_mangling.h
  29. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
  30. COMPONENT Development
  31. )
  32. # --------------------------------------------------
  33. if(BUILD_TESTING)
  34. add_subdirectory(testing)
  35. add_subdirectory(examples)
  36. endif()
  37. if(NOT BLAS_FOUND)
  38. set(ALL_TARGETS ${ALL_TARGETS} ${BLASLIB})
  39. endif()
  40. # Export cblas targets from the
  41. # install tree, if any.
  42. set(_cblas_config_install_guard_target "")
  43. if(ALL_TARGETS)
  44. install(EXPORT ${CBLASLIB}-targets
  45. DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
  46. COMPONENT Development
  47. )
  48. # Choose one of the cblas targets to use as a guard for
  49. # cblas-config.cmake to load targets from the install tree.
  50. list(GET ALL_TARGETS 0 _cblas_config_install_guard_target)
  51. endif()
  52. # Export cblas targets from the build tree, if any.
  53. set(_cblas_config_build_guard_target "")
  54. if(ALL_TARGETS)
  55. export(TARGETS ${ALL_TARGETS} FILE ${CBLASLIB}-targets.cmake)
  56. # Choose one of the cblas targets to use as a guard
  57. # for cblas-config.cmake to load targets from the build tree.
  58. list(GET ALL_TARGETS 0 _cblas_config_build_guard_target)
  59. endif()
  60. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in
  61. ${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake @ONLY)
  62. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in
  63. ${LAPACK_BINARY_DIR}/${CBLASLIB}-config.cmake @ONLY)
  64. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc @ONLY)
  65. install(FILES
  66. ${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc
  67. DESTINATION ${PKG_CONFIG_DIR}
  68. )
  69. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in
  70. ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake @ONLY)
  71. install(FILES
  72. ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake
  73. ${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake
  74. DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
  75. )
  76. #install(EXPORT ${CBLASLIB}-targets
  77. # DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION}
  78. # COMPONENT Development
  79. # )