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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. option(DEBUG_MODE "Debug mode, default off" OFF)
  2. option(ENABLE_COVERAGE "Enable code coverage report" OFF)
  3. option(ENABLE_PYTHON "Enable python" ON)
  4. option(ENABLE_ASAN "Enable Google Sanitizer to find memory bugs")
  5. option(MS_WHL_LIB_PATH "MindSpore lib path")
  6. option(MS_BACKEND "Compile MindSpore")
  7. option(RUN_TESTCASES "Compile UT")
  8. if(MS_WHL_LIB_PATH)
  9. message("MindSpore whl lib path:" ${MS_WHL_LIB_PATH})
  10. elseif(MS_BACKEND)
  11. message("MindSpore backend method:" ${MS_BACKEND})
  12. elseif (RUN_TESTCASES)
  13. message("MindSpore Serving Compile UT:" ${RUN_TESTCASES})
  14. elseif ()
  15. message(FATAL_ERROR "Please confirm how to use MindSpore.")
  16. endif()
  17. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND Linux)
  18. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
  19. endif()
  20. if (ENABLE_COVERAGE)
  21. set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -ftest-coverage")
  22. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
  23. endif()
  24. if (ENABLE_ASAN)
  25. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  26. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -fsanitize=undefined")
  27. else()
  28. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libsan -fsanitize=undefined")
  29. endif()
  30. endif()
  31. if (DEBUG_MODE)
  32. set(CMAKE_BUILD_TYPE "Debug")
  33. add_compile_definitions(MEM_REUSE_DEBUG)
  34. else()
  35. set(CMAKE_BUILD_TYPE "Release")
  36. endif()
  37. if ((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") OR (CMAKE_BUILD_TYPE STREQUAL Release))
  38. set(PYBIND11_LTO_CXX_FLAGS FALSE)
  39. endif()
  40. if (NOT BUILD_PATH)
  41. set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
  42. endif()
  43. if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
  44. set(MS_BUILD_GRPC ON)
  45. endif()
  46. add_compile_definitions(USE_GLOG)

A lightweight and high-performance service module that helps MindSpore developers efficiently deploy online inference services in the production environment.