Skip to content

Commit 386af2f

Browse files
Meinersburyuxuanchen1997
authored andcommitted
[libclc] Revise IDE folder structure (#89746)
Summary: 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. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250967
1 parent 9f3fe58 commit 386af2f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

libclc/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.20.0)
33
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
44
project(libclc VERSION 0.2.0 LANGUAGES CXX C)
55
endif()
6+
set(LLVM_SUBPROJECT_TITLE "libclc")
67

78
set(CMAKE_CXX_STANDARD 17)
89

@@ -230,12 +231,14 @@ add_custom_command(
230231
COMMAND ${Python3_EXECUTABLE} ${script_loc} > convert.cl
231232
DEPENDS ${script_loc} )
232233
add_custom_target( "generate_convert.cl" DEPENDS convert.cl )
234+
set_target_properties( "generate_convert.cl" PROPERTIES FOLDER "libclc/Sourcegenning" )
233235

234236
add_custom_command(
235237
OUTPUT clspv-convert.cl
236238
COMMAND ${Python3_EXECUTABLE} ${script_loc} --clspv > clspv-convert.cl
237239
DEPENDS ${script_loc} )
238240
add_custom_target( "clspv-generate_convert.cl" DEPENDS clspv-convert.cl )
241+
set_target_properties( "clspv-generate_convert.cl" PROPERTIES FOLDER "libclc/Sourcegenning" )
239242

240243
enable_testing()
241244

@@ -388,6 +391,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
388391
add_custom_target( ${builtins_comp_lib_tgt}
389392
DEPENDS ${bytecode_files}
390393
)
394+
set_target_properties( ${builtins_comp_lib_tgt} PROPERTIES FOLDER "libclc/Device IR/Comp" )
391395

392396
set( builtins_link_lib_tgt builtins.link.${arch_suffix} )
393397
link_bc(
@@ -405,6 +409,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
405409
DEPENDS ${builtins_link_lib} ${builtins_link_lib_tgt}
406410
)
407411
add_custom_target( "prepare-${spv_suffix}" ALL DEPENDS "${spv_suffix}" )
412+
set_target_properties( "prepare-${spv_suffix}" PROPERTIES FOLDER "libclc/Device IR/Prepare" )
408413
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${spv_suffix}
409414
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
410415
else()
@@ -421,6 +426,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
421426
)
422427
set_target_properties( ${builtins_opt_lib_tgt}
423428
PROPERTIES TARGET_FILE ${builtins_opt_lib_tgt}.bc
429+
FOLDER "libclc/Device IR/Opt"
424430
)
425431

426432
set( builtins_opt_lib $<TARGET_PROPERTY:${builtins_opt_lib_tgt},TARGET_FILE> )
@@ -431,6 +437,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
431437
COMMAND ${prepare_builtins_exe} -o ${obj_suffix} ${builtins_opt_lib}
432438
DEPENDS ${builtins_opt_lib} ${builtins_opt_lib_tgt} ${prepare_builtins_target} )
433439
add_custom_target( prepare-${obj_suffix} ALL DEPENDS ${obj_suffix} )
440+
set_target_properties( "prepare-${obj_suffix}" PROPERTIES FOLDER "libclc/Device IR/Prepare" )
434441

435442
# nvptx-- targets don't include workitem builtins
436443
if( NOT clang_triple MATCHES ".*ptx.*--$" )
@@ -445,6 +452,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
445452
add_custom_target( ${alias_suffix} ALL
446453
COMMAND ${CMAKE_COMMAND} -E create_symlink ${obj_suffix} ${alias_suffix}
447454
DEPENDS prepare-${obj_suffix} )
455+
set_target_properties( "${alias_suffix}" PROPERTIES FOLDER "libclc/Device IR/Aliases" )
448456
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
449457
endforeach( a )
450458
endif()

libclc/cmake/modules/AddLibclc.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ function(link_bc)
112112
)
113113

114114
add_custom_target( ${ARG_TARGET} ALL DEPENDS ${ARG_TARGET}.bc )
115-
set_target_properties( ${ARG_TARGET} PROPERTIES TARGET_FILE ${ARG_TARGET}.bc )
115+
set_target_properties( ${ARG_TARGET} PROPERTIES
116+
TARGET_FILE ${ARG_TARGET}.bc
117+
FOLDER "libclc/Device IR/Linking"
118+
)
116119
endfunction()
117120

118121
# Decomposes and returns variables based on a libclc triple and architecture

0 commit comments

Comments
 (0)