Skip to content
Snippets Groups Projects
Commit 8b64fa54 authored by Andrew Woloszyn's avatar Andrew Woloszyn
Browse files

Fixes for compiling glslang on Android.

Primarily fix is due to Android not supporting std::to_string().
parent f99b7dde
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@
#include <algorithm>
#include <cassert>
#include "../glslang/Include/Common.h"
namespace spv {
......
......@@ -24,7 +24,9 @@ set(LIBRARIES
if(WIN32)
set(LIBRARIES ${LIBRARIES} psapi)
elseif(UNIX)
set(LIBRARIES ${LIBRARIES} pthread)
if(NOT ANDROID)
set(LIBRARIES ${LIBRARIES} pthread)
endif()
endif(WIN32)
target_link_libraries(glslangValidator ${LIBRARIES})
......
......@@ -51,6 +51,17 @@
#define UINT_PTR uintptr_t
#endif
#ifdef __ANDROID__
#include <sstream>
namespace std {
template<typename T>
std::string to_string(const T& val) {
std::ostringstream os;
os << val;
return os.str();
}
}
#endif
/* windows only pragma */
#ifdef _MSC_VER
#pragma warning(disable : 4786) // Don't warn about too long identifiers
......
......@@ -48,6 +48,8 @@ namespace {
bool is_positive_infinity(double x) {
#ifdef _MSC_VER
return _fpclass(x) == _FPCLASS_PINF;
#elif defined __ANDROID__
return std::isinf(x) && (x >= 0);
#else
return isinf(x) && (x >= 0);
#endif
......
......@@ -62,6 +62,9 @@ void DetachThreadLinux(void *)
//
void OS_CleanupThreadData(void)
{
#ifdef __ANDROID__
DetachThread();
#else
int old_cancel_state, old_cancel_type;
void *cleanupArg = NULL;
......@@ -85,6 +88,7 @@ void OS_CleanupThreadData(void)
// Restore the thread's previous cancellation mode.
//
pthread_setcanceltype(old_cancel_state, NULL);
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment