Explorar el Código

Support debug in release mode. (#155)

Winlin hace 2 años
padre
commit
2a278b0ff2
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      CMakeLists.txt

+ 6 - 0
CMakeLists.txt

@@ -66,6 +66,12 @@ if(NOT CMAKE_BUILD_TYPE)
 endif()
 message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
 
+# Set the release compiler flags to support debugging, see https://github.com/k2-fsa/sherpa-ncnn/issues/147
+if(SHERPA_NCNN_ENABLE_DEBUG_FOR_RELEASE)
+  message(STATUS "Enable debugging for Release")
+  string(APPEND CMAKE_CXX_FLAGS_RELEASE " -g -O0")
+endif()
+
 set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ version to be used.")
 set(CMAKE_CXX_EXTENSIONS OFF)