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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. if(MS_WHL_LIB_PATH)
  8. message("MindSpore whl lib path: " ${MS_WHL_LIB_PATH})
  9. elseif(MS_BACKEND)
  10. message("MindSpore backend method: " ${MS_BACKEND})
  11. else()
  12. message( FATAL_ERROR "Please confirm how to use MindSpore.")
  13. endif()
  14. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND Linux)
  15. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
  16. endif()
  17. if (ENABLE_COVERAGE)
  18. set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -ftest-coverage")
  19. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
  20. endif()
  21. if (ENABLE_ASAN)
  22. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  23. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -fsanitize=undefined")
  24. else()
  25. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libsan -fsanitize=undefined")
  26. endif()
  27. endif()
  28. if (DEBUG_MODE)
  29. set(CMAKE_BUILD_TYPE "Debug")
  30. add_compile_definitions(MEM_REUSE_DEBUG)
  31. else()
  32. set(CMAKE_BUILD_TYPE "Release")
  33. endif()
  34. if ((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") OR (CMAKE_BUILD_TYPE STREQUAL Release))
  35. set(PYBIND11_LTO_CXX_FLAGS FALSE)
  36. endif()
  37. if (NOT BUILD_PATH)
  38. set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
  39. endif()
  40. if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
  41. set(MS_BUILD_GRPC ON)
  42. endif()
  43. 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.