Skip to content

Commit fdc8ffd

Browse files
committed
[Build] Updated following initial comments from Eric.
Change the `--linux[-static]-arch` option to `--linux[-static]-archs`, on the basis that it supports multiple values. Other tidying. rdar://123503470
1 parent ae1c045 commit fdc8ffd

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,6 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
11071107
set(SWIFT_HOST_VARIANT "linux" CACHE STRING
11081108
"Deployment OS for Swift host tools (the compiler) [linux].")
11091109

1110-
# Should we build the standard library for the host?
11111110
is_sdk_requested(LINUX swift_build_linux)
11121111
if(swift_build_linux)
11131112
if("${SWIFT_SDK_LINUX_ARCHITECTURES}" STREQUAL "")
@@ -1117,7 +1116,6 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
11171116
configure_sdk_unix("Linux" "${SWIFT_SDK_LINUX_ARCHITECTURES}")
11181117
endif()
11191118

1120-
# Should we build it for LINUX_STATIC?
11211119
is_sdk_requested(LINUX_STATIC swift_build_linux_static)
11221120
if(swift_build_linux_static)
11231121
if("${SWIFT_MUSL_PATH}" STREQUAL "")

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,10 +2089,10 @@ function(add_swift_target_library name)
20892089
elseif(sdk STREQUAL "LINUX" OR sdk STREQUAL "ANDROID")
20902090
list(APPEND swiftlib_module_depends_flattened
20912091
${SWIFTLIB_SWIFT_MODULE_DEPENDS_LINUX})
2092-
elseif(${sdk} STREQUAL "LINUX_STATIC")
2092+
elseif(sdk STREQUAL "LINUX_STATIC")
20932093
list(APPEND swiftlib_module_depends_flattened
20942094
${SWIFTLIB_SWIFT_MODULE_DEPENDS_LINUX_STATIC})
2095-
elseif(${sdk} STREQUAL "CYGWIN")
2095+
elseif(sdk STREQUAL "CYGWIN")
20962096
list(APPEND swiftlib_module_depends_flattened
20972097
${SWIFTLIB_SWIFT_MODULE_DEPENDS_CYGWIN})
20982098
elseif(sdk STREQUAL "HAIKU")
@@ -2349,19 +2349,19 @@ function(add_swift_target_library name)
23492349

23502350
# If the SDK is static only, always build static instead of dynamic
23512351
if(SWIFT_SDK_${sdk}_STATIC_ONLY AND SWIFTLIB_SHARED)
2352-
set(shared)
2353-
set(static STATIC)
2352+
set(shared_keyword)
2353+
set(static_keyword STATIC)
23542354
else()
2355-
set(shared ${SWIFTLIB_SHARED_keyword})
2356-
set(static ${SWIFTLIB_STATIC_keyword})
2355+
set(shared_keyword ${SWIFTLIB_SHARED_keyword})
2356+
set(static_keyword ${SWIFTLIB_STATIC_keyword})
23572357
endif()
23582358

