Selaa lähdekoodia

Build DXC without hct on Windows and use the built dxil.dll (#290)

The install script for the dxc previously installed the `dxil.dll` from
the Windows SDK instead of using the one from the install directory.
I found that the `dxil.dll` from the Windows SDK is no longer compatible
with the 2505.1 executables when testing
https://github.com/o3de/o3de/pull/19171
Copying `dxil.dll` from a locally built dxc did however fix this
problem.

I'm not sure why we ever used the `dxil.dll` from the Windows SDK
instead of the built one. On Linux and Mac there is no Windows SDK so
they use the built one without problems.

This PR also changes the build step from the `hct` build script to using
CMake directly. As far as I can see hct is only a wrapper around CMake
anyway.

---------

Signed-off-by: Martin Sattlecker <[email protected]>
Martin Sattlecker 1 kuukausi sitten
vanhempi
commit
e8fd183dff

+ 4 - 4
package-system/DirectXShaderCompiler/FindDirectXShaderCompilerDxc.cmake.Windows

@@ -18,10 +18,10 @@ set(${MY_NAME}_BINARY_DIR ${CMAKE_CURRENT_LIST_DIR}/${MY_NAME}/bin)
 add_library(${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
 
 set(${MY_NAME}_RUNTIME_DEPENDENCIES
-		${${MY_NAME}_BINARY_DIR}/Release/dxc.exe
-		${${MY_NAME}_BINARY_DIR}/Release/dxsc.exe
-		${${MY_NAME}_BINARY_DIR}/Release/dxil.dll
-		${${MY_NAME}_BINARY_DIR}/Release/dxcompiler.dll)
+		${${MY_NAME}_BINARY_DIR}/dxc.exe
+		${${MY_NAME}_BINARY_DIR}/dxsc.exe
+		${${MY_NAME}_BINARY_DIR}/dxil.dll
+		${${MY_NAME}_BINARY_DIR}/dxcompiler.dll)
 ly_add_target_files(TARGETS ${TARGET_WITH_NAMESPACE} OUTPUT_SUBDIRECTORY ${output_subfolder} FILES ${${MY_NAME}_RUNTIME_DEPENDENCIES})
 
 

+ 23 - 5
package-system/DirectXShaderCompiler/build_config.json

@@ -2,7 +2,7 @@
    "git_url":"https://github.com/o3de/DirectXShaderCompiler.git",
    "git_tag": "release-1.8.2505.1-o3de",
    "package_name":"DirectXShaderCompilerDxc",
-   "package_version": "1.8.2505.1-o3de-rev1",
+   "package_version": "1.8.2505.1-o3de-rev2",
    "package_url":"https://github.com/o3de/DirectXShaderCompiler",
    "package_license":"NCSA",
    "package_license_file":"LICENSE.TXT",
@@ -10,12 +10,30 @@
    "Platforms":{
       "Windows":{
          "Windows":{
+            "build_configs": [
+               "Release"
+            ],
             "cmake_find_source":"FindDirectXShaderCompilerDxc.cmake.Windows",
-            "custom_build_cmd": [
-               "build_dxc_windows.cmd"
+            "cmake_generate_args": [
+               "-GNinja",
+               "-Csrc/cmake/caches/PredefinedParams.cmake",
+               "-DCMAKE_BUILD_TYPE=Release",
+               "-DLLVM_INCLUDE_TESTS:BOOL=OFF",
+               "-DCLANG_INCLUDE_TESTS:BOOL=OFF",
+               "-DHLSL_INCLUDE_TESTS:BOOL=OFF",
+               "-DSPIRV_BUILD_TESTS:BOOL=OFF",
+               "-DLLVM_INCLUDE_TOOLS=ON"
+            ],
+            "cmake_build_args": [
+               "--target",
+               "all llvm-as llvm-dis",
+               "--parallel"
             ],
-            "custom_install_cmd": [
-               "install_dxc_windows.cmd"
+            "cmake_install_filter": [
+               "bin/dxc.exe",
+               "bin/dxsc.exe",
+               "bin/dxil.dll",
+               "bin/dxcompiler.dll"
             ]
          }
       },

+ 0 - 41
package-system/DirectXShaderCompiler/build_dxc_windows.cmd

@@ -1,41 +0,0 @@
-@echo off
-REM
-REM 
-REM Copyright (c) Contributors to the Open 3D Engine Project.
-REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
-REM 
-REM SPDX-License-Identifier: Apache-2.0 OR MIT
-REM 
-REM 
-
-SET SRC_PATH=temp\src
-SET BLD_PATH=temp\build
-SET HCT_PATH=temp\src\utils\hct
-
-SET HCT_START=%HCT_PATH%\\hctstart.cmd
-
-REM Initialize the environment
-call %HCT_START% %SRC_PATH% %BLD_PATH%
-IF %ERRORLEVEL% NEQ 0 (
-    ECHO "%HCT_START% Command Failed"
-    exit /b 1
-)
-
-REM Make sure TAEF is installed
-%PYTHON_BINARY% utils\hct\hctgettaef.py
-IF %ERRORLEVEL% NEQ 0 (
-    ECHO "utils\hct\hctgettaef.py Command Failed"
-    exit /b 1
-)
-
-REM Run the build for Release
-call utils\hct\hctbuild.cmd -rel -x64 -vs2022 -spirv
-IF %ERRORLEVEL% NEQ 0 (
-    ECHO "Building Release with hctbuild.cmd -rel -x64 -vs2022 Failed"
-    exit /b 1
-)
-
-ECHO Custom Build for DirectXShaderCompiler finished successfully
-exit /b 0
-
-

+ 0 - 62
package-system/DirectXShaderCompiler/install_dxc_windows.cmd

@@ -1,62 +0,0 @@
- @echo off
-
-REM Copyright (c) Contributors to the Open 3D Engine Project.
-REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
-REM 
-REM SPDX-License-Identifier: Apache-2.0 OR MIT
-REM
-
-SET BLD_PATH=temp\build
-SET SRC_PATH=temp\src
-SET BIN_PATH=%TARGET_INSTALL_ROOT%\bin
-
-
-REM Locate the Windows Kit 10 installation path to get the dxil.dll located inside the Redist/D3D folder
-set REG_QUERY=REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0"
-set WINKIT_ROOT=
-for /F "tokens=1,2*" %%A in ('%REG_QUERY% /v InstallationFolder') do (
-  if "%%A"=="InstallationFolder" (
-    set WINKIT_ROOT=%%C
-  )
-)
-set DXIL_PATH="%WINKIT_ROOT%\Redist\D3D\x64\dxil.dll"
-IF NOT EXIST %DXIL_PATH% (
-    echo Unable to find dxil.dll. Make sure that Windows Kit is installed
-    exit /b 1
-)
-
-mkdir %BIN_PATH%\Release
-
-echo Copying %BLD_PATH%\Release\bin\dxc.exe to %BIN_PATH%\Release\
-copy /Y %BLD_PATH%\Release\bin\dxc.exe %BIN_PATH%\Release\
-IF %ERRORLEVEL% NEQ 0 (
-    ECHO Unable to copy %BLD_PATH%\Release\bin\dxc.exe
-    exit /b 1
-)
-
-echo Copying %BLD_PATH%\Release\bin\dxsc.exe to %BIN_PATH%\Release\
-copy /Y %BLD_PATH%\Release\bin\dxsc.exe %BIN_PATH%\Release\
-IF %ERRORLEVEL% NEQ 0 (
-    ECHO Unable to copy %BLD_PATH%\Release\bin\dxsc.exe
-    exit /b 1
-)
-
-ECHO Copying %BLD_PATH%\Release\bin\dxcompiler.dll to %BIN_PATH%\\Release\
-copy /Y %BLD_PATH%\Release\bin\dxcompiler.dll %BIN_PATH%\\Release\
-IF %ERRORLEVEL% NEQ 0 (
-    ECHO Unable to copy %BLD_PATH%\Release\bin\dxcompiler.dll
-    exit /b 1
-)
-
-ECHO Copying DXIL_PATH to %BIN_PATH%\Release\
-copy /Y %DXIL_PATH% %BIN_PATH%\Release\
-IF %ERRORLEVEL% NEQ 0 (
-    ECHO Unable to copy %DXIL_PATH%
-    exit /b 1
-)
-
-exit /b 0
-
-
-
-

+ 2 - 2
package_build_list_host_darwin.json

@@ -38,7 +38,7 @@
         "SQLite-3.37.2-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Mac --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Mac --package-root ../../package-system --clean",
         "astc-encoder-3.2-rev5-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean",
-        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean",
+        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean",
         "azslc-1.8.22-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Mac --package-root ../../package-system/azslc/temp --clean",
         "python-3.10.13-rev1-darwin": "package-system/python/build_package_image.py",
         "mcpp-2.7.2_az.2-rev1-mac": "package-system/mcpp/get_and_build_mcpp.py mcpp-2.7.2_az.2-rev1",
@@ -95,7 +95,7 @@
         "SPIRVCross-1.3.275.0-rev1-mac": "package-system/SPIRVCross-mac",
         "squish-ccr-deb557d-rev1-mac": "package-system/squish-ccr-mac",
         "astc-encoder-3.2-rev5-mac": "package-system/astc-encoder-mac",
-        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-mac": "package-system/DirectXShaderCompilerDxc-mac",
+        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-mac": "package-system/DirectXShaderCompilerDxc-mac",
         "azslc-1.8.22-rev1-mac": "package-system/azslc/temp/azslc-mac",
         "SQLite-3.37.2-rev2-mac": "package-system/SQLite-mac",
         "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform",

+ 2 - 2
package_build_list_host_linux-aarch64.json

@@ -11,7 +11,7 @@
         "AWSNativeSDK-1.11.361-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Linux-aarch64 --clean",
         "azslc-1.8.22-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux-aarch64 --clean",
         "cityhash-1.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/cityhash --platform-name Linux-aarch64 --clean",
-        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux-aarch64 --clean",
+        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux-aarch64 --clean",
         "expat-2.4.2-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Linux-aarch64 --clean",
         "freetype-2.11.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Linux-aarch64 --clean",
         "googlebenchmark-1.7.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googlebenchmark --platform-name Linux-aarch64 --clean",
@@ -52,7 +52,7 @@
         "AWSNativeSDK-1.11.361-rev1-linux-aarch64": "package-system/AWSNativeSDK/temp/AWSNativeSDK-linux-aarch64",
         "azslc-1.8.22-rev1-linux-aarch64": "package-system/azslc/temp/azslc-linux-aarch64",
         "cityhash-1.1-rev1-linux-aarch64": "package-system/cityhash/temp/cityhash-linux-aarch64",
-        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-linux-aarch64": "package-system/DirectXShaderCompiler/temp/DirectXShaderCompilerDxc-linux-aarch64",
+        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-linux-aarch64": "package-system/DirectXShaderCompiler/temp/DirectXShaderCompilerDxc-linux-aarch64",
         "expat-2.4.2-rev2-linux-aarch64": "package-system/expat/temp/expat-linux-aarch64",
         "freetype-2.11.1-rev1-linux-aarch64": "package-system/freetype/temp/freetype-linux-aarch64",
         "googlebenchmark-1.7.0-rev1-linux-aarch64": "package-system/googlebenchmark/temp/googlebenchmark-linux-aarch64",

+ 2 - 2
package_build_list_host_linux.json

@@ -40,7 +40,7 @@
         "squish-ccr-deb557d-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux --clean",
         "squish-ccr-deb557d-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux-aarch64 --clean",
         "astc-encoder-3.2-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Linux --package-root ../../package-system --clean",
-        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux --package-root ../../package-system --clean",
+        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux --package-root ../../package-system --clean",
         "azslc-1.8.22-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux --package-root ../../package-system/azslc/temp --clean",
         "tiff-4.2.0.15-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/tiff --platform-name Linux --package-root ../../package-system --clean",
         "python-3.10.13-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux --clean",
@@ -84,7 +84,7 @@
         "squish-ccr-deb557d-rev1-linux": "package-system/squish-ccr/temp/squish-ccr-linux",
         "squish-ccr-deb557d-rev1-linux-aarch64": "package-system/squish-ccr/temp/squish-ccr-linux-aarch64",
         "astc-encoder-3.2-rev3-linux": "package-system/astc-encoder-linux",
-        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-linux": "package-system/DirectXShaderCompilerDxc-linux",
+        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-linux": "package-system/DirectXShaderCompilerDxc-linux",
         "azslc-1.8.22-rev1-linux": "package-system/azslc/temp/azslc-linux",
         "tiff-4.2.0.15-rev3-linux": "package-system/tiff-linux",
         "python-3.10.13-rev2-linux": "package-system/python/temp/python-linux",

+ 2 - 2
package_build_list_host_windows.json

@@ -13,7 +13,7 @@
         "AWSNativeSDK-1.11.361-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Windows --package-root ../../package-system --clean",
         "Blast-v1.1.7_rc2-9-geb169fe-rev2-windows": "package-system/Blast/build_package_image.py --platform-name windows",
         "Crashpad-0.8.0-rev2-windows": "package-system/Crashpad/build_package_image.py --platform-name windows",
-        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean",
+        "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean",
         "expat-2.4.2-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Android --package-root ../../package-system/expat/temp --clean",
         "expat-2.4.2-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Windows --package-root ../../package-system/expat/temp --clean",
         "freetype-2.11.1-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Android --package-root ../../package-system/freetype/temp --clean",
@@ -77,7 +77,7 @@
     "cityhash-1.1-multiplatform": "package-system/cityhash-multiplatform",
     "civetweb-1.8-rev1-windows": "package-system/civetweb-windows",
     "Crashpad-0.8.0-rev2-windows": "package-system/Crashpad-windows",
-    "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev1-windows": "package-system/DirectXShaderCompilerDxc-windows",
+    "DirectXShaderCompilerDxc-1.8.2505.1-o3de-rev2-windows": "package-system/DirectXShaderCompilerDxc-windows",
     "d3dx12-headers-rev1-windows": "package-system/d3dx12-windows",
     "expat-2.4.2-rev2-android": "package-system/expat/temp/expat-android",
     "expat-2.4.2-rev2-windows": "package-system/expat/temp/expat-windows",