Commit bdcd3491 authored by Michael Kuron's avatar Michael Kuron
Browse files

Make dependency on execinfo.h optional

parent 6ea4987e
Pipeline #18907 passed with stages
in 246 minutes and 43 seconds
......@@ -777,6 +777,23 @@ endif()
############################################################################################################################
##
## backtrace may be in a separate library
##
############################################################################################################################
if ( NOT WIN32 AND (WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL OR WALBERLA_CXX_COMPILER_IS_CLANG))
find_package ( Backtrace QUIET )
if ( Backtrace_FOUND )
list ( APPEND SERVICE_LIBS ${Backtrace_LIBRARIES} )
set ( WALBERLA_BUILD_WITH_BACKTRACE ON )
set ( WALBERLA_BACKTRACE_HEADER ${Backtrace_HEADER} )
endif ( Backtrace_FOUND )
endif()
############################################################################################################################
##
## MPI
......
......@@ -36,9 +36,9 @@ void printStacktrace()
} // namespace debug
} // namespace walberla
#if defined(WALBERLA_CXX_COMPILER_IS_GNU) || defined(WALBERLA_CXX_COMPILER_IS_INTEL) || defined( WALBERLA_CXX_COMPILER_IS_CLANG)
#ifdef WALBERLA_BUILD_WITH_BACKTRACE
#include <execinfo.h>
#include WALBERLA_BACKTRACE_HEADER
#include <cstdlib>
#include <string>
......@@ -55,14 +55,13 @@ namespace debug {
void * array[BACKTRACE_LENGTH];
size_t size;
char **strings;
size_t i;
size = numeric_cast< size_t >( backtrace (array, BACKTRACE_LENGTH) );
strings = backtrace_symbols (array, int_c(size) );
os << "Backtrace: " << std::endl;
for (i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
std::string line ( strings[i] );
#ifdef __APPLE__
......
......@@ -53,6 +53,10 @@
#cmakedefine WALBERLA_USE_STD_ANY
#cmakedefine WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL
#cmakedefine WALBERLA_USE_STD_OPTIONAL
#cmakedefine WALBERLA_BUILD_WITH_BACKTRACE
#ifdef WALBERLA_BUILD_WITH_BACKTRACE
#define WALBERLA_BACKTRACE_HEADER "${Backtrace_HEADER}"
#endif
// SIMD
#cmakedefine WALBERLA_SIMD_FORCE_SCALAR
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment