mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 09:29:44 +00:00
fix Android build
This commit is contained in:
parent
2053b3a11f
commit
ee41e058a9
2 changed files with 12 additions and 3 deletions
|
|
@ -1,15 +1,14 @@
|
|||
#include "commons.hpp"
|
||||
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
|
||||
#define NOMINMAX
|
||||
#include <stdexcept>
|
||||
#include <limits>
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#include <curl/curl.h>
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@
|
|||
|
||||
#if defined(_WIN32)
|
||||
#include <malloc.h>
|
||||
#elif defined(__ANDROID__)
|
||||
static inline void* aligned_alloc(size_t alignment, size_t size) {
|
||||
void* ptr = nullptr;
|
||||
if (posix_memalign(&ptr, alignment, size) != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace util {
|
||||
|
|
@ -63,6 +71,8 @@ namespace util {
|
|||
std::unique_ptr<void, AlignedDeleter> ptr(
|
||||
#if defined(_WIN32)
|
||||
_aligned_malloc(sizeof(T), alignof(T))
|
||||
#elif defined(__ANDROID__)
|
||||
aligned_alloc(sizeof(T), alignof(T))
|
||||
#else
|
||||
std::aligned_alloc(alignof(T), sizeof(T))
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue