[llvm] Revise IDE folder structure (#89741)

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.
This commit is contained in:
Michael Kruse 2024-05-25 13:28:30 +02:00 committed by GitHub
parent 83646590af
commit 4ecbfacf9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
56 changed files with 158 additions and 113 deletions

View File

@ -1122,7 +1122,7 @@ configure_file(
add_custom_target(srpm
COMMAND cpack -G TGZ --config CPackSourceConfig.cmake -B ${LLVM_SRPM_DIR}/SOURCES
COMMAND rpmbuild -bs --define '_topdir ${LLVM_SRPM_DIR}' ${LLVM_SRPM_BINARY_SPECFILE})
set_target_properties(srpm PROPERTIES FOLDER "Misc")
set_target_properties(srpm PROPERTIES FOLDER "LLVM/Misc")
if(APPLE AND DARWIN_LTO_LIBRARY)
set(CMAKE_EXE_LINKER_FLAGS
@ -1225,7 +1225,9 @@ if( LLVM_INCLUDE_UTILS )
add_subdirectory(utils/split-file)
add_subdirectory(utils/mlgo-utils)
if( LLVM_INCLUDE_TESTS )
set(LLVM_SUBPROJECT_TITLE "Third-Party/Google Test")
add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
set(LLVM_SUBPROJECT_TITLE)
endif()
else()
if ( LLVM_INCLUDE_TESTS )
@ -1289,7 +1291,7 @@ if( LLVM_INCLUDE_TESTS )
if(LLVM_ALL_LIT_DEPENDS OR LLVM_ALL_ADDITIONAL_TEST_DEPENDS)
add_dependencies(test-depends ${LLVM_ALL_LIT_DEPENDS} ${LLVM_ALL_ADDITIONAL_TEST_DEPENDS})
endif()
set_target_properties(test-depends PROPERTIES FOLDER "Tests")
set_target_properties(test-depends PROPERTIES FOLDER "LLVM/Tests")
add_dependencies(check-all test-depends)
endif()
@ -1346,7 +1348,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
# Installing the headers needs to depend on generating any public
# tablegen'd headers.
add_custom_target(llvm-headers DEPENDS intrinsics_gen omp_gen)
set_target_properties(llvm-headers PROPERTIES FOLDER "Misc")
set_target_properties(llvm-headers PROPERTIES FOLDER "LLVM/Resources")
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-llvm-headers
@ -1356,7 +1358,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
# Custom target to install all libraries.
add_custom_target(llvm-libraries)
set_target_properties(llvm-libraries PROPERTIES FOLDER "Misc")
set_target_properties(llvm-libraries PROPERTIES FOLDER "LLVM/Resources")
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-llvm-libraries
@ -1402,6 +1404,8 @@ if (LLVM_INCLUDE_BENCHMARKS)
set(HAVE_STD_REGEX ON CACHE BOOL "OK" FORCE)
add_subdirectory(${LLVM_THIRD_PARTY_DIR}/benchmark
${CMAKE_CURRENT_BINARY_DIR}/third-party/benchmark)
set_target_properties(benchmark PROPERTIES FOLDER "Third-Party/Google Benchmark")
set_target_properties(benchmark_main PROPERTIES FOLDER "Third-Party/Google Benchmark")
add_subdirectory(benchmarks)
endif()

View File

@ -4,6 +4,21 @@ include(LLVMProcessSources)
include(LLVM-Config)
include(DetermineGCCCompatible)
# get_subproject_title(titlevar)
# Set ${outvar} to the title of the current LLVM subproject (Clang, MLIR ...)
#
# The title is set in the subproject's top-level using the variable
# LLVM_SUBPROJECT_TITLE. If it does not exist, it is assumed it is LLVM itself.
# The title is not semantically significant, but use to create folders in
# CMake-generated IDE projects (Visual Studio/XCode).
function(get_subproject_title outvar)
if (LLVM_SUBPROJECT_TITLE)
set(${outvar} "${LLVM_SUBPROJECT_TITLE}" PARENT_SCOPE)
else ()
set(${outvar} "LLVM" PARENT_SCOPE)
endif ()
endfunction(get_subproject_title)
function(llvm_update_compile_flags name)
get_property(sources TARGET ${name} PROPERTY SOURCES)
if("${sources}" MATCHES "\\.c(;|$)")
@ -151,7 +166,8 @@ function(add_llvm_symbol_exports target_name export_file)
endif()
add_custom_target(${target_name}_exports DEPENDS ${native_export_file})
set_target_properties(${target_name}_exports PROPERTIES FOLDER "Misc")
get_subproject_title(subproject_title)
set_target_properties(${target_name}_exports PROPERTIES FOLDER "${subproject_title}/API")
get_property(srcs TARGET ${target_name} PROPERTY SOURCES)
foreach(src ${srcs})
@ -543,6 +559,8 @@ function(llvm_add_library name)
endif()
endif()
get_subproject_title(subproject_title)
# Generate objlib
if((ARG_SHARED AND ARG_STATIC) OR ARG_OBJECT)
# Generate an obj library for both targets.
@ -564,7 +582,7 @@ function(llvm_add_library name)
# Bring in the target include directories from our original target.
target_include_directories(${obj_name} PRIVATE $<TARGET_PROPERTY:${name},INCLUDE_DIRECTORIES>)
set_target_properties(${obj_name} PROPERTIES FOLDER "Object Libraries")
set_target_properties(${obj_name} PROPERTIES FOLDER "${subproject_title}/Object Libraries")
if(ARG_DEPENDS)
add_dependencies(${obj_name} ${ARG_DEPENDS})
endif()
@ -603,6 +621,7 @@ function(llvm_add_library name)
LINK_LIBS ${ARG_LINK_LIBS}
LINK_COMPONENTS ${ARG_LINK_COMPONENTS}
)
set_target_properties(${name_static} PROPERTIES FOLDER "${subproject_title}/Libraries")
# Bring in the target link info from our original target.
target_link_directories(${name_static} PRIVATE $<TARGET_PROPERTY:${name},LINK_DIRECTORIES>)
@ -620,6 +639,7 @@ function(llvm_add_library name)
else()
add_library(${name} STATIC ${ALL_FILES})
endif()
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Libraries")
if(ARG_COMPONENT_LIB)
set_target_properties(${name} PROPERTIES LLVM_COMPONENT TRUE)
@ -796,6 +816,8 @@ function(add_llvm_install_targets target)
endif()
endforeach()
get_subproject_title(subproject_title)
add_custom_target(${target}
DEPENDS ${file_dependencies}
COMMAND "${CMAKE_COMMAND}"
@ -803,7 +825,7 @@ function(add_llvm_install_targets target)
${prefix_option}
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
USES_TERMINAL)
set_target_properties(${target} PROPERTIES FOLDER "Component Install Targets")
set_target_properties(${target} PROPERTIES FOLDER "${subproject_title}/Installation")
add_custom_target(${target}-stripped
DEPENDS ${file_dependencies}
COMMAND "${CMAKE_COMMAND}"
@ -812,7 +834,7 @@ function(add_llvm_install_targets target)
-DCMAKE_INSTALL_DO_STRIP=1
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
USES_TERMINAL)
set_target_properties(${target}-stripped PROPERTIES FOLDER "Component Install Targets (Stripped)")
set_target_properties(${target}-stripped PROPERTIES FOLDER "${subproject_title}/Installation")
if(target_dependencies)
add_dependencies(${target} ${target_dependencies})
add_dependencies(${target}-stripped ${target_dependencies})
@ -832,6 +854,8 @@ endfunction()
function(add_llvm_component_group name)
cmake_parse_arguments(ARG "HAS_JIT" "" "LINK_COMPONENTS" ${ARGN})
add_custom_target(${name})
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Component Groups")
if(ARG_HAS_JIT)
set_property(TARGET ${name} PROPERTY COMPONENT_HAS_JIT ON)
endif()
@ -865,6 +889,8 @@ function(add_llvm_component_library name)
if(ARG_ADD_TO_COMPONENT)
set_property(TARGET ${ARG_ADD_TO_COMPONENT} APPEND PROPERTY LLVM_LINK_COMPONENTS ${component_name})
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Libraries/${ARG_ADD_TO_COMPONENT}")
endif()
endfunction()
@ -921,10 +947,12 @@ macro(add_llvm_library name)
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
get_subproject_title(subproject_title)
if (ARG_MODULE)
set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Loadable Modules")
else()
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Libraries")
endif()
endmacro(add_llvm_library name)
@ -948,7 +976,8 @@ macro(generate_llvm_objects name)
add_dependencies(${obj_name} ${ARG_DEPENDS})
endif()
set_target_properties(${obj_name} PROPERTIES FOLDER "Object Libraries")
get_subproject_title(subproject_title)
set_target_properties(${obj_name} PROPERTIES FOLDER "${subproject_title}/Object Libraries")
endif()
if (ARG_GENERATE_DRIVER)
@ -999,6 +1028,8 @@ macro(add_llvm_executable name)
else()
add_executable(${name} ${ALL_FILES})
endif()
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Executables")
setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})
@ -1418,8 +1449,9 @@ macro(llvm_add_tool project name)
if( LLVM_BUILD_TOOLS )
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Tools")
endif()
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools")
endmacro(llvm_add_tool project name)
macro(add_llvm_tool name)
@ -1435,7 +1467,8 @@ macro(add_llvm_example name)
if( LLVM_BUILD_EXAMPLES )
install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}")
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Examples")
endmacro(add_llvm_example name)
macro(add_llvm_example_library name)
@ -1446,7 +1479,8 @@ macro(add_llvm_example_library name)
add_llvm_library(${name} ${ARGN})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Examples")
endmacro(add_llvm_example_library name)
# This is a macro that is used to create targets for executables that are needed
@ -1457,7 +1491,8 @@ macro(add_llvm_utility name)
endif()
add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "Utils")
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Utils")
if ( ${name} IN_LIST LLVM_TOOLCHAIN_UTILITIES OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
get_target_export_arg(${name} LLVM export_to_llvmexports)
@ -1480,19 +1515,20 @@ endmacro(add_llvm_utility name)
macro(add_llvm_fuzzer name)
cmake_parse_arguments(ARG "" "DUMMY_MAIN" "" ${ARGN})
get_subproject_title(subproject_title)
if( LLVM_LIB_FUZZING_ENGINE )
set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN})
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
target_link_libraries(${name} PRIVATE ${LLVM_LIB_FUZZING_ENGINE})
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Fuzzers")
elseif( LLVM_USE_SANITIZE_COVERAGE )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN})
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Fuzzers")
elseif( ARG_DUMMY_MAIN )
add_llvm_executable(${name} ${ARG_DUMMY_MAIN} ${ARG_UNPARSED_ARGUMENTS})
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Fuzzers")
endif()
endmacro()
@ -1653,6 +1689,8 @@ function(add_unittest test_suite test_name)
list(APPEND LLVM_LINK_COMPONENTS Support) # gtest needs it for raw_ostream
add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH ${ARGN})
get_subproject_title(subproject_title)
set_target_properties(${test_name} PROPERTIES FOLDER "${subproject_title}/Tests/Unit")
# The runtime benefits of LTO don't outweight the compile time costs for tests.
if(LLVM_ENABLE_LTO)
@ -1684,10 +1722,6 @@ function(add_unittest test_suite test_name)
target_link_libraries(${test_name} PRIVATE llvm_gtest_main llvm_gtest ${LLVM_PTHREAD_LIB})
add_dependencies(${test_suite} ${test_name})
get_target_property(test_suite_folder ${test_suite} FOLDER)
if (test_suite_folder)
set_property(TARGET ${test_name} PROPERTY FOLDER "${test_suite_folder}")
endif ()
endfunction()
# Use for test binaries that call llvm::getInputFileDirectory(). Use of this
@ -1710,7 +1744,8 @@ function(add_benchmark benchmark_name)
add_llvm_executable(${benchmark_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH ${ARGN})
set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
set_output_directory(${benchmark_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
set_property(TARGET ${benchmark_name} PROPERTY FOLDER "Utils")
get_subproject_title(subproject_title)
set_property(TARGET ${benchmark_name} PROPERTY FOLDER "${subproject_title}/Benchmarks")
target_link_libraries(${benchmark_name} PRIVATE benchmark)
endfunction()
@ -1999,6 +2034,8 @@ function(add_lit_target target comment)
COMMAND ${CMAKE_COMMAND} -E echo "${target} does nothing, no tools built.")
message(STATUS "${target} does nothing.")
endif()
get_subproject_title(subproject_title)
set_target_properties(${target} PROPERTIES FOLDER "${subproject_title}/Tests")
if (ARG_DEPENDS)
add_dependencies(${target} ${ARG_DEPENDS})
@ -2080,7 +2117,8 @@ function(add_lit_testsuites project directory)
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER" "PARAMS;DEPENDS;ARGS" ${ARGN})
if (NOT ARG_FOLDER)
set(ARG_FOLDER "Test Subdirectories")
get_subproject_title(subproject_title)
set(ARG_FOLDER "${subproject_title}/Tests/LIT Testsuites")
endif()
# Search recursively for test directories by assuming anything not
@ -2282,7 +2320,8 @@ function(llvm_add_tool_symlink project link_name target)
set(should_build_all ALL)
endif()
add_custom_target(${target_name} ${should_build_all} DEPENDS ${target} ${output_path})
set_target_properties(${target_name} PROPERTIES FOLDER Tools)
get_subproject_title(subproject_title)
set_target_properties(${target_name} PROPERTIES FOLDER "${subproject_title}/Tools")
# Make sure both the link and target are toolchain tools
if (${link_name} IN_LIST LLVM_TOOLCHAIN_TOOLS AND ${target} IN_LIST LLVM_TOOLCHAIN_TOOLS)
@ -2542,5 +2581,7 @@ function(setup_host_tool tool_name setting_name exe_var_name target_var_name)
if(LLVM_USE_HOST_TOOLS AND NOT ${setting_name})
build_native_tool(${tool_name} exe_name DEPENDS ${tool_name})
add_custom_target(${target_var_name} DEPENDS ${exe_name})
get_subproject_title(subproject_title)
set_target_properties(${target_var_name} PROPERTIES FOLDER "${subproject_title}/Native")
endif()
endfunction()

View File

@ -173,6 +173,8 @@ function(add_ocaml_library name)
VERBATIM)
add_custom_target("ocaml_${name}" ALL DEPENDS ${ocaml_outputs} "${bin}/${name}.odoc")
get_subproject_title(subproject_title)
set_target_properties("ocaml_${name}" PROPERTIES FOLDER "${subproject_title}/Bindings/OCaml")
set_target_properties("ocaml_${name}" PROPERTIES
OCAML_FLAGS "-I;${bin}")
@ -228,5 +230,5 @@ endfunction()
add_custom_target(ocaml_make_directory
COMMAND "${CMAKE_COMMAND}" "-E" "make_directory" "${LLVM_LIBRARY_DIR}/ocaml/llvm")
add_custom_target("ocaml_all")
set_target_properties(ocaml_all PROPERTIES FOLDER "Misc")
set_target_properties(ocaml_make_directory PROPERTIES FOLDER "Misc")
set_target_properties(ocaml_all PROPERTIES FOLDER "LLVM/Bindings/OCaml")
set_target_properties(ocaml_make_directory PROPERTIES FOLDER "LLVM/Bindings/OCaml")

View File

@ -6,6 +6,7 @@ if (LLVM_ENABLE_SPHINX)
find_package(Sphinx REQUIRED)
if (LLVM_BUILD_DOCS AND NOT TARGET sphinx)
add_custom_target(sphinx ALL)
set_target_properties(sphinx PROPERTIES FOLDER "LLVM/Docs")
endif()
else()
message(STATUS "Sphinx disabled.")
@ -58,6 +59,8 @@ function (add_sphinx_target builder project)
"${SPHINX_BUILD_DIR}" # Output
COMMENT
"Generating ${builder} Sphinx documentation for ${project} into \"${SPHINX_BUILD_DIR}\"")
get_subproject_title(subproject_title)
set_target_properties(${SPHINX_TARGET_NAME} PROPERTIES FOLDER "${subproject_title}/Docs")
# When "clean" target is run, remove the Sphinx build directory
set_property(DIRECTORY APPEND PROPERTY

View File

@ -45,6 +45,8 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
add_custom_target(CREATE_${project_name}_${target_name}
DEPENDS ${${project_name}_${target_name}_BUILD})
get_subproject_title(subproject_title)
set_target_properties(CREATE_${project_name}_${target_name} PROPERTIES FOLDER "${subproject_title}/Native")
# Escape semicolons in the targets list so that cmake doesn't expand
# them to spaces.
@ -98,6 +100,8 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
add_custom_target(CONFIGURE_${project_name}_${target_name}
DEPENDS ${${project_name}_${target_name}_BUILD}/CMakeCache.txt)
get_subproject_title(subproject_title)
set_target_properties(CONFIGURE_${project_name}_${target_name} PROPERTIES FOLDER "${subproject_title}/Native")
endfunction()

View File

@ -210,6 +210,8 @@ function(install_distribution_exports project)
COMPONENT ${target})
if(NOT LLVM_ENABLE_IDE)
add_custom_target(${target})
get_subproject_title(subproject_title)
set_target_properties(${target} PROPERTIES FOLDER "${subproject_title}/Distribution")
add_llvm_install_targets(install-${target} COMPONENT ${target})
endif()
endif()
@ -260,6 +262,14 @@ function(llvm_distribution_add_targets)
add_custom_target(${distribution_target})
add_custom_target(install-${distribution_target})
add_custom_target(install-${distribution_target}-stripped)
get_subproject_title(subproject_title)
set_target_properties(
${distribution_target}
install-${distribution_target}
install-${distribution_target}-stripped
PROPERTIES
FOLDER "${subproject_title}/Distribution"
)
foreach(target ${distribution_components})
# Note that some distribution components may not have an actual target, but only an install-FOO target.

