Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Initial addition of CLI Reference docs #24754

Merged
merged 7 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This too
- [Patching Example: Patching libpng to work for x64-uwp](examples/patching.md)
- [Getting Started with Versioning](examples/versioning.getting-started.md)

### Command Line Reference

- [Command Line Reference](commands/index.md)

### User Help

- [Buildsystem Integration](users/integration.md)
Expand Down
115 changes: 115 additions & 0 deletions docs/commands/common-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Common Command Options

**The latest version of this documentation is available on [GitHub](https://github.com/Microsoft/vcpkg/tree/master/docs/commands/common-options.md).**

All vcpkg commands accept a group of common options that control cross-cutting aspects of the tool.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

<a name="triplet"></a>

## `--triplet=<triplet>`

Specify the target [architecture triplet][triplets].

If unset, defaults to the `VCPKG_DEFAULT_TRIPLET` environment variable. If that is unset, it is deduced based on the host architecture and operating system.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

<a name="host-triplet"></a>

## `--host-triplet=<triplet>`

Specify the host [architecture triplet][triplets].

If unset, defaults to the `VCPKG_DEFAULT_HOST_TRIPLET` environment variable. If that is unset, it is deduced based on the host architecture and operating system.

<a name="overlay-ports"></a>

## `--overlay-ports=<path>`

Specify a directory to be considered for [overlay ports](../specifications/ports-overlay.md).
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

This option can be specified multiple times; ports will resolve to the first match.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

<a name="overlay-triplets"></a>

## `--overlay-triplets=<path>`

Specify a directory to be considered for [overlay triplets](../examples/overlay-triplets-linux-dynamic.md).

This option can be specified multiple times; [triplets][] will resolve to the first match.

<a name="binarysource"></a>

## `--binarysource=<config>`

Add a source for [Binary Caching](../users/binarycaching.md).
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

This option can be specified multiple times; see the Binary Caching documentation for how multiple binary sources interact.

<a name="x-asset-sources"></a>

## `--x-asset-sources=<config>`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move experimental options to the bottom of the list?

Copy link
Contributor Author

@ras0219-msft ras0219-msft May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the x- prefix should be treated like the when sorting phrases.

The intended path of experimental functionality (90% of the time) is to drop the prefix when stable and continue accepting the old name. This ensures maximum compatibility with existing scripts.

We could consider an entirely separate section for experimental functionality, but I feel that's unnecessary and unusual as long as they're clearly marked.


**Experimental: will change or be removed at any time**

Add a source for [Asset Caching](../users/assetcaching.md).

This option can be specified multiple times; see the Asset Caching documentation for how multiple binary sources interact.

## `--downloads-root=<path>`

Specify where downloaded tools and source code archives should be kept.

If unset, defaults to the `VCPKG_DOWNLOADS` environment variable. If that is unset, defaults to `downloads/` under the vcpkg root folder.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

## `--vcpkg-root=<path>`

Specifies the vcpkg root folder.

This folder should be a valid vcpkg instance, such as a `git clone` of `https://github.com/microsoft/vcpkg`.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--x-manifest-root=<path>`

**Experimental: will change or be removed at any time**

Specifies the directory containing [`vcpkg.json`](../users/manifests.md).

Defaults to searching upwards from the current working directory.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

## `--x-buildtrees-root=<path>`

**Experimental: will change or be removed at any time**

Specifies the temporary path to store intermediate build files, such as objects or unpacked source code.

If unset, defaults to `buildtrees/` under the vcpkg root folder.

## `--x-install-root=<path>`

**Experimental: will change or be removed at any time**

Specifies the path to lay out installed packages.

If unset in classic mode, defaults to `installed/` under the vcpkg root folder. If unset in manifest mode, defaults to `vcpkg_installed/` under the manifest folder.

## `--x-packages-root=<path>`

**Experimental: will change or be removed at any time**

Specifies the temporary path to stage intermediate package files before final install.

If unset, defaults to `packages/` under the vcpkg root folder.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

## `--x-json`
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

**Experimental: will change or be removed at any time**

Requests structured JSON output from the command instead of human-readable output.

*Note: most commands do not currently respect this option.*

## Response Files (`@<file>`)

The vcpkg command line accepts text files containing newline-separated command line parameters.

The tool will act as though the items in the file were spliced into the command line in place of the `@` reference. Response files cannot contain additional response files.

[triplets]: ../users/triplets.md
13 changes: 13 additions & 0 deletions docs/commands/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# vcpkg Command Line Reference

**The latest version of this documentation is available on [GitHub](https://github.com/Microsoft/vcpkg/tree/master/docs/commands/index.md).**

## Contents

- [Common Options](common-options.md)
- Commands
- [vcpkg install](install.md)

## Source

The vcpkg command line is developed in a separate repository on GitHub: [microsoft/vcpkg-tool](https://github.com/microsoft/vcpkg-tool). Issues should be posted to [microsoft/vcpkg](https://github.com/microsoft/vcpkg/issues).
165 changes: 165 additions & 0 deletions docs/commands/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# vcpkg install

**The latest version of this documentation is available on [GitHub](https://github.com/Microsoft/vcpkg/tree/master/docs/commands/install.md).**

## Synopsis

**Classic Mode**
```no-highlight
vcpkg install [options] [<package>...]
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved
```

**Manifest Mode**
```no-highlight
vcpkg install [options]
```

## Description

Build and install packages.

### Classic Mode

In Classic Mode, this verb adds packages to the existing set in the installed directory. This may require rebuilding existing packages with new features.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

**Package Syntax**
```
name[feature1,feature2]:triplet
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved
```

Package references without a triplet are automatically qualified by the [default target triplet](common-options.md#triplet). Package references that do not explicitly list `core` are considered to imply all default features.

### Manifest Mode

In [Manifest Mode][], this verb sets the installed directory to the state specified by the manifest file, adding, removing, or rebuilding packages as needed.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

## Options

All vcpkg commands support a set of [common options](common-options.md).

### `--allow-unsupported`

Instead of erroring on an unsupported port, continue with a warning.

By default, vcpkg will refuse to execute an install plan that contains a port installation for an unsupported triplet. This flag allows the plan to be executed ignoring the [`"supports"`][] field, although the build is likely to fail.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--clean-after-build`

Clean buildtrees, packages, and downloads after building each package.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--clean-buildtrees-after-build`

Clean all subdirectories from the buildtrees temporary subfolder after building each package.

All top-level files in the buildtrees subfolder (e.g. `buildtrees/zlib/config-x64-windows-out.log`) will be kept.

### `--clean-downloads-after-build`

Clean all unextracted assets from the `downloads/` folder after building each package.

Extracted tools will be kept even with this flag.

### `--clean-packages-after-build`

Clean the packages temporary subfolder after building each package.

### `--dry-run`

Only print the install plan, do not remove or install any packages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a bit more context for the user: "Useful for getting a preview of what vcpkg is about to do before asking it to start running builds and downloading files to your disk."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a bit more verbosity, but I don't feel like being that prescriptive is appropriate for this reference document


### `--editable`

**Classic Mode Only**

Perform editable builds for all directly referenced packages on the command line.

When vcpkg builds packages, it purges and re-extracts the source code each time to ensure it can accurately track what inputs were used. This is necessary for [Manifest Mode][] as well as [Binary Caching][].

However, while developing a package it can be useful to edit the sources in-place and quickly request a new package build using the edited sources. Editable builds will not clean out the sources each time, enabling them to be modified with a text editor in the `buildtrees/` folder and quickly rebuilt.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--enforce-port-checks`

Fail install if a port has detected problems or attempts to use a deprecated feature.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

By default, vcpkg will run several checks on built packages and emit warnings if any issues are detected. This flag upgrades those warnings to an error.

### `--x-feature=<feature>`

**Experimental and may change or be removed at any time**

**[Manifest Mode][] Only**

Specify an additional feature from the `vcpkg.json` to install dependencies for.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--head`

**Classic Mode Only**

Request that all packages explicitly referenced on the command line fetch the latest sources available when building.

This flag is only intended for temporary testing and is not intended for production or long-term use.

This disables Binary Caching for all referenced packages and any packages that depend upon them, since vcpkg cannot accurately track all inputs.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--keep-going`

Continue the install plan after the first failure.

Without this flag, vcpkg will stop at the first package build failure. With this flag, vcpkg will continue to build and install other parts of the install plan that don't depend on the failed package.

### `--x-no-default-features`

**Experimental and may change or be removed at any time**

**[Manifest Mode][] Only**

Don't install the default features from the top-level manifest.

When using `install` in Manifest Mode, by default all dependencies of the features listed in [`"default-features"`][] will be installed. This flag disables that behavior so (without any `TODO` flags) only the dependencies listed in [`"dependencies"`][] will be installed.

### `--no-downloads`

When building a package, prevent recipes from downloading new assets during the build.

By default, recipes will acquire source code and tools on demand from the internet (subject to [Asset Caching][]). This parameter blocks downloads and restricts recipes to only the assets that were previously downloaded and cached on the machine.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--only-downloads`

Attempt to download all assets required for an install plan without performing any builds.

When passed this option, vcpkg will run every recipe in the plan until they make their first non-downloading external process call. Most recipes perform all required downloads before this call (which is usually to their buildsystem), so this procedure will successfully run all download steps without executing the underlying build.

### `--only-binarycaching`

Refuse to perform any builds. Only restore packages from [Binary Caches][Binary Caching].

This flag blocks vcpkg from performing builds on demand and will fail if a package cannot be found in any binary caches.

### `--recurse`

**Classic Mode Only**

Approve an install plan that requires rebuilding packages.

In order to modify the set of features of an installed package, vcpkg must remove and rebuild that package. Because this has the potential of failing and leaving the install tree with fewer packages than the user started with, the user must approve plans that rebuild packages by passing this flag.

### `--x-use-aria2`

**Experimental and may change or be removed at any time**

Use aria2 to perform download tasks.
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved

### `--x-write-nuget-packages-config`

**Experimental and may change or be removed at any time**

Writes out a NuGet `packages.config`-formatted file for use with [Binary Caching][].

This option can be used in conjunction with `--dry-run` to obtain the list of NuGet packages required from [Binary Caching][] without building or installing any packages. This enables the NuGet command line to be invoked separately for advanced scenarios, such as using alternate protocols to acquire the `.nupkg` files.

[Asset Caching]: ../users/assetcaching.md
[Binary Caching]: ../users/binarycaching.md
[Manifest Mode]: ../users/manifests.md
[`"supports"`]: ../users/manifests.md#supports
[`"default-features"`]: ../users/manifests.md#default-features
[`"dependencies"`]: ../users/manifests.md#dependencies
Loading