blob: 213f2f5bcae6de48306448d5f376ae7f38142369 [file] [log] [blame]
Primiano Tucci97440f42017-10-24 13:27:18 +01001/*
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
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080017#ifndef PERFETTO_PERFETTO_BASE_BUILD_CONFIG_H_
18#define PERFETTO_PERFETTO_BASE_BUILD_CONFIG_H_
Primiano Tucci97440f42017-10-24 13:27:18 +010019
Primiano Tuccifd484232017-10-25 00:15:39 +010020// DO NOT include this file in public headers (include/) to avoid collisions.
21
Primiano Tucci97440f42017-10-24 13:27:18 +010022// 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
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080044#endif // PERFETTO_PERFETTO_BASE_BUILD_CONFIG_H_