Skip to content

Commit 064391d

Browse files
authored
[mlir] Revise IDE folder structure (llvm#89749)
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.
1 parent c3efb57 commit 064391d

File tree

14 files changed

+20
-12
lines changed

14 files changed

+20
-12
lines changed

mlir/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# MLIR project.
22
cmake_minimum_required(VERSION 3.20.0)
3+
set(LLVM_SUBPROJECT_TITLE "MLIR")
34

45
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
56
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@@ -96,12 +97,13 @@ endif()
9697
# tablegen'd targets.
9798
# mlir-generic-headers are dialect-independent.
9899
add_custom_target(mlir-generic-headers)
99-
set_target_properties(mlir-generic-headers PROPERTIES FOLDER "Misc")
100+
set_target_properties(mlir-generic-headers PROPERTIES FOLDER "MLIR/Resources")
100101
# mlir-headers may be dialect-dependent.
101102
add_custom_target(mlir-headers)
102-
set_target_properties(mlir-headers PROPERTIES FOLDER "Misc")
103+
set_target_properties(mlir-headers PROPERTIES FOLDER "MLIR/Resources")
103104
add_dependencies(mlir-headers mlir-generic-headers)
104105
add_custom_target(mlir-doc)
106+
set_target_properties(mlir-doc PROPERTIES FOLDER "MLIR/Docs")
105107

106108
# Only enable execution engine if the native target is available.
107109
if(${LLVM_NATIVE_ARCH} IN_LIST LLVM_TARGETS_TO_BUILD)
@@ -193,6 +195,7 @@ add_subdirectory(lib/CAPI)
193195
if (MLIR_INCLUDE_TESTS)
194196
add_definitions(-DMLIR_INCLUDE_TESTS)
195197
add_custom_target(MLIRUnitTests)
198+
set_target_properties(MLIRUnitTests PROPERTIES FOLDER "MLIR/Tests")
196199
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
197200
add_subdirectory(unittests)
198201
else()
@@ -253,7 +256,7 @@ endif()
253256

254257
# Custom target to install all mlir libraries
255258
add_custom_target(mlir-libraries)
256-
set_target_properties(mlir-libraries PROPERTIES FOLDER "Misc")
259+
set_target_properties(mlir-libraries PROPERTIES FOLDER "MLIR/Metatargets")
257260

258261
if (NOT LLVM_ENABLE_IDE)
259262
add_llvm_install_targets(install-mlir-libraries

mlir/cmake/modules/AddMLIR.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ function(add_mlir_doc doc_filename output_file output_directory command)
210210
${GEN_DOC_FILE}
211211
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${output_file}.md)
212212
add_custom_target(${output_file}DocGen DEPENDS ${GEN_DOC_FILE})
213+
set_target_properties(${output_file}DocGen PROPERTIES FOLDER "MLIR/Tablegenning/Docs")
213214
add_dependencies(mlir-doc ${output_file}DocGen)
214215
endfunction()
215216

@@ -290,7 +291,7 @@ function(add_mlir_example_library name)
290291
list(APPEND ARG_DEPENDS mlir-generic-headers)
291292

292293
llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs} DEPENDS ${ARG_DEPENDS} LINK_COMPONENTS ${ARG_LINK_COMPONENTS} LINK_LIBS ${ARG_LINK_LIBS})
293-
set_target_properties(${name} PROPERTIES FOLDER "Examples")
294+
set_target_properties(${name} PROPERTIES FOLDER "MLIR/Examples")
294295
if (LLVM_BUILD_EXAMPLES AND NOT ${ARG_DISABLE_INSTALL})
295296
add_mlir_library_install(${name})
296297
else()
@@ -367,7 +368,7 @@ function(add_mlir_library name)
367368
# Add empty "phony" target
368369
add_custom_target(${name})
369370
endif()
370-
set_target_properties(${name} PROPERTIES FOLDER "MLIR libraries")
371+
set_target_properties(${name} PROPERTIES FOLDER "MLIR/Libraries")
371372

372373
# Setup aggregate.
373374
if(ARG_ENABLE_AGGREGATION)

mlir/docs/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if (LLVM_ENABLE_DOXYGEN)
7878
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
7979
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
8080
COMMENT "Generating mlir doxygen documentation." VERBATIM)
81+
set_target_properties(doxygen-mlir PROPERTIES FOLDER "MLIR/Docs")
8182

8283
if (LLVM_BUILD_DOCS)
8384
add_dependencies(doxygen doxygen-mlir)

mlir/examples/toy/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_custom_target(Toy)
2-
set_target_properties(Toy PROPERTIES FOLDER Examples)
2+
set_target_properties(Toy PROPERTIES FOLDER "MLIR/Examples")
33

44
macro(add_toy_chapter name)
55
add_dependencies(Toy ${name})

mlir/examples/transform/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
add_custom_target(TransformExample)
2+
set_target_properties(TransformExample PROPERTIES FOLDER "MLIR/Examples")
23

34
add_subdirectory(Ch2)
45
add_subdirectory(Ch3)

mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function(add_linalg_ods_yaml_gen yaml_ast_file output_file)
2323
${MLIR_LINALG_ODS_YAML_GEN_EXE}
2424
${MLIR_LINALG_ODS_YAML_GEN_TARGET}
2525
${GEN_ODS_FILE} ${GEN_CPP_FILE})
26+
set_target_properties(MLIR${output_file}YamlIncGen PROPERTIES FOLDER "MLIR/Tablegenning")
2627
list(APPEND LLVM_TARGET_DEPENDS ${GEN_ODS_FILE})
2728
set(LLVM_TARGET_DEPENDS ${LLVM_TARGET_DEPENDS} PARENT_SCOPE)
2829
endfunction()
@@ -40,6 +41,7 @@ add_custom_target(LinalgOdsGen
4041
DEPENDS
4142
MLIRLinalgNamedStructuredOpsYamlIncGen
4243
)
44+
set_target_properties(LinalgOdsGen PROPERTIES FOLDER "MLIR/Tablegenning")
4345
add_dependencies(mlir-headers LinalgOdsGen)
4446

4547
add_mlir_dialect(LinalgOps linalg)

mlir/lib/TableGen/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ llvm_add_library(MLIRTableGen STATIC
4040
${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen
4141
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
4242
)
43+
set_target_properties(MLIRTableGen PROPERTIES FOLDER "MLIR/Tablegenning")
4344

4445
mlir_check_all_link_libraries(MLIRTableGen)
4546

mlir/test/CAPI/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function(_add_capi_test_executable name)
99
add_llvm_executable(${name}
1010
PARTIAL_SOURCES_INTENDED
1111
${ARG_UNPARSED_ARGUMENTS})
12+
set_target_properties(${name} PROPERTIES FOLDER "MLIR/Tests")
13+
1214
llvm_update_compile_flags(${name})
1315
if(MLIR_BUILD_MLIR_C_DYLIB)
1416
target_link_libraries(${name} PRIVATE

mlir/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ endif()
217217
add_custom_target(check-mlir-build-only
218218
DEPENDS ${MLIR_TEST_DEPENDS}
219219
)
220+
set_target_properties(check-mlir-build-only PROPERTIES FOLDER "MLIR/Tests")
220221

221222
add_lit_testsuite(check-mlir "Running the MLIR regression tests"
222223
${CMAKE_CURRENT_BINARY_DIR}
223224
DEPENDS ${MLIR_TEST_DEPENDS}
224225
)
225-
set_target_properties(check-mlir PROPERTIES FOLDER "Tests")
226226

227227
add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
228228
DEPENDS ${MLIR_TEST_DEPENDS}

mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ setup_host_tool(mlir-linalg-ods-yaml-gen MLIR_LINALG_ODS_YAML_GEN MLIR_LINALG_OD
1818

1919
if(NOT ${MLIR_LINALG_ODS_YAML_GEN_EXE} STREQUAL "mlir-linalg-ods-yaml-gen")
2020
add_custom_target(mlir-linalg-ods-yaml-gen-host DEPENDS ${MLIR_LINALG_ODS_YAML_GEN_EXE})
21+
set_target_properties(mlir-linalg-ods-yaml-gen-host PROPERTIES FOLDER "MLIR/Tablegenning")
2122

2223
if(NOT LLVM_BUILD_UTILS)
2324
set_target_properties(mlir-linalg-ods-yaml-gen PROPERTIES EXCLUDE_FROM_ALL ON)

mlir/tools/mlir-pdll/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ add_tablegen(mlir-pdll MLIR_PDLL
2121
${LIBS}
2222
)
2323

24-
set_target_properties(mlir-pdll PROPERTIES FOLDER "Tablegenning")
2524
target_link_libraries(mlir-pdll PRIVATE ${LIBS})
2625

2726
mlir_check_all_link_libraries(mlir-pdll)

mlir/tools/mlir-src-sharder/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ add_tablegen(mlir-src-sharder MLIR_SRC_SHARDER
88
${LIBS}
99
)
1010

11-
set_target_properties(mlir-src-sharder PROPERTIES FOLDER "Tablegenning")
11+
set_target_properties(mlir-src-sharder PROPERTIES FOLDER "MLIR/Tablegenning")
1212
target_link_libraries(mlir-src-sharder PRIVATE ${LIBS})
1313

1414
mlir_check_all_link_libraries(mlir-src-sharder)

mlir/tools/mlir-tblgen/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ add_tablegen(mlir-tblgen MLIR
3333
SPIRVUtilsGen.cpp
3434
)
3535

36-
set_target_properties(mlir-tblgen PROPERTIES FOLDER "Tablegenning")
3736
target_link_libraries(mlir-tblgen
3837
PRIVATE
3938
MLIRTblgenLib)

mlir/unittests/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
set_target_properties(MLIRUnitTests PROPERTIES FOLDER "MLIR Tests")
2-
31
# To silence warning caused by Wundef.
42
add_definitions(-DGTEST_NO_LLVM_SUPPORT=0)
53

0 commit comments

Comments
 (0)