diff --git a/clang/cmake/caches/HLSL.cmake b/clang/cmake/caches/HLSL.cmake index 24afcbbda2a40..182eff16a81e3 100644 --- a/clang/cmake/caches/HLSL.cmake +++ b/clang/cmake/caches/HLSL.cmake @@ -14,3 +14,22 @@ if (HLSL_ENABLE_DISTRIBUTION) "clang;hlsl-resource-headers;clangd" CACHE STRING "") endif() + +# Enable the offload test suite distribution. Produces a portable install +# prefix containing the binaries and test data needed to run the HLSL +# offload test suite on another machine. See the offload-test-suite repo +# (docs/offload-distribution.md) for setup, prerequisites, and run +# instructions. +if (HLSL_ENABLE_OFFLOAD_DISTRIBUTION) + if (NOT "OffloadTest" IN_LIST LLVM_EXTERNAL_PROJECTS) + message(FATAL_ERROR + "HLSL_ENABLE_OFFLOAD_DISTRIBUTION requires OffloadTest to be enabled " + "as an external project. Pass -DLLVM_EXTERNAL_PROJECTS=OffloadTest " + "and -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=.") + endif() + # Lit utilities (FileCheck, split-file, etc.) require LLVM_INSTALL_UTILS. + set(LLVM_INSTALL_UTILS ON CACHE BOOL "") + set(LLVM_DISTRIBUTION_COMPONENTS + "clang;hlsl-resource-headers;FileCheck;split-file;obj2yaml;not" + CACHE STRING "") +endif()