[llvm-branch-commits] [libclc] [libclc] Revise IDE folder structure (PR #89746)
Michael Kruse via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Apr 23 05:37:54 PDT 2024
https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/89746
Reviewers of #89153 suggested to break up the patch into per-subproject patches. This is the libclc part. See #89153 for the entire series and motivation.
Update the folder titles for targets in the monorepository that have not seen taken care of for some time. These are the folders that targets are organized in Visual Studio and XCode (`set_property(TARGET <target> PROPERTY FOLDER "<title>")`) when using the respective CMake's IDE generator.
* Ensure that every target is in a folder
* Use a folder hierarchy with each LLVM subproject as a top-level folder
* Use consistent folder names between subprojects
* When using target-creating functions from AddLLVM.cmake, automatically deduce the folder. This reduces the number of `set_property`/`set_target_property`, but are still necessary when `add_custom_target`, `add_executable`, `add_library`, etc. are used. A LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's root CMakeLists.txt.
>From 24ed445050def3e41569cc25bc04dd3dc107c04f Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Tue, 23 Apr 2024 13:25:53 +0200
Subject: [PATCH] [libclc] Revise IDE folder structure
---
libclc/CMakeLists.txt | 13 ++++++++++++-
libclc/cmake/modules/AddLibclc.cmake | 5 ++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 5ce17952430854..05e0061d42298a 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.20.0)
project( libclc VERSION 0.2.0 LANGUAGES CXX C)
+set(LLVM_SUBPROJECT_TITLE "libclc")
set(CMAKE_CXX_STANDARD 17)
@@ -54,7 +55,10 @@ if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DI
foreach( tool IN ITEMS clang llvm-as llvm-link opt )
find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )
add_executable( libclc::${tool} IMPORTED GLOBAL )
- set_target_properties( libclc::${tool} PROPERTIES IMPORTED_LOCATION ${LLVM_TOOL_${tool}} )
+ set_target_properties( libclc::${tool} PROPERTIES
+ IMPORTED_LOCATION ${LLVM_TOOL_${tool}}
+ FOLDER "libclc/Tools"
+ )
endforeach()
endif()
else()
@@ -168,6 +172,7 @@ if( LIBCLC_STANDALONE_BUILD )
else()
add_llvm_utility( prepare_builtins utils/prepare-builtins.cpp )
endif()
+set_target_properties( prepare_builtins PROPERTIES FOLDER "libclc/Tablegenning")
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
# These were not properly reported in early LLVM and we don't need them
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
@@ -225,12 +230,14 @@ add_custom_command(
COMMAND ${Python3_EXECUTABLE} ${script_loc} > convert.cl
DEPENDS ${script_loc} )
add_custom_target( "generate_convert.cl" DEPENDS convert.cl )
+set_target_properties( "generate_convert.cl" PROPERTIES FOLDER "libclc/Tablegenning" )
add_custom_command(
OUTPUT clspv-convert.cl
COMMAND ${Python3_EXECUTABLE} ${script_loc} --clspv > clspv-convert.cl
DEPENDS ${script_loc} )
add_custom_target( "clspv-generate_convert.cl" DEPENDS clspv-convert.cl )
+set_target_properties( "clspv-generate_convert.cl" PROPERTIES FOLDER "libclc/Tablegenning" )
enable_testing()
@@ -394,6 +401,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
DEPENDS ${builtins_link_lib}
)
add_custom_target( "prepare-${spv_suffix}" ALL DEPENDS "${spv_suffix}" )
+ set_target_properties( "prepare-${spv_suffix}" PROPERTIES FOLDER "libclc/Tablegenning" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${spv_suffix}
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
else()
@@ -410,6 +418,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
)
set_target_properties( ${builtins_opt_lib_tgt}
PROPERTIES TARGET_FILE ${builtins_opt_lib_tgt}.bc
+ FOLDER "libclc/BC Genning"
)
set( builtins_opt_lib $<TARGET_PROPERTY:${builtins_opt_lib_tgt},TARGET_FILE> )
@@ -420,6 +429,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
COMMAND prepare_builtins -o ${obj_suffix} ${builtins_opt_lib}
DEPENDS ${builtins_opt_lib} prepare_builtins )
add_custom_target( prepare-${obj_suffix} ALL DEPENDS ${obj_suffix} )
+ set_target_properties( "prepare-${obj_suffix}" PROPERTIES FOLDER "libclc/BC Genning" )
# nvptx-- targets don't include workitem builtins
if( NOT clang_triple MATCHES ".*ptx.*--$" )
@@ -434,6 +444,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
add_custom_target( ${alias_suffix} ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink ${obj_suffix} ${alias_suffix}
DEPENDS prepare-${obj_suffix} )
+ set_target_properties( "${alias_suffix}" PROPERTIES FOLDER "libclc/BC Genning" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
endforeach( a )
endif()
diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake
index bbedc244a72899..b358f871a251d8 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -95,7 +95,10 @@ function(link_bc)
)
add_custom_target( ${ARG_TARGET} ALL DEPENDS ${ARG_TARGET}.bc )
- set_target_properties( ${ARG_TARGET} PROPERTIES TARGET_FILE ${ARG_TARGET}.bc )
+ set_target_properties( ${ARG_TARGET} PROPERTIES
+ TARGET_FILE ${ARG_TARGET}.bc
+ FOLDER "libclc/BC Genning"
+ )
endfunction()
# Decomposes and returns variables based on a libclc triple and architecture
More information about the llvm-branch-commits
mailing list