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 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 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/buildsystems/integration.md)
Expand Down
121 changes: 121 additions & 0 deletions docs/commands/common-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# 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).**

Most vcpkg commands accept a group of common options that control cross-cutting aspects of the tool. Not all options affect every command. For example, a command that does not download any files will be unaffected by changing the downloads directory.

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

## `--x-asset-sources=<config>`

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

Specify the cache configuration for [Asset Caching](../users/assetcaching.md).

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

## `--binarysource=<config>`

Add a source for [Binary Caching](../users/binarycaching.md).

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

<a name="buildtrees-root"></a>

## `--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.

Defaults to `buildtrees/` under the vcpkg root folder.

<a name="downloads-root"></a>

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

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

Defaults to the `VCPKG_DOWNLOADS` environment variable. If that is unset, defaults to `downloads/` under the vcpkg root folder.

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

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

Specify the host [architecture triplet][triplets].

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

<a name="install-root"></a>

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

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

Specifies the path to lay out installed packages.

In Classic Mode, defaults to `installed/` under the vcpkg root folder.

In [Manifest Mode][../users/manifests.md], defaults to `vcpkg_installed/` under the manifest folder.

<a name="manifest-root"></a>

### `--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 for the nearest `vcpkg.json`.

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

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

Specifies a directory containing [overlay ports](../specifications/ports-overlay.md).

This option can be specified multiple times; ports will resolve to the first match.

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

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

Specifies a directory containing [overlay triplets](../examples/overlay-triplets-linux-dynamic.md).

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

<a name="packages-root"></a>

## `--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.

Defaults to `packages/` under the vcpkg root folder.

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

## `--triplet=<triplet>`

Specify the target [architecture triplet][triplets].

Defaults to the `VCPKG_DEFAULT_TRIPLET` environment variable. If that is unset, deduced based on the host architecture and operating system.

Note that on Windows operating systems, the architecture is always deduced as x86 for legacy reasons.

<a name="vcpkg-root"></a>

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

Specifies the vcpkg root folder.

Defaults to the directory containing the vcpkg program. The directory must be a valid vcpkg instance, such as a `git clone` of `https://github.com/microsoft/vcpkg`. This option can be used to run a custom-built copy of the tool directly from the build folder.

## 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).
183 changes: 183 additions & 0 deletions docs/commands/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# 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>...
```

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

## Description

Build and install port packages.

### Classic Mode

In Classic Mode, this verb adds port packages to the existing set in the [installed directory][] (defaults to `installed/` under the vcpkg root). This can require removing and rebuilding existing packages, which can fail.

**Package Syntax**
```
portname[feature1,feature2]:triplet
```

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 `vcpkg.json` manifest file, adding, removing, or rebuilding packages as needed.

[installed directory]: common-options.md#install-root

## Options

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

### `--allow-unsupported`

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

By default, vcpkg refuses to execute an install plan containing a port installation for a triplet outside its [`"supports"`][] clause. The [`"supports"`][] clause of a package describes the full set of platforms a package is expected to be buildable on. This flag instructs vcpkg to warn that the build is expected to fail instead of stopping.

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

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

This option has the same effect as passing [`--clean-buildtrees-after-build`](#clean-buildtrees-after-build), [`--clean-downloads-after-build`](#clean-downloads-after-build), and [`--clean-packages-after-build`](#clean-packages-after-build).

<a id="clean-buildtrees-after-build"></a>

### `--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. All subdirectories will be deleted.

<a id="clean-downloads-after-build"></a>

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

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

All top level files in the `downloads/` folder will be deleted. Extracted tools will be kept.

<a id="clean-packages-after-build"></a>

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

Clean the packages temporary subfolder after building each package.

The packages subfolder for the built package (for example, `packages/zlib_x64-windows`) will be deleted after installation.

### `--dry-run`

Print the install plan, but do not remove or install any packages.

The install plan lists all packages and features that will be installed, as well as any other packages that need to be removed and rebuilt.

### `--editable`

**Classic Mode Only**

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

When vcpkg builds ports, it purges and re-extracts the source code each time to ensure inputs are accurately. This is necessary for [Manifest Mode][] to accurately update what is installed and [Binary Caching][] to ensure cached content is correct.

Passing the `--editable` flag disables this behavior, preserving edits to the extracted sources in the `buildtrees/` folder. This helps develop patches quickly by avoiding the need to write a file on each change.

Sources extracted during an editable build do not have a `.clean/` suffix on the directory name and will not be cleared by subsequent non-editable builds.

### `--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](../users/manifests.md#features) from the `vcpkg.json` to install dependencies for.

By default, only [`"dependencies"`](../users/manifests.md#dependencies) and the dependencies of the [`"default-features"`](../users/manifests.md#default-features) will be installed.

### `--head`

**Classic Mode Only**

Request all packages explicitly referenced on the command line to 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 explicitly referenced packages and their dependents because vcpkg cannot accurately track all inputs.

### `--keep-going`

Continue the install plan after the first failure.

By default, vcpkg will stop at the first package build failure. This flag instructs vcpkg to continue building and installing other parts of the install plan that don't depend upon 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 ports from downloading new assets during the build.

By default, ports will acquire source code and tools on demand from the internet (subject to [Asset Caching][]). This parameter blocks downloads and restricts ports to only the assets that were previously downloaded and cached on the machine.

### `--only-downloads`

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

When passed this option, vcpkg will run each build in the plan until it makes its first non-downloading external process call. Most ports perform all downloads before the first external process call (usually to their buildsystem), so this procedure will download all required assets. Ports that do not follow this procedure will not have their assets predownloaded.

### `--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

<a id="write-nuget-packages-config"></a>

### `--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