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 2.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND x${CMAKE_Fortran_COMPILER_ID} MATCHES "IntelLLVM"))
  44. set(BU "_")
  45. file(APPEND ${TARGET_CONF_TEMP}
  46. "#define BUNDERSCORE _\n"
  47. "#define NEEDBUNDERSCORE 1\n"
  48. "#define NEED2UNDERSCORES 0\n")
  49. else ()
  50. set (FCOMMON_OPT "${FCOMMON_OPT} /fp:precise /recursive /names:lowercase /assume:nounderscore")
  51. endif()
  52. else ()
  53. #When we only build CBLAS, we set NOFORTRAN=2
  54. set(NOFORTRAN 2)
  55. set(NO_FBLAS 1)
  56. #set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
  57. set(BU "_")
  58. file(APPEND ${TARGET_CONF_TEMP}
  59. "#define BUNDERSCORE _\n"
  60. "#define NEEDBUNDERSCORE 1\n")
  61. endif()
  62. if (CMAKE_Fortran_COMPILER)
  63. get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
  64. string(TOUPPER ${F_COMPILER} F_COMPILER)
  65. endif()