• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
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 
16 #ifndef TENSORFLOW_PLATFORM_PLATFORM_DEFINE_H_
17 #define TENSORFLOW_PLATFORM_PLATFORM_DEFINE_H_
18 
19 // Set one PLATFORM_* macro and set IS_MOBILE_PLATFORM if the platform is for
20 // mobile.
21 
22 #if !defined(PLATFORM_POSIX) && !defined(PLATFORM_GOOGLE) &&                 \
23     !defined(PLATFORM_POSIX_ANDROID) && !defined(PLATFORM_GOOGLE_ANDROID) && \
24     !defined(PLATFORM_WINDOWS)
25 
26 // Choose which platform we are on.
27 #if defined(ANDROID) || defined(__ANDROID__)
28 #define PLATFORM_POSIX_ANDROID
29 #define IS_MOBILE_PLATFORM
30 
31 #elif defined(__APPLE__)
32 #define PLATFORM_POSIX
33 #include "TargetConditionals.h"
34 #if TARGET_IPHONE_SIMULATOR
35 #define IS_MOBILE_PLATFORM
36 #elif TARGET_OS_IPHONE
37 #define IS_MOBILE_PLATFORM
38 #endif
39 
40 #elif defined(_WIN32)
41 #define PLATFORM_WINDOWS
42 
43 #elif defined(__arm__) || defined(__EMSCRIPTEN__)
44 #define PLATFORM_POSIX
45 
46 // Require an outside macro to tell us if we're building for Raspberry Pi or
47 // another ARM device that's not a mobile platform.
48 #if !defined(RASPBERRY_PI) && !defined(ARM_NON_MOBILE)
49 #define IS_MOBILE_PLATFORM
50 #endif  // !defined(RASPBERRY_PI) && !defined(ARM_NON_MOBILE)
51 
52 #else
53 // If no platform specified, use:
54 #define PLATFORM_POSIX
55 
56 #endif
57 #endif
58 
59 // Look for both gcc/clang and Visual Studio macros indicating we're compiling
60 // for an x86 device.
61 #if defined(__x86_64__) || defined(__amd64__) || defined(_M_IX86) || \
62     defined(_M_X64)
63 #define PLATFORM_IS_X86
64 #endif
65 
66 #endif  // TENSORFLOW_PLATFORM_PLATFORM_DEFINE_H_
67