1 // Copyright 2018 The Amber Authors.
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 #ifndef SRC_PLATFORM_H_
16 #define SRC_PLATFORM_H_
17 
18 namespace amber {
19 
20 #if defined(_WIN32) || defined(_WIN64)
21 #define AMBER_PLATFORM_WINDOWS 1
22 #elif defined(__linux__)
23 #define AMBER_PLATFORM_LINUX 1
24 #define AMBER_PLATFORM_POSIX 1
25 #elif defined(__FreeBSD__)
26 #define AMBER_PLATFORM_FREEBSD 1
27 #define AMBER_PLATFORM_POSIX 1
28 #elif defined(__APPLE__)
29 #define AMBER_PLATFORM_APPLE 1
30 #define AMBER_PLATFORM_POSIX 1
31 #elif defined(__Fuchsia__)
32 #define AMBER_PLATFORM_POSIX 1
33 #elif defined(__QNX__)
34 #define AMBER_PLATFORM_QNX 1
35 #define AMBER_PLATFORM_POSIX 1
36 #else
37 #error "Unknown platform."
38 #endif
39 
40 #if !defined(AMBER_PLATFORM_WINDOWS)
41 #define AMBER_PLATFORM_WINDOWS 0
42 #endif
43 
44 #if !defined(AMBER_PLATFORM_LINUX)
45 #define AMBER_PLATFORM_LINUX 0
46 #endif
47 
48 #if !defined(AMBER_PLATFORM_FREEBSD)
49 #define AMBER_PLATFORM_FREEBSD 0
50 #endif
51 
52 #if !defined(AMBER_PLATFORM_APPLE)
53 #define AMBER_PLATFORM_APPLE 0
54 #endif
55 
56 #if !defined(AMBER_PLATFORM_POSIX)
57 #define AMBER_PLATFORM_POSIX 0
58 #endif
59 
60 #if !defined(AMBER_PLATFORM_QNX)
61 #define AMBER_PLATFORM_QNX 0
62 #endif
63 
64 }  // namespace amber
65 
66 #endif  // SRC_PLATFORM_H_
67