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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ##
  2. ## Author: Hank Anderson <hank@statease.com>
  3. ##
  4. cmake_minimum_required(VERSION 2.8.4)
  5. project(OpenBLAS)
  6. set(OpenBLAS_MAJOR_VERSION 0)
  7. set(OpenBLAS_MINOR_VERSION 2)
  8. set(OpenBLAS_PATCH_VERSION 13)
  9. set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}.${OpenBLAS_PATCH_VERSION}")
  10. enable_language(Fortran)
  11. enable_language(ASM)
  12. message(WARNING "CMake support is experimental. This will not produce the same Makefiles that OpenBLAS ships with. Only DOUBLE and x86 support is currently available.")
  13. include("${CMAKE_SOURCE_DIR}/cmake/utils.cmake")
  14. include("${CMAKE_SOURCE_DIR}/cmake/system.cmake")
  15. set(BLASDIRS interface driver/level2 driver/level3 driver/others)
  16. if (NOT DYNAMIC_ARCH)
  17. list(APPEND BLASDIRS kernel)
  18. endif ()
  19. if (DEFINED UTEST_CHECK)
  20. set(SANITY_CHECK 1)
  21. endif ()
  22. if (DEFINED SANITY_CHECK)
  23. list(APPEND BLASDIRS reference)
  24. endif ()
  25. set(SUBDIRS ${BLASDIRS})
  26. if (NOT NO_LAPACK)
  27. list(APPEND SUBDIRS lapack)
  28. endif ()
  29. set(SUBDIRS_ALL ${SUBDIRS} test ctest utest exports benchmark ../laswp ../bench)
  30. # all :: libs netlib tests shared
  31. # libs :
  32. if (NOT DEFINED CORE OR "${CORE}" STREQUAL "UNKNOWN")
  33. message(FATAL_ERROR "Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for details.")
  34. endif ()
  35. # Let CMake handle this
  36. #if (${NOFORTRAN})
  37. # message(ERROR "OpenBLAS: Detecting fortran compiler failed. Please install fortran compiler, e.g. gfortran, ifort, openf90.")
  38. #endif ()
  39. if (${NO_STATIC} AND ${NO_SHARED})
  40. message(FATAL_ERROR "Neither static nor shared are enabled.")
  41. endif ()
  42. set(DBLAS_OBJS "")
  43. foreach (SUBDIR ${SUBDIRS})
  44. add_subdirectory(${SUBDIR})
  45. endforeach ()
  46. # get obj vars into format that add_library likes: $<TARGET_OBJS:objlib> (see http://www.cmake.org/cmake/help/v3.0/command/add_library.html)
  47. set(TARGET_OBJS "")
  48. foreach (DBLAS_OBJ ${DBLAS_OBJS})
  49. get_target_property(PREV_DEFS ${DBLAS_OBJ} COMPILE_DEFINITIONS)
  50. set_target_properties(${DBLAS_OBJ} PROPERTIES COMPILE_DEFINITIONS "${PREV_DEFS};DOUBLE")
  51. list(APPEND TARGET_OBJS "$<TARGET_OBJECTS:${DBLAS_OBJ}>")
  52. endforeach ()
  53. # netlib:
  54. # Can't just use lapack-netlib's CMake files, since they are set up to search for BLAS, build and install a binary. We just want to build a couple of lib files out of lapack and lapacke.
  55. # Not using add_subdirectory here because lapack-netlib already has its own CMakeLists.txt. Instead include a cmake script with the sources we want.
  56. include("${CMAKE_SOURCE_DIR}/cmake/lapack.cmake")
  57. add_library(LA_OBJ OBJECT ${LA_SOURCES})
  58. set_target_properties(LA_OBJ PROPERTIES COMPILE_FLAGS "${LAPACK_FFLAGS}")
  59. list(APPEND TARGET_OBJS "$<TARGET_OBJECTS:LA_OBJ>")
  60. # add objects to the openblas lib
  61. add_library(openblas ${TARGET_OBJS})
  62. # TODO: Why is the config saved here? Is this necessary with CMake?
  63. #Save the config files for installation
  64. # @cp Makefile.conf Makefile.conf_last
  65. # @cp config.h config_last.h
  66. #ifdef QUAD_PRECISION
  67. # @echo "#define QUAD_PRECISION">> config_last.h
  68. #endif
  69. #ifeq ($(EXPRECISION), 1)
  70. # @echo "#define EXPRECISION">> config_last.h
  71. #endif
  72. ###
  73. #ifeq ($(DYNAMIC_ARCH), 1)
  74. # @$(MAKE) -C kernel commonlibs || exit 1
  75. # @for d in $(DYNAMIC_CORE) ; \
  76. # do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
  77. # done
  78. # @echo DYNAMIC_ARCH=1 >> Makefile.conf_last
  79. #endif
  80. #ifdef USE_THREAD
  81. # @echo USE_THREAD=$(USE_THREAD) >> Makefile.conf_last
  82. #endif
  83. # @touch lib.grd