Skip to content

Commit 327c666

Browse files
authored
Revert "[CMake][NFC] Introduce component targets for proper dependency tracking"
1 parent 3a7a694 commit 327c666

File tree

17 files changed

+12
-58
lines changed

17 files changed

+12
-58
lines changed

Diff for: CMakeLists.txt

+10-13
Original file line numberDiff line numberDiff line change
@@ -499,18 +499,6 @@ include(CMakePushCheckState)
499499

500500
print_versions()
501501

502-
include(SwiftSharedCMakeConfig)
503-
504-
# NOTE: We include this before SwiftComponents as it relies on some LLVM CMake
505-
# functionality.
506-
# Support building Swift as a standalone project, using LLVM as an
507-
# external library.
508-
if(SWIFT_BUILT_STANDALONE)
509-
swift_common_standalone_build_config(SWIFT)
510-
else()
511-
swift_common_unified_build_config(SWIFT)
512-
endif()
513-
514502
include(SwiftComponents)
515503
include(SwiftHandleGybSources)
516504
include(SwiftSetIfArchBitness)
@@ -539,6 +527,16 @@ if(NOT CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
539527
OUTPUT_STRIP_TRAILING_WHITESPACE)
540528
endif()
541529

530+
include(SwiftSharedCMakeConfig)
531+
532+
# Support building Swift as a standalone project, using LLVM as an
533+
# external library.
534+
if(SWIFT_BUILT_STANDALONE)
535+
swift_common_standalone_build_config(SWIFT)
536+
else()
537+
swift_common_unified_build_config(SWIFT)
538+
endif()
539+
542540
get_filename_component(SWIFT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
543541
set(SWIFT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
544542
set(SWIFT_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
@@ -1053,7 +1051,6 @@ if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
10531051
else()
10541052
set(SOURCEKIT_RUNTIME_DIR lib)
10551053
endif()
1056-
add_dependencies(sourcekit-inproc BlocksRuntime dispatch)
10571054
swift_install_in_component(FILES
10581055
$<TARGET_FILE:dispatch>
10591056
$<TARGET_FILE:BlocksRuntime>

Diff for: apinotes/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ add_custom_target("copy_apinotes" ALL
2626
COMMENT "Copying API notes to ${output_dir}"
2727
SOURCES "${sources}")
2828

29-
add_dependencies(compiler copy_apinotes)
3029
swift_install_in_component(DIRECTORY "${output_dir}"
3130
DESTINATION "lib/swift/"
3231
COMPONENT compiler)

Diff for: cmake/modules/AddSwift.cmake

-8
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,6 @@ function(add_swift_host_library name)
15061506
INSTALL_IN_COMPONENT "dev"
15071507
)
15081508

1509-
add_dependencies(dev ${name})
15101509
if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
15111510
swift_install_in_component(TARGETS ${name}
15121511
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT dev
@@ -2118,7 +2117,6 @@ function(add_swift_target_library name)
21182117
endif()
21192118

21202119
if(sdk STREQUAL WINDOWS AND CMAKE_SYSTEM_NAME STREQUAL Windows)
2121-
add_dependencies(${SWIFTLIB_INSTALL_IN_COMPONENT} ${name}-windows-${SWIFT_PRIMARY_VARIANT_ARCH})
21222120
swift_install_in_component(TARGETS ${name}-windows-${SWIFT_PRIMARY_VARIANT_ARCH}
21232121
RUNTIME
21242122
DESTINATION "bin"
@@ -2131,9 +2129,6 @@ function(add_swift_target_library name)
21312129
COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
21322130
PERMISSIONS ${file_permissions})
21332131
else()
2134-
# NOTE: ${UNIVERSAL_LIBRARY_NAME} is the output associated with the target
2135-
# ${lipo_target}
2136-
add_dependencies(${SWIFTLIB_INSTALL_IN_COMPONENT} ${lipo_target})
21372132
swift_install_in_component(FILES "${UNIVERSAL_LIBRARY_NAME}"
21382133
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
21392134
COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
@@ -2144,7 +2139,6 @@ function(add_swift_target_library name)
21442139
foreach(arch ${SWIFT_SDK_WINDOWS_ARCHITECTURES})
21452140
if(TARGET ${name}-windows-${arch}_IMPLIB)
21462141
get_target_property(import_library ${name}-windows-${arch}_IMPLIB IMPORTED_LOCATION)
2147-
add_dependencies(${SWIFTLIB_INSTALL_IN_COMPONENT} ${name}-windows-${arch}_IMPLIB)
21482142
swift_install_in_component(FILES ${import_library}
21492143
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}/${arch}"
21502144
COMPONENT ${SWIFTLIB_INSTALL_IN_COMPONENT}
@@ -2211,7 +2205,6 @@ function(add_swift_target_library name)
22112205
OUTPUT
22122206
"${UNIVERSAL_LIBRARY_NAME}"
22132207
${THIN_INPUT_TARGETS_STATIC})
2214-
add_dependencies(${SWIFTLIB_INSTALL_IN_COMPONENT} ${lipo_target_static})
22152208
swift_install_in_component(FILES "${UNIVERSAL_LIBRARY_NAME}"
22162209
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${install_subdir}/${resource_dir_sdk_subdir}"
22172210
PERMISSIONS
@@ -2413,7 +2406,6 @@ function(add_swift_host_tool executable)
24132406
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
24142407
${ASHT_UNPARSED_ARGUMENTS})
24152408

2416-
add_dependencies(${ASHT_SWIFT_COMPONENT} ${executable})
24172409
swift_install_in_component(TARGETS ${executable}
24182410
RUNTIME
24192411
DESTINATION bin

Diff for: cmake/modules/SwiftComponents.cmake

+1-16
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,11 @@ macro(swift_configure_components)
9292
"A semicolon-separated list of components to install from the set ${_SWIFT_DEFINED_COMPONENTS}")
9393

9494
foreach(component ${_SWIFT_DEFINED_COMPONENTS})
95-
add_custom_target(${component})
96-
add_llvm_install_targets(install-${component}
97-
DEPENDS ${component}
98-
COMPONENT ${component})
99-
10095
string(TOUPPER "${component}" var_name_piece)
10196
string(REPLACE "-" "_" var_name_piece "${var_name_piece}")
10297
set(SWIFT_INSTALL_${var_name_piece} FALSE)
10398
endforeach()
10499

105-
# NOTE: never_install is a dummy component to indicate something should not
106-
# be installed. We explicitly do not add an install target for this.
107-
add_custom_target(never_install)
108-
109-
add_custom_target(swift-components)
110-
add_custom_target(install-swift-components)
111-
112100
foreach(component ${SWIFT_INSTALL_COMPONENTS})
113101
if(NOT "${component}" IN_LIST _SWIFT_DEFINED_COMPONENTS)
114102
message(FATAL_ERROR "unknown install component: ${component}")
@@ -118,8 +106,6 @@ macro(swift_configure_components)
118106
string(REPLACE "-" "_" var_name_piece "${var_name_piece}")
119107
if(NOT SWIFT_INSTALL_EXCLUDE_${var_name_piece})
120108
set(SWIFT_INSTALL_${var_name_piece} TRUE)
121-
add_dependencies(swift-components ${component})
122-
add_dependencies(install-swift-components install-${component})
123109
endif()
124110
endforeach()
125111
endmacro()
@@ -188,6 +174,5 @@ function(swift_install_symlink_component component)
188174
MESSAGE "LLVMInstallSymlink script must be available.")
189175

190176
install(SCRIPT ${INSTALL_SYMLINK}
191-
CODE "install_symlink(${ARG_LINK_NAME} ${ARG_TARGET} ${ARG_DESTINATION})"
192-
COMPONENT ${component})
177+
CODE "install_symlink(${ARG_LINK_NAME} ${ARG_TARGET} ${ARG_DESTINATION})")
193178
endfunction()

Diff for: cmake/modules/SwiftManpage.cmake

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function(manpage)
2727
"${CMAKE_CURRENT_BINARY_DIR}/${MP_MAN_FILE_BASENAME}.${MP_MAN_SECTION}")
2828

2929
add_custom_command_target(
30-
manpage_target
30+
unused_var
3131
COMMAND
3232
"${POD2MAN}" "--section" "${MP_MAN_SECTION}"
3333
"--center" "${MP_PAGE_HEADER}" "--release=\"swift ${SWIFT_VERSION}\""
@@ -38,7 +38,6 @@ function(manpage)
3838
DEPENDS "${MP_SOURCE}"
3939
ALL)
4040

41-
add_dependencies(${MP_INSTALL_IN_COMPONENT} ${manpage_target})
4241
swift_install_in_component(FILES "${output_file_name}"
4342
DESTINATION "share/man/man${MP_MAN_SECTION}"
4443
COMPONENT "${MP_INSTALL_IN_COMPONENT}")

Diff for: docs/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ if (DOXYGEN_FOUND)
6868
add_dependencies(doxygen doxygen-swift)
6969
endif()
7070

71-
add_dependencies(dev doxygen-swift)
7271
swift_install_in_component(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxygen/html"
7372
DESTINATION "docs/html"
7473
COMPONENT dev)

Diff for: lib/Driver/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,4 @@ if(SWIFT_BUILD_STATIC_STDLIB)
6262
endif()
6363
endforeach()
6464
add_custom_target(swift_static_lnk_args ALL DEPENDS ${static_stdlib_lnk_file_list})
65-
add_dependencies(stdlib swift_static_lnk_args)
6665
endif()

Diff for: lib/SwiftDemangle/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ target_compile_definitions(swiftDemangle PRIVATE
66
target_link_libraries(swiftDemangle PRIVATE
77
swiftDemangling)
88

9-
add_dependencies(compiler swiftDemangle)
109
swift_install_in_component(TARGETS swiftDemangle
1110
LIBRARY
1211
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}"

Diff for: stdlib/public/Platform/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,3 @@ foreach(sdk ${SWIFT_SDKS})
125125
endforeach()
126126
add_custom_target(glibc_modulemap DEPENDS ${glibc_modulemap_target_list})
127127
set_property(TARGET glibc_modulemap PROPERTY FOLDER "Miscellaneous")
128-
add_dependencies(sdk-overlay glibc_modulemap)

Diff for: stdlib/public/runtime/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
111111
"${LibraryLocation}/${CMAKE_STATIC_LIBRARY_PREFIX}swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX}"
112112
DEPENDS
113113
${FragileSupportLibrary})
114-
add_dependencies(stdlib ${FragileSupportLibrary})
115114
swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibrary}>
116115
DESTINATION "lib/swift_static/${lowercase_sdk}/${arch}"
117116
COMPONENT stdlib)
@@ -126,7 +125,6 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
126125
"${LibraryLocationPrimary}/${CMAKE_STATIC_LIBRARY_PREFIX}swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX}"
127126
DEPENDS
128127
${FragileSupportLibraryPrimary})
129-
add_dependencies(stdlib ${FragileSupportLibraryPrimary})
130128
swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibraryPrimary}>
131129
DESTINATION "lib/swift_static/${lowercase_sdk}"
132130
COMPONENT stdlib)
@@ -152,7 +150,6 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
152150
add_dependencies(static_binary_magic ${swift_image_inspection_${arch}_static})
153151
endforeach()
154152
add_dependencies(static_binary_magic ${swift_image_inspection_static_primary_arch})
155-
add_dependencies(stdlib static_binary_magic)
156153