View File

@ -56,11 +56,13 @@ endfunction()
# Use provided strip tool instead of the default one.
# TARGET_TRIPLE triple
# Optional target triple to pass to the compiler
# FOLDER
# For IDEs, the Folder to put the targets into.
# )
function(llvm_ExternalProject_Add name source_dir)
cmake_parse_arguments(ARG
"USE_TOOLCHAIN;EXCLUDE_FROM_ALL;NO_INSTALL;ALWAYS_CLEAN"
"SOURCE_DIR"
"SOURCE_DIR;FOLDER"
"CMAKE_ARGS;TOOLCHAIN_TOOLS;RUNTIME_LIBRARIES;DEPENDS;EXTRA_TARGETS;PASSTHROUGH_PREFIXES;STRIP_TOOL;TARGET_TRIPLE"
${ARGN})
canonicalize_tool_name(${name} nameCanon)
@ -150,6 +152,9 @@ function(llvm_ExternalProject_Add name source_dir)
COMMENT "Clobbering ${name} build and stamp directories"
USES_TERMINAL
)
if (ARG_FOLDER)
set_target_properties(${name}-clear PROPERTIES FOLDER "${ARG_FOLDER}")
endif ()
# Find all variables that start with a prefix and propagate them through
get_cmake_property(variableNames VARIABLES)
@ -252,6 +257,9 @@ function(llvm_ExternalProject_Add name source_dir)
add_custom_target(${name}-clobber
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${name}-clobber-stamp)
if (ARG_FOLDER)
set_target_properties(${name}-clobber PROPERTIES FOLDER "${ARG_FOLDER}")
endif ()
if(ARG_EXCLUDE_FROM_ALL)
set(exclude EXCLUDE_FROM_ALL 1)
@ -358,6 +366,12 @@ function(llvm_ExternalProject_Add name source_dir)
USES_TERMINAL_INSTALL 1
LIST_SEPARATOR |
)
if (ARG_FOLDER)
set_target_properties(
${name} ${name}-clobber ${name}-build ${name}-configure
PROPERTIES FOLDER "${ARG_FOLDER}"
)
endif ()
if(ARG_USE_TOOLCHAIN)
set(force_deps DEPENDS ${TOOLCHAIN_BINS})
@ -374,6 +388,9 @@ function(llvm_ExternalProject_Add name source_dir)
USES_TERMINAL 1
)
ExternalProject_Add_StepTargets(${name} clean)
if (ARG_FOLDER)
set_target_properties(${name}-clean PROPERTIES FOLDER "${ARG_FOLDER}")
endif ()
if(ARG_USE_TOOLCHAIN)
add_dependencies(${name}-clean ${name}-clobber)
@ -388,6 +405,9 @@ function(llvm_ExternalProject_Add name source_dir)
add_llvm_install_targets(install-${name}
DEPENDS ${name}
COMPONENT ${name})
if (ARG_FOLDER)
set_target_properties(install-${name} PROPERTIES FOLDER "${ARG_FOLDER}")
endif ()
endif()
# Add top-level targets
@ -404,5 +424,8 @@ function(llvm_ExternalProject_Add name source_dir)
WORKING_DIRECTORY ${BINARY_DIR}
VERBATIM
USES_TERMINAL)
if (ARG_FOLDER)
set_target_properties(${target} PROPERTIES FOLDER "${ARG_FOLDER}")
endif ()
endforeach()
endfunction()