23592359
# Add this library variant.
23602360
add_swift_target_library_single(
23612361
${variant_name}
23622362
${name}
2363-
${shared}
2364-
${static}
2363+
${shared_keyword}
2364+
${static_keyword}
23652365
${SWIFTLIB_NO_LINK_NAME_keyword}
23662366
${SWIFTLIB_OBJECT_LIBRARY_keyword}
23672367
${SWIFTLIB_INSTALL_WITH_SHARED_keyword}
@@ -2420,19 +2420,23 @@ function(add_swift_target_library name)
24202420

24212421
if(NOT SWIFTLIB_OBJECT_LIBRARY)
24222422
# Add dependencies on the (not-yet-created) custom lipo target.
2423-
foreach(dep ${SWIFTLIB_LINK_LIBRARIES})
2424-
if (NOT "${dep}" MATCHES "^(icucore|dispatch|BlocksRuntime)($|-.*)$")
2423+
foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
2424+
if (NOT "${DEP}" MATCHES "^icucore($|-.*)$" AND
2425+
NOT "${DEP}" MATCHES "^dispatch($|-.*)$" AND
2426+
NOT "${DEP}" MATCHES "^BlocksRuntime($|-.*)$")
24252427
add_dependencies(${VARIANT_NAME}
2426-
"${dep}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
2428+
"${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
24272429
endif()
24282430
endforeach()
24292431

24302432
if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
24312433
# Add dependencies on the (not-yet-created) custom lipo target.
2432-
foreach(dep ${SWIFTLIB_LINK_LIBRARIES})
2433-
if (NOT "${dep}" MATCHES "^(icucore|dispatch|BlocksRuntime)($|-.*)$")
2434+
foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
2435+
if (NOT "${DEP}" MATCHES "^icucore($|-.*)$" AND
2436+
NOT "${DEP}" MATCHES "^dispatch($|-.*)$" AND
2437+
NOT "${DEP}" MATCHES "^BlocksRuntime($|-.*)$")
24342438
add_dependencies("${VARIANT_NAME}-static"
2435-
"${dep}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
2439+
"${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
24362440
endif()
24372441
endforeach()
24382442
endif()

utils/build-script

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,13 @@ def default_stdlib_deployment_targets(args):
278278
if host_target is None:
279279
return None
280280

281+
targets = [host_target]
282+
281283
# OS X build machines configure all Darwin platforms by default.
282284
# Put iOS native targets last so that we test them last
283285
# (it takes a long time).
284286
if host_target == StdlibDeploymentTarget.OSX.x86_64 or \
285287
host_target == StdlibDeploymentTarget.OSX.arm64:
286-
targets = [host_target]
287288
if args.build_ios and args.build_ios_simulator:
288289
targets.extend(StdlibDeploymentTarget.iOSSimulator.targets)
289290
if args.build_ios and args.build_ios_device:
@@ -305,14 +306,11 @@ def default_stdlib_deployment_targets(args):
305306
targets.extend(StdlibDeploymentTarget.XROS.targets)
306307
return targets
307308
elif host_target.platform.name == 'linux':
308-
targets = [host_target]
309309
if args.build_linux_static:
310310
targets.append(getattr(StdlibDeploymentTarget.Musl,
311311
host_target.arch))
312-
return targets
313-
else:
314-
# All other machines only configure their host stdlib by default.
315-
return [host_target]
312+
313+
return targets
316314

317315

318316
def apply_default_arguments(toolchain, args):

utils/build-script-impl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ KNOWN_SETTINGS=(
9595

9696
## Linux Options
9797
musl-path "/usr/local/musl" "The path to the Musl headers and libraries"
98-
linux-arch "" "The Linux target architecture(s)"
99-
linux-static-arch "" "The fully static Linux target architecture(s)"
98+
linux-archs "" "The Linux target architecture(s)"
99+
linux-static-archs "" "The fully static Linux target architecture(s)"
100100

101101
## Darwin Options
102102
darwin-crash-reporter-client "" "whether to enable CrashReporter integration, default is 1 on Darwin platforms, 0 otherwise"
@@ -1729,15 +1729,15 @@ for host in "${ALL_HOSTS[@]}"; do
17291729
if [[ ! "${SKIP_BUILD_LINUX}" ]]; then
17301730
cmake_options=(
17311731
"${cmake_options[@]}"
1732-
-DSWIFT_SDK_LINUX_ARCHITECTURES:STRING="${LINUX_ARCH}"
1732+
-DSWIFT_SDK_LINUX_ARCHITECTURES:STRING="${LINUX_ARCHS}"
17331733
)
17341734
fi
17351735

17361736
if [[ ! "${SKIP_BUILD_LINUX_STATIC}" ]]; then
17371737
cmake_options=(
17381738
"${cmake_options[@]}"
17391739
-DSWIFT_MUSL_PATH:STRING="${MUSL_PATH}"
1740-
-DSWIFT_SDK_LINUX_STATIC_ARCHITECTURES:STRING="${LINUX_STATIC_ARCH}"
1740+
-DSWIFT_SDK_LINUX_STATIC_ARCHITECTURES:STRING="${LINUX_STATIC_ARCHS}"
17411741
)
17421742
fi
17431743

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ def create_argument_parser():
13941394
# -------------------------------------------------------------------------
13951395
in_group('Build settings for Linux')
13961396

1397-
option('--linux-arch', store,
1397+
option('--linux-archs', store,
13981398
type=argparse.ShellSplitType(),
13991399
default=None,
14001400
help='Semicolon-separated list of architectures to use when '
@@ -1407,7 +1407,7 @@ def create_argument_parser():
14071407
default='/usr/local/musl',
14081408
help='The path to the Musl headers and libraries.')
14091409

1410-
option('--linux-static-arch', store,
1410+
option('--linux-static-archs', store,
14111411
type=argparse.ShellSplitType(),
14121412
default=None,
14131413
help='Semicolon-separated list of architectures to use when '

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
'libdispatch_build_variant': 'Debug',
213213
'libicu_build_variant': 'Debug',
214214
'libxml2_build_variant': 'Debug',
215-
'linux_arch': None,
215+
'linux_archs': None,
216216
'lit_jobs': multiprocessing.cpu_count(),
217217
'zlib_build_variant': 'Debug',
218218
'curl_build_variant': 'Debug',
@@ -238,7 +238,7 @@
238238
'maccatalyst': False,
239239
'maccatalyst_ios_tests': False,
240240
'musl_path': '/usr/local/musl',
241-
'linux_static_arch': None,
241+
'linux_static_archs': None,
242242
'native_clang_tools_path': None,
243243
'native_llvm_tools_path': None,
244244
'native_swift_tools_path': None,

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,13 @@ def convert_to_impl_arguments(self):
523523
impl_args += [
524524
"--musl-path=%s" % (args.musl_path, )
525525
]
526-
if args.linux_static_arch:
526+
if args.linux_static_archs:
527527
impl_args += [
528-
"--linux-static-arch=%s" % ';'.join(args.linux_static_arch)
528+
"--linux-static-archs=%s" % ';'.join(args.linux_static_archs)
529529
]
530-
if args.linux_arch:
530+
if args.linux_archs:
531531
impl_args += [
532-
"--linux-arch=%s" % ';'.join(args.linux_arch)
532+
"--linux-archs=%s" % ';'.join(args.linux_archs)
533533
]
534534

535535
# Compute the set of host-specific variables, which we pass through to

0 commit comments

Comments
 (0)