Skip to content

Commit 200b96d

Browse files
committed
Revert "Revert "swift-lang: shuffle the source directory structure (NFC)""
This reverts commit beb8ecd. Add a workaround for the dependency issue. It is unclear why `sourcekitd` is getting added improperly as a dependency on `lib/sourcekitd.framework/sourcekitd`. This workaround adjusts the dependency such that we end up with a dependency on `lib/sourcekitd.framework/Versions/A/sourcekitd` as an order-only dependency. This should fix the compile issue. I am unable to reproduce this issue with the `add_library` usage for adding a Swift library. This allows us to cleave the host and target libraries, and so the workaround is sufficient to make progress and the problem will be resolved with the migration towards CMake for handling the dependencies.
1 parent c93b961 commit 200b96d

File tree

11 files changed

+45
-32
lines changed

11 files changed

+45
-32
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,11 @@ function(_add_swift_target_library_single target name)
12931293
-libc;${SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY})
12941294
endif()
12951295

1296+
if(sourcekitd IN_LIST SWIFTLIB_SINGLE_DEPENDS)
1297+
list(REMOVE_ITEM SWIFTLIB_SINGLE_DEPENDS sourcekitd)
1298+
set(SWIFTLIB_SINGLE_INJECT_SOURCEKITD_DEPENDENCY TRUE)
1299+
endif()
1300+
12961301
# FIXME: don't actually depend on the libraries in SWIFTLIB_SINGLE_LINK_LIBRARIES,
12971302
# just any swiftmodule files that are associated with them.
12981303
handle_swift_sources(
@@ -1318,6 +1323,10 @@ function(_add_swift_target_library_single target name)
13181323
${embed_bitcode_arg}
13191324
INSTALL_IN_COMPONENT "${SWIFTLIB_SINGLE_INSTALL_IN_COMPONENT}"
13201325
MACCATALYST_BUILD_FLAVOR "${SWIFTLIB_SINGLE_MACCATALYST_BUILD_FLAVOR}")
1326+
if(SWIFTLIB_SINGLE_INJECT_SOURCEKITD_DEPENDENCY)
1327+
add_dependencies(${swift_object_dependency_target}
1328+
sourcekitd)
1329+
endif()
13211330
add_swift_source_group("${SWIFTLIB_SINGLE_EXTERNAL_SOURCES}")
13221331

13231332
# If there were any swift sources, then a .swiftmodule may have been created.

stdlib/tools/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
if(SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_INCLUDE_TESTS)
22
add_subdirectory(swift-reflection-test)
33
endif()
4+
if(SWIFT_BUILD_SDK_OVERLAY)
5+
include(CheckIncludeFiles)
6+
check_include_files("xpc/xpc.h" HAVE_XPC_H)
7+
8+
if(SWIFT_BUILD_SOURCEKIT AND CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_XPC_H)
9+
add_subdirectory(swift-lang)
10+
endif()
11+
endif()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
if(SWIFT_HOST_VARIANT MATCHES "^iphoneos")
2+
set(SWIFT_LANG_TARGET_SDK "IOS")
3+
elseif(SWIFT_HOST_VARIANT MATCHES "^iphonesimulator")
4+
set(SWIFT_LANG_TARGET_SDK "IOS_SIMULATOR")
5+
elseif(SWIFT_HOST_VARIANT MATCHES "^macosx")
6+
set(SWIFT_LANG_TARGET_SDK "OSX")
7+
else()
8+
message(SEND_ERROR "Unknown SDK for SwiftLang")
9+
endif()
10+
11+
add_swift_target_library(swiftSwiftLang SHARED
12+
SwiftLang.swift
13+
SourceKitdClient.swift
14+
SourceKitdRequest.swift
15+
SourceKitdResponse.swift
16+
SourceKitdUID.swift
17+
18+
GYB_SOURCES
19+
UIDs.swift.gyb
20+
21+
DEPENDS sourcekitd
22+
SWIFT_MODULE_DEPENDS_OSX Darwin Foundation
23+
PRIVATE_LINK_LIBRARIES sourcekitd
24+
SWIFT_COMPILE_FLAGS -F${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib
25+
INSTALL_IN_COMPONENT sourcekit-xpc-service
26+
DARWIN_INSTALL_NAME_DIR "@rpath"
27+
TARGET_SDKS ${SWIFT_LANG_TARGET_SDK}
28+
IS_STDLIB)

tools/SourceKit/tools/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ if(LibEdit_FOUND AND LibEdit_HAS_UNICODE)
1010
add_swift_tool_subdirectory(sourcekitd-repl)
1111
endif()
1212
add_swift_tool_subdirectory(complete-test)
13-
add_subdirectory(swift-lang)

tools/SourceKit/tools/swift-lang/CMakeLists.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)