View File

@ -167,7 +167,8 @@ function(add_public_tablegen_target target)
if(LLVM_COMMON_DEPENDS)
add_dependencies(${target} ${LLVM_COMMON_DEPENDS})
endif()
set_target_properties(${target} PROPERTIES FOLDER "Tablegenning")
get_subproject_title(subproject_title)
set_target_properties(${target} PROPERTIES FOLDER "${subproject_title}/Tablegenning")
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${target} PARENT_SCOPE)
endfunction()
@ -217,6 +218,8 @@ macro(add_tablegen target project)
set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE)
add_custom_target(${target}-host DEPENDS ${${project}_TABLEGEN_EXE})
get_subproject_title(subproject_title)
set_target_properties(${target}-host PROPERTIES FOLDER "${subproject_title}/Native")
set(${project}_TABLEGEN_TARGET ${target}-host PARENT_SCOPE)
# If we're using the host tablegen, and utils were not requested, we have no

View File

@ -87,6 +87,7 @@ if (LLVM_ENABLE_DOXYGEN)
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating llvm doxygen documentation." VERBATIM)
set_target_properties(doxygen-llvm PROPERTIES FOLDER "LLVM/Docs")
if (LLVM_BUILD_DOCS)
add_dependencies(doxygen doxygen-llvm)

