Replace ANDROID with __ANDROID__ (#4909)
__ANDROID__ is always set by the toolchain and less likely to cause conflicts than ANDROID. This change also removes the -DANDROID flag we set ourselves in our toolchain CMake files since we don't need it anymore.
This commit is contained in:
@@ -69,7 +69,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
# C_FLAGS += -Wl,-pie
|
||||
# CXX_FLAGS += -lstdc++
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANDROID -fPIE -mcpu=cortex-a57" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE -mcpu=cortex-a57" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING "Toolchain CXXFLAGS")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie -static-libstdc++" CACHE STRING "Toolchain LDFLAGS")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++" CACHE STRING "Toolchain LDFLAGS")
|
||||
|
||||
@@ -81,7 +81,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
# for hardfp: CFLAGS must have -mhard-float
|
||||
# LDFLAGS must have -Wl,--no-warn-mismatch
|
||||
#
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb -march=armv7-a -mcpu=cortex-a15 -mfloat-abi=softfp -mfpu=neon-vfpv4 -DANDROID -fPIE" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb -march=armv7-a -mcpu=cortex-a15 -mfloat-abi=softfp -mfpu=neon-vfpv4 -fPIE" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING "Toolchain CXXFLAGS")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -march=armv7-a -Wl,--no-warn-mismatch -L${TOOLCHAIN}/arm-linux-androideabi/lib/armv7-a -static-libstdc++ -fPIE -pie" CACHE STRING "Toolchain LDFLAGS")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -march=armv7-a -Wl,--no-warn-mismatch -L${TOOLCHAIN}/arm-linux-androideabi/lib/armv7-a -static-libstdc++" CACHE STRING "Toolchain LDFLAGS")
|
||||
|
||||
@@ -65,7 +65,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
# compiler and linker flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANDROID -fPIE" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING "Toolchain CXXFLAGS")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-warn-mismatch -L${TOOLCHAIN}/i686-linux-android/lib64/ -static-libstdc++ -fPIE -pie" CACHE STRING "Toolchain LDFLAGS")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-warn-mismatch -L${TOOLCHAIN}/i686-linux-android/lib64/ -static-libstdc++" CACHE STRING "Toolchain LDFLAGS")
|
||||
|
||||
@@ -65,7 +65,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
# compiler and linker flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANDROID -fPIE" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE" CACHE STRING "Toolchain CFLAGS")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING "Toolchain CXXFLAGS")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-warn-mismatch -L${TOOLCHAIN}/x86_64-linux-android/lib64/ -static-libstdc++ -fPIE -pie" CACHE STRING "Toolchain LDFLAGS")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-warn-mismatch -L${TOOLCHAIN}/x86_64-linux-android/lib64/ -static-libstdc++" CACHE STRING "Toolchain LDFLAGS")
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,7 @@ CommandStream::CommandStream(Driver& driver, CircularBuffer& buffer) noexcept
|
||||
, mThreadId(std::this_thread::get_id())
|
||||
#endif
|
||||
{
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
char property[PROP_VALUE_MAX];
|
||||
__system_property_get("debug.filament.perfcounters", property);
|
||||
mUsePerformanceCounter = bool(atoi(property));
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <utils/Systrace.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
#include <sys/system_properties.h>
|
||||
#if defined(FILAMENT_SUPPORTS_OPENGL) && !defined(FILAMENT_USE_EXTERNAL_GLES3)
|
||||
#include "opengl/platforms/PlatformEGLAndroid.h"
|
||||
@@ -90,7 +90,7 @@ DefaultPlatform* DefaultPlatform::create(Backend* backend) noexcept {
|
||||
SYSTRACE_CALL();
|
||||
assert_invariant(backend);
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
char scratch[PROP_VALUE_MAX + 1];
|
||||
int length = __system_property_get("debug.filament.backend", scratch);
|
||||
if (length > 0) {
|
||||
@@ -101,7 +101,7 @@ DefaultPlatform* DefaultPlatform::create(Backend* backend) noexcept {
|
||||
if (*backend == Backend::DEFAULT) {
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
*backend = Backend::OPENGL;
|
||||
#elif defined(ANDROID)
|
||||
#elif defined(__ANDROID__)
|
||||
*backend = Backend::OPENGL;
|
||||
#elif defined(IOS) || defined(__APPLE__)
|
||||
*backend = Backend::METAL;
|
||||
@@ -116,7 +116,7 @@ DefaultPlatform* DefaultPlatform::create(Backend* backend) noexcept {
|
||||
}
|
||||
if (*backend == Backend::VULKAN) {
|
||||
#if defined(FILAMENT_DRIVER_SUPPORTS_VULKAN)
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
return new PlatformVkAndroid();
|
||||
#elif defined(IOS)
|
||||
return new PlatformVkCocoaTouch();
|
||||
@@ -148,7 +148,7 @@ DefaultPlatform* DefaultPlatform::create(Backend* backend) noexcept {
|
||||
#if defined(FILAMENT_SUPPORTS_OPENGL)
|
||||
#if defined(FILAMENT_USE_EXTERNAL_GLES3) || defined(FILAMENT_USE_SWIFTSHADER)
|
||||
return nullptr;
|
||||
#elif defined(ANDROID)
|
||||
#elif defined(__ANDROID__)
|
||||
return new PlatformEGLAndroid();
|
||||
#elif defined(IOS)
|
||||
return new PlatformCocoaTouchGL();
|
||||
|
||||
@@ -31,7 +31,7 @@ NoopDriver::NoopDriver() noexcept : DriverBase(new ConcreteDispatcher<NoopDriver
|
||||
NoopDriver::~NoopDriver() noexcept = default;
|
||||
|
||||
backend::ShaderModel NoopDriver::getShaderModel() const noexcept {
|
||||
#if defined(ANDROID) || defined(IOS) || defined(__EMSCRIPTEN__)
|
||||
#if defined(__ANDROID__) || defined(IOS) || defined(__EMSCRIPTEN__)
|
||||
return ShaderModel::GL_ES_30;
|
||||
#else
|
||||
return ShaderModel::GL_CORE_41;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined(ANDROID) || defined(FILAMENT_USE_EXTERNAL_GLES3) || defined(__EMSCRIPTEN__)
|
||||
#if defined(__ANDROID__) || defined(FILAMENT_USE_EXTERNAL_GLES3) || defined(__EMSCRIPTEN__)
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef TNT_FILAMENT_DRIVER_GL_HEADERS_H
|
||||
#define TNT_FILAMENT_DRIVER_GL_HEADERS_H
|
||||
|
||||
#if defined(ANDROID) || defined(FILAMENT_USE_EXTERNAL_GLES3) || defined(__EMSCRIPTEN__)
|
||||
#if defined(__ANDROID__) || defined(FILAMENT_USE_EXTERNAL_GLES3) || defined(__EMSCRIPTEN__)
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
||||
@@ -166,7 +166,7 @@ VulkanDriver::VulkanDriver(VulkanPlatform* platform,
|
||||
}
|
||||
|
||||
} else {
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
utils::slog.d << "Validation layers are not available; did you set jniLibs in your "
|
||||
<< "gradle file?" << utils::io::endl;
|
||||
#else
|
||||
@@ -186,7 +186,7 @@ VulkanDriver::VulkanDriver(VulkanPlatform* platform,
|
||||
ppEnabledExtensions[enabledExtensionCount++] = "VK_KHR_surface";
|
||||
ppEnabledExtensions[enabledExtensionCount++] = "VK_KHR_get_physical_device_properties2";
|
||||
#if VK_ENABLE_VALIDATION
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
ppEnabledExtensions[enabledExtensionCount++] = "VK_EXT_debug_report";
|
||||
#endif
|
||||
if (validationFeaturesSupported) {
|
||||
@@ -307,7 +307,7 @@ Driver* VulkanDriver::create(VulkanPlatform* const platform,
|
||||
}
|
||||
|
||||
ShaderModel VulkanDriver::getShaderModel() const noexcept {
|
||||
#if defined(ANDROID) || defined(IOS)
|
||||
#if defined(__ANDROID__) || defined(IOS)
|
||||
return ShaderModel::GL_ES_30;
|
||||
#else
|
||||
return ShaderModel::GL_CORE_41;
|
||||
|
||||
@@ -304,7 +304,7 @@ void VulkanSwapChain::makePresentable() {
|
||||
// subresources affected by the barrier
|
||||
//
|
||||
// (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkImageMemoryBarrier-oldLayout-01197)
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
#else
|
||||
// If nothing was rendered, then the layout was never transitioned to COLOR_ATTACHMENT_OPTIMAL.
|
||||
|
||||
@@ -410,7 +410,7 @@ void FEngine::flush() {
|
||||
|
||||
void FEngine::flushAndWait() {
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
// first make sure we've not terminated filament
|
||||
ASSERT_PRECONDITION(!mCommandBufferQueue.isExitRequested(),
|
||||
@@ -421,7 +421,7 @@ void FEngine::flushAndWait() {
|
||||
// enqueue finish command -- this will stall in the driver until the GPU is done
|
||||
getDriverApi().finish();
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
// then create a fence that will trigger when we're past the finish() above
|
||||
size_t tryCount = 8;
|
||||
@@ -471,7 +471,7 @@ int FEngine::loop() {
|
||||
}
|
||||
|
||||
#if FILAMENT_ENABLE_MATDBG
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
const char* portString = "8081";
|
||||
#else
|
||||
const char* portString = getenv("FILAMENT_MATDBG_PORT");
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
// For emscripten and Android builds, we never load from the file
|
||||
// system, so we-opt out of the stdio functionality in stb.
|
||||
#if defined(__EMSCRIPTEN__) || defined(ANDROID)
|
||||
#if defined(__EMSCRIPTEN__) || defined(__ANDROID__)
|
||||
#define STBI_NO_STDIO
|
||||
#endif
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#if defined(__EMSCRIPTEN__) || defined(ANDROID) || defined(IOS)
|
||||
#if defined(__EMSCRIPTEN__) || defined(__ANDROID__) || defined(IOS)
|
||||
#define USE_FILESYSTEM 0
|
||||
#else
|
||||
#define USE_FILESYSTEM 1
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define SYSTRACE_TAG_JOBSYSTEM (1<<2)
|
||||
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
#include <atomic>
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ FreeList::FreeList(void* begin, void* end,
|
||||
AtomicFreeList::AtomicFreeList(void* begin, void* end,
|
||||
size_t elementSize, size_t alignment, size_t extra) noexcept
|
||||
{
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
// on some platform (e.g. web) this returns false. we really only care about mobile though.
|
||||
assert(mHead.is_lock_free());
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <memory>
|
||||
|
||||
// FIXME: Some platforms do not have execinfo.h (but have unwind.h)
|
||||
#if !defined(ANDROID) && !defined(WIN32) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(__ANDROID__) && !defined(WIN32) && !defined(__EMSCRIPTEN__)
|
||||
#include <execinfo.h>
|
||||
#define HAS_EXECINFO 1
|
||||
#else
|
||||
|
||||
@@ -39,7 +39,7 @@ static constexpr bool DEBUG_FINISH_HANGS = false;
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
# include <sys/time.h>
|
||||
# include <sys/resource.h>
|
||||
# ifndef ANDROID_PRIORITY_URGENT_DISPLAY
|
||||
@@ -81,7 +81,7 @@ void JobSystem::setThreadName(const char* name) noexcept {
|
||||
}
|
||||
|
||||
void JobSystem::setThreadPriority(Priority priority) noexcept {
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
int androidPriority = 0;
|
||||
switch (priority) {
|
||||
case Priority::NORMAL:
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <string>
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
# include <android/log.h>
|
||||
# ifndef UTILS_LOG_TAG
|
||||
# define UTILS_LOG_TAG "Filament"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <utils/Systrace.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
#include <utils/api_level.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include <mutex>
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
|
||||
namespace utils {
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
|
||||
uint32_t sApiLevel = 0;
|
||||
std::once_flag sApiLevelOnceFlag;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/stat.h>
|
||||
# include <memory.h>
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#if __ANDROID_API__ >= 26
|
||||
|
||||
|
||||
6
third_party/civetweb/src/civetweb.c
vendored
6
third_party/civetweb/src/civetweb.c
vendored
@@ -162,7 +162,7 @@ mg_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
|
||||
#define PATH_MAX FILENAME_MAX
|
||||
#endif /* __SYMBIAN32__ */
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
@@ -804,7 +804,7 @@ struct mg_pollfd {
|
||||
|
||||
typedef const void *SOCK_OPT_TYPE;
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(__ANDROID__)
|
||||
typedef unsigned short int in_port_t;
|
||||
#endif
|
||||
|
||||
@@ -3691,7 +3691,7 @@ mg_difftimespec(const struct timespec *ts_now, const struct timespec *ts_before)
|
||||
}
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
static void mg_cry_internal_impl(const struct mg_connection *conn,
|
||||
const char *func,
|
||||
unsigned line,
|
||||
|
||||
4
third_party/draco/tnt/CMakeLists.txt
vendored
4
third_party/draco/tnt/CMakeLists.txt
vendored
@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
project(draco C CXX)
|
||||
|
||||
if (ANDROID)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANDROID")
|
||||
endif()
|
||||
|
||||
if (LINUX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user