SPM build options control how an SPM project is compiled and linked. They are shared across the build, run, test, and archive commands.
| Option | Description |
|---|
-p, --path <path> | Path to the SPM project. Defaults to current directory |
--build-dir <path> | Path to the build directory. Defaults to .build |
-o, --output <path> | Path to the output directory. Defaults to Product |
| Option | Description |
|---|
-c, --configuration <type> | Build configuration: debug (default) or release |
--os-version <version> | Minimum OS version or Android API level |
--static-swift-stdlib | Link with the static Swift standard library |
--debug-info-format <format> | Debug info format: dwarf (default), codeview, or none |
--sdk <path> | Path to the target SDK sysroot |
--pkg-config-path <path> | Additional directory to search for .pc files. Repeatable |
--build-tests | Build test targets |
| Option | Description |
|---|
--target <name> | SPM target to build. Repeatable. Defaults to all targets |
--product <name> | SPM product to build. Repeatable. Defaults to all products |
Flags can be passed globally (applied to all platforms) or scoped to a specific platform using the :<platform> suffix.
Platforms: macos, ios, ios-simulator, android-arm64-v8a, android-armeabi-v7a, android-x86_64, android-x86
| Option | Description |
|---|
-Xcc <flag> | Pass flag to all C compiler invocations |
-Xcc:<platform> <flag> | Pass flag to C compiler invocations for the given platform |
-Xswiftc <flag> | Pass flag to all Swift compiler invocations |
-Xswiftc:<platform> <flag> | Pass flag to Swift compiler invocations for the given platform |
-Xcxx <flag> | Pass flag to all C++ compiler invocations |
-Xcxx:<platform> <flag> | Pass flag to C++ compiler invocations for the given platform |
-Xlinker <flag> | Pass flag to all linker invocations |
-Xlinker:<platform> <flag> | Pass flag to linker invocations for the given platform |
| Option | Description |
|---|
-L, --link-library-path <path> | Add a library search path. Repeatable |
--link-library-path:<platform> <path> | Add a library search path for the given platform. Repeatable |
-l, --link-library <name> | Link against a library. Repeatable |
--link-library:<platform> <name> | Link against a library for the given platform. Repeatable |
| Option | Description |
|---|
--java-sources <path> | Path to additional Java sources to compile into JAR archives |