View File

@ -1,5 +1,5 @@
add_custom_target(Kaleidoscope)
set_target_properties(Kaleidoscope PROPERTIES FOLDER Examples)
set_target_properties(Kaleidoscope PROPERTIES FOLDER "LLVM/Examples")
macro(add_kaleidoscope_chapter name)
add_dependencies(Kaleidoscope ${name})

View File

@ -48,4 +48,4 @@ set_source_files_properties("${version_inc}"
HEADER_FILE_ONLY TRUE)
add_custom_target(llvm_vcsrevision_h ALL DEPENDS "${generated_files}")
set_target_properties(llvm_vcsrevision_h PROPERTIES FOLDER "Misc")
set_target_properties(llvm_vcsrevision_h PROPERTIES FOLDER "LLVM/Resources")

View File

@ -79,4 +79,5 @@ else()
endif()
add_library(LLVMSupportBlake3 OBJECT EXCLUDE_FROM_ALL ${LLVM_BLAKE3_FILES})
set_target_properties(LLVMSupportBlake3 PROPERTIES FOLDER "LLVM/Libraries")
llvm_update_compile_flags(LLVMSupportBlake3)

View File

@ -93,6 +93,7 @@ function(builtin_default_target compiler_rt_path)
SANITIZER
USE_TOOLCHAIN
TARGET_TRIPLE ${LLVM_TARGET_TRIPLE}
FOLDER "Compiler-RT"
${EXTRA_ARGS})
endfunction()
@ -128,6 +129,7 @@ function(builtin_register_target compiler_rt_path name)
${COMMON_CMAKE_ARGS}
${${name}_extra_args}
USE_TOOLCHAIN
FOLDER "Compiler-RT"
${EXTRA_ARGS} ${ARG_EXTRA_ARGS})
endfunction()
@ -148,6 +150,10 @@ if(compiler_rt_path)
add_custom_target(builtins)
add_custom_target(install-builtins)
add_custom_target(install-builtins-stripped)
set_target_properties(
builtins install-builtins install-builtins-stripped
PROPERTIES FOLDER "Compiler-RT"
)
endif()
foreach(target ${LLVM_BUILTIN_TARGETS})
@ -263,6 +269,7 @@ function(runtime_default_target)
${SUB_INSTALL_TARGETS}
USE_TOOLCHAIN
TARGET_TRIPLE ${LLVM_TARGET_TRIPLE}
FOLDER "Runtimes"
${EXTRA_ARGS})
endfunction()
@ -388,6 +395,7 @@ function(runtime_register_target name)
EXTRA_TARGETS ${${name}_extra_targets}
${${name}_test_targets}
USE_TOOLCHAIN
FOLDER "Runtimes"
${EXTRA_ARGS} ${ARG_EXTRA_ARGS})
add_dependencies(runtimes runtimes-${name})
@ -401,14 +409,17 @@ function(runtime_register_target name)
foreach(runtime_name ${runtime_names})
if(NOT TARGET ${runtime_name})
add_custom_target(${runtime_name})
set_target_properties(${runtime_name} PROPERTIES FOLDER "${runtime_name}")
endif()
add_dependencies(${runtime_name} ${runtime_name}-${name})
if(NOT TARGET install-${runtime_name})
add_custom_target(install-${runtime_name})
set_target_properties(install-${runtime_name} PROPERTIES FOLDER "${runtime_name}")
endif()
add_dependencies(install-${runtime_name} install-${runtime_name}-${name})
if(NOT TARGET install-${runtime_name}-stripped)
add_custom_target(install-${runtime_name}-stripped)
set_target_properties(install-${runtime_name} PROPERTIES FOLDER "${runtime_name}")
endif()
add_dependencies(install-${runtime_name}-stripped install-${runtime_name}-${name}-stripped)
endforeach()
@ -507,9 +518,17 @@ if(runtimes)
add_custom_target(runtimes-configure)
add_custom_target(install-runtimes)
add_custom_target(install-runtimes-stripped)
set_target_properties(
runtimes runtimes-configure install-runtimes install-runtimes-stripped
PROPERTIES FOLDER "Runtimes"
)
if(LLVM_INCLUDE_TESTS)
add_custom_target(check-runtimes)
add_custom_target(runtimes-test-depends)
set_target_properties(
check-runtimes runtimes-test-depends
PROPERTIES FOLDER "Runtimes"
)
set(test_targets "")
endif()
if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
@ -517,6 +536,10 @@ if(runtimes)
add_custom_target(${component})
add_custom_target(install-${component})
add_custom_target(install-${component}-stripped)
set_target_properties(
${component} install-${component} install-${component}-stripped
PROPERTIES FOLDER "${component}"
)
endforeach()
endif()
endif()

