@@ -64,6 +64,7 @@ tvm_option(USE_PROFILER "Build profiler for the VM and graph executor" ON)
6464tvm_option(USE_OPENMP "Build with OpenMP thread pool implementation" OFF )
6565tvm_option(USE_RELAY_DEBUG "Building Relay in debug mode..." OFF )
6666tvm_option(TVM_DEBUG_WITH_ABI_CHANGE "Enable debug code that may cause ABI changes" OFF )
67+ tvm_option(TVM_LOG_BEFORE_THROW "Whether log before throw, for debugging purposes" OFF )
6768tvm_option(USE_RTTI "Build with RTTI" ON )
6869tvm_option(USE_MSVC_MT "Build with MT" OFF )
6970tvm_option(USE_MICRO "Build with Micro TVM support" OFF )
@@ -155,16 +156,20 @@ if(NOT IS_SUBPROJECT AND NOT DEFINED "${CMAKE_EXPORT_COMPILE_COMMANDS}")
155156 set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
156157endif ()
157158
159+ if (TVM_LOG_BEFORE_THROW)
160+ # log error before throw as
161+ # when system have issues with stack trace
162+ add_definitions (-DDMLC_LOG_BEFORE_THROW=1)
163+ endif ()
164+
158165# Generic compilation options
159166if (MSVC )
160167 add_definitions (-DWIN32_LEAN_AND_MEAN)
161168 add_definitions (-D_CRT_SECURE_NO_WARNINGS)
162169 add_definitions (-D_SCL_SECURE_NO_WARNINGS)
163170 add_definitions (-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
164171 add_definitions (-DNOMINMAX)
165- # log error before throw as usually windows
166- # may have issues with stack trace
167- add_definitions (-DDMLC_LOG_BEFORE_THROW=1)
172+
168173 # regeneration does not work well with msbuild custom rules.
169174 set (CMAKE_SUPPRESS_REGENERATION ON )
170175 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" )
0 commit comments