File tree Expand file tree Collapse file tree 4 files changed +85
-2
lines changed Expand file tree Collapse file tree 4 files changed +85
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -ex
3
+ DESTINATION_TOOLCHAIN=$1
4
+ SOURCE_PATH=" $( cd " $( dirname $0 ) /../../.." && pwd) "
5
+
6
+ # Remove host CoreFoundation (which can be different from the target) headers
7
+ # to avoid shadowing the wasm32 target CoreFoundation
8
+ rm -rf $DESTINATION_TOOLCHAIN /usr/lib/swift/CoreFoundation
9
+
10
+ FOUNDATION_BUILD=" $SOURCE_PATH /build/Ninja-ReleaseAssert/foundation-wasi-wasm32"
11
+
12
+ mkdir -p $FOUNDATION_BUILD
13
+ cd $FOUNDATION_BUILD
14
+
15
+ cmake -G Ninja \
16
+ -DCMAKE_Swift_COMPILER=" $DESTINATION_TOOLCHAIN /usr/bin/swiftc" \
17
+ -DCMAKE_STAGING_PREFIX=" $DESTINATION_TOOLCHAIN /usr" \
18
+ -DCMAKE_TOOLCHAIN_FILE=" $SOURCE_PATH /swift/utils/webassembly/toolchain-wasi.cmake" \
19
+ -DWASI_SDK_PATH=" $SOURCE_PATH /wasi-sdk" \
20
+ -DICU_ROOT=" $SOURCE_PATH /icu_out" \
21
+ -DBUILD_SHARED_LIBS=OFF \
22
+ " ${SOURCE_PATH} /swift-corelibs-foundation"
23
+
24
+ ninja -v
25
+ ninja -v install
26
+
27
+ # On macOS the target CoreFoundation shadows the CoreFoundation suppplied by Xcode.
28
+ # On Linux though there's no system CoreFoundation, its headers have to be shipped
29
+ # in the installable archive and serve for both host and target.
30
+ if [[ " $( uname) " == " Darwin" ]]; then
31
+ mv $DESTINATION_TOOLCHAIN /usr/lib/swift/CoreFoundation \
32
+ $DESTINATION_TOOLCHAIN /usr/lib/swift/wasi/wasm32/CoreFoundation
33
+ fi
Original file line number Diff line number Diff line change @@ -81,8 +81,9 @@ sed -i -e "s@\".*/include@\"../../../../share/wasi-sysroot/include@g" $SOURCE_PA
81
81
# but nightly's one is symbolic link. A simple copy fails to merge them.
82
82
rsync -v -a $SOURCE_PATH /install/$TOOLCHAIN_NAME /usr/lib/ $HOST_TOOLCHAIN_SDK /usr/lib/ --exclude ' swift/clang'
83
83
84
- $UTILS_PATH /build-foundation.sh $HOST_TOOLCHAIN_SDK
85
- $UTILS_PATH /build-xctest.sh $HOST_TOOLCHAIN_SDK
84
+ # FIXME: avoid building foundation for now
85
+ # $UTILS_PATH/build-foundation.sh $HOST_TOOLCHAIN_SDK
86
+ # $UTILS_PATH/build-xctest.sh $HOST_TOOLCHAIN_SDK
86
87
87
88
cd $HOST_TOOLCHAIN_DESTDIR
88
89
tar cfz $PACKAGE_ARTIFACT $TOOLCHAIN_NAME
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -ex
3
+ DESTINATION_TOOLCHAIN=$1
4
+ SOURCE_PATH=" $( cd " $( dirname $0 ) /../../.." && pwd) "
5
+
6
+ BUILD_DIR=" $SOURCE_PATH /build/Ninja-ReleaseAssert/xctest-wasi-wasm32"
7
+
8
+ mkdir -p $BUILD_DIR
9
+ cd $BUILD_DIR
10
+
11
+ cmake -G Ninja \
12
+ -DCMAKE_Swift_COMPILER=" $DESTINATION_TOOLCHAIN /usr/bin/swiftc" \
13
+ -DCMAKE_STAGING_PREFIX=" $DESTINATION_TOOLCHAIN /usr" \
14
+ -DCMAKE_TOOLCHAIN_FILE=" $SOURCE_PATH /swift/utils/webassembly/toolchain-wasi.cmake" \
15
+ -DWASI_SDK_PATH=" $SOURCE_PATH /wasi-sdk" \
16
+ -DBUILD_SHARED_LIBS=OFF \
17
+ -DSWIFT_FOUNDATION_PATH=$DESTINATION_TOOLCHAIN /usr/lib/swift/wasi/wasm32 \
18
+ " ${SOURCE_PATH} /swift-corelibs-xctest"
19
+
20
+ ninja -v
21
+ ninja -v install
Original file line number Diff line number Diff line change
1
+ set (CMAKE_SYSTEM_NAME Generic )
2
+ set (CMAKE_SYSTEM_VERSION 1 )
3
+ set (CMAKE_SYSTEM_PROCESSOR wasm32 )
4
+ set (triple wasm32-unknown-wasi )
5
+
6
+ set (WASI_SDK_PREFIX "${SWIFT_SOURCE_PREFIX} /wasi-sdk" )
7
+
8
+ set (CMAKE_C_COMPILER ${WASI_SDK_PREFIX} /bin/clang )
9
+ set (CMAKE_CXX_COMPILER ${WASI_SDK_PREFIX} /bin/clang++ )
10
+ set (CMAKE_AR ${WASI_SDK_PREFIX} /bin/llvm-ar CACHE STRING "wasi-sdk build" )
11
+ set (CMAKE_RANLIB ${WASI_SDK_PREFIX} /bin/llvm-ranlib CACHE STRING "wasi-sdk build" )
12
+ set (CMAKE_C_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build" )
13
+ set (CMAKE_CXX_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build" )
14
+ set (CMAKE_EXE_LINKER_FLAGS "-Wl,--no-threads" CACHE STRING "wasi-sdk build" )
15
+
16
+ set (CMAKE_SYSROOT ${WASI_SDK_PREFIX} /share/wasi-sysroot CACHE STRING "wasi-sdk build" )
17
+ set (CMAKE_STAGING_PREFIX ${WASI_SDK_PREFIX} /share/wasi-sysroot CACHE STRING "wasi-sdk build" )
18
+
19
+ # Don't look in the sysroot for executables to run during the build
20
+ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
21
+ # Only look in the sysroot (not in the host paths) for the rest
22
+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
23
+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
24
+ set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER )
25
+
26
+ # Some other hacks
27
+ set (CMAKE_C_COMPILER_WORKS ON )
28
+ set (CMAKE_CXX_COMPILER_WORKS ON )
You can’t perform that action at this time.
0 commit comments