From: Jordan Justen <jordan.l.justen@intel.com>
Date: Wed, 29 Jul 2020 02:01:24 -0700
Subject: Add RENDERDOC_X86_PROC_FAMILY CMake and RDOC_X86_FAMILY C switches

This can build useful when trying to build renderdoc on unsupported
platforms. For example, if trying to build renderdoc on ARM, but
without targeting ANDROID, the compressonator code will fail to
compile. Instead of depending on the BUILD_ANDROID flag, we can use
the RENDERDOC_X86 flag.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
 CMakeLists.txt                  |  8 ++++++++
 renderdoc/common/globalconfig.h | 10 ++++++++++
 2 files changed, 18 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 857c848..42d3469 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,6 +98,14 @@ set(LIB_SUFFIX "" CACHE STRING "Suffix for 'lib' folder in target directory stru
 set(LIB_SUBFOLDER "" CACHE STRING "Subfolder under the 'lib' folder in target directory structure. E.g. set to 'renderdoc' to use /usr/local/lib/renderdoc instead of /usr/local/lib.")
 set(VULKAN_JSON_SUFFIX "" CACHE STRING "Suffix for the vulkan implicit_layer json file. E.g. set to '.x86_64' to use renderdoc_capture.x86_64.json instead of renderdoc_capture.json")
 
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR
+    CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
+set(RENDERDOC_X86_PROC_FAMILY TRUE)
+add_definitions(-DRENDERDOC_X86_PROC_FAMILY=1)
+else()
+set(RENDERDOC_X86_PROC_FAMILY FALSE)
+endif()
+
 if(NOT LIB_SUFFIX STREQUAL "")
     add_definitions(-DRENDERDOC_LIB_SUFFIX=${LIB_SUFFIX})
 endif()
diff --git a/renderdoc/common/globalconfig.h b/renderdoc/common/globalconfig.h
index 2fe6257..32656b5 100644
--- a/renderdoc/common/globalconfig.h
+++ b/renderdoc/common/globalconfig.h
@@ -125,6 +125,16 @@
 
 #endif
 
+#if defined(RENDERDOC_X86_PROC_FAMILY)
+
+#define RDOC_X86_FAMILY OPTION_ON
+
+#else
+
+#define RDOC_X86_FAMILY OPTION_OFF
+
+#endif
+
 // is size_t a real separate type, not just typedef'd to uint32_t or uint64_t (or equivalent)?
 #if defined(RENDERDOC_PLATFORM_APPLE)
 #define RDOC_SIZET_SEP_TYPE OPTION_ON
