|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef LulPlatformMacros_h |
|
8 #define LulPlatformMacros_h |
|
9 |
|
10 #include <stdint.h> |
|
11 #include <stdlib.h> |
|
12 |
|
13 // Define platform selection macros in a consistent way. The primary |
|
14 // factorisation is on (ARCH,OS) pairs ("PLATforms") but ARCH_ and OS_ |
|
15 // macros are defined too, since they are sometimes convenient. |
|
16 |
|
17 #undef LUL_PLAT_x64_linux |
|
18 #undef LUL_PLAT_x86_linux |
|
19 #undef LUL_PLAT_arm_android |
|
20 #undef LUL_PLAT_x86_android |
|
21 |
|
22 #undef LUL_ARCH_arm |
|
23 #undef LUL_ARCH_x86 |
|
24 #undef LUL_ARCH_x64 |
|
25 |
|
26 #undef LUL_OS_android |
|
27 #undef LUL_OS_linux |
|
28 |
|
29 #if defined(__linux__) && defined(__x86_64__) |
|
30 # define LUL_PLAT_x64_linux 1 |
|
31 # define LUL_ARCH_x64 1 |
|
32 # define LUL_OS_linux 1 |
|
33 |
|
34 #elif defined(__linux__) && defined(__i386__) && !defined(__ANDROID__) |
|
35 # define LUL_PLAT_x86_linux 1 |
|
36 # define LUL_ARCH_x86 1 |
|
37 # define LUL_OS_linux 1 |
|
38 |
|
39 #elif defined(__ANDROID__) && defined(__arm__) |
|
40 # define LUL_PLAT_arm_android 1 |
|
41 # define LUL_ARCH_arm 1 |
|
42 # define LUL_OS_android 1 |
|
43 |
|
44 #elif defined(__ANDROID__) && defined(__i386__) |
|
45 # define LUL_PLAT_x86_android 1 |
|
46 # define LUL_ARCH_x86 1 |
|
47 # define LUL_OS_android 1 |
|
48 |
|
49 #else |
|
50 # error "Unsupported platform" |
|
51 #endif |
|
52 |
|
53 #endif // LulPlatformMacros_h |