Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [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 | |
| 17 | #ifndef INCLUDE_PERFETTO_BASE_BUILD_CONFIG_H_ |
| 18 | #define INCLUDE_PERFETTO_BASE_BUILD_CONFIG_H_ |
| 19 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 20 | // Allows to define build flags that give a compiler error if the header that |
| 21 | // defined the flag is not included, instead of silently ignoring the #if block. |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 22 | #define PERFETTO_BUILDFLAG_CAT_INDIRECT(a, b) a##b |
| 23 | #define PERFETTO_BUILDFLAG_CAT(a, b) PERFETTO_BUILDFLAG_CAT_INDIRECT(a, b) |
| 24 | #define PERFETTO_BUILDFLAG(flag) \ |
| 25 | (PERFETTO_BUILDFLAG_CAT(PERFETTO_BUILDFLAG_DEFINE_, flag)()) |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 26 | |
Primiano Tucci | ce19ae9 | 2018-03-29 23:50:42 +0100 | [diff] [blame] | 27 | #if defined(__ANDROID__) |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 28 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 1 |
| 29 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 |
| 30 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 31 | #elif defined(__APPLE__) |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 32 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 |
| 33 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 1 |
| 34 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 35 | #elif defined(__linux__) |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 36 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 |
| 37 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 |
| 38 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 1 |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 39 | #else |
| 40 | #error OS not supported (see build_config.h) |
| 41 | #endif |
| 42 | |
Lalit Maganti | 79f2d7b | 2018-01-23 18:27:33 +0000 | [diff] [blame] | 43 | #if defined(PERFETTO_BUILD_WITH_ANDROID) |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 44 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD() 1 |
Lalit Maganti | 79f2d7b | 2018-01-23 18:27:33 +0000 | [diff] [blame] | 45 | #else |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 46 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD() 0 |
Lalit Maganti | 79f2d7b | 2018-01-23 18:27:33 +0000 | [diff] [blame] | 47 | #endif |
| 48 | |
Oystein Eftevaag | f7a0d7e | 2018-01-12 13:02:43 -0800 | [diff] [blame] | 49 | #if defined(PERFETTO_BUILD_WITH_CHROMIUM) |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 50 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_CHROMIUM_BUILD() 1 |
Oystein Eftevaag | f7a0d7e | 2018-01-12 13:02:43 -0800 | [diff] [blame] | 51 | #else |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 52 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_CHROMIUM_BUILD() 0 |
Oystein Eftevaag | f7a0d7e | 2018-01-12 13:02:43 -0800 | [diff] [blame] | 53 | #endif |
| 54 | |
Lalit Maganti | d0e7679 | 2018-02-12 14:25:01 +0000 | [diff] [blame] | 55 | #if defined(PERFETTO_START_DAEMONS_FOR_TESTING) |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 56 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_START_DAEMONS() 1 |
Lalit Maganti | d0e7679 | 2018-02-12 14:25:01 +0000 | [diff] [blame] | 57 | #else |
Oystein Eftevaag | ff72959 | 2018-02-12 14:24:06 -0800 | [diff] [blame] | 58 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_START_DAEMONS() 0 |
Lalit Maganti | d0e7679 | 2018-02-12 14:25:01 +0000 | [diff] [blame] | 59 | #endif |
| 60 | |
Lalit Maganti | 41844ed | 2018-05-23 14:41:43 +0100 | [diff] [blame] | 61 | #if defined(PERFETTO_BUILD_WITH_ANDROID_USERDEBUG) |
| 62 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_USERDEBUG_BUILD() 1 |
| 63 | #else |
| 64 | #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_USERDEBUG_BUILD() 0 |
| 65 | #endif |
| 66 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 67 | #endif // INCLUDE_PERFETTO_BASE_BUILD_CONFIG_H_ |