Skip to content

Commit 9600e2f

Browse files
committed
Use command-line flags to work around CMake 3.30+ linker flag bug, rather than patching files
1 parent 4ed1375 commit 9600e2f

File tree

7 files changed

+7
-48
lines changed

7 files changed

+7
-48
lines changed

.github/workflows/pull_request.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ jobs:
4444
build-type: 'docker'
4545
build-compiler: '0'
4646
runner: 'ubuntu-24.04'
47-
- swift-version: 'swift-6.2-branch'
48-
build-type: 'docker'
49-
build-compiler: '0'
50-
runner: 'ubuntu-24.04'
51-
- swift-version: 'development'
52-
build-type: 'docker'
53-
build-compiler: '0'
54-
runner: 'ubuntu-24.04'
5547
runs-on: ${{ matrix.runner }}
5648
# 15 hour timeout
5749
timeout-minutes: 900

swift-ci/sdks/android/build-docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# default architectures to build for
1010
TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64,armv7}
1111

12-
ANDROID_NDK_VERSION=android-ndk-r27c
12+
ANDROID_NDK_VERSION=android-ndk-r27d
1313
ANDROID_API=28
1414

1515
BASEPATH=$(dirname $(realpath $0))

swift-ci/sdks/android/build-local

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# default architectures to build for
1010
TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64,armv7}
1111

12-
ANDROID_NDK_VERSION=android-ndk-r27c
12+
ANDROID_NDK_VERSION=android-ndk-r27d
1313
ANDROID_API=28
1414

1515
BASEPATH=$(dirname $(realpath $0))

swift-ci/sdks/android/patches/apply-patches.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ case "${BUILD_SCHEME}" in
1010
;;
1111
development)
1212
git apply -v -C1 ${patches_dir}/swift-android.patch
13-
git apply -v -C1 ${patches_dir}/swift-android-trunk-libdispatch.patch
13+
git apply -v -C1 ${patches_dir}/swift-android-trunk.patch
1414
;;
1515
*)
1616
echo "$0: invalid BUILD_SCHEME=${BUILD_SCHEME}"

swift-ci/sdks/android/patches/swift-android-trunk-libdispatch.patch renamed to swift-ci/sdks/android/patches/swift-android-trunk.patch

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,3 @@ index 9a0f5b43e2d..5c7d1320a2d 100644
2828

2929
toolchain_path = product.native_toolchain_path(args.host_target)
3030
cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER',
31-
diff --git a/swift-corelibs-libdispatch/src/swift/CMakeLists.txt b/swift-corelibs-libdispatch/src/swift/CMakeLists.txt
32-
index 38bef37..d0ddf98 100644
33-
--- a/swift-corelibs-libdispatch/src/swift/CMakeLists.txt
34-
+++ b/swift-corelibs-libdispatch/src/swift/CMakeLists.txt
35-
@@ -15,6 +15,7 @@ add_library(swiftDispatch
36-
Source.swift
37-
Time.swift
38-
Wrapper.swift)
39-
+set(CMAKE_SHARED_LINKER_FLAGS "")
40-
target_compile_options(swiftDispatch PRIVATE
41-
"SHELL:-Xcc -fblocks"
42-
"SHELL:-Xcc -fmodule-map-file=${PROJECT_SOURCE_DIR}/dispatch/module.modulemap"

swift-ci/sdks/android/patches/swift-android.patch

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ index 324d1a77eea..e88601a8701 100644
3636

3737
from . import cmake_product
3838
from . import product
39-
@@ -115,6 +117,24 @@ class SwiftTestingCMakeShim(cmake_product.CMakeProduct):
39+
@@ -115,6 +117,25 @@ class SwiftTestingCMakeShim(cmake_product.CMakeProduct):
4040
# FIXME: If we build macros for the builder, specify the path.
4141
self.cmake_options.define('SwiftTesting_MACRO', 'NO')
4242

@@ -56,32 +56,9 @@ index 324d1a77eea..e88601a8701 100644
5656
+ self.cmake_options.define('CMAKE_Swift_FLAGS', flags)
5757
+ self.cmake_options.define('CMAKE_Swift_COMPILER_TARGET', triple)
5858
+ self.cmake_options.define('CMAKE_CXX_COMPILER_WORKS', 'True')
59+
+ self.cmake_options.define('CMAKE_SHARED_LINKER_FLAGS', '')
5960
+ self.cmake_options.define('CMAKE_FIND_ROOT_PATH', self.args.cross_compile_deps_path)
6061
+
6162
self.generate_toolchain_file_for_darwin_or_linux(
6263
host_target, override_macos_deployment_version=override_deployment_version)
6364
self.build_with_cmake([], self.args.build_variant, [],
64-
diff --git a/swift-corelibs-foundation/CMakeLists.txt b/swift-corelibs-foundation/CMakeLists.txt
65-
index 7f290d16..95366592 100644
66-
--- a/swift-corelibs-foundation/CMakeLists.txt
67-
+++ b/swift-corelibs-foundation/CMakeLists.txt
68-
@@ -51,6 +51,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
69-
endif()
70-
endif()
71-
72-
+set(CMAKE_SHARED_LINKER_FLAGS "")
73-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
74-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
75-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
76-
diff --git a/swift-testing/CMakeLists.txt b/swift-testing/CMakeLists.txt
77-
index 1be9a4b..bd7b1bd 100644
78-
--- a/swift-testing/CMakeLists.txt
79-
+++ b/swift-testing/CMakeLists.txt
80-
@@ -28,6 +28,7 @@ list(APPEND CMAKE_MODULE_PATH
81-
${PROJECT_SOURCE_DIR}/cmake/modules
82-
${PROJECT_SOURCE_DIR}/cmake/modules/shared)
83-
84-
+set(CMAKE_SHARED_LINKER_FLAGS "")
85-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
86-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
87-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

swift-ci/sdks/android/scripts/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,8 @@ for arch in $archs; do
460460
--swift-testing --install-swift-testing \
461461
--cross-compile-build-swift-tools=0 \
462462
--llvm-ninja-targets-for-cross-compile-hosts=help \
463+
--libdispatch-cmake-options=-DCMAKE_SHARED_LINKER_FLAGS= \
464+
--foundation-cmake-options=-DCMAKE_SHARED_LINKER_FLAGS= \
463465
--cross-compile-append-host-target-to-destdir=False
464466
# --extra-cmake-options='-DCMAKE_EXTRA_LINK_FLAGS="-Wl,-z,max-page-size=16384"'
465467
# need to remove symlink that gets created in the NDK to the previous arch's build

0 commit comments

Comments
 (0)