Skip to content

Commit

Permalink
enable stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Sep 7, 2023
1 parent 0a3eb60 commit c35b1e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
8 changes: 7 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ include(CMakeDependentOption)
include(FetchContent)
include(CheckFunctionExists)

set(CMAKE_CXX_STANDARD 17)
if(NOT CMAKE_CXX_STANDARD)
if("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# NOTE: POSITION INDEPENDENT CODE hurts performance, and it only make sense on POSIX systems
Expand Down
7 changes: 2 additions & 5 deletions cmake/onnxruntime_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@ endif()
source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_common_src})

onnxruntime_add_static_library(onnxruntime_common ${onnxruntime_common_src})
if(WIN32)
if("cxx_std_23" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set_property(TARGET onnxruntime_common PROPERTY CXX_STANDARD 23)
target_compile_options(onnxruntime_common PRIVATE "/Zc:char8_t-")
endif()
if("cxx_std_23" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set_property(TARGET onnxruntime_common PROPERTY CXX_STANDARD 23)
endif()
if (onnxruntime_USE_TELEMETRY)
set_target_properties(onnxruntime_common PROPERTIES COMPILE_FLAGS "/FI${ONNXRUNTIME_INCLUDE_DIR}/core/platform/windows/TraceLoggingConfigPrivate.h")
Expand Down
4 changes: 2 additions & 2 deletions cmake/onnxruntime_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
#cmakedefine HAS_UNUSED_BUT_SET_VARIABLE
#cmakedefine HAS_UNUSED_VARIABLE
#cmakedefine HAS_USELESS_CAST
#cmakedefine ORT_BUILD_INFO u8"@ORT_BUILD_INFO@"
#cmakedefine ORT_VERSION u8"@ORT_VERSION@"
#cmakedefine ORT_BUILD_INFO "@ORT_BUILD_INFO@"
#cmakedefine ORT_VERSION "@ORT_VERSION@"
6 changes: 0 additions & 6 deletions onnxruntime/core/platform/windows/stacktrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,15 @@ class CaptureStackTrace {

// Get the stack trace. Currently only enabled for a DEBUG build as we require the DbgHelp library.
std::vector<std::string> GetStackTrace() {
#ifndef NDEBUG
// TVM need to run with shared CRT, so won't work with debug helper now
#if (defined __cpp_lib_stacktrace) && !(defined _OPSCHEMA_LIB_) && !(defined _GAMING_XBOX) && !(defined ONNXRUNTIME_ENABLE_MEMLEAK_CHECK)
return detail::CaptureStackTrace().Trace();
#else
return {};
#endif
#else
return {};
#endif
}

namespace detail {
#ifndef NDEBUG
#if (defined __cpp_lib_stacktrace) && !(defined _OPSCHEMA_LIB_) && !(defined _GAMING_XBOX) && !(defined ONNXRUNTIME_ENABLE_MEMLEAK_CHECK)

std::vector<std::string> CaptureStackTrace::Trace() const {
Expand All @@ -58,7 +53,6 @@ std::vector<std::string> CaptureStackTrace::Trace() const {
return stacktrace;
}

#endif
#endif
} // namespace detail
} // namespace onnxruntime

0 comments on commit c35b1e9

Please sign in to comment.