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 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. 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)()) 26 27 #if defined(__ANDROID__) 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 31 #elif defined(__APPLE__) 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 35 #elif defined(__linux__) 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 39 #else 40 #error OS not supported (see build_config.h) 41 #endif 42 43 #if defined(PERFETTO_BUILD_WITH_ANDROID) 44 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD() 1 45 #else 46 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD() 0 47 #endif 48 49 #if defined(PERFETTO_BUILD_WITH_CHROMIUM) 50 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_CHROMIUM_BUILD() 1 51 #else 52 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_CHROMIUM_BUILD() 0 53 #endif 54 55 #if defined(PERFETTO_START_DAEMONS_FOR_TESTING) 56 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_START_DAEMONS() 1 57 #else 58 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_START_DAEMONS() 0 59 #endif 60 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 67 #endif // INCLUDE_PERFETTO_BASE_BUILD_CONFIG_H_ 68