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

This moves the swift-lang library out of the tools/SourceKit directory
and into the stdlib directory.  As it stands, the library required that
the standard library and the SDK overlay was being built.  This is
implicitly done when building the stdlib subdirectory.  Furthermore, it
had an odd tie between the flags for Swift and SourceKit which now have
the logic separated.  This clearly delineates the host and target
components in the repository.
This commit is contained in:
Saleem Abdulrasool
2020-02-13 14:13:32 -08:00
committed by Saleem Abdulrasool
parent 3777ec0eaf
commit edbe22b63c
10 changed files with 35 additions and 32 deletions

View File

@@ -1,3 +1,11 @@
if(SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_INCLUDE_TESTS) if(SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_INCLUDE_TESTS)
add_subdirectory(swift-reflection-test) add_subdirectory(swift-reflection-test)
endif() 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,27 @@
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
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) add_swift_tool_subdirectory(sourcekitd-repl)
endif() endif()
add_swift_tool_subdirectory(complete-test) 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()