Skip to content

Commit a2a220b

Browse files
authored
[CMake] Add an option to disable source generation (microsoft#6730)
This change adds a new CMake configuration option `HLSL_DISABLE_SOURCE_GENERATION` which allows a user to disable generating the in-tree sources which contributte to DXC's source releases. This option should only be used by users building DXC and not modifying it. Resolves microsoft#6728
1 parent 5cfefc7 commit a2a220b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmake/modules/HCT.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
option(HLSL_COPY_GENERATED_SOURCES "Copy generated sources if different" Off)
2+
option(HLSL_DISABLE_SOURCE_GENERATION "Disable generation of in-tree sources" Off)
3+
mark_as_advanced(HLSL_DISABLE_SOURCE_GENERATION)
24

35
add_custom_target(HCTGen)
46

@@ -43,6 +45,10 @@ function(add_hlsl_hctgen mode)
4345
if (NOT ARG_OUTPUT)
4446
message(FATAL_ERROR "add_hlsl_hctgen requires OUTPUT argument")
4547
endif()
48+
49+
if (HLSL_DISABLE_SOURCE_GENERATION AND NOT ARG_BUILD_DIR)
50+
return()
51+
endif()
4652

4753
set(temp_output ${CMAKE_CURRENT_BINARY_DIR}/tmp/${ARG_OUTPUT})
4854
set(full_output ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_OUTPUT})

0 commit comments

Comments
 (0)