[PATCH] Update root CMake to define LLVM_ENABLE_DIA_SDK when appropriate.

Zachary Turner zturner at google.com
Thu Feb 5 21:01:42 PST 2015


Hi chandlerc,

This allows all CMake projects, as well as C++ code, to detect if and when DIA SDK is available for use.

This is independent of actually having any DIA-based code in the codebase, so in theory can go in now, even though the DIA stuff isn't in yet.

I'm not sure if I did this correctly.  LMK if I overlooked something or if I'm going about this wrong.

http://reviews.llvm.org/D7457

Files:
  CMakeLists.txt
  include/llvm/Config/config.h.in
  include/llvm/Config/llvm-config.h.cmake
  include/llvm/Config/llvm-config.h.in

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -229,8 +229,25 @@
 # MSVC has a gazillion warnings with this.
 if( MSVC )
   option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF)
+
+  # See if the DIA SDK is available and usable.
+  set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
+
+  # Due to a bug in MSVC 2013's installation software, it is possible
+  # for MSVC 2013 to write the DIA SDK into the Visual Studio 2012
+  # install directory.  If this happens, the installation is corrupt
+  # and there's nothing we can do.  It happens with enough frequency
+  # though that we should handle it.  We do so by simply checking that
+  # the DIA SDK folder exists.  Should this happen you will need to
+  # uninstall VS 2012 and then re-install VS 2013.
+  if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
+    set(LLVM_ENABLE_DIA_SDK 1)
+  else()
+    set(LLVM_ENABLE_DIA_SDK 0)
+  endif()
 else()
   option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
+  set(LLVM_ENABLE_DIA_SDK 0)
 endif()
 
 option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
Index: include/llvm/Config/config.h.in
===================================================================
--- include/llvm/Config/config.h.in
+++ include/llvm/Config/config.h.in
@@ -537,6 +537,9 @@
 /* Installation prefix directory */
 #undef LLVM_PREFIX
 
+/* Define if we have the DIA SDK */
+#undef LLVM_ENABLE_DIA_SDK
+
 /* Define if we have the Intel JIT API runtime support library */
 #undef LLVM_USE_INTEL_JITEVENTS
 
Index: include/llvm/Config/llvm-config.h.cmake
===================================================================
--- include/llvm/Config/llvm-config.h.cmake
+++ include/llvm/Config/llvm-config.h.cmake
@@ -80,6 +80,9 @@
 /* Installation prefix directory */
 #cmakedefine LLVM_PREFIX "${LLVM_PREFIX}"
 
+/* Define if we have the DIA SDK */
+#cmakedefine LLVM_ENABLE_DIA_SDK ${LLVM_ENABLE_DIA_SDK}
+
 /* Define if we have the Intel JIT API runtime support library */
 #cmakedefine LLVM_USE_INTEL_JITEVENTS 1
 
Index: include/llvm/Config/llvm-config.h.in
===================================================================
--- include/llvm/Config/llvm-config.h.in
+++ include/llvm/Config/llvm-config.h.in
@@ -83,6 +83,9 @@
 /* Define if we have the Intel JIT API runtime support library */
 #undef LLVM_USE_INTEL_JITEVENTS
 
+/* Define if we have the DIA SDK */
+#undef LLVM_ENABLE_DIA_SDK
+
 /* Define if we have the oprofile JIT-support library */
 #undef LLVM_USE_OPROFILE

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7457.19456.patch
Type: text/x-patch
Size: 2557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/cfeb7a4d/attachment.bin>


More information about the llvm-commits mailing list