157154
add_swift_target_library(swiftImageInspectionSharedObject OBJECT_LIBRARY
158155
ImageInspectionELF.cpp
@@ -253,7 +250,6 @@ foreach(sdk ${SWIFT_CONFIGURED_SDKS})
253250
add_custom_target(swiftImageRegistration-${arch_suffix}
254251
ALL DEPENDS
255252
${swiftImageRegistration-${arch_suffix}})
256-
add_dependencies(stdlib swift-stdlib-${arch_suffix} swiftImageRegistration-${arch_suffix})
257253
endif()
258254
endforeach()
259255
endforeach()

Diff for: tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ macro(add_sourcekit_library name)
188188
set(SOURCEKITLIB_INSTALL_IN_COMPONENT dev)
189189
endif()
190190
endif()
191-
add_dependencies(${SOURCEKITLIB_INSTALL_IN_COMPONENT} ${name})
192191
swift_install_in_component(TARGETS ${name}
193192
LIBRARY
194193
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}"
@@ -346,7 +345,6 @@ macro(add_sourcekit_framework name)
346345
MACOSX_FRAMEWORK_SHORT_VERSION_STRING "1.0"
347346
MACOSX_FRAMEWORK_BUNDLE_VERSION "${SOURCEKIT_VERSION_STRING}"
348347
PUBLIC_HEADER "${headers}")
349-
add_dependencies(${SOURCEKITFW_INSTALL_IN_COMPONENT} ${name})
350348
swift_install_in_component(TARGETS ${name}
351349
FRAMEWORK
352350
DESTINATION lib${LLVM_LIBDIR_SUFFIX}

Diff for: tools/SourceKit/tools/complete-test/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ if(SWIFT_ANALYZE_CODE_COVERAGE)
2424
LINK_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
2525
endif()
2626

27-
add_dependencies(tools complete-test)
2827
swift_install_in_component(TARGETS complete-test
2928
RUNTIME
3029
DESTINATION bin

Diff for: tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ if(HAVE_UNICODE_LIBEDIT)
2727
LINK_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
2828
endif()
2929

30-
add_dependencies(tools sourcekitd-repl)
3130
swift_install_in_component(TARGETS sourcekitd-repl
3231
RUNTIME
3332
DESTINATION bin

Diff for: tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ if(SWIFT_ANALYZE_CODE_COVERAGE)
3232
LINK_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
3333
endif()
3434

35-
add_dependencies(tools sourcekitd-test)
3635
swift_install_in_component(TARGETS sourcekitd-test
3736
RUNTIME
3837
DESTINATION bin

Diff for: tools/driver/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,12 @@ if(NOT SWIFT_BUILT_STANDALONE)
3737
add_dependencies(swift clang-headers)
3838
endif()
3939

40-
add_dependencies(compiler swift)
4140
swift_install_in_component(FILES "${SWIFT_RUNTIME_OUTPUT_INTDIR}/swiftc${CMAKE_EXECUTABLE_SUFFIX}"
4241
DESTINATION "bin"
4342
COMPONENT compiler)
44-
add_dependencies(autolink-driver swift)
4543
swift_install_in_component(FILES "${SWIFT_RUNTIME_OUTPUT_INTDIR}/swift-autolink-extract${CMAKE_EXECUTABLE_SUFFIX}"
4644
DESTINATION "bin"
4745
COMPONENT autolink-driver)
48-
add_dependencies(editor-integration swift)
4946
swift_install_in_component(FILES "${SWIFT_RUNTIME_OUTPUT_INTDIR}/swift-indent${CMAKE_EXECUTABLE_SUFFIX}"
5047
DESTINATION "bin"
5148
COMPONENT editor-integration)

Diff for: tools/libSwiftSyntaxParser/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
4646
target_link_libraries(libSwiftSyntaxParser PRIVATE BlocksRuntime)
4747
endif()
4848

49-
add_dependencies(parser-lib libSwiftSyntaxParser)
5049
swift_install_in_component(FILES "${SWIFT_LIBRARY_OUTPUT_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${SYNTAX_PARSER_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
5150
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
5251
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}"

Diff for: utils/build-script-impl

-1
Original file line numberDiff line numberDiff line change
@@ -3552,7 +3552,6 @@ for host in "${ALL_HOSTS[@]}"; do
35523552
if [[ -z "${INSTALL_SWIFT}" ]] ; then
35533553
continue
35543554
fi
3555-
INSTALL_TARGETS=install-swift-components
35563555
# Swift syntax parser is currently a sub-product of Swift;
35573556
# We need to specify the install target separately here.
35583557
if [ "${BUILD_LIBPARSER_ONLY}" ]; then

0 commit comments

Comments
 (0)