optional stack trace support
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2024-07-26 09:23:21 -05:00
parent 68a5f90715
commit 8aba39c955
3 changed files with 32 additions and 25 deletions

View File

@ -31,6 +31,8 @@ dcmake_cxx_flags
dcpphttplib_openssl_support dcpphttplib_openssl_support
dcpphttplib_tcp_nodelay dcpphttplib_tcp_nodelay
dcpptrace_static_define dcpptrace_static_define
dcpptrace_unwind_with_execinfo
dcpptrace_unwind_with_libunwind
dcurl_ca_bundle dcurl_ca_bundle
dcurl_ca_fallback dcurl_ca_fallback
dcurl_disable_ldap dcurl_disable_ldap
@ -67,6 +69,7 @@ drocksdb_install_on_windows
dshared dshared
dspdlog_fmt_external dspdlog_fmt_external
dthreads_prefer_pthread_flag dthreads_prefer_pthread_flag
dunw_local_only
duse_libidn2 duse_libidn2
duuid_build_tests duuid_build_tests
dwith_benchmark dwith_benchmark

View File

@ -1,28 +1,29 @@
add_definitions(-DCPPTRACE_STATIC_DEFINE) if (NOT PROJECT_STATIC_LINK)
if(PROJECT_IS_MINGW)
add_definitions(-DCPPTRACE_UNWIND_WITH_DBGHELP)
else()
add_definitions(-DCPPTRACE_UNWIND_WITH_UNWIND)
endif()
if(PROJECT_IS_MINGW) include(FetchContent)
add_definitions(-DCPPTRACE_UNWIND_WITH_DBGHELP) FetchContent_Declare(
else() cpptrace
add_definitions(-DCPPTRACE_UNWIND_WITH_LIBUNWIND) GIT_REPOSITORY https://github.com/jeremy-rifkin/cpptrace.git
endif() GIT_TAG v0.6.3
include(FetchContent)
FetchContent_Declare(
cpptrace
GIT_REPOSITORY https://github.com/jeremy-rifkin/cpptrace.git
GIT_TAG v0.6.3
)
FetchContent_MakeAvailable(cpptrace)
link_libraries(cpptrace::cpptrace)
if(WIN32)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:cpptrace::cpptrace>
$<TARGET_FILE_DIR:your_target>
) )
FetchContent_MakeAvailable(cpptrace)
if(WIN32)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:cpptrace::cpptrace>
$<TARGET_FILE_DIR:your_target>
)
endif()
link_libraries(cpptrace::cpptrace)
endif() endif()
set(CMAKE_CXX_FLAGS "-include common.hpp ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-include common.hpp ${CMAKE_CXX_FLAGS}")

View File

@ -19,7 +19,9 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#if !defined(PROJECT_STATIC_LINK)
#include "cpptrace/cpptrace.hpp" #include "cpptrace/cpptrace.hpp"
#endif
#include "cli/actions.hpp" #include "cli/actions.hpp"
#include "initialize.hpp" #include "initialize.hpp"
@ -30,7 +32,10 @@
using namespace repertory; using namespace repertory;
auto main(int argc, char **argv) -> int { auto main(int argc, char **argv) -> int {
#if !defined(PROJECT_STATIC_LINK)
cpptrace::register_terminate_handler(); cpptrace::register_terminate_handler();
#endif
if (not repertory::project_initialize()) { if (not repertory::project_initialize()) {
return -1; return -1;
} }
@ -114,8 +119,6 @@ auto main(int argc, char **argv) -> int {
} }
} }
throw std::runtime_error("test");
int mount_result{}; int mount_result{};
if (res == exit_code::success) { if (res == exit_code::success) {
if (utils::cli::has_option(args, utils::cli::options::help_option)) { if (utils::cli::has_option(args, utils::cli::options::help_option)) {