Skip to content

Commit 1c6cb1c

Browse files
committed
Simplify build configuraiton and DXV detection
With this change configuraiton requires setting `DXC_DIR` to the folder containing dxc and dxv, and the rest is handled by CMake.
1 parent 1839781 commit 1c6cb1c

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

.github/workflows/test-all.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ jobs:
117117
cd DXC
118118
mkdir build
119119
cd build
120-
cmake -G Ninja -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/HLSLTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
120+
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/HLSLTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
121121
ninja
122122
- name: Build LLVM
123123
run: |
124124
cd llvm-project
125125
mkdir build
126126
cd build
127-
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/HLSLTest/cmake/caches/sccache.cmake -DDXC_BUILD_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_HLSLTEST_SOURCE_DIR=${{ github.workspace }}/HLSLTest -DLLVM_EXTERNAL_PROJECTS="HLSLTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DHLSLTEST_TEST_CLANG=${{ inputs.Test-Clang }} ${{ github.workspace }}/llvm-project/llvm/
127+
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/HLSLTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_HLSLTEST_SOURCE_DIR=${{ github.workspace }}/HLSLTest -DLLVM_EXTERNAL_PROJECTS="HLSLTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DHLSLTEST_TEST_CLANG=${{ inputs.Test-Clang }} ${{ github.workspace }}/llvm-project/llvm/
128128
ninja hlsl-test-depends
129129
- name: Run HLSL Tests
130130
run: |

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ set(HLSLTEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
1212
set(HLSLTEST_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
1313
set(HLSLTEST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
1414

15-
set(DXC_BUILD_DIR "" CACHE STRING "Path to a DXC build directory")
16-
find_program(DXC_EXECUTABLE dxc HINTS ${DXC_BUILD_DIR})
17-
find_program(DXV_EXECUTABLE dxv HINTS ${DXC_BUILD_DIR})
15+
set(DXC_DIR "" CACHE STRING "Path to a DXC build or install binary directory")
16+
find_program(DXC_EXECUTABLE dxc HINTS ${DXC_DIR})
17+
find_program(DXV_EXECUTABLE dxv HINTS ${DXC_DIR})
1818

19-
set(HLSLTEST_COMPILER ${DXC_EXECUTABLE} CACHE STRING "Compiler to use for testing (uses dxc from PATH if unset)")
2019
if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)
2120
set(default_HLSLTEST_TEST_CLANG On)
2221
else()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you do not have a build of dxc on your path you'll need to specify the shader
3131
compiler to use by passing:
3232

3333
```shell
34-
-DHLSLTEST_COMPILER=<path to compiler>
34+
-DDXC_DIR=<path to folder containing dxc & dxv>
3535
```
3636

3737
# YAML Pipeline Format

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function(try_compile_hlsl output)
2020
set(TRY_COMPILE_FLAGS "${ARG_FLAGS}")
2121
string(REPLACE ";" " " extra_flags "${TRY_COMPILE_FLAGS}")
2222

23-
set(test_compile_command ${HLSLTEST_COMPILER} ${extra_flags} ${SIMPLE_HLSL})
23+
set(test_compile_command ${DXC_EXECUTABLE} ${extra_flags} ${SIMPLE_HLSL})
2424
string(REPLACE "\"" "" test_compile_command "${test_compile_command}")
2525
string(REPLACE " " ";" test_compile_command "${test_compile_command}")
2626

test/lit.cfg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
tools.append(ToolSubst("%gpu-exec", FindTool("gpu-exec")))
4949

5050
if config.hlsltest_test_clang:
51-
if os.path.exists(config.hlsltest_dxv):
52-
tools.append(ToolSubst("dxc", FindTool("clang-dxc"), extra_args=["--dxv-path=%s" % config.hlsltest_dxv]))
51+
if os.path.exists(config.hlsltest_dxc_dir):
52+
tools.append(ToolSubst("dxc", FindTool("clang-dxc"), extra_args=["--dxv-path=%s" % config.hlsltest_dxc_dir]))
5353
else:
5454
tools.append(ToolSubst("dxc", FindTool("clang-dxc")))
5555
config.available_features.add("Clang")
5656
else:
57-
tools.append(ToolSubst("dxc", config.hlsltest_compiler))
57+
tools.append(ToolSubst("dxc", config.hlsltest_dxc))
5858

5959
llvm_config.add_tool_substitutions(tools, config.llvm_tools_dir)
6060

test/lit.site.cfg.py.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import sys
55
config.hlsltest_obj_root = path(r"@HLSLTEST_BINARY_DIR@")
66
config.hlsltest_src_root = path(r"@HLSLTEST_SOURCE_DIR@")
77
config.llvm_tools_dir = lit_config.substitute(path(r"@LLVM_TOOLS_DIR@"))
8-
config.hlsltest_compiler = path(r"@HLSLTEST_COMPILER@")
8+
config.hlsltest_dxc = path(r"@DXC_EXECUTABLE@")
99
config.hlsltest_supports_spirv = @SUPPORTS_SPIRV@
1010
config.hlsltest_test_clang = @FORCE_CLANG@
1111
config.hlsltest_test_warp = @FORCE_WARP@
12-
config.hlsltest_dxv = "@DXV_EXECUTABLE@"
12+
config.hlsltest_dxc_dir = r"@DXC_DIR@"
1313

1414
config.hlsltest_suite = "@suite@"
1515
config.hlsltest_enable_d3d12 = @TEST_d3d12@

0 commit comments

Comments
 (0)