mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
build: remove TARGET_SDKS from the runtime
The runtime and stubs are built for ALL targets, not specific ones. This allows us to configure when cross-compiling to Windows again. Collapse the dual addition of the swiftRuntime into a single build. This unifies the runtime build for the apple and non-Apple SDKs. The difference here was the ObjC interop sources. In order to deal with that unification add a CPP macro to indicate whether the interop sources should be included or not.
This commit is contained in:
@@ -51,9 +51,7 @@ set(swift_runtime_sources
|
||||
Once.cpp
|
||||
Portability.cpp
|
||||
ProtocolConformance.cpp
|
||||
ReflectionNative.cpp
|
||||
RuntimeEntrySymbols.cpp
|
||||
SwiftObjectNative.cpp)
|
||||
RuntimeEntrySymbols.cpp)
|
||||
|
||||
# Acknowledge that the following sources are known.
|
||||
set(LLVM_OPTIONAL_SOURCES
|
||||
@@ -119,16 +117,7 @@ add_swift_library(swiftRuntime OBJECT_LIBRARY TARGET_LIBRARY
|
||||
${swift_runtime_leaks_sources}
|
||||
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
|
||||
LINK_FLAGS ${swift_runtime_linker_flags}
|
||||
INSTALL_IN_COMPONENT never_install
|
||||
TARGET_SDKS ALL_APPLE_PLATFORMS)
|
||||
|
||||
add_swift_library(swiftRuntime OBJECT_LIBRARY TARGET_LIBRARY
|
||||
${swift_runtime_sources}
|
||||
${swift_runtime_leaks_sources}
|
||||
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
|
||||
LINK_FLAGS ${swift_runtime_linker_flags}
|
||||
INSTALL_IN_COMPONENT never_install
|
||||
TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX)
|
||||
INSTALL_IN_COMPONENT never_install)
|
||||
|
||||
set(ELFISH_SDKS)
|
||||
foreach(sdk ${SWIFT_CONFIGURED_SDKS})
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#include "swift/Runtime/Debug.h"
|
||||
#include "swift/Runtime/ObjCBridge.h"
|
||||
#include "swift/Basic/Lazy.h"
|
||||
@@ -592,3 +595,5 @@ extern "C" auto *_swift_willThrow = _swift_willThrow_;
|
||||
void swift::swift_willThrow(SwiftError *error) {
|
||||
return _swift_willThrow(error);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// This file is here only to bring in the parts of Reflection.mm that apply
|
||||
// when not using an objc runtime.
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if !SWIFT_OBJC_INTEROP
|
||||
#include "Reflection.mm"
|
||||
#endif
|
||||
@@ -16,6 +16,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#include <objc/NSObject.h>
|
||||
#include <objc/runtime.h>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// This file is here only to bring in the parts of SwiftObject.mm that apply
|
||||
// when not using an objc runtime.
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if !SWIFT_OBJC_INTEROP
|
||||
#include "SwiftObject.mm"
|
||||
#endif
|
||||
@@ -18,6 +18,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#include "SwiftObject.h"
|
||||
#include "SwiftValue.h"
|
||||
#include "swift/Basic/Lazy.h"
|
||||
@@ -30,10 +33,6 @@
|
||||
#include <objc/runtime.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#if !SWIFT_OBJC_INTEROP
|
||||
#error "This file should only be compiled when ObjC interop is enabled."
|
||||
#endif
|
||||
|
||||
using namespace swift;
|
||||
using namespace swift::hashable_support;
|
||||
|
||||
@@ -380,6 +379,7 @@ static NSString *getValueDescription(_SwiftValue *self) {
|
||||
}
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
||||
// TODO: We could pick specialized _SwiftValue subclasses for trivial types
|
||||
// or for types with known size and alignment characteristics. Probably
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#include "swift/Basic/Lazy.h"
|
||||
#include "swift/Runtime/Debug.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
@@ -93,3 +96,5 @@ _SwiftNSOperatingSystemVersion swift::_swift_stdlib_operatingSystemVersion() {
|
||||
|
||||
return { version.majorVersion, version.minorVersion, version.patchVersion };
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,16 +23,8 @@ list(APPEND swift_stubs_c_compile_flags -DswiftCore_EXPORTS)
|
||||
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
|
||||
${swift_stubs_sources}
|
||||
${swift_stubs_objc_sources}
|
||||
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
|
||||
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
|
||||
TARGET_SDKS ALL_APPLE_PLATFORMS
|
||||
INSTALL_IN_COMPONENT stdlib)
|
||||
|
||||
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
|
||||
${swift_stubs_sources}
|
||||
${swift_stubs_unicode_normalization_sources}
|
||||
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
|
||||
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
|
||||
TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX
|
||||
INSTALL_IN_COMPONENT stdlib)
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#include "../SwiftShims/CoreFoundationShims.h"
|
||||
|
||||
@@ -112,3 +115,5 @@ _swift_shims_CFStringRef
|
||||
swift::_swift_stdlib_objcDebugDescription(id _Nonnull nsObject) {
|
||||
return [nsObject debugDescription];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#include "swift/Basic/Lazy.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "swift/Runtime/Metadata.h"
|
||||
@@ -97,3 +100,5 @@ id _swift_Foundation_getOptionalNilSentinelObject(const Metadata *Wrapped) {
|
||||
|
||||
return objc_retain(getSentinelForDepth(depth));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
SWIFT_CC(swift)
|
||||
@@ -24,4 +26,5 @@ extern "C" bool _swift_stdlib_NSObject_isKindOfClass(
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#include <objc/NSObject.h>
|
||||
@@ -216,6 +219,7 @@ extern "C" void swift_stdlib_CFSetGetValues(NSSet *NS_RELEASES_ARGUMENT set,
|
||||
CFSetGetValues((__bridge CFSetRef)set, values);
|
||||
swift_unknownRelease(set);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ${'Local Variables'}:
|
||||
// eval: (read-only-mode 1)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
#include "swift/Basic/Lazy.h"
|
||||
#include "swift/Runtime/Config.h"
|
||||
#include "swift/Runtime/Debug.h"
|
||||
@@ -283,3 +284,5 @@ swift::_swift_stdlib_unicode_strToLower(uint16_t *Destination,
|
||||
}
|
||||
|
||||
swift::Lazy<ASCIICollation> ASCIICollation::theTable;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user