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.

f_check.cmake 1.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ##
  2. ## Author: Hank Anderson <hank@statease.com>
  3. ## Copyright: (c) Stat-Ease, Inc.
  4. ## Created: 12/29/14
  5. ## Last Modified: 12/29/14
  6. ## Description: Ported from the OpenBLAS/f_check perl script.
  7. ## This is triggered by prebuild.cmake and runs before any of the code is built.
  8. ## Appends Fortran information to config.h and Makefile.conf.
  9. # CMake vars set by this file:
  10. # F_COMPILER
  11. # FC
  12. # BU
  13. # NOFORTRAN
  14. # NEED2UNDERSCORES
  15. # FEXTRALIB
  16. # Defines set by this file:
  17. # BUNDERSCORE
  18. # NEEDBUNDERSCORE
  19. # NEED2UNDERSCORES
  20. if (NOT NO_LAPACK)
  21. include(CheckLanguage)
  22. check_language(Fortran)
  23. if(CMAKE_Fortran_COMPILER)
  24. enable_language(Fortran)
  25. else()
  26. message(STATUS "No Fortran compiler found, can build only BLAS but not LAPACK")
  27. set (NOFORTRAN 1)
  28. set (NO_LAPACK 1)
  29. endif()
  30. else()
  31. include(CMakeForceCompiler)
  32. CMAKE_FORCE_Fortran_COMPILER(gfortran GNU)
  33. endif()
  34. if (NOT ONLY_CBLAS)
  35. # run f_check (appends to TARGET files)
  36. # TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
  37. # TODO: set FEXTRALIB flags a la f_check?
  38. set(BU "_")
  39. file(APPEND ${TARGET_CONF_TEMP}
  40. "#define BUNDERSCORE _\n"
  41. "#define NEEDBUNDERSCORE 1\n"
  42. "#define NEED2UNDERSCORES 0\n")
  43. else ()
  44. #When we only build CBLAS, we set NOFORTRAN=2
  45. set(NOFORTRAN 2)
  46. set(NO_FBLAS 1)
  47. #set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
  48. set(BU "_")
  49. file(APPEND ${TARGET_CONF_TEMP}
  50. "#define BUNDERSCORE _\n"
  51. "#define NEEDBUNDERSCORE 1\n")
  52. endif()
  53. get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
  54. string(TOUPPER ${F_COMPILER} F_COMPILER)