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.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. include(CheckLanguage)
  21. check_language(Fortran)
  22. if(CMAKE_Fortran_COMPILER)
  23. enable_language(Fortran)
  24. else()
  25. set (NOFORTRAN 1)
  26. if (NOT NO_LAPACK)
  27. if (NOT XXXXX)
  28. message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK")
  29. set(C_LAPACK 1)
  30. if (INTERFACE64)
  31. set (CCOMMON_OPT "${CCOMMON_OPT} -DLAPACK_ILP64")
  32. endif ()
  33. set(TIMER "NONE")
  34. else ()
  35. message(STATUS "No Fortran compiler found, can build only BLAS")
  36. endif()
  37. endif()
  38. endif()
  39. if (NOT ONLY_CBLAS)
  40. # run f_check (appends to TARGET files)
  41. # TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
  42. # TODO: set FEXTRALIB flags a la f_check?
  43. set(BU "_")
  44. file(APPEND ${TARGET_CONF_TEMP}
  45. "#define BUNDERSCORE _\n"
  46. "#define NEEDBUNDERSCORE 1\n"
  47. "#define NEED2UNDERSCORES 0\n")
  48. else ()
  49. #When we only build CBLAS, we set NOFORTRAN=2
  50. set(NOFORTRAN 2)
  51. set(NO_FBLAS 1)
  52. #set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
  53. set(BU "_")
  54. file(APPEND ${TARGET_CONF_TEMP}
  55. "#define BUNDERSCORE _\n"
  56. "#define NEEDBUNDERSCORE 1\n")
  57. endif()
  58. get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
  59. string(TOUPPER ${F_COMPILER} F_COMPILER)