Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmake/modules/HCT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ if (NOT CLANG_FORMAT_EXE)
endif ()
endif ()

# If an upstream folder contains a .clang-format, incorrect formatting may be
# applied which causes the build to fail. Create a copy in the build dir
# to ensure the right formatting is applied.
get_filename_component(HLSL_SRC_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
get_filename_component(HLSL_BIN_ROOT "${CMAKE_CURRENT_BINARY_DIR}/../.." ABSOLUTE)
if (EXISTS "${HLSL_SRC_ROOT}/.clang-format")
file(MAKE_DIRECTORY "${HLSL_BIN_ROOT}")
file(CREATE_LINK "${HLSL_SRC_ROOT}/.clang-format" "${HLSL_BIN_ROOT}/.clang-format" COPY_ON_ERROR)
endif()

if (WIN32 AND NOT DEFINED HLSL_AUTOCRLF)
find_program(git_executable NAMES git git.exe git.cmd)
execute_process(COMMAND ${git_executable} config --get core.autocrlf
Expand Down