[PATCH] D134979: [llvm-driver][NFC] Simplify handling of tool symlinks
Alex Brachet via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 1 13:21:16 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa1c58b9c67a: [llvm-driver][NFC] Simplify handling of tool symlinks (authored by abrachet).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134979/new/
https://reviews.llvm.org/D134979
Files:
clang/cmake/modules/AddClang.cmake
llvm/cmake/modules/AddLLVM.cmake
llvm/tools/llvm-driver/CMakeLists.txt
Index: llvm/tools/llvm-driver/CMakeLists.txt
===================================================================
--- llvm/tools/llvm-driver/CMakeLists.txt
+++ llvm/tools/llvm-driver/CMakeLists.txt
@@ -5,15 +5,17 @@
foreach(tool ${LLVM_DRIVER_TOOLS})
string(REPLACE "-" "_" tool_entry ${tool})
- string(REPLACE "llvm-" "" tool ${tool})
- set(def_decl "${def_decl}LLVM_DRIVER_TOOL(\"${tool}\", ${tool_entry})\n")
+ get_property(tool_aliases GLOBAL PROPERTY LLVM_DRIVER_TOOL_ALIASES_${tool})
+ foreach(alias ${tool_aliases})
+ set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_SYMLINKS ${alias})
+ string(REPLACE "llvm-" "" alias ${alias})
+ set(def_decl "${def_decl}LLVM_DRIVER_TOOL(\"${alias}\", ${tool_entry})\n")
+ endforeach()
endforeach()
-get_property(LLVM_EXTRA_DRIVER_ENTRIES GLOBAL PROPERTY LLVM_EXTRA_DRIVER_ENTRIES)
-
file(WRITE
"${CMAKE_CURRENT_BINARY_DIR}/LLVMDriverTools.def"
- "${def_decl}${LLVM_EXTRA_DRIVER_ENTRIES}#undef LLVM_DRIVER_TOOL\n")
+ "${def_decl}#undef LLVM_DRIVER_TOOL\n")
target_include_directories(llvm-driver PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_sources(llvm-driver PRIVATE llvm-driver.cpp)
@@ -28,9 +30,8 @@
endif(APPLE)
macro(generate_driver_tool_targets)
- get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
get_property(LLVM_DRIVER_TOOL_SYMLINKS GLOBAL PROPERTY LLVM_DRIVER_TOOL_SYMLINKS)
- foreach(name IN LISTS LLVM_DRIVER_TOOLS LLVM_DRIVER_TOOL_SYMLINKS)
+ foreach(name ${LLVM_DRIVER_TOOL_SYMLINKS})
add_llvm_tool_symlink(${name} llvm-driver ALWAYS_GENERATE)
# Always generate install targets
llvm_install_symlink(LLVM ${name} llvm-driver ALWAYS_GENERATE)
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -916,6 +916,7 @@
set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_OBJLIBS "${obj_name}")
set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOLS ${name})
+ set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_ALIASES_${name} ${name})
target_link_libraries(${obj_name} ${LLVM_PTHREAD_LIB})
llvm_config(${obj_name} ${USE_SHARED} ${LLVM_LINK_COMPONENTS} )
endif()
@@ -2032,7 +2033,6 @@
function(llvm_install_symlink project name dest)
get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
if(LLVM_TOOL_LLVM_DRIVER_BUILD AND ${dest} IN_LIST LLVM_DRIVER_TOOLS)
- set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_SYMLINKS ${name})
return()
endif()
cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
@@ -2079,11 +2079,7 @@
get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
if (${target} IN_LIST LLVM_DRIVER_TOOLS)
- string(REPLACE "-" "_" tool_entry ${target})
- string(REPLACE "-" "_" key ${link_name})
- string(REPLACE "llvm-" "" tool_name ${link_name})
- set_property(GLOBAL APPEND_STRING PROPERTY
- LLVM_EXTRA_DRIVER_ENTRIES "LLVM_DRIVER_TOOL(\"${tool_name}\", ${tool_entry})\n")
+ set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_ALIASES_${target} ${link_name})
endif()
set(dest_binary "$<TARGET_FILE:${target}>")
Index: clang/cmake/modules/AddClang.cmake
===================================================================
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -182,7 +182,7 @@
macro(add_clang_symlink name dest)
get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
if(LLVM_TOOL_LLVM_DRIVER_BUILD AND ${dest} IN_LIST LLVM_DRIVER_TOOLS)
- set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_SYMLINKS ${name})
+ set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_ALIASES_${dest} ${name})
else()
llvm_add_tool_symlink(CLANG ${name} ${dest} ALWAYS_GENERATE)
# Always generate install targets
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134979.464513.patch
Type: text/x-patch
Size: 3915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221001/2efba8c1/attachment.bin>
More information about the cfe-commits
mailing list