Skip to content

Commit

Permalink
Allow compilation on android (#7386)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse authored Nov 13, 2024
1 parent 0734571 commit c289562
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wpinet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wpinet/examples/dsclient/dsclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ int main() {
});

// wait for a keypress to terminate
std::getchar();
static_cast<void>(std::getchar());
}
2 changes: 1 addition & 1 deletion wpinet/examples/parallelconnect/parallelconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ int main() {
});

// wait for a keypress to terminate
std::getchar();
static_cast<void>(std::getchar());
}
2 changes: 1 addition & 1 deletion wpinet/examples/webserver/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ int main() {
});

// wait for a keypress to terminate
std::getchar();
static_cast<void>(std::getchar());
}
5 changes: 5 additions & 0 deletions wpiutil/src/main/native/unix/StackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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

0 comments on commit c289562

Please sign in to comment.