BuildConstants.h (1270B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef BUILD_CONSTANTS_H_ 8 #define BUILD_CONSTANTS_H_ 9 10 /** 11 * Why not just use ifdefs? 12 * ifdefs tend to result in code that compiles on one platform but not another. 13 * Given the number of build and platform configurations we have, it's best to 14 * aim to compile the same on as many platforms as possible, and let the 15 * compiler see the constexprs and handle dead-code elision itself. 16 */ 17 18 namespace mozilla { 19 20 constexpr bool kIsDebug = 21 #ifdef DEBUG 22 true; 23 #else 24 false; 25 #endif 26 27 constexpr bool kIsWindows = 28 #ifdef XP_WIN 29 true; 30 #else 31 false; 32 #endif 33 34 constexpr bool kIsMacOS = 35 #ifdef XP_MACOSX 36 true; 37 #else 38 false; 39 #endif 40 41 constexpr bool kIsLinux = 42 #ifdef MOZ_WIDGET_GTK 43 true; 44 #else 45 false; 46 #endif 47 48 constexpr bool kIsAndroid = 49 #ifdef MOZ_WIDGET_ANDROID 50 true; 51 #else 52 false; 53 #endif 54 55 constexpr bool kIsDmd = 56 #ifdef MOZ_DMD 57 true; 58 #else 59 false; 60 #endif 61 62 } // namespace mozilla 63 64 #endif // BUILD_CONSTANTS_H_