Skip to content

Commit 1c49469

Browse files
committed
Add checks for symlink creation
1 parent cb90405 commit 1c49469

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) # Tablegen'd files
99
include_directories(${Python3_INCLUDE_DIR})
1010
include_directories(${pybind11_INCLUDE_DIR})
1111

12+
function(add_symlink source_file link_name)
13+
if (EXISTS ${source_file})
14+
file(CREATE_LINK ${source_file} ${link_name} SYMBOLIC)
15+
else()
16+
message(WARNING "${source_file} not found. Skipping symlink creation for ${link_name}.")
17+
endif()
18+
endfunction()
19+
1220
add_subdirectory(include)
1321
add_subdirectory(lib)
1422
add_subdirectory(test)
@@ -28,6 +36,6 @@ cmake_path(APPEND CMAKE_SOURCE_DIR "python" "test" "unit" "language" "test_core.
2836
cmake_path(APPEND CMAKE_SOURCE_DIR "python" "test" "unit" "language" "test_annotations.py" OUTPUT_VARIABLE TRITON_TEST_ANNOTATIONS)
2937
cmake_path(APPEND CMAKE_SOURCE_DIR ".clang-format" OUTPUT_VARIABLE TRITON_CLANG_FORMAT_SETTING)
3038

31-
file(CREATE_LINK ${TRITON_TEST_CORE} ${TRITON_SHARED_TEST_CORE} SYMBOLIC)
32-
file(CREATE_LINK ${TRITON_TEST_ANNOTATIONS} ${TRITON_SHARED_TEST_ANNOTATIONS} SYMBOLIC)
33-
file(CREATE_LINK ${TRITON_CLANG_FORMAT_SETTING} ${TRITON_SHARED_CLANG_FORMAT_SETTING} SYMBOLIC)
39+
add_symlink(${TRITON_TEST_CORE} ${TRITON_SHARED_TEST_CORE})
40+
add_symlink(${TRITON_TEST_ANNOTATIONS} ${TRITON_SHARED_TEST_ANNOTATIONS})
41+
add_symlink(${TRITON_CLANG_FORMAT_SETTING} ${TRITON_SHARED_CLANG_FORMAT_SETTING})

0 commit comments

Comments
 (0)