mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[embedded] Don't build *all* the embedded stdlibs by default
This commit is contained in:
@@ -148,6 +148,10 @@ option(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB
|
||||
"Enable build of the embedded Swift standard library and runtime"
|
||||
TRUE)
|
||||
|
||||
option(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING
|
||||
"Enable build of the embedded Swift standard library and runtime for cross-compiling targets"
|
||||
FALSE)
|
||||
|
||||
# Temporarily, by default only build embedded stdlib when building the compiler, to
|
||||
# unblock CI jobs that run against old(er) toolchains.
|
||||
option(SWIFT_ALLOW_BUILD_EMBEDDED_STDLIB_WITH_HOST_COMPILER
|
||||
@@ -163,8 +167,9 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "OFF")
|
||||
set(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB FALSE)
|
||||
endif()
|
||||
|
||||
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
|
||||
set(EMBEDDED_STDLIB_TARGET_TRIPLES)
|
||||
set(EMBEDDED_STDLIB_TARGET_TRIPLES)
|
||||
|
||||
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING)
|
||||
if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
|
||||
list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES
|
||||
# arch module_name target triple
|
||||
@@ -218,7 +223,9 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
|
||||
"wasm64 wasm64-unknown-none-wasm wasm64-unknown-none-wasm"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
|
||||
if (SWIFT_HOST_VARIANT STREQUAL "linux")
|
||||
set(EMBEDDED_STDLIB_TARGET_TRIPLES ${EMBEDDED_STDLIB_TARGET_TRIPLES}
|
||||
"${SWIFT_HOST_VARIANT_ARCH} ${SWIFT_HOST_VARIANT_ARCH}-unknown-linux-gnu ${SWIFT_HOST_VARIANT_ARCH}-unknown-linux-gnu"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: OS=macosx || OS=linux-gnu
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// BEGIN BridgingHeader.h
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: OS=macosx || OS=linux-gnu
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
@main
|
||||
public struct Application {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: OS=macosx || OS=linux-gnu
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
//--- MyModuleA.swift
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: OS=macosx || OS=linux-gnu
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
print("Hello Embedded Swift!")
|
||||
print(42)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: OS=macosx || OS=linux-gnu
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
@main
|
||||
struct Main {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: CODEGENERATOR=RISCV
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
class MyClass {}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: CODEGENERATOR=ARM
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
// https://github.com/apple/swift/issues/73249
|
||||
// UNSUPPORTED: OS=windows-msvc
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// RUN: %target-run %t/check.wasm
|
||||
// REQUIRES: executable_test
|
||||
// REQUIRES: CPU=wasm32
|
||||
// REQUIRES: embedded_stdlib_cross_compiling
|
||||
|
||||
//--- rt.c
|
||||
|
||||
|
||||
@@ -159,6 +159,8 @@ if "@SWIFT_ENABLE_SYNCHRONIZATION@" == "TRUE":
|
||||
config.available_features.add('synchronization')
|
||||
if "@SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB@" == "TRUE":
|
||||
config.available_features.add('embedded_stdlib')
|
||||
if "@SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING@" == "TRUE":
|
||||
config.available_features.add('embedded_stdlib_cross_compiling')
|
||||
|
||||
config.swift_freestanding_is_darwin = "@SWIFT_FREESTANDING_IS_DARWIN@" == "TRUE"
|
||||
config.swift_stdlib_use_relative_protocol_witness_tables = "@SWIFT_STDLIB_USE_RELATIVE_PROTOCOL_WITNESS_TABLES@" == "TRUE"
|
||||
|
||||
@@ -36,6 +36,8 @@ build-ninja
|
||||
|
||||
build-swift-stdlib-unittest-extra
|
||||
|
||||
build-embedded-stdlib-cross-compiling
|
||||
|
||||
install-llvm
|
||||
install-static-linux-config
|
||||
install-swift
|
||||
@@ -343,6 +345,8 @@ build-ninja
|
||||
|
||||
skip-test-cmark
|
||||
|
||||
build-embedded-stdlib-cross-compiling
|
||||
|
||||
[preset: buildbot_incremental_base_all_platforms]
|
||||
mixin-preset=buildbot_incremental_base
|
||||
|
||||
@@ -858,6 +862,7 @@ install-swiftdocc
|
||||
build-swift-static-stdlib
|
||||
build-swift-static-sdk-overlay
|
||||
build-swift-stdlib-unittest-extra
|
||||
build-embedded-stdlib-cross-compiling
|
||||
|
||||
# Executes the lit tests for the installable package that is created
|
||||
# Assumes the swift-integration-tests repo is checked out
|
||||
@@ -1166,6 +1171,8 @@ relocate-xdg-cache-home-under-build-subdir
|
||||
llvm-cmake-options=
|
||||
-DCLANG_DEFAULT_LINKER=gold
|
||||
|
||||
build-embedded-stdlib-cross-compiling
|
||||
|
||||
[preset: buildbot_incremental_linux]
|
||||
mixin-preset=
|
||||
buildbot_incremental_linux_base
|
||||
@@ -1336,6 +1343,8 @@ lldb-build-type=Release
|
||||
build-ninja
|
||||
build-swift-stdlib-unittest-extra
|
||||
|
||||
build-embedded-stdlib-cross-compiling
|
||||
|
||||
# Don't build the benchmarks
|
||||
skip-build-benchmarks
|
||||
|
||||
|
||||
@@ -1147,6 +1147,9 @@ def create_argument_parser():
|
||||
option('--build-swift-stdlib-static-print', toggle_true,
|
||||
help='Build constant-folding print() support')
|
||||
|
||||
option('--build-embedded-stdlib-cross-compiling', toggle_true,
|
||||
help='Build embedded stdlib for cross-compiling targets.')
|
||||
|
||||
option('--build-swift-stdlib-unicode-data', toggle_true,
|
||||
default=True,
|
||||
help='Include Unicode data in the standard library.'
|
||||
|
||||
@@ -89,6 +89,7 @@ EXPECTED_DEFAULTS = {
|
||||
'build_swift_stdlib_unittest_extra': False,
|
||||
'build_swift_stdlib_static_print': False,
|
||||
'build_swift_stdlib_unicode_data': True,
|
||||
'build_embedded_stdlib_cross_compiling': False,
|
||||
'build_swift_clang_overlays': True,
|
||||
'build_swift_remote_mirror': True,
|
||||
'build_swiftpm': False,
|
||||
@@ -597,6 +598,7 @@ EXPECTED_OPTIONS = [
|
||||
EnableOption('--build-toolchain-only'),
|
||||
EnableOption('--build-swift-private-stdlib'),
|
||||
EnableOption('--build-swift-stdlib-unicode-data'),
|
||||
EnableOption('--build-embedded-stdlib-cross-compiling'),
|
||||
EnableOption('--build-swift-libexec'),
|
||||
EnableOption('--build-swift-clang-overlays'),
|
||||
EnableOption('--build-swift-remote-mirror'),
|
||||
|
||||
@@ -82,6 +82,8 @@ class Swift(product.Product):
|
||||
|
||||
self.cmake_options.extend(self._enable_stdlib_unicode_data)
|
||||
|
||||
self.cmake_options.extend(self._enable_embedded_stdlib_cross_compiling)
|
||||
|
||||
self.cmake_options.extend(
|
||||
self._swift_tools_ld64_lto_codegen_only_for_supporting_targets)
|
||||
|
||||
@@ -249,6 +251,11 @@ updated without updating swift.py?")
|
||||
return [('SWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL',
|
||||
self.args.enable_experimental_parser_validation)]
|
||||
|
||||
@property
|
||||
def _enable_embedded_stdlib_cross_compiling(self):
|
||||
return [('SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING',
|
||||
self.args.build_embedded_stdlib_cross_compiling)]
|
||||
|
||||
def _handle_swift_debuginfo_non_lto_args(self):
|
||||
if ('swift_debuginfo_non_lto_args' not in self.args
|
||||
or self.args.swift_debuginfo_non_lto_args is None):
|
||||
|
||||
@@ -66,6 +66,7 @@ class SwiftTestCase(unittest.TestCase):
|
||||
build_early_swiftsyntax=False,
|
||||
build_swift_stdlib_static_print=False,
|
||||
build_swift_stdlib_unicode_data=True,
|
||||
build_embedded_stdlib_cross_compiling=False,
|
||||
swift_freestanding_is_darwin=False,
|
||||
build_swift_private_stdlib=True,
|
||||
swift_tools_ld64_lto_codegen_only_for_supporting_targets=False)
|
||||
@@ -113,6 +114,7 @@ class SwiftTestCase(unittest.TestCase):
|
||||
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
|
||||
'-DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE',
|
||||
'-DSWIFT_STDLIB_ENABLE_UNICODE_DATA=TRUE',
|
||||
'-DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING=FALSE',
|
||||
'-DSWIFT_TOOLS_LD64_LTO_CODEGEN_ONLY_FOR_SUPPORTING_TARGETS:BOOL=FALSE',
|
||||
'-USWIFT_DEBUGINFO_NON_LTO_ARGS'
|
||||
]
|
||||
@@ -144,6 +146,7 @@ class SwiftTestCase(unittest.TestCase):
|
||||
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
|
||||
'-DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE',
|
||||
'-DSWIFT_STDLIB_ENABLE_UNICODE_DATA=TRUE',
|
||||
'-DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING=FALSE',
|
||||
'-DSWIFT_TOOLS_LD64_LTO_CODEGEN_ONLY_FOR_SUPPORTING_TARGETS:BOOL=FALSE',
|
||||
'-USWIFT_DEBUGINFO_NON_LTO_ARGS'
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user