Allow compilation on android (#7386)

This commit is contained in:
Thad House
2024-11-12 16:39:41 -08:00
committed by GitHub
parent 07345712dc
commit c289562a06
5 changed files with 9 additions and 4 deletions

View File

@@ -202,7 +202,7 @@ foreach(example ${wpinet_examples})
endif()
endforeach()
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT ANDROID)
set(LIBUTIL -lutil)
else()
set(LIBUTIL)

View File

@@ -32,5 +32,5 @@ int main() {
});
// wait for a keypress to terminate
std::getchar();
static_cast<void>(std::getchar());
}

View File

@@ -48,5 +48,5 @@ int main() {
});
// wait for a keypress to terminate
std::getchar();
static_cast<void>(std::getchar());
}

View File

@@ -85,5 +85,5 @@ int main() {
});
// wait for a keypress to terminate
std::getchar();
static_cast<void>(std::getchar());
}

View File

@@ -16,6 +16,7 @@
namespace wpi {
std::string GetStackTraceDefault(int offset) {
#ifndef __ANDROID__
void* stackTrace[128];
int stackSize = backtrace(stackTrace, 128);
char** mangledSymbols = backtrace_symbols(stackTrace, stackSize);
@@ -38,6 +39,10 @@ std::string GetStackTraceDefault(int offset) {
std::free(mangledSymbols);
return std::string{trace.str()};
#else
// backtrace_symbols not supported on android
return "";
#endif
}
} // namespace wpi