forked from apple/swift
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid building Foundation and XCTest for now
- Loading branch information
1 parent
7dd7b3d
commit c6274c5
Showing
4 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
set -ex | ||
DESTINATION_TOOLCHAIN=$1 | ||
SOURCE_PATH="$(cd "$(dirname $0)/../../.." && pwd)" | ||
|
||
# Remove host CoreFoundation (which can be different from the target) headers | ||
# to avoid shadowing the wasm32 target CoreFoundation | ||
rm -rf $DESTINATION_TOOLCHAIN/usr/lib/swift/CoreFoundation | ||
|
||
FOUNDATION_BUILD="$SOURCE_PATH/build/Ninja-ReleaseAssert/foundation-wasi-wasm32" | ||
|
||
mkdir -p $FOUNDATION_BUILD | ||
cd $FOUNDATION_BUILD | ||
|
||
cmake -G Ninja \ | ||
-DCMAKE_Swift_COMPILER="$DESTINATION_TOOLCHAIN/usr/bin/swiftc" \ | ||
-DCMAKE_STAGING_PREFIX="$DESTINATION_TOOLCHAIN/usr" \ | ||
-DCMAKE_TOOLCHAIN_FILE="$SOURCE_PATH/swift/utils/webassembly/toolchain-wasi.cmake" \ | ||
-DWASI_SDK_PATH="$SOURCE_PATH/wasi-sdk" \ | ||
-DICU_ROOT="$SOURCE_PATH/icu_out" \ | ||
-DBUILD_SHARED_LIBS=OFF \ | ||
"${SOURCE_PATH}/swift-corelibs-foundation" | ||
|
||
ninja -v | ||
ninja -v install | ||
|
||
# On macOS the target CoreFoundation shadows the CoreFoundation suppplied by Xcode. | ||
# On Linux though there's no system CoreFoundation, its headers have to be shipped | ||
# in the installable archive and serve for both host and target. | ||
if [[ "$(uname)" == "Darwin" ]]; then | ||
mv $DESTINATION_TOOLCHAIN/usr/lib/swift/CoreFoundation \ | ||
$DESTINATION_TOOLCHAIN/usr/lib/swift/wasi/wasm32/CoreFoundation | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
set -ex | ||
DESTINATION_TOOLCHAIN=$1 | ||
SOURCE_PATH="$(cd "$(dirname $0)/../../.." && pwd)" | ||
|
||
BUILD_DIR="$SOURCE_PATH/build/Ninja-ReleaseAssert/xctest-wasi-wasm32" | ||
|
||
mkdir -p $BUILD_DIR | ||
cd $BUILD_DIR | ||
|
||
cmake -G Ninja \ | ||
-DCMAKE_Swift_COMPILER="$DESTINATION_TOOLCHAIN/usr/bin/swiftc" \ | ||
-DCMAKE_STAGING_PREFIX="$DESTINATION_TOOLCHAIN/usr" \ | ||
-DCMAKE_TOOLCHAIN_FILE="$SOURCE_PATH/swift/utils/webassembly/toolchain-wasi.cmake" \ | ||
-DWASI_SDK_PATH="$SOURCE_PATH/wasi-sdk" \ | ||
-DBUILD_SHARED_LIBS=OFF \ | ||
-DSWIFT_FOUNDATION_PATH=$DESTINATION_TOOLCHAIN/usr/lib/swift/wasi/wasm32 \ | ||
"${SOURCE_PATH}/swift-corelibs-xctest" | ||
|
||
ninja -v | ||
ninja -v install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
set(CMAKE_SYSTEM_NAME Generic) | ||
set(CMAKE_SYSTEM_VERSION 1) | ||
set(CMAKE_SYSTEM_PROCESSOR wasm32) | ||
set(triple wasm32-unknown-wasi) | ||
|
||
set(WASI_SDK_PREFIX "${SWIFT_SOURCE_PREFIX}/wasi-sdk") | ||
|
||
set(CMAKE_C_COMPILER ${WASI_SDK_PREFIX}/bin/clang) | ||
set(CMAKE_CXX_COMPILER ${WASI_SDK_PREFIX}/bin/clang++) | ||
set(CMAKE_AR ${WASI_SDK_PREFIX}/bin/llvm-ar CACHE STRING "wasi-sdk build") | ||
set(CMAKE_RANLIB ${WASI_SDK_PREFIX}/bin/llvm-ranlib CACHE STRING "wasi-sdk build") | ||
set(CMAKE_C_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build") | ||
set(CMAKE_CXX_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build") | ||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-threads" CACHE STRING "wasi-sdk build") | ||
|
||
set(CMAKE_SYSROOT ${WASI_SDK_PREFIX}/share/wasi-sysroot CACHE STRING "wasi-sdk build") | ||
set(CMAKE_STAGING_PREFIX ${WASI_SDK_PREFIX}/share/wasi-sysroot CACHE STRING "wasi-sdk build") | ||
|
||
# Don't look in the sysroot for executables to run during the build | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
# Only look in the sysroot (not in the host paths) for the rest | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) | ||
|
||
# Some other hacks | ||
set(CMAKE_C_COMPILER_WORKS ON) | ||
set(CMAKE_CXX_COMPILER_WORKS ON) |