Fix test failures introduced by PR #113697 (#116941)
[llvm-project.git] / llvm / tools / dxil-dis / CMakeLists.txt
blobd0541fcf802e988025c51dbaea94278a2121602b
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
29     GIT_REPOSITORY https://github.com/microsoft/DirectXShaderCompiler.git
30     GIT_TAG main)
32 if (DXC_SOURCE_DIR)
33   set(SOURCE_DIR ${DXC_SOURCE_DIR})
34   unset(GIT_SETTINGS)
35 endif ()
37 ExternalProject_Add(DXC
38                     ${GIT_SETTINGS}
39                     SOURCE_DIR ${SOURCE_DIR}
40                     BINARY_DIR ${BINARY_DIR}
41                     CMAKE_ARGS -C ${SOURCE_DIR}/cmake/caches/PredefinedParams.cmake -DLLVM_INCLUDE_TESTS=On
42                     BUILD_COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR} --target llvm-dis
43                     BUILD_BYPRODUCTS ${BINARY_DIR}/bin/llvm-dis
44                     INSTALL_COMMAND ""
45                     )
47 add_custom_target(dxil-dis
48                   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}"
49                   DEPENDS DXC
50                   )