[Aarch64] Fix assumption that Windows implies x86
authorDavid Truby <david.truby@arm.com>
Mon, 26 Oct 2020 14:45:11 +0000 (14:45 +0000)
committerDavid Truby <david.truby@arm.com>
Fri, 30 Oct 2020 12:11:34 +0000 (12:11 +0000)
When compiling for Windows on Arm the amd64 debug interfce from the Visual
Studio SDK is used as the cmake currently only distinguishes between x86 and
amd64 by checking the pointer size. Instead we can get the target
architecture for the compilier and check that to distinguish between
architectures.

llvm/lib/DebugInfo/PDB/CMakeLists.txt

index 9088bc8..21f8fa9 100644 (file)
@@ -6,7 +6,12 @@ endmacro()
 if(LLVM_ENABLE_DIA_SDK)
   include_directories(${MSVC_DIA_SDK_DIR}/include)
   set(LIBPDB_LINK_FOLDERS "${MSVC_DIA_SDK_DIR}\\lib")
-  if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+
+  if ("$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "arm64")
+    set(LIBPDB_LINK_FOLDERS "${LIBPDB_LINK_FOLDERS}\\arm64")
+  elseif ("$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "arm")
+    set(LIBPDB_LINK_FOLDERS "${LIBPDB_LINK_FOLDERS}\\arm")
+  elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
     set(LIBPDB_LINK_FOLDERS "${LIBPDB_LINK_FOLDERS}\\amd64")
   endif()
   file(TO_CMAKE_PATH "${LIBPDB_LINK_FOLDERS}\\diaguids.lib" LIBPDB_ADDITIONAL_LIBRARIES)