[PATCH] D134693: [CMake] Add `CLANG_ENABLE_HLSL` CMake option

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 10:33:33 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe432108bf254: [CMake] Add `CLANG_ENABLE_HLSL` CMake option (authored by beanz).

Changed prior to commit:
  https://reviews.llvm.org/D134693?vs=463079&id=463275#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134693/new/

https://reviews.llvm.org/D134693

Files:
  clang/CMakeLists.txt
  clang/cmake/caches/HLSL.cmake
  clang/lib/Headers/CMakeLists.txt
  clang/tools/driver/CMakeLists.txt


Index: clang/tools/driver/CMakeLists.txt
===================================================================
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -61,7 +61,11 @@
   set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
 endif()
 
-foreach(link ${CLANG_LINKS_TO_CREATE})
+if (CLANG_ENABLE_HLSL)
+  set(HLSL_LINK clang-dxc)
+endif()
+
+foreach(link ${CLANG_LINKS_TO_CREATE} ${HLSL_LINK})
   add_clang_symlink(${link} clang)
 endforeach()
 
Index: clang/lib/Headers/CMakeLists.txt
===================================================================
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -62,11 +62,15 @@
   __clang_hip_runtime_wrapper.h
   )
 
-set(hlsl_files
-  hlsl.h
+set(hlsl_h hlsl.h)
+set(hlsl_subdir_files
   hlsl/hlsl_basic_types.h
   hlsl/hlsl_intrinsics.h
   )
+set(hlsl_files
+  ${hlsl_h}
+  ${hlsl_subdir_files}
+  )
 
 set(mips_msa_files
   msa.h
@@ -548,10 +552,20 @@
   EXCLUDE_FROM_ALL
   COMPONENT x86-resource-headers)
 
+if(NOT CLANG_ENABLE_HLSL)
+  set(EXCLUDE_HLSL EXCLUDE_FROM_ALL)
+endif()
+
 install(
-  FILES ${hlsl_files}
+  FILES ${hlsl_h}
   DESTINATION ${header_install_dir}
-  EXCLUDE_FROM_ALL
+  ${EXCLUDE_HLSL}
+  COMPONENT hlsl-resource-headers)
+
+install(
+  FILES ${hlsl_subdir_files}
+  DESTINATION ${header_install_dir}/hlsl
+  ${EXCLUDE_HLSL}
   COMPONENT hlsl-resource-headers)
 
 install(
Index: clang/cmake/caches/HLSL.cmake
===================================================================
--- clang/cmake/caches/HLSL.cmake
+++ clang/cmake/caches/HLSL.cmake
@@ -9,3 +9,5 @@
 # HLSL support is currently limted to clang, eventually it will expand to
 # clang-tools-extra too.
 set(LLVM_ENABLE_PROJECTS "clang" CACHE STRING "")
+
+set(CLANG_ENABLE_HLSL On CACHE BOOL "")
Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -482,6 +482,10 @@
        "Generate build targets for the Clang unit tests."
        ${LLVM_INCLUDE_TESTS})
 
+option(CLANG_ENABLE_HLSL "Include HLSL build products" Off)
+# While HLSL support is experimental this should stay hidden.
+mark_as_advanced(CLANG_ENABLE_HLSL)
+
 add_subdirectory(utils/TableGen)
 
 # Export CLANG_TABLEGEN_EXE for use by flang docs.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134693.463275.patch
Type: text/x-patch
Size: 2302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220927/19c74eab/attachment.bin>


More information about the cfe-commits mailing list