Skip to content

Commit 76e7c8f

Browse files
authored
[flang] Revise IDE folder structure (#89745)
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 4d60be0 commit 76e7c8f

File tree

9 files changed

+17
-6
lines changed

9 files changed

+17
-6
lines changed

flang/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cmake_minimum_required(VERSION 3.20.0)
2+
set(LLVM_SUBPROJECT_TITLE "Flang")
23

34
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
45
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@@ -481,7 +482,7 @@ endif()
481482

482483
# Custom target to install Flang libraries.
483484
add_custom_target(flang-libraries)
484-
set_target_properties(flang-libraries PROPERTIES FOLDER "Misc")
485+
set_target_properties(flang-libraries PROPERTIES FOLDER "Flang/Meta")
485486

486487
if (NOT LLVM_ENABLE_IDE)
487488
add_llvm_install_targets(install-flang-libraries

flang/cmake/modules/AddFlang.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,12 @@ function(add_flang_library name)
9494
add_custom_target(${name})
9595
endif()
9696

97-
set_target_properties(${name} PROPERTIES FOLDER "Flang libraries")
97+
set_target_properties(${name} PROPERTIES FOLDER "Flang/Libraries")
9898
set_flang_windows_version_resource_properties(${name})
9999
endfunction(add_flang_library)
100100

101101
macro(add_flang_executable name)
102102
add_llvm_executable(${name} ${ARGN})
103-
set_target_properties(${name} PROPERTIES FOLDER "Flang executables")
104103
set_flang_windows_version_resource_properties(${name})
105104
endmacro(add_flang_executable)
106105

flang/docs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ if (LLVM_ENABLE_DOXYGEN)
7979
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
8080
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
8181
COMMENT "Generating flang doxygen documentation." VERBATIM)
82-
82+
set_target_properties(doxygen-flang PROPERTIES FOLDER "Flang/Docs")
8383
if (LLVM_BUILD_DOCS)
8484
add_dependencies(doxygen doxygen-flang)
8585
endif()

flang/include/flang/Optimizer/Dialect/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ mlir_tablegen(CanonicalizationPatterns.inc -gen-rewriters)
3333
add_public_tablegen_target(CanonicalizationPatternsIncGen)
3434

3535
add_custom_target(flang-doc)
36+
set_target_properties(flang-doc PROPERTIES FOLDER "Flang/Docs")
3637
set(dialect_doc_filename "FIRLangRef")
3738

3839
set(LLVM_TARGET_DEFINITIONS FIROps.td)
@@ -45,4 +46,5 @@ add_custom_command(
4546
${GEN_DOC_FILE}
4647
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dialect_doc_filename}.md)
4748
add_custom_target(${dialect_doc_filename}DocGen DEPENDS ${GEN_DOC_FILE})
49+
set_target_properties(${dialect_doc_filename}DocGen PROPERTIES FOLDER "Flang/Tablegenning/Docs")
4850
add_dependencies(flang-doc ${dialect_doc_filename}DocGen)

flang/runtime/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,21 +271,26 @@ else()
271271
LINK_LIBS
272272
FortranDecimal.static
273273
INSTALL_WITH_TOOLCHAIN)
274+
set_target_properties(FortranRuntime.static PROPERTIES FOLDER "Flang/Runtime Libraries")
274275
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
275276
add_flang_library(FortranRuntime.dynamic ${sources}
276277
LINK_LIBS
277278
FortranDecimal.dynamic
278279
INSTALL_WITH_TOOLCHAIN)
280+
set_target_properties(FortranRuntime.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries")
279281
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
280282
add_flang_library(FortranRuntime.static_dbg ${sources}
281283
LINK_LIBS
282284
FortranDecimal.static_dbg
283285
INSTALL_WITH_TOOLCHAIN)
286+
set_target_properties(FortranRuntime.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
284287
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
285288
add_flang_library(FortranRuntime.dynamic_dbg ${sources}
286289
LINK_LIBS
287290
FortranDecimal.dynamic_dbg
288291
INSTALL_WITH_TOOLCHAIN)
292+
set_target_properties(FortranRuntime.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
289293
add_dependencies(FortranRuntime FortranRuntime.static FortranRuntime.dynamic
290294
FortranRuntime.static_dbg FortranRuntime.dynamic_dbg)
291295
endif()
296+
set_target_properties(FortranRuntime PROPERTIES FOLDER "Flang/Runtime Libraries")

flang/test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ if (LLVM_BUILD_EXAMPLES)
8383
endif ()
8484

8585
add_custom_target(flang-test-depends DEPENDS ${FLANG_TEST_DEPENDS})
86+
set_target_properties(flang-test-depends PROPERTIES FOLDER "Flang/Meta")
8687

8788
add_lit_testsuite(check-flang "Running the Flang regression tests"
8889
${CMAKE_CURRENT_BINARY_DIR}
8990
PARAMS ${FLANG_TEST_PARAMS}
9091
DEPENDS ${FLANG_TEST_DEPENDS}
9192
)
92-
set_target_properties(check-flang PROPERTIES FOLDER "Tests")
93+
set_target_properties(check-flang PROPERTIES FOLDER "Flang/Meta")
9394

9495
# In case of standalone builds.
9596
if (FLANG_STANDALONE_BUILD)

flang/tools/f18/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ if (NOT CMAKE_CROSSCOMPILING)
9696
endif()
9797

9898
add_custom_target(module_files ALL DEPENDS ${MODULE_FILES})
99+
set_target_properties(module_files PROPERTIES FOLDER "Flang/Resources")
99100

100101
# TODO Move this to a more suitable location
101102
# Copy the generated omp_lib.h header file, if OpenMP support has been configured.

flang/unittests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (FLANG_EXPERIMENTAL_CUDA_RUNTIME)
88
endif()
99

1010
add_custom_target(FlangUnitTests)
11-
set_target_properties(FlangUnitTests PROPERTIES FOLDER "Flang Unit Tests")
11+
set_target_properties(FlangUnitTests PROPERTIES FOLDER "Flang/Tests")
1212

1313
function(add_flang_unittest_offload_properties target)
1414
# Set CUDA_RESOLVE_DEVICE_SYMBOLS.
@@ -55,6 +55,7 @@ function(add_flang_nongtest_unittest test_name)
5555
endif()
5656

5757
add_executable(${test_name}${suffix} ${test_name}.cpp)
58+
set_target_properties(${test_name}${suffix} PROPERTIES FOLDER "Flang/Tests/Unit")
5859

5960
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
6061
set(llvm_libs LLVM)

flang/unittests/Evaluate/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ add_library(FortranEvaluateTesting
33
testing.cpp
44
fp-testing.cpp
55
)
6+
set_target_properties(FortranEvaluateTesting PROPERTIES FOLDER "Flang/Tests")
67
if (LLVM_LINK_LLVM_DYLIB)
78
set(llvm_libs LLVM)
89
else()

0 commit comments

Comments
 (0)