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 #include "TargetConditionals.h" 33 #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 34 #define PLATFORM_POSIX_IOS 35 #define IS_MOBILE_PLATFORM 36 #else 37 // If no platform specified, use: 38 #define PLATFORM_POSIX 39 #endif 40 41 #elif defined(_WIN32) 42 #define PLATFORM_WINDOWS 43 44 #elif defined(__EMSCRIPTEN__) 45 #define PLATFORM_PORTABLE_GOOGLE 46 #define PLATFORM_POSIX 47 // EMSCRIPTEN builds are considered "mobile" for the sake of portability. 48 #define IS_MOBILE_PLATFORM 49 50 #else 51 // If no platform specified, use: 52 #define PLATFORM_POSIX 53 54 #endif 55 #endif 56 57 // Look for both gcc/clang and Visual Studio macros indicating we're compiling 58 // for an x86 device. 59 #if defined(__x86_64__) || defined(__amd64__) || defined(_M_IX86) || \ 60 defined(_M_X64) 61 #define PLATFORM_IS_X86 62 #endif 63 64 #endif // TENSORFLOW_PLATFORM_PLATFORM_DEFINE_H_ 65