Skip to content
Merged
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
18 changes: 11 additions & 7 deletions libclc/cmake/modules/AddLibclc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -425,17 +425,21 @@ function(add_libclc_builtin_set)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
endif()

if(CMAKE_HOST_UNIX OR LLVM_USE_SYMLINKS)
set(LIBCLC_LINK_OR_COPY create_symlink)
else()
set(LIBCLC_LINK_OR_COPY copy)
endif()

foreach( a IN LISTS ARG_ALIASES )
if(CMAKE_HOST_UNIX OR LLVM_USE_SYMLINKS)
cmake_path(RELATIVE_PATH libclc_builtins_lib
BASE_DIRECTORY ${LIBCLC_OUTPUT_LIBRARY_DIR}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems libclc_builtins_lib is always located in LIBCLC_OUTPUT_LIBRARY_DIR, so here probably we only need to set LIBCLC_LINK_OR_COPY_SOURCE to be file basename part of libclc_builtins_lib.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but that's precisely what #146833 changed, apparently to account for the possibility of moving the files in the future.

Copy link
Contributor

@wenju-he wenju-he Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@frasercrmck to confirm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps best leave it as you've got it here, as it's more robust to changes. If (some) files are moved in the future, everything would likely still be relative to LIBCLC_OUTPUT_LIBRARY_DIR which is the thing that would most likely change. But I don't see the harm in having it as is.

OUTPUT_VARIABLE LIBCLC_LINK_OR_COPY_SOURCE)
set(LIBCLC_LINK_OR_COPY create_symlink)
else()
set(LIBCLC_LINK_OR_COPY_SOURCE ${libclc_builtins_lib})
set(LIBCLC_LINK_OR_COPY copy)
endif()

set( alias_suffix "${a}-${ARG_TRIPLE}.bc" )
add_custom_command(
OUTPUT ${LIBCLC_OUTPUT_LIBRARY_DIR}/${alias_suffix}
COMMAND ${CMAKE_COMMAND} -E ${LIBCLC_LINK_OR_COPY} ${libclc_builtins_lib} ${LIBCLC_OUTPUT_LIBRARY_DIR}/${alias_suffix}
COMMAND ${CMAKE_COMMAND} -E ${LIBCLC_LINK_OR_COPY} ${LIBCLC_LINK_OR_COPY_SOURCE} ${LIBCLC_OUTPUT_LIBRARY_DIR}/${alias_suffix}
DEPENDS prepare-${obj_suffix}
)
add_custom_target( alias-${alias_suffix} ALL
Expand Down
Loading