Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / tools / dxil-dis / CMakeLists.txt
blob9addf108a8614e829429f920b8b544f51f68abcb
1 option(LLVM_INCLUDE_DXIL_TESTS "Include DXIL tests" Off)
2 mark_as_advanced(LLVM_INCLUDE_DXIL_TESTS)
4 if (NOT LLVM_INCLUDE_DXIL_TESTS)
5   return()
6 endif ()
8 if (NOT "DirectX" IN_LIST LLVM_TARGETS_TO_BUILD)
9   message(FATAL_ERROR "Building dxil-dis tests is unsupported without the DirectX target")
10 endif ()
12 if (CMAKE_HOST_UNIX)
13   set(LLVM_LINK_OR_COPY create_symlink)
14 else ()
15   set(LLVM_LINK_OR_COPY copy)
16 endif ()
18 if (DXIL_DIS)
19   add_custom_target(dxil-dis
20     COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${DXIL_DIS}" "${LLVM_RUNTIME_OUTPUT_INTDIR}/dxil-dis${CMAKE_EXECUTABLE_SUFFIX}")
21   return()
22 endif ()
24 include(ExternalProject)
26 set(SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/DXC-src)
27 set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/DXC-bins)
28 set(GIT_SETTINGS GIT_REPOSITORY https://github.com/microsoft/DirectXShaderCompiler.git)
30 if (DXC_SOURCE_DIR)
31   set(SOURCE_DIR ${DXC_SOURCE_DIR})
32   unset(GIT_SETTINGS)
33 endif ()
35 ExternalProject_Add(DXC
36                     ${GIT_SETTINGS}
37                     SOURCE_DIR ${SOURCE_DIR}
38                     BINARY_DIR ${BINARY_DIR}
39                     CMAKE_ARGS -C ${SOURCE_DIR}/cmake/caches/PredefinedParams.cmake -DLLVM_INCLUDE_TESTS=On
40                     BUILD_COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR} --target llvm-dis
41                     BUILD_BYPRODUCTS ${BINARY_DIR}/bin/llvm-dis
42                     INSTALL_COMMAND ""
43                     )
45 add_custom_target(dxil-dis
46                   COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${BINARY_DIR}/bin/llvm-dis${CMAKE_EXECUTABLE_SUFFIX}" "${LLVM_RUNTIME_OUTPUT_INTDIR}/dxil-dis${CMAKE_EXECUTABLE_SUFFIX}"
47                   DEPENDS DXC
48                   )