Revert "Revert "swift-lang: shuffle the source directory structure (NFC)""

This reverts commit beb8ecd8cc.  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.
This commit is contained in:
Saleem Abdulrasool
2020-02-19 16:01:06 -08:00
parent c93b961cc3
commit 200b96df81
11 changed files with 45 additions and 32 deletions

View File

@@ -1293,6 +1293,11 @@ function(_add_swift_target_library_single target name)
-libc;${SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY})
endif()
if(sourcekitd IN_LIST SWIFTLIB_SINGLE_DEPENDS)
list(REMOVE_ITEM SWIFTLIB_SINGLE_DEPENDS sourcekitd)
set(SWIFTLIB_SINGLE_INJECT_SOURCEKITD_DEPENDENCY TRUE)
endif()
# FIXME: don't actually depend on the libraries in SWIFTLIB_SINGLE_LINK_LIBRARIES,
# just any swiftmodule files that are associated with them.
handle_swift_sources(
@@ -1318,6 +1323,10 @@ function(_add_swift_target_library_single target name)
${embed_bitcode_arg}
INSTALL_IN_COMPONENT "${SWIFTLIB_SINGLE_INSTALL_IN_COMPONENT}"
MACCATALYST_BUILD_FLAVOR "${SWIFTLIB_SINGLE_MACCATALYST_BUILD_FLAVOR}")
if(SWIFTLIB_SINGLE_INJECT_SOURCEKITD_DEPENDENCY)
add_dependencies(${swift_object_dependency_target}
sourcekitd)
endif()
add_swift_source_group("${SWIFTLIB_SINGLE_EXTERNAL_SOURCES}")
# If there were any swift sources, then a .swiftmodule may have been created.

View File

@@ -1,3 +1,11 @@
if(SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_INCLUDE_TESTS)
add_subdirectory(swift-reflection-test)
endif()
if(SWIFT_BUILD_SDK_OVERLAY)
include(CheckIncludeFiles)
check_include_files("xpc/xpc.h" HAVE_XPC_H)
if(SWIFT_BUILD_SOURCEKIT AND CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_XPC_H)
add_subdirectory(swift-lang)
endif()
endif()

View File

@@ -0,0 +1,28 @@
if(SWIFT_HOST_VARIANT MATCHES "^iphoneos")
set(SWIFT_LANG_TARGET_SDK "IOS")
elseif(SWIFT_HOST_VARIANT MATCHES "^iphonesimulator")
set(SWIFT_LANG_TARGET_SDK "IOS_SIMULATOR")
elseif(SWIFT_HOST_VARIANT MATCHES "^macosx")
set(SWIFT_LANG_TARGET_SDK "OSX")
else()
message(SEND_ERROR "Unknown SDK for SwiftLang")
endif()
add_swift_target_library(swiftSwiftLang SHARED
SwiftLang.swift
SourceKitdClient.swift
SourceKitdRequest.swift
SourceKitdResponse.swift
SourceKitdUID.swift
GYB_SOURCES
UIDs.swift.gyb
DEPENDS sourcekitd
SWIFT_MODULE_DEPENDS_OSX Darwin Foundation
PRIVATE_LINK_LIBRARIES sourcekitd
SWIFT_COMPILE_FLAGS -F${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib
INSTALL_IN_COMPONENT sourcekit-xpc-service
DARWIN_INSTALL_NAME_DIR "@rpath"
TARGET_SDKS ${SWIFT_LANG_TARGET_SDK}
IS_STDLIB)

View File

@@ -10,4 +10,3 @@ if(LibEdit_FOUND AND LibEdit_HAS_UNICODE)
add_swift_tool_subdirectory(sourcekitd-repl)
endif()
add_swift_tool_subdirectory(complete-test)
add_subdirectory(swift-lang)

View File

@@ -1,31 +0,0 @@
if(NOT SWIFT_SOURCEKIT_USE_INPROC_LIBRARY AND SWIFT_BUILD_STDLIB AND SWIFT_BUILD_SDK_OVERLAY)
# The build type of swiftlang should agree with stdlib
# This setting could avoid us adding additional search paths when building
# executables using SwiftLang.
set(SWIFT_LANG_LIBRARY_BUILD_TYPES)
if(SWIFT_BUILD_DYNAMIC_STDLIB)
list(APPEND SWIFT_LANG_LIBRARY_BUILD_TYPES SHARED)
endif()
if(SWIFT_BUILD_STATIC_STDLIB)
list(APPEND SWIFT_LANG_LIBRARY_BUILD_TYPES STATIC)
endif()
add_swift_target_library(swiftSwiftLang ${SWIFT_LANG_LIBRARY_BUILD_TYPES}
SwiftLang.swift
SourceKitdClient.swift
SourceKitdRequest.swift
SourceKitdResponse.swift
SourceKitdUID.swift
GYB_SOURCES
UIDs.swift.gyb
DEPENDS sourcekitd-test
SWIFT_MODULE_DEPENDS_OSX Darwin Foundation
PRIVATE_LINK_LIBRARIES sourcekitd
SWIFT_COMPILE_FLAGS -F${SWIFT_LIBRARY_OUTPUT_INTDIR}
INSTALL_IN_COMPONENT sourcekit-xpc-service
DARWIN_INSTALL_NAME_DIR "@rpath"
TARGET_SDKS ${SOURCEKIT_DEFAULT_TARGET_SDK}
IS_STDLIB)
endif()