Unix: compatibility with platforms where backtrace() is not in libc.
Also, don't depend on backtrace() when built as libslvs; it is not the responsbility of the library to use it.
This commit is contained in:
parent
8ccc9fe56c
commit
ad2371cfae
|
@ -187,6 +187,7 @@ elseif(APPLE)
|
||||||
find_package(Freetype REQUIRED)
|
find_package(Freetype REQUIRED)
|
||||||
find_library(APPKIT_LIBRARY AppKit REQUIRED)
|
find_library(APPKIT_LIBRARY AppKit REQUIRED)
|
||||||
else() # Linux and compatible systems
|
else() # Linux and compatible systems
|
||||||
|
find_package(Backtrace)
|
||||||
find_package(SpaceWare)
|
find_package(SpaceWare)
|
||||||
|
|
||||||
# Use freedesktop's pkg-config to locate everything.
|
# Use freedesktop's pkg-config to locate everything.
|
||||||
|
|
|
@ -216,6 +216,11 @@ if(SPACEWARE_FOUND)
|
||||||
${SPACEWARE_LIBRARIES})
|
${SPACEWARE_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(Backtrace_FOUND)
|
||||||
|
target_link_libraries(solvespace
|
||||||
|
${Backtrace_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
foreach(lib ${platform_BUNDLED_LIBS})
|
foreach(lib ${platform_BUNDLED_LIBS})
|
||||||
get_filename_component(name ${lib} NAME)
|
get_filename_component(name ${lib} NAME)
|
||||||
|
|
|
@ -31,6 +31,7 @@ void assert_failure(const char *file, unsigned line, const char *function,
|
||||||
fprintf(stderr, "File %s, line %u, function %s:\n", file, line, function);
|
fprintf(stderr, "File %s, line %u, function %s:\n", file, line, function);
|
||||||
fprintf(stderr, "Assertion '%s' failed: ((%s) == false).\n", message, condition);
|
fprintf(stderr, "Assertion '%s' failed: ((%s) == false).\n", message, condition);
|
||||||
|
|
||||||
|
#ifndef LIBRARY
|
||||||
static void *ptrs[1024] = {};
|
static void *ptrs[1024] = {};
|
||||||
size_t nptrs = backtrace(ptrs, sizeof(ptrs) / sizeof(ptrs[0]));
|
size_t nptrs = backtrace(ptrs, sizeof(ptrs) / sizeof(ptrs[0]));
|
||||||
char **syms = backtrace_symbols(ptrs, nptrs);
|
char **syms = backtrace_symbols(ptrs, nptrs);
|
||||||
|
@ -45,6 +46,7 @@ void assert_failure(const char *file, unsigned line, const char *function,
|
||||||
fprintf(stderr, "%2zu: %p\n", i, ptrs[i]);
|
fprintf(stderr, "%2zu: %p\n", i, ptrs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user