1 |
efrain |
1 |
// Copyright 2019 Google
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#pragma once
|
|
|
16 |
|
|
|
17 |
#include <TargetConditionals.h>
|
|
|
18 |
|
|
|
19 |
// macro trickiness
|
|
|
20 |
#define CONCAT_EXPANDED(a, b) a##b
|
|
|
21 |
#define CONCAT(a, b) CONCAT_EXPANDED(a, b)
|
|
|
22 |
|
|
|
23 |
// These macros generate a function to force a symbol for the containing .o, to work around an issue
|
|
|
24 |
// where strip will not strip debug information without a symbol to strip.
|
|
|
25 |
#define DUMMY_FUNCTION_NAME(x) CONCAT(fircls_strip_this_, x)
|
|
|
26 |
#define INJECT_STRIP_SYMBOL(x) \
|
|
|
27 |
void DUMMY_FUNCTION_NAME(x)(void) { \
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
// These make some target os types available to previous versions of xcode that do not yet have them
|
|
|
31 |
// in their SDKs
|
|
|
32 |
#ifndef TARGET_OS_IOS
|
|
|
33 |
#define TARGET_OS_IOS TARGET_OS_IPHONE
|
|
|
34 |
#endif
|
|
|
35 |
|
|
|
36 |
#ifndef TARGET_OS_WATCH
|
|
|
37 |
#define TARGET_OS_WATCH 0
|
|
|
38 |
#endif
|
|
|
39 |
|
|
|
40 |
#ifndef TARGET_OS_TV
|
|
|
41 |
#define TARGET_OS_TV 0
|
|
|
42 |
#endif
|
|
|
43 |
|
|
|
44 |
// Whether MetricKit should be supported
|
|
|
45 |
#if defined(__IPHONE_15_0)
|
|
|
46 |
#define CLS_METRICKIT_SUPPORTED (__has_include(<MetricKit/MetricKit.h>) && TARGET_OS_IOS)
|
|
|
47 |
#else
|
|
|
48 |
#define CLS_METRICKIT_SUPPORTED 0
|
|
|
49 |
#endif
|
|
|
50 |
|
|
|
51 |
// These help compile based on availability of technologies/frameworks.
|
|
|
52 |
#define CLS_TARGET_OS_OSX (TARGET_OS_MAC && !TARGET_OS_IPHONE)
|
|
|
53 |
#define CLS_TARGET_OS_HAS_UIKIT (TARGET_OS_IOS || TARGET_OS_TV)
|
|
|
54 |
|
|
|
55 |
// arch definitions
|
|
|
56 |
#if defined(__arm__) || defined(__arm64__) || defined(__arm64e__)
|
|
|
57 |
#include <arm/arch.h>
|
|
|
58 |
#endif
|
|
|
59 |
|
|
|
60 |
#if defined(__arm__)
|
|
|
61 |
#define CLS_CPU_ARM 1
|
|
|
62 |
#endif
|
|
|
63 |
#if defined(__arm64__) || defined(__arm64e__)
|
|
|
64 |
#define CLS_CPU_ARM64 1
|
|
|
65 |
#endif
|
|
|
66 |
#if defined(__ARM_ARCH_7S__)
|
|
|
67 |
#define CLS_CPU_ARMV7S 1
|
|
|
68 |
#endif
|
|
|
69 |
#if defined(_ARM_ARCH_7)
|
|
|
70 |
#define CLS_CPU_ARMV7 1
|
|
|
71 |
#endif
|
|
|
72 |
#if defined(_ARM_ARCH_6)
|
|
|
73 |
#define CLS_CPU_ARMV6 1
|
|
|
74 |
#endif
|
|
|
75 |
#if defined(__i386__)
|
|
|
76 |
#define CLS_CPU_I386 1
|
|
|
77 |
#endif
|
|
|
78 |
#if defined(__x86_64__)
|
|
|
79 |
#define CLS_CPU_X86_64 1
|
|
|
80 |
#endif
|
|
|
81 |
#define CLS_CPU_X86 (CLS_CPU_I386 || CLS_CPU_X86_64)
|
|
|
82 |
#define CLS_CPU_64BIT (CLS_CPU_X86_64 || CLS_CPU_ARM64)
|