mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
121 lines
4.1 KiB
C
121 lines
4.1 KiB
C
// Copyright 2021 Google LLC
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#ifndef THIRD_PARTY_NEARBY_SHARING_INTERNAL_BASE_UTF_STRING_CONFIGURATION_H_
|
|
#define THIRD_PARTY_NEARBY_SHARING_INTERNAL_BASE_UTF_STRING_CONFIGURATION_H_
|
|
|
|
// A set of macros to use for platform detection.
|
|
#if defined(__native_client__)
|
|
// __native_client__ must be first, so that other OS_ defines are not set.
|
|
#define OS_NACL 1
|
|
#define OS_NACL_SFI
|
|
#elif defined(ANDROID)
|
|
#define OS_ANDROID 1
|
|
#elif defined(__APPLE__)
|
|
// Only include TargetConditionals after testing ANDROID as some Android builds
|
|
// on the Mac have this header available and it's not needed unless the target
|
|
// is really an Apple platform.
|
|
#include <TargetConditionals.h>
|
|
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
|
#define OS_IOS 1
|
|
#else
|
|
#define OS_MAC 1
|
|
#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
|
#elif defined(__linux__)
|
|
#if !defined(OS_CHROMEOS)
|
|
// Do not define OS_LINUX on Chrome OS build.
|
|
// The OS_CHROMEOS macro is defined in GN.
|
|
#define OS_LINUX 1
|
|
#endif // !defined(OS_CHROMEOS)
|
|
#if defined(__GLIBC__) && !defined(__UCLIBC__)
|
|
// We really are using glibc, not uClibc pretending to be glibc.
|
|
#define LIBC_GLIBC 1
|
|
#endif
|
|
#elif defined(_WIN32)
|
|
#define OS_WIN 1
|
|
#elif defined(__Fuchsia__)
|
|
#define OS_FUCHSIA 1
|
|
#elif defined(__FreeBSD__)
|
|
#define OS_FREEBSD 1
|
|
#elif defined(__NetBSD__)
|
|
#define OS_NETBSD 1
|
|
#elif defined(__OpenBSD__)
|
|
#define OS_OPENBSD 1
|
|
#elif defined(__sun)
|
|
#define OS_SOLARIS 1
|
|
#elif defined(__QNXNTO__)
|
|
#define OS_QNX 1
|
|
#elif defined(_AIX)
|
|
#define OS_AIX 1
|
|
#elif defined(__asmjs__) || defined(__wasm__)
|
|
#define OS_ASMJS 1
|
|
#elif defined(__MVS__)
|
|
#define OS_ZOS 1
|
|
#else
|
|
#error Please add support for your platform in build/build_config.h
|
|
#endif
|
|
// NOTE: Adding a new port? Please follow
|
|
// https://chromium.googlesource.com/chromium/src/+/main/docs/new_port_policy.md
|
|
|
|
#if defined(OS_MAC) || defined(OS_IOS)
|
|
#define OS_APPLE 1
|
|
#endif
|
|
|
|
// For access to standard BSD features, use OS_BSD instead of a
|
|
// more specific macro.
|
|
#if defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD)
|
|
#define OS_BSD 1
|
|
#endif
|
|
|
|
// For access to standard POSIX features, use OS_POSIX instead of a
|
|
// more specific macro.
|
|
#if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \
|
|
defined(OS_FREEBSD) || defined(OS_IOS) || defined(OS_LINUX) || \
|
|
defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_NACL) || \
|
|
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_QNX) || \
|
|
defined(OS_SOLARIS) || defined(OS_ZOS)
|
|
#define OS_POSIX 1
|
|
#endif
|
|
|
|
// Compiler detection. Note: clang masquerades as GCC on POSIX and as MSVC on
|
|
// Windows.
|
|
#if defined(__GNUC__)
|
|
#define COMPILER_GCC 1
|
|
#elif defined(_MSC_VER)
|
|
#define COMPILER_MSVC 1
|
|
#else
|
|
#error Please add support for your compiler in build/build_config.h
|
|
#endif
|
|
|
|
// Type detection for wchar_t.
|
|
#if defined(OS_WIN)
|
|
#define WCHAR_T_IS_UTF16
|
|
#elif defined(OS_FUCHSIA)
|
|
#define WCHAR_T_IS_UTF32
|
|
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
|
|
(__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
|
|
#define WCHAR_T_IS_UTF32
|
|
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
|
|
(__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
|
|
// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
|
|
// compile in this mode (in particular, Chrome doesn't). This is intended for
|
|
// other projects using base who manage their own dependencies and make sure
|
|
// short wchar works for them.
|
|
#define WCHAR_T_IS_UTF16
|
|
#else
|
|
#error Please add support for your compiler in build/build_config.h
|
|
#endif
|
|
|
|
#endif // THIRD_PARTY_NEARBY_SHARING_INTERNAL_BASE_UTF_STRING_CONFIGURATION_H_
|