Development Guide

Forum posts

Repositories

swiftwasm/swift

The main repository of this project. Forked from apple/swift. We are tracking upstream changes using pull

Branching scheme

  • swiftwasm is the main develop branch
  • master is a mirror of the master branch of the upstream apple/master repository. This branch is necessary to avoid some issues
  • swiftwasm-release/5.3 is the branch where 5.3 release of SwiftWasm is prepared.
  • release/5.3 is a mirror of the upstream release/5.3 branch.

swiftwasm/llvm-project

Forked from apple/llvm-project.

swiftwasm branch is based on swift/master branch of apple/llvm-project.

Please see AppleBranchingScheme.md

swiftwasm/icu4c-wasi

Build script and patches for building ICU project for WebAssembly

We are sending patches to upstream repository.

  • https://github.com/unicode-org/icu/pull/990

swiftwasm/wasi-sdk and swiftwasm/wasi-libc

Forked from WebAssembly/wasi-sdk and WebAssembly/wasi-libc.

We fork them to build wasi-sysroot with pthread header. There aren't so many diff from upstream.

How to build

First, checkout the project source code.

$ mkdir swiftwasm-source
$ cd swiftwasm-source
$ git clone https://github.com/swiftwasm/swift.git
$ ./swift/utils/update-checkout --scheme wasm --clone

Before building Swift, please install required dependencies.

# On macOS
$ ./utils/webassembly/macos/install-dependencies.sh
# On Linux
$ ./utils/webassembly/linux/install-dependencies.sh

We support both Linux and macOS to build Swift. These script wraps ./utils/build-script to simplify build options. You can pass additional build-script options through these scripts.

# On macOS
$ ./utils/webassembly/build-mac.sh -R
# On Linux
$ ./utils/webassembly/build-linux.sh -R

If you want to get more information about build system, please feel free to ask @kateinoigakukun on Twitter.

Development Tips

Cache

Compilation time of LLVM project is very long, so we recommend to cache the artifact using sccache

Use sccache to cache build artifacts

Debugging

When you want to debug a WebAssembly binary, wasminspect is very helpful to investigate.