View File

@ -230,7 +230,7 @@ if (LLVM_INCLUDE_SPIRV_TOOLS_TESTS)
endif()
add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
set_target_properties(llvm-test-depends PROPERTIES FOLDER "LLVM/Tests")
if(LLVM_BUILD_TOOLS)
set(exclude_from_check_all "")
@ -243,7 +243,7 @@ add_lit_testsuite(check-llvm "Running the LLVM regression tests"
${exclude_from_check_all}
DEPENDS ${LLVM_TEST_DEPENDS}
)
set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
set_target_properties(check-llvm PROPERTIES FOLDER "LLVM/Tests")
add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
${exclude_from_check_all}
@ -254,4 +254,4 @@ add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
# Setup an alias for 'check-all'.
add_custom_target(check)
add_dependencies(check check-all)
set_target_properties(check PROPERTIES FOLDER "Tests")
set_target_properties(check PROPERTIES FOLDER "LLVM/Tests")

View File

@ -13,6 +13,7 @@ foreach (file ${files})
endforeach (file)
add_custom_target(opt-viewer DEPENDS ${files})
set_target_properties(opt-viewer PROPERTIES FOLDER "LLVM/Tools")
if(NOT LLVM_ENABLE_IDE)
add_llvm_install_targets("install-opt-viewer"
DEPENDS opt-viewer

View File

@ -12,11 +12,10 @@ if (NOT WIN32 AND NOT CYGWIN)
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/../
LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/../
)
set_target_properties(InlineAdvisorPlugin PROPERTIES FOLDER "Tests")
set_target_properties(InlineAdvisorPlugin PROPERTIES FOLDER "LLVM/Tests")
# The plugin depends on some of the output files of intrinsics_gen, so make sure
# it is built before the plugin.
add_dependencies(InlineAdvisorPlugin intrinsics_gen)
add_dependencies(AnalysisTests InlineAdvisorPlugin)
set_property(TARGET InlineAdvisorPlugin PROPERTY FOLDER "Tests/UnitTests/AnalysisTests")
endif()

