Skip to content

Commit

Permalink
[polly] Revise IDE folder structure (#89752)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Meinersbur committed May 25, 2024
1 parent e14f5f2 commit c16538f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
6 changes: 3 additions & 3 deletions polly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
cmake_minimum_required(VERSION 3.20.0)
set(POLLY_STANDALONE_BUILD TRUE)
endif()
set(LLVM_SUBPROJECT_TITLE "Polly")

# Must go below project(..)
include(GNUInstallDirs)
Expand Down Expand Up @@ -157,8 +158,7 @@ foreach (file IN LISTS files)
endforeach ()

add_custom_target(polly-check-format DEPENDS ${check_format_depends})
set_target_properties(polly-check-format PROPERTIES FOLDER "Polly")
set_target_properties(polly-check-format PROPERTIES FOLDER "Polly/Metatargets")

add_custom_target(polly-update-format DEPENDS ${update_format_depends})
set_target_properties(polly-update-format PROPERTIES FOLDER "Polly")

set_target_properties(polly-update-format PROPERTIES FOLDER "Polly/Metatargets")
4 changes: 2 additions & 2 deletions polly/cmake/polly_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ macro(add_polly_library name)
set(libkind)
endif()
add_library( ${name} ${libkind} ${srcs} )
set_target_properties(${name} PROPERTIES FOLDER "Polly")
set_target_properties(${name} PROPERTIES FOLDER "Polly/Libraries")

if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
Expand Down Expand Up @@ -64,7 +64,7 @@ macro(add_polly_loadable_module name)
endif()
set(MODULE TRUE)
add_polly_library(${name} ${srcs})
set_target_properties(${name} PROPERTIES FOLDER "Polly")
set_target_properties(${name} PROPERTIES FOLDER "Polly/Loadable Modules")
if (GLOBAL_NOT_MODULE)
unset (MODULE)
endif()
Expand Down
1 change: 1 addition & 0 deletions polly/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ if (LLVM_ENABLE_DOXYGEN)
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating polly doxygen documentation." VERBATIM)
set_target_properties(doxygen-polly PROPERTIES FOLDER "Polly/Docs")

if (LLVM_BUILD_DOCS)
add_dependencies(doxygen doxygen-polly)
Expand Down
4 changes: 1 addition & 3 deletions polly/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ add_llvm_pass_plugin(Polly
LINK_COMPONENTS
${POLLY_COMPONENTS}
)
set_target_properties(obj.Polly PROPERTIES FOLDER "Polly")
set_target_properties(Polly PROPERTIES FOLDER "Polly")

if (MSVC_IDE OR XCODE)
# Configure source groups for Polly source files. By default, in the IDE there
Expand All @@ -120,7 +118,7 @@ if (WIN32 OR CYGWIN OR NOT LLVM_ENABLE_PIC)
# Add dummy target, either because loadable modules are not supported
# as on Windows or because PIC code has been disabled
add_custom_target(LLVMPolly)
set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly/Loadable Modules")
else ()
add_polly_loadable_module(LLVMPolly
Plugin/Polly.cpp
Expand Down
2 changes: 1 addition & 1 deletion polly/lib/External/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ if (POLLY_BUNDLED_ISL)
add_executable(polly-isl-test
isl/isl_test.c
)
set_target_properties(polly-isl-test PROPERTIES FOLDER "Polly")
set_target_properties(polly-isl-test PROPERTIES FOLDER "Polly/Tests")

target_link_libraries(polly-isl-test PRIVATE
PollyISL
Expand Down
7 changes: 2 additions & 5 deletions polly/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(LLVM_SHLIBEXT "${CMAKE_SHARED_MODULE_SUFFIX}")

add_custom_target(check-polly)
set_target_properties(check-polly PROPERTIES FOLDER "Polly")
set_target_properties(check-polly PROPERTIES FOLDER "Polly/Meta")

if(NOT LLVM_MAIN_SRC_DIR)
find_program(LLVM_OPT NAMES opt HINTS ${LLVM_TOOLS_BINARY_DIR})
Expand Down Expand Up @@ -64,7 +64,6 @@ add_lit_testsuite(check-polly-tests "Running polly regression tests"
polly_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
DEPENDS ${POLLY_TEST_DEPS}
)
set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
add_dependencies(check-polly check-polly-tests)

configure_lit_site_cfg(
Expand All @@ -80,7 +79,6 @@ if (POLLY_GTEST_AVAIL)
EXCLUDE_FROM_CHECK_ALL
DEPENDS PollyUnitTests
)
set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
endif ()

configure_file(
Expand All @@ -94,7 +92,6 @@ if (POLLY_BUNDLED_ISL)
EXCLUDE_FROM_CHECK_ALL
DEPENDS polly-isl-test
)
set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly")
endif (POLLY_BUNDLED_ISL)

# Run polly-check-format as part of polly-check only if we are compiling with
Expand All @@ -114,5 +111,5 @@ configure_file(

# Add a legacy target spelling: polly-test
add_custom_target(polly-test)
set_target_properties(polly-test PROPERTIES FOLDER "Polly")
set_target_properties(polly-test PROPERTIES FOLDER "Polly/Metatargets")
add_dependencies(polly-test check-polly)
5 changes: 2 additions & 3 deletions polly/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_custom_target(PollyUnitTests)
set_target_properties(PollyUnitTests PROPERTIES FOLDER "Polly")
set_target_properties(PollyUnitTests PROPERTIES FOLDER "Polly/Tests")

# add_polly_unittest(test_dirname file1.cpp file2.cpp)
#
Expand All @@ -13,9 +13,8 @@ function(add_polly_unittest test_name)

target_link_libraries(${test_name} PRIVATE gtest_main gtest)
add_dependencies(PollyUnitTests ${test_name})

set_property(TARGET ${test_name} PROPERTY FOLDER "Polly")
endif()
set_property(TARGET ${test_name} PROPERTY FOLDER "Polly/Tests/Unit")

if(LLVM_LINK_LLVM_DYLIB AND LLVM_POLLY_LINK_INTO_TOOLS)
# In this case Polly is already present in libLLVM,
Expand Down

0 comments on commit c16538f

Please sign in to comment.