4

新しい Swift Package Manager 形式で記述された Swift コードを、高度に最適化されたバイナリ コードにコンパイルしたいと考えています。これは現在使用できswiftc -O somefile.swiftますが、swift パッケージはコマンドを使用してビルドされるため、オプションを受け入れないためswift build渡すことができません。-Oでは、コンパイル プロセス中にコードを最適化するように指定する方法はありますか?

4

1 に答える 1

7

以下を使用してリリース構成を構築できますswift build --configuration release

ツールの使用状況は、次の方法でも確認できます。

$ swift build --help
OVERVIEW: Build sources into binary products

USAGE: swift build [mode] [options]

MODES:
  -c, --configuration <value>   Build with configuration (debug|release) [default: debug]
  --clean [<mode>]              Delete artifacts (build|dist) [default: build]

OPTIONS:
      -C, --chdir <path>       Change working directory before any other operation
  --build-path <path>      Specify build/cache directory [default: ./.build]
  --color <mode>           Specify color mode (auto|always|never) [default: auto]
  -v, --verbose            Increase verbosity of informational output
  -Xcc <flag>              Pass flag through to all C compiler invocations
  -Xlinker <flag>          Pass flag through to all linker invocations
  -Xswiftc <flag>          Pass flag through to all Swift compiler invocations

NOTE: Use `swift package` to perform other functions on packages

このオプションをリストします。

詳細については、パッケージ マネージャーのリファレンスを参照してください。

于 2016-09-29T17:49:46.247 に答える