Преглед изворни кода

Support for ARM64EC and custom cmake (#3245)

* Merged PR 5375287: Support for ARM64EC and custom cmake

* Fix linux build break

* Change argument name to -dxc-cmake
Helena Kotas пре 4 година
родитељ
комит
6008113f60
4 измењених фајлова са 41 додато и 13 уклоњено
  1. 1 1
      cmake/modules/FindD3D12.cmake
  2. 1 1
      cmake/modules/FindTAEF.cmake
  3. 3 0
      lib/Support/CMakeLists.txt
  4. 36 11
      utils/hct/hctbuild.cmd

+ 1 - 1
cmake/modules/FindD3D12.cmake

@@ -42,7 +42,7 @@ if ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
     set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x64)
 elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM")
     set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm)
-elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM64")
+elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" MATCHES "ARM64.*")
     set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm64)
 elseif ("${DXC_BUILD_ARCH}" STREQUAL "Win32" )
     set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x86)

+ 1 - 1
cmake/modules/FindTAEF.cmake

@@ -36,7 +36,7 @@ elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" OR "${DXC_BUILD_ARCH}" STRE
   find_library(TAEF_WEX_LOGGER_LIBRARY NAMES Wex.Logger.lib
                HINTS ${TAEF_INCLUDE_DIR}/../Library/arm
                HINTS ${TAEF_INCLUDE_DIR}/../lib/arm )
-elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM64")
+elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" MATCHES "ARM64.*")
   find_library(TAEF_COMMON_LIBRARY NAMES Te.Common.lib
                HINTS ${TAEF_INCLUDE_DIR}/../Library/arm64
                HINTS ${TAEF_INCLUDE_DIR}/../lib/arm64 )

+ 3 - 0
lib/Support/CMakeLists.txt

@@ -137,3 +137,6 @@ add_llvm_library(LLVMSupport
   )
 
 set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
+if(WIN32)
+set_property(TARGET LLVMSupport PROPERTY COMPILE_FLAGS /EHsc )
+endif(WIN32)

+ 36 - 11
utils/hct/hctbuild.cmd

@@ -30,13 +30,6 @@ if "%HLSL_BLD_DIR%"=="" (
   exit /b 1
 )
 
-where cmake.exe 1>nul 2>nul
-if errorlevel 1 (
-  echo Unable to find cmake.exe on the path.
-  echo cmake 3.4 is available from https://cmake.org/files/v3.4/cmake-3.4.0-win32-x86.exe
-  exit /b 1
-)
-
 if "%BUILD_ARCH%"=="" (
   set BUILD_ARCH=Win32
 )
@@ -47,6 +40,7 @@ set BUILD_CONFIG=Debug
 set DO_SETUP=1
 set DO_BUILD=1
 set CMAKE_OPTS=
+set CMAKE_PATH=
 set SPEAK=1
 set PARALLEL_OPT=/m
 set ALL_DEFS=OFF
@@ -119,6 +113,10 @@ if /i "%1"=="-arm64" (
   set BUILD_ARCH=ARM64
   shift /1
 )
+if /i "%1"=="-arm64ec" (
+  set BUILD_ARCH=ARM64EC
+  shift /1
+)
 if /i "%1"=="-Debug" (
   set BUILD_CONFIG=Debug
   shift /1
@@ -179,6 +177,22 @@ if "%1"=="-dxc-cmake-ends-include" (
   shift /1
 )
 
+if "%1"=="-dxc-cmake" (
+  set CMAKE_PATH=%~2
+  shift /1
+  shift /1
+)
+
+if "%CMAKE_PATH%"=="" (
+  where cmake.exe 1>nul 2>nul
+  if errorlevel 1 (
+    echo Unable to find cmake.exe on the path.
+    echo cmake 3.4 is available from https://cmake.org/files/v3.4/cmake-3.4.0-win32-x86.exe
+    exit /b 1
+  )
+  set CMAKE_PATH=cmake
+)
+
 rem Begin SPIRV change
 if "%1"=="-spirv" (
   echo SPIR-V codegen is enabled.
@@ -224,6 +238,17 @@ if /i "%BUILD_ARCH%"=="arm64" (
   )
 )
 
+if /i "%BUILD_ARCH%"=="arm64ec" (
+  if "%BUILD_VS_VER%" NEQ "2019" (
+    echo "ARM64EC platform is not supported on VS2017."    
+    exit /b 1
+  )
+  set BUILD_GENERATOR_PLATFORM=ARM64EC
+  set BUILD_ARM_CROSSCOMPILING=1
+  set VS2019ARCH=-AARM64EC
+  set CMAKE_OPTS=%CMAKE_OPTS% -DCMAKE_SYSTEM_VERSION=10.0.20207.0 -DMSVC_BUILD_AS_X=1
+)
+
 if "%1"=="-ninja" (
   set BUILD_GENERATOR=Ninja
   shift /1
@@ -371,12 +396,12 @@ cd /d %3
 if "%DO_SETUP%"=="1" (
   echo Creating solution files for %2, logging to %3\cmake-log.txt
   if "%BUILD_GENERATOR%"=="Ninja" (
-    echo Running cmake -DCMAKE_BUILD_TYPE:STRING=%1 %CMAKE_OPTS% -G %4 %HLSL_SRC_DIR% > %3\cmake-log.txt
-    cmake -DCMAKE_BUILD_TYPE:STRING=%1 %CMAKE_OPTS% -G %4 %HLSL_SRC_DIR% >> %3\cmake-log.txt 2>&1
+    echo Running %CMAKE_PATH% -DCMAKE_BUILD_TYPE:STRING=%1 %CMAKE_OPTS% -G %4 %HLSL_SRC_DIR% > %3\cmake-log.txt
+    %CMAKE_PATH% -DCMAKE_BUILD_TYPE:STRING=%1 %CMAKE_OPTS% -G %4 %HLSL_SRC_DIR% >> %3\cmake-log.txt 2>&1
   ) else (
     rem -DCMAKE_BUILD_TYPE:STRING=%1 is not necessary for multi-config generators like VS
-    echo Running cmake %CMAKE_OPTS% -G %4 %5 %HLSL_SRC_DIR% > %3\cmake-log.txt
-    cmake %CMAKE_OPTS% -G %4 %5 %HLSL_SRC_DIR% >> %3\cmake-log.txt 2>&1
+    echo Running "%CMAKE_PATH%" %CMAKE_OPTS% -G %4 %5 %HLSL_SRC_DIR% > %3\cmake-log.txt
+    "%CMAKE_PATH%" %CMAKE_OPTS% -G %4 %5 %HLSL_SRC_DIR% >> %3\cmake-log.txt 2>&1
   )
   if errorlevel 1 (
     echo Failed to configure cmake projects.