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.

options.cmake 3.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. option(ENABLE_D "Enable d" OFF)
  2. option(ENABLE_GPU "Enable gpu" OFF)
  3. option(ENABLE_CPU "Enable cpu" OFF)
  4. option(ENABLE_GE "Enable graph engine as backend to execute" OFF)
  5. option(ENABLE_MINDDATA "Enable minddata compile" OFF)
  6. option(ENABLE_TRAIN "Enable ge train, default off(only infer)" OFF)
  7. option(ENABLE_TESTCASES "Run testcases switch, default off" OFF)
  8. option(ENABLE_CPP_ST "Run cpp st testcases switch, default off" OFF)
  9. option(DEBUG_MODE "Debug mode, default off" OFF)
  10. option(ENABLE_ASAN "Enable Google Sanitizer to find memory bugs")
  11. option(ENABLE_LOAD_ANF_IR "Enable load ANF-IR as input of 'infer' stage of pipeline" OFF)
  12. option(ENABLE_COVERAGE "Enable code coverage report" OFF)
  13. option(USE_GLOG "Use glog to output log" OFF)
  14. option(ENABLE_PROFILE "Enable pipeline profile, default off" OFF)
  15. option(ENABLE_TIMELINE "Enable time line record" OFF)
  16. option(ENABLE_DUMP_PROTO "Enable dump anf graph to file in ProtoBuffer format, default on" ON)
  17. option(ENABLE_DUMP_IR "Enable dump function graph ir, default on" ON)
  18. option(ENABLE_MPI "enable mpi" OFF)
  19. option(ENABLE_AKG "enable akg" OFF)
  20. option(ENABLE_DEBUGGER "enable debugger" OFF)
  21. option(ENABLE_IBVERBS "enable IBVERBS for parameter server" OFF)
  22. option(ENABLE_PYTHON "Enable python" ON)
  23. option(ENABLE_ACL "enable acl" OFF)
  24. option(ENABLE_GLIBCXX "enable_glibcxx" OFF)
  25. if(NOT ENABLE_D AND NOT ENABLE_TESTCASES AND NOT ENABLE_ACL)
  26. set(ENABLE_GLIBCXX ON)
  27. endif()
  28. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  29. if(WIN32)
  30. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all")
  31. else()
  32. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
  33. endif()
  34. endif()
  35. if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
  36. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -Wsign-compare")
  37. endif()
  38. if(ENABLE_COVERAGE)
  39. set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -ftest-coverage")
  40. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
  41. endif()
  42. if(ENABLE_ASAN)
  43. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer")
  44. if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  45. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -static-libsan")
  46. endif()
  47. endif()
  48. if(DEBUG_MODE)
  49. set(CMAKE_BUILD_TYPE "Debug")
  50. else()
  51. set(CMAKE_BUILD_TYPE "Release")
  52. endif()
  53. if((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") OR (CMAKE_BUILD_TYPE STREQUAL Release))
  54. set(PYBIND11_LTO_CXX_FLAGS FALSE)
  55. endif()
  56. if(NOT BUILD_PATH)
  57. set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
  58. endif()
  59. if(ENABLE_GE OR ENABLE_D)
  60. set(ENABLE_TDTQUE ON)
  61. endif()
  62. if(ENABLE_GPU)
  63. set(ENABLE_GPUQUE ON)
  64. add_compile_definitions(ENABLE_GPU_COLLECTIVE)
  65. endif()
  66. if(ENABLE_CPU)
  67. add_compile_definitions(ENABLE_CPU)
  68. endif()
  69. if(ENABLE_GE)
  70. add_compile_definitions(ENABLE_GE)
  71. add_compile_definitions(CUSTOM_OP)
  72. endif()
  73. if(ENABLE_TRAIN)
  74. add_compile_definitions(ENABLE_TRAIN=1)
  75. else()
  76. add_compile_definitions(ENABLE_TRAIN=0)
  77. endif()
  78. if(USE_GLOG)
  79. add_compile_definitions(USE_GLOG)
  80. endif()
  81. if(ENABLE_PROFILE)
  82. add_compile_definitions(ENABLE_PROFILE)
  83. endif()
  84. if(ENABLE_TIMELINE)
  85. add_compile_definitions(ENABLE_TIMELINE)
  86. endif()
  87. if(ENABLE_LOAD_ANF_IR)
  88. add_compile_definitions(ENABLE_LOAD_ANF_IR)
  89. endif()
  90. if(ENABLE_TESTCASES OR (NOT ENABLE_D AND NOT ENABLE_GE))
  91. add_compile_definitions(NO_DLIB=1)
  92. endif()
  93. if(ENABLE_DUMP_IR)
  94. add_compile_definitions(ENABLE_DUMP_IR)
  95. endif()
  96. if(ENABLE_MINDDATA)
  97. add_compile_definitions(ENABLE_MINDDATA)
  98. if(ENABLE_TDTQUE)
  99. add_compile_definitions(ENABLE_TDTQUE)
  100. endif()
  101. endif()
  102. if(ENABLE_DEBUGGER)
  103. add_compile_definitions(ENABLE_DEBUGGER)
  104. endif()
  105. if(ENABLE_DEBUGGER OR ENABLE_TESTCASES)
  106. set(MS_BUILD_GRPC ON)
  107. endif()
  108. if(ENABLE_MINDDATA AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
  109. set(MS_BUILD_GRPC ON)
  110. endif()