View File

@ -18,5 +18,4 @@ if (NOT WIN32 AND NOT CYGWIN)
# it is built before the plugin.
add_dependencies(InlineOrderPlugin intrinsics_gen)
add_dependencies(AnalysisTests InlineOrderPlugin)
set_property(TARGET InlineOrderPlugin PROPERTY FOLDER "Tests/UnitTests/AnalysisTests")
endif()

View File

@ -1,5 +1,5 @@
add_custom_target(UnitTests)
set_target_properties(UnitTests PROPERTIES FOLDER "Tests/UnitTests")
set_target_properties(UnitTests PROPERTIES FOLDER "LLVM/Tests")
function(add_llvm_unittest test_dirname)
add_unittest(UnitTests ${test_dirname} ${ARGN})

View File

@ -9,5 +9,3 @@ add_llvm_unittest(DebugInfoBTFTests
)
target_link_libraries(DebugInfoBTFTests PRIVATE LLVMTestingSupport)
set_property(TARGET DebugInfoBTFTests PROPERTY FOLDER "Tests/UnitTests/DebugInfoTests")

View File

@ -10,5 +10,3 @@ add_llvm_unittest(DebugInfoCodeViewTests
)
target_link_libraries(DebugInfoCodeViewTests PRIVATE LLVMTestingSupport)
set_property(TARGET DebugInfoCodeViewTests PROPERTY FOLDER "Tests/UnitTests/DebugInfoTests")

View File

@ -31,5 +31,3 @@ add_llvm_unittest(DebugInfoDWARFTests
)
target_link_libraries(DebugInfoDWARFTests PRIVATE LLVMTestingSupport)
set_property(TARGET DebugInfoDWARFTests PROPERTY FOLDER "Tests/UnitTests/DebugInfoTests")

View File

@ -11,5 +11,3 @@ add_llvm_unittest(DebugInfoGSYMTests
)
target_link_libraries(DebugInfoGSYMTests PRIVATE LLVMTestingSupport)
set_property(TARGET DebugInfoGSYMTests PROPERTY FOLDER "Tests/UnitTests/DebugInfoTests")

View File

@ -9,5 +9,3 @@ add_llvm_unittest(DebugInfoMSFTests
)
target_link_libraries(DebugInfoMSFTests PRIVATE LLVMTestingSupport)
set_property(TARGET DebugInfoMSFTests PROPERTY FOLDER "Tests/UnitTests/DebugInfoTests")

View File

