All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
defines.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef ARCH_DEFINES_H
25 #define ARCH_DEFINES_H
26 
27 #include "pxr/pxr.h"
28 
29 PXR_NAMESPACE_OPEN_SCOPE
30 
31 //
32 // OS
33 //
34 
35 #if defined(__linux__)
36 #define ARCH_OS_LINUX
37 #elif defined(__APPLE__)
38 #include "TargetConditionals.h"
39 #define ARCH_OS_DARWIN
40 #if TARGET_OS_IPHONE
41 #define ARCH_OS_IOS
42 #else
43 #define ARCH_OS_OSX
44 #endif
45 #elif defined(_WIN32) || defined(_WIN64)
46 #define ARCH_OS_WINDOWS
47 #endif
48 
49 //
50 // Processor
51 //
52 
53 #if defined(i386) || defined(__i386__) || defined(__x86_64__) || \
54  defined(_M_IX86) || defined(_M_X64)
55 #define ARCH_CPU_INTEL
56 #elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM)
57 #define ARCH_CPU_ARM
58 #endif
59 
60 //
61 // Bits
62 //
63 
64 #if defined(__x86_64__) || defined(__aarch64__) || defined(_M_X64)
65 #define ARCH_BITS_64
66 #else
67 #error "Unsupported architecture. x86_64 or ARM64 required."
68 #endif
69 
70 //
71 // Compiler
72 //
73 
74 #if defined(__clang__)
75 #define ARCH_COMPILER_CLANG
76 #define ARCH_COMPILER_CLANG_MAJOR __clang_major__
77 #define ARCH_COMPILER_CLANG_MINOR __clang_minor__
78 #define ARCH_COMPILER_CLANG_PATCHLEVEL __clang_patchlevel__
79 #elif defined(__GNUC__)
80 #define ARCH_COMPILER_GCC
81 #define ARCH_COMPILER_GCC_MAJOR __GNUC__
82 #define ARCH_COMPILER_GCC_MINOR __GNUC_MINOR__
83 #define ARCH_COMPILER_GCC_PATCHLEVEL __GNUC_PATCHLEVEL__
84 #elif defined(__ICC)
85 #define ARCH_COMPILER_ICC
86 #elif defined(_MSC_VER)
87 #define ARCH_COMPILER_MSVC
88 #define ARCH_COMPILER_MSVC_VERSION _MSC_VER
89 #endif
90 
91 //
92 // Features
93 //
94 
95 // Only use the GNU STL extensions on Linux when using gcc.
96 #if defined(ARCH_OS_LINUX) && defined(ARCH_COMPILER_GCC)
97 #define ARCH_HAS_GNU_STL_EXTENSIONS
98 #endif
99 
100 // The current version of Apple clang does not support the thread_local
101 // keyword.
102 #if !(defined(ARCH_OS_DARWIN) && defined(ARCH_COMPILER_CLANG))
103 #define ARCH_HAS_THREAD_LOCAL
104 #endif
105 
106 // The MAP_POPULATE flag for mmap calls only exists on Linux platforms.
107 #if defined(ARCH_OS_LINUX)
108 #define ARCH_HAS_MMAP_MAP_POPULATE
109 #endif
110 
111 PXR_NAMESPACE_CLOSE_SCOPE
112 
113 #endif // ARCH_DEFINES_H