Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions guide/src/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Options:

Requires `pgo-command` to be set in `[tool.maturin]` in pyproject.toml. This performs a three-phase build: instrumented build, profile training, and optimized rebuild.

Can also be enabled via the MATURIN_PGO environment variable.

[env: MATURIN_PGO=]

-i, --interpreter [<INTERPRETER>...]
The python versions to build wheels for, given as the executables of interpreters such as `python3.9` or `/usr/bin/python3.8`

Expand Down
1 change: 1 addition & 0 deletions guide/src/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Config-settings take priority over `MATURIN_PEP517_ARGS`; the environment variab
`MATURIN_PYODIDE_ABI_VERSION` when possible — wheels built with the legacy
tag are not installable on PEP 783-compliant runtimes.
* `MATURIN_STRIP`: Strip the library for minimum file size
* `MATURIN_PGO`: Build with Profile-Guided Optimization (same as `--pgo`), works with `maturin build`, `maturin develop` and PEP 517 builds (e.g. `pip install .`). Set to `0`, `false`, `no` or `off` to disable, any other value enables it
* `MATURIN_NO_MISSING_BUILD_BACKEND_WARNING`: Suppress missing build backend warning
* `MATURIN_USE_XWIN`: Set to `1` to force to use `xwin` for cross compiling even on Windows that supports native compilation
* `ANDROID_API_LEVEL`: The Android API level to target when cross compiling for Android
Expand Down
4 changes: 4 additions & 0 deletions guide/src/local_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Options:

Implies `--release` unless `--profile` is specified.

Can also be enabled via the MATURIN_PGO environment variable.

[env: MATURIN_PGO=]

--strip
Strip the library for minimum file size

Expand Down
10 changes: 10 additions & 0 deletions src/commands/pep517.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ pub enum Pep517Command {
metadata_directory: PathBuf,
#[command(flatten)]
strip_opt: StripOption,
/// Build with Profile-Guided Optimization (PGO)
#[arg(long, env = "MATURIN_PGO", value_parser = clap::builder::FalseyValueParser::new())]
pgo: bool,
},
#[command(name = "build-wheel")]
/// Implementation of build_wheel
Expand All @@ -34,6 +37,9 @@ pub enum Pep517Command {
build_options: BuildOptions,
#[command(flatten)]
strip_opt: StripOption,
/// Build with Profile-Guided Optimization (PGO)
#[arg(long, env = "MATURIN_PGO", value_parser = clap::builder::FalseyValueParser::new())]
pgo: bool,
/// Build editable wheels
#[arg(long)]
editable: bool,
Expand Down Expand Up @@ -86,12 +92,14 @@ pub fn pep517(subcommand: Pep517Command) -> Result<()> {
mut build_options,
metadata_directory,
strip_opt,
pgo,
} => {
require_single_interpreter(&mut build_options, "write-dist-info")?;
let mut context = build_options
.into_build_context()
.strip(strip_opt.strip)
.editable(false)
.pgo(pgo)
.build()?;
ensure_release_profile(&mut context);

Expand All @@ -111,13 +119,15 @@ pub fn pep517(subcommand: Pep517Command) -> Result<()> {
Pep517Command::BuildWheel {
mut build_options,
strip_opt,
pgo,
editable,
} => {
require_single_interpreter(&mut build_options, "build-wheel")?;
let mut build_context = build_options
.into_build_context()
.strip(strip_opt.strip)
.editable(editable)
.pgo(pgo)
.build()?;
ensure_release_profile(&mut build_context);

Expand Down
4 changes: 3 additions & 1 deletion src/develop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ pub struct DevelopOptions {
/// and optimized rebuild.
///
/// Implies `--release` unless `--profile` is specified.
#[arg(long)]
///
/// Can also be enabled via the MATURIN_PGO environment variable.
#[arg(long, env = "MATURIN_PGO", value_parser = clap::builder::FalseyValueParser::new())]
pub pgo: bool,
/// Strip the library for minimum file size
#[arg(long)]
Expand Down
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ enum Command {
/// Requires `pgo-command` to be set in `[tool.maturin]` in pyproject.toml.
/// This performs a three-phase build: instrumented build, profile training,
/// and optimized rebuild.
#[arg(long)]
///
/// Can also be enabled via the MATURIN_PGO environment variable.
#[arg(long, env = "MATURIN_PGO", value_parser = clap::builder::FalseyValueParser::new())]
pgo: bool,
#[command(flatten)]
build: BuildOptions,
Expand All @@ -98,7 +100,9 @@ enum Command {
/// Build with Profile-Guided Optimization (PGO).
///
/// Requires `pgo-command` to be set in `[tool.maturin]` in pyproject.toml.
#[arg(long)]
///
/// Can also be enabled via the MATURIN_PGO environment variable.
#[arg(long, env = "MATURIN_PGO", value_parser = clap::builder::FalseyValueParser::new())]
pgo: bool,
#[command(flatten)]
publish: PublishOpt,
Expand Down
4 changes: 4 additions & 0 deletions tests/cmd/build.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Options:

Requires `pgo-command` to be set in `[tool.maturin]` in pyproject.toml. This performs a
three-phase build: instrumented build, profile training, and optimized rebuild.

Can also be enabled via the MATURIN_PGO environment variable.

[env: MATURIN_PGO=]

-i, --interpreter [<INTERPRETER>...]
The python versions to build wheels for, given as the executables of interpreters such as
Expand Down
4 changes: 4 additions & 0 deletions tests/cmd/develop.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Options:
three-phase build: instrumented build, profile training, and optimized rebuild.

Implies `--release` unless `--profile` is specified.

Can also be enabled via the MATURIN_PGO environment variable.

[env: MATURIN_PGO=]

--strip
Strip the library for minimum file size
Expand Down
4 changes: 4 additions & 0 deletions tests/cmd/publish.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Options:
Build with Profile-Guided Optimization (PGO).

Requires `pgo-command` to be set in `[tool.maturin]` in pyproject.toml.

Can also be enabled via the MATURIN_PGO environment variable.

[env: MATURIN_PGO=]

-r, --repository <REPOSITORY>
The repository (package index) to upload the package to. Should be a section in the config
Expand Down
Loading