Skip to content

Building SPM Projects

scd supports building SPM projects for multiple platforms out of the box, including Android. The build command compiles an SPM project for a target platform. It’s the command you use during everyday development to check for compile errors and warnings, without producing a distributable artifact — for that, see archive.

archive and test also compile your project using this same build logic before packaging or deploying it, so everything on this page applies to them as well.

For each platform, scd resolves the correct SDK and toolchain paths and automatically passes the compiler and linker options required to produce a working binary for that platform — so you don’t have to figure out and maintain those flags yourself.

Terminal window
scd build --platform <platform> --configuration Release

See SPM Build Options for the full list of build flags, and Platforms for supported --platform values.

This is where scd build matters most. It uses the SCADE Android Swift SDK and automatically applies several Android-specific compatibility flags — see Platforms for details.

For example, to build for Android ARM64 in Release mode:

Terminal window
scd build --platform android-arm64-v8a --configuration Release

build targets a single platform per invocation. To produce artifacts for multiple Android ABIs at once, use archive instead.

To build a specific target instead of the whole project:

Terminal window
scd build --platform android-arm64-v8a --target MyLibrary

To build using a custom Android SDK and NDK location:

Terminal window
scd build --platform android-arm64-v8a --android-sdk ~/Library/Android/sdk --android-ndk ~/Library/Android/sdk/ndk/27.0.12077973

For the host platform, build resolves the Xcode and Swift toolchain to use (see Global Options) and otherwise behaves like a direct wrapper around swift build.

For example, to build for macOS, the default platform on a macOS host:

Terminal window
scd build

To build using a specific Xcode installation:

Terminal window
scd build --xcode /Applications/Xcode-16.app

To build a specific target in Release configuration with static Swift standard library linking:

Terminal window
scd build --target MyLibrary --configuration Release --static-swift-stdlib