Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2268)

Unified Diff: src/include/nacl_defines.h

Issue 788193003: Create a build_config header file. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/include/nacl_defines.h
diff --git a/src/include/nacl_defines.h b/src/include/nacl_defines.h
new file mode 100644
index 0000000000000000000000000000000000000000..09b49076fbbf7dd3c1f2c1e7357a866f8de78e29
--- /dev/null
+++ b/src/include/nacl_defines.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2014 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
Mark Seaborn 2014/12/11 16:11:40 Could we call this "build_config.h"? Firstly, to
teravest 2014/12/15 20:08:36 Done.
+#ifndef NATIVE_CLIENT_SRC_INCLUDE_NACL_DEFINES_H_
+#define NATIVE_CLIENT_SRC_INCLUDE_NACL_DEFINES_H_ 1
+
+#if !defined(NACL_WINDOWS) && !defined(NACL_LINUX) && !defined(NACL_OSX)
Mark Seaborn 2014/12/11 16:11:41 Can you add a TODO to remove this when the Gyp bui
teravest 2014/12/15 20:08:36 Done.
+
+#if defined(_WIN32)
Mark Seaborn 2014/12/11 16:11:40 Can you indent like this? #if defined(_WIN32) # de
teravest 2014/12/15 20:08:36 Done.
+#define NACL_WINDOWS 1
+#else
+#define NACL_WINDOWS 0
+#endif
+
+#if defined(__linux__)
+#define NACL_LINUX 1
+#else
+#define NACL_LINUX 0
+#endif
+
+#if defined(__APPLE__)
+#define NACL_OSX 1
+#else
+#define NACL_OSX 0
+#endif
+
+#endif
+
+#if !defined(NACL_ANDROID)
+#if defined(ANDROID)
+#define NACL_ANDROID 1
+#else
+#define NACL_ANDROID 0
+#endif
+#endif
+
+#if defined(NACL_BUILD_ARCH) && !defined(NACL_BUILD_SUBARCH)
Mark Seaborn 2014/12/11 16:11:40 Similar TODO for NACL_BUILD_(SUB)ARCH
teravest 2014/12/15 20:08:36 Done.
+#error Please define both NACL_BUILD_ARCH and NACL_BUILD_SUBARCH.
+#elif !defined(NACL_BUILD_ARCH) && defined(NACL_BUILD_SUBARCH)
+#error Please define both NACL_BUILD_ARCH and NACL_BUILD_SUBARCH.
+#endif
+
+
+#if !defined(NACL_BUILD_ARCH)
+
+#if defined(_M_X64) || defined(__x86_64__)
+#define NACL_BUILD_ARCH x86
+#define NACL_BUILD_SUBARCH 64
+#endif
+
+#if defined(_M_IX86) || defined(__i386__)
+#define NACL_BUILD_ARCH x86
+#define NACL_BUILD_SUBARCH 32
+#endif
+
+/* TODO(teravest): Handle __aarch64__? */
Mark Seaborn 2014/12/11 16:11:41 This TODO is not really needed since we don't supp
teravest 2014/12/15 20:08:36 Removed.
+#if defined(__ARMEL__)
+#define NACL_BUILD_ARCH arm
+#define NACL_BUILD_SUBARCH 32
+#endif
+
+#if defined((__MIPSEL__)
Mark Seaborn 2014/12/11 16:11:40 Stray extra "(" here
teravest 2014/12/15 20:08:36 Done.
+#define NACL_BUILD_ARCH mips
+#define NACL_BUILD_SUBARCH 32
+#endif
+
+#endif /* !defined(NACL_BUILD_ARCH) */
+
+#if !defined(NACL_BUILD_ARCH)
+#error NACL_BUILD_ARCH not defined.
+#endif
+
+#if !defined(NACL_BUILD_SUBARCH)
+#error NACL_BUILD_SUBARCH not defined.
+#endif
+
+#endif /* NATIVE_CLIENT_SRC_PUBLIC_NACL_DEFINES_H_ */

Powered by Google App Engine
This is Rietveld 408576698