@ -13,5 +13,3 @@ add_llvm_unittest_with_input_files(DebugInfoPDBTests
)
target_link_libraries(DebugInfoPDBTests PRIVATE LLVMTestingSupport)
set_property(TARGET DebugInfoPDBTests PROPERTY FOLDER "Tests/UnitTests/DebugInfoTests")

View File

@ -21,5 +21,3 @@ list(FIND LLVM_TARGETS_WITH_JIT "${LLVM_NATIVE_ARCH}" jit_idx)
if (NOT build_idx LESS 0 AND NOT jit_idx LESS 0)
add_subdirectory(MCJIT)
endif()
set_property(TARGET ExecutionEngineTests PROPERTY FOLDER "Tests/UnitTests/ExecutionTests")

View File

@ -18,5 +18,3 @@ add_llvm_unittest(JITLinkTests
)
target_link_libraries(JITLinkTests PRIVATE LLVMTestingSupport)
set_property(TARGET JITLinkTests PROPERTY FOLDER "Tests/UnitTests/ExecutionTests")

View File

@ -32,5 +32,3 @@ add_llvm_unittest(MCJITTests
if(MINGW OR CYGWIN)
set_property(TARGET MCJITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
endif()
set_property(TARGET MCJITTests PROPERTY FOLDER "Tests/UnitTests/ExecutionTests")

View File

@ -48,6 +48,4 @@ target_link_libraries(OrcJITTests PRIVATE
LLVMTestingSupport
${ORC_JIT_TEST_LIBS})
set_property(TARGET OrcJITTests PROPERTY FOLDER "Tests/UnitTests/ExecutionTests")
export_executable_symbols(OrcJITTests)

View File

@ -33,7 +33,3 @@ add_dependencies(${test_suite} ${test_name})
set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
get_target_property(test_suite_folder ${test_suite} FOLDER)
if (test_suite_folder)
set_property(TARGET ${test_name} PROPERTY FOLDER "${test_suite_folder}")
endif ()

View File

@ -6,7 +6,7 @@ set(LLVM_LINK_COMPONENTS Support)
add_library(DynamicLibraryLib STATIC
ExportedFuncs.cpp
)
set_target_properties(DynamicLibraryLib PROPERTIES FOLDER "Tests")
set_target_properties(DynamicLibraryLib PROPERTIES FOLDER "LLVM/Tests/Support")
# extract_symbols.py relies on all its library arguments being in the same
# directory, so we must set the output directory in the same way as if
@ -25,7 +25,7 @@ function(dynlib_add_module NAME)
add_library(${NAME} MODULE
PipSqueak.cpp
)
set_target_properties(${NAME} PROPERTIES FOLDER "Tests")
set_target_properties(${NAME} PROPERTIES FOLDER "LLVM/Tests/Support")
set_output_directory(${NAME}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}

View File

@ -31,5 +31,3 @@ add_llvm_target_unittest(AArch64Tests
AArch64SVESchedPseudoTest.cpp
Immediates.cpp
)
set_property(TARGET AArch64Tests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -21,5 +21,3 @@ add_llvm_target_unittest(AMDGPUTests
DwarfRegMappings.cpp
ExecMayBeModifiedBeforeAnyUse.cpp
)
set_property(TARGET AMDGPUTests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -23,5 +23,3 @@ add_llvm_target_unittest(ARMTests
MachineInstrTest.cpp
InstSizes.cpp
)
set_property(TARGET ARMTests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -9,6 +9,3 @@ set(LLVM_LINK_COMPONENTS Core Target AllTargetsCodeGens AllTargetsDescs AllTarge
add_llvm_unittest(TargetMachineCTests
TargetMachineOptionsTest.cpp
)
set_property(TARGET TargetMachineCTests
PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -22,5 +22,3 @@ add_llvm_target_unittest(LoongArchTests
InstSizes.cpp
MCInstrAnalysisTest.cpp
)
set_property(TARGET LoongArchTests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -16,5 +16,3 @@ set(LLVM_LINK_COMPONENTS
add_llvm_unittest(PowerPCTests
AIXRelocModelTest.cpp
)
set_property(TARGET PowerPCTests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -19,5 +19,3 @@ add_llvm_target_unittest(RISCVTests
MCInstrAnalysisTest.cpp
RISCVInstrInfoTest.cpp
)
set_property(TARGET RISCVTests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -18,5 +18,3 @@ set(LLVM_LINK_COMPONENTS
add_llvm_target_unittest(WebAssemblyTests
WebAssemblyExceptionInfoTest.cpp
)
set_property(TARGET WebAssemblyTests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -25,5 +25,3 @@ add_llvm_unittest(X86Tests
MachineSizeOptsTest.cpp
TernlogTest.cpp
)
set_property(TARGET X86Tests PROPERTY FOLDER "Tests/UnitTests/TargetTests")

View File

@ -14,5 +14,3 @@ add_llvm_unittest(CoroTests
)
target_link_libraries(CoroTests PRIVATE LLVMTestingSupport)
set_property(TARGET CoroTests PROPERTY FOLDER "Tests/UnitTests/TransformTests")

View File

@ -14,5 +14,3 @@ add_llvm_unittest(IPOTests
AttributorTest.cpp
FunctionSpecializationTest.cpp
)
set_property(TARGET IPOTests PROPERTY FOLDER "Tests/UnitTests/TransformsTests")

View File

@ -19,5 +19,3 @@ target_link_libraries(ScalarTests PRIVATE LLVMTestingSupport)
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
set_source_files_properties(LoopPassManagerTest.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-function)
endif()
set_property(TARGET ScalarTests PROPERTY FOLDER "Tests/UnitTests/TransformsTests")

View File

@ -32,5 +32,3 @@ add_llvm_unittest(UtilsTests
ValueMapperTest.cpp
ProfDataUtilTest.cpp
)
set_property(TARGET UtilsTests PROPERTY FOLDER "Tests/UnitTests/TransformsTests")

View File

@ -13,5 +13,3 @@ add_llvm_unittest(VectorizeTests
VPlanSlpTest.cpp
VPlanVerifierTest.cpp
)
set_property(TARGET VectorizeTests PROPERTY FOLDER "Tests/UnitTests/TransformsTests")

View File

@ -16,5 +16,3 @@ add_llvm_unittest(CFIVerifyTests
GraphBuilder.cpp
)
target_link_libraries(CFIVerifyTests PRIVATE LLVMCFIVerify)
set_property(TARGET CFIVerifyTests PROPERTY FOLDER "Tests/UnitTests/ToolTests")

View File

@ -62,5 +62,3 @@ add_llvm_target_unittest(LLVMExegesisTests
${exegesis_sources}
)
target_link_libraries(LLVMExegesisTests PRIVATE ${exegesis_link_libraries})
set_property(TARGET LLVMExegesisTests PROPERTY FOLDER "Tests/UnitTests/ToolTests")

View File

@ -48,5 +48,3 @@ include_directories(${mca_includes})
add_llvm_target_unittest(LLVMMCATests
${mca_sources}
)
set_property(TARGET LLVMMCATests PROPERTY FOLDER "Tests/UnitTests/ToolTests")

View File

@ -9,5 +9,3 @@ add_llvm_unittest(LLVMProfdataTests
)
target_link_libraries(LLVMProfdataTests PRIVATE LLVMTestingSupport)
set_property(TARGET LLVMProfdataTests PROPERTY FOLDER "Tests/UnitTests/ToolTests")

View File

@ -9,5 +9,3 @@ add_llvm_unittest(LLVMProfgenTests
target_link_libraries(LLVMProfgenTests PRIVATE LLVMTestingSupport)
add_dependencies(LLVMProfgenTests intrinsics_gen)
set_property(TARGET LLVMProfgenTests PROPERTY FOLDER "Tests/UnitTests/ToolTests")

View File

@ -3,5 +3,5 @@
if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION)
set(LLVM_VISUALIZERS llvm.natvis)
add_custom_target(LLVMVisualizers SOURCES ${LLVM_VISUALIZERS})
set_target_properties(LLVMVisualizers PROPERTIES FOLDER "Utils")
set_target_properties(LLVMVisualizers PROPERTIES FOLDER "LLVM/Misc")
endif()

View File

@ -12,7 +12,6 @@ add_llvm_library(LLVMTableGenBasic OBJECT EXCLUDE_FROM_ALL
CodeGenIntrinsics.cpp
SDNodeProperties.cpp
)
set_target_properties(LLVMTableGenBasic PROPERTIES FOLDER "Tablegenning")
# Users may include its headers as "Basic/*.h"
target_include_directories(LLVMTableGenBasic

View File

@ -23,7 +23,6 @@ add_tablegen(llvm-min-tblgen LLVM_HEADERS
PARTIAL_SOURCES_INTENDED
)
set_target_properties(llvm-min-tblgen PROPERTIES FOLDER "Tablegenning")
set(LLVM_LINK_COMPONENTS
CodeGenTypes
@ -83,4 +82,3 @@ add_tablegen(llvm-tblgen LLVM
DEPENDS
intrinsics_gen # via llvm-min-tablegen
)
set_target_properties(llvm-tblgen PROPERTIES FOLDER "Tablegenning")

View File

@ -42,7 +42,6 @@ add_llvm_library(LLVMTableGenCommon STATIC OBJECT EXCLUDE_FROM_ALL
vt_gen
intrinsics_gen
)
set_target_properties(LLVMTableGenCommon PROPERTIES FOLDER "Tablegenning")
# Users may include its headers as "Common/*.h"
target_include_directories(LLVMTableGenCommon

View File

@ -26,5 +26,5 @@ add_lit_testsuite(check-lit "Running lit's tests"
)
# For IDEs
set_target_properties(check-lit PROPERTIES FOLDER "Tests")
set_target_properties(prepare-check-lit PROPERTIES FOLDER "Tests")
set_target_properties(check-lit PROPERTIES FOLDER "LLVM/Tests")
set_target_properties(prepare-check-lit PROPERTIES FOLDER "LLVM/Tests")

View File

@ -12,5 +12,5 @@ if (LLVM_INCLUDE_UTILS AND LLVM_INCLUDE_TOOLS)
if (NOT LLVM_BUILD_TOOLS)
set_target_properties(llvm-locstats PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
set_target_properties(llvm-locstats PROPERTIES FOLDER "Tools")
set_target_properties(llvm-locstats PROPERTIES FOLDER "LLVM/Tools")
endif()

View File

@ -7,5 +7,3 @@ add_lit_testsuite(check-mlgo-utils "Running mlgo-utils tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "FileCheck" "not" "count" "split-file" "yaml2obj" "llvm-objcopy"
)
set_target_properties(check-mlgo-utils PROPERTIES FOLDER "Tests")