Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 17 | #ifndef PERFETTO_BASE_BUILD_CONFIG_H_ |
| 18 | #define PERFETTO_BASE_BUILD_CONFIG_H_ |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 19 | |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 20 | // DO NOT include this file in public headers (include/) to avoid collisions. |
| 21 | |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 22 | // Allows to define build flags that give a compiler error if the header that |
| 23 | // defined the flag is not included, instead of silently ignoring the #if block. |
| 24 | #define BUILDFLAG_CAT_INDIRECT(a, b) a##b |
| 25 | #define BUILDFLAG_CAT(a, b) BUILDFLAG_CAT_INDIRECT(a, b) |
| 26 | #define BUILDFLAG(flag) (BUILDFLAG_CAT(BUILDFLAG_DEFINE_, flag)()) |
| 27 | |
| 28 | #if defined(ANDROID) |
| 29 | #define BUILDFLAG_DEFINE_OS_ANDROID() 1 |
| 30 | #define BUILDFLAG_DEFINE_OS_MACOSX() 0 |
| 31 | #define BUILDFLAG_DEFINE_OS_LINUX() 0 |
| 32 | #elif defined(__APPLE__) |
| 33 | #define BUILDFLAG_DEFINE_OS_ANDROID() 0 |
| 34 | #define BUILDFLAG_DEFINE_OS_MACOSX() 1 |
| 35 | #define BUILDFLAG_DEFINE_OS_LINUX() 0 |
| 36 | #elif defined(__linux__) |
| 37 | #define BUILDFLAG_DEFINE_OS_ANDROID() 0 |
| 38 | #define BUILDFLAG_DEFINE_OS_MACOSX() 0 |
| 39 | #define BUILDFLAG_DEFINE_OS_LINUX() 1 |
| 40 | #else |
| 41 | #error OS not supported (see build_config.h) |
| 42 | #endif |
| 43 | |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 44 | #endif // PERFETTO_BASE_BUILD_CONFIG_H_ |