Skip to content

Commit

Permalink
[docs] Rewrite docs for vcpkg_cmake_build and vcpkg_cmake_install (mi…
Browse files Browse the repository at this point in the history
…crosoft#25477)

* [docs] Rewrite docs for vcpkg_cmake_build and vcpkg_cmake_install

* [docs] Fix broken links

* [docs] Add notes about parent helper port
  • Loading branch information
ras0219-msft authored Aug 16, 2022
1 parent cd5e794 commit 23cc584
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 80 deletions.
2 changes: 1 addition & 1 deletion docs/examples/packaging-github-repos.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vcpkg_cmake_install()
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libogg" RENAME copyright)
```

Check the documentation for [`vcpkg_cmake_configure`](../maintainers/vcpkg_cmake_configure.md) and [`vcpkg_cmake_install`](../maintainers/ports/vcpkg-cmake/vcpkg_cmake_install.md) if your package needs additional options.
Check the documentation for [`vcpkg_cmake_configure`](../maintainers/vcpkg_cmake_configure.md) and [`vcpkg_cmake_install`](../maintainers/vcpkg_cmake_install.md) if your package needs additional options.

Now you can run `vcpkg install libogg` to build and install the package.

Expand Down
4 changes: 2 additions & 2 deletions docs/maintainers/maintainer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ At this time, the following helpers are deprecated:
- `vcpkg_build_msbuild()` should be replaced by [`vcpkg_install_msbuild()`](vcpkg_install_msbuild.md)
- `vcpkg_copy_tool_dependencies()` should be replaced by [`vcpkg_copy_tools()`](vcpkg_copy_tools.md)
- `vcpkg_configure_cmake` should be replaced by [`vcpkg_cmake_configure()`](vcpkg_cmake_configure.md) after removing `PREFER_NINJA` (from port [`vcpkg-cmake`](ports/vcpkg-cmake.md))
- `vcpkg_build_cmake` should be replaced by [`vcpkg_cmake_build()`](ports/vcpkg-cmake/vcpkg_cmake_build.md#vcpkg_cmake_build) (from port [`vcpkg-cmake`](ports/vcpkg-cmake.md))
- `vcpkg_install_cmake` should be replaced by [`vcpkg_cmake_install()`](ports/vcpkg-cmake/vcpkg_cmake_install.md#vcpkg_cmake_install) (from port [`vcpkg-cmake`](ports/vcpkg-cmake.md))
- `vcpkg_build_cmake` should be replaced by [`vcpkg_cmake_build()`](vcpkg_cmake_build.md) (from port [`vcpkg-cmake`](ports/vcpkg-cmake.md))
- `vcpkg_install_cmake` should be replaced by [`vcpkg_cmake_install()`](vcpkg_cmake_install.md) (from port [`vcpkg-cmake`](ports/vcpkg-cmake.md))
- `vcpkg_fixup_cmake_targets` should be replaced by [`vcpkg_cmake_config_fixup`](ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.md#vcpkg_cmake_config_fixup) (from port [`vcpkg-cmake-config`](ports/vcpkg-cmake-config.md#vcpkg-cmake-config))

Some of the replacement helper functions are in "tools ports" to allow consumers to pin their
Expand Down
10 changes: 4 additions & 6 deletions docs/maintainers/portfile-functions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<!-- Run regenerate.ps1 to extract scripts documentation -->

# Portfile helper functions
- [execute\_process](execute_process.md)
- [vcpkg\_acquire\_msys](vcpkg_acquire_msys.md)
- [vcpkg\_add\_to\_path](vcpkg_add_to_path.md)
- [vcpkg\_apply\_patches](vcpkg_apply_patches.md) (deprecated)
- [vcpkg\_backup\_restore\_env\_vars](vcpkg_backup_restore_env_vars.md)
- [vcpkg\_build\_cmake](vcpkg_build_cmake.md) (deprecated, use [vcpkg\_cmake\_build](ports/vcpkg-cmake/vcpkg_cmake_build.md))
- [vcpkg\_build\_cmake](vcpkg_build_cmake.md) (deprecated, use [vcpkg\_cmake\_build](vcpkg_cmake_build.md))
- [vcpkg\_build\_make](vcpkg_build_make.md)
- [vcpkg\_build\_msbuild](vcpkg_build_msbuild.md)
- [vcpkg\_build\_ninja](vcpkg_build_ninja.md)
Expand Down Expand Up @@ -46,7 +44,7 @@
- [vcpkg\_get\_program\_files\_platform\_bitness](vcpkg_get_program_files_platform_bitness.md)
- [vcpkg\_get\_windows\_sdk](vcpkg_get_windows_sdk.md)
- [vcpkg\_host\_path\_list](vcpkg_host_path_list.md)
- [vcpkg\_install\_cmake](vcpkg_install_cmake.md) (deprecated, use [vcpkg\_cmake\_install](ports/vcpkg-cmake/vcpkg_cmake_install.md))
- [vcpkg\_install\_cmake](vcpkg_install_cmake.md) (deprecated, use [vcpkg\_cmake\_install](vcpkg_cmake_install.md))
- [vcpkg\_install\_gn](vcpkg_install_gn.md) (deprecated, use [vcpkg\_gn\_install](ports/vcpkg-gn/vcpkg_gn_install.md))
- [vcpkg\_install\_copyright](vcpkg_install_copyright.md)
- [vcpkg\_install\_make](vcpkg_install_make.md)
Expand All @@ -71,9 +69,9 @@

### [vcpkg-cmake](ports/vcpkg-cmake.md)

- [vcpkg\_cmake\_build](ports/vcpkg-cmake/vcpkg_cmake_build.md)
- [vcpkg\_cmake\_build](vcpkg_cmake_build.md)
- [vcpkg\_cmake\_configure](vcpkg_cmake_configure.md)
- [vcpkg\_cmake\_install](ports/vcpkg-cmake/vcpkg_cmake_install.md)
- [vcpkg\_cmake\_install](vcpkg_cmake_install.md)

### [vcpkg-gn](ports/vcpkg-gn.md)

Expand Down
4 changes: 2 additions & 2 deletions docs/maintainers/ports/vcpkg-cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
This port contains portfile helper functions for dealing with a CMake buildsystem.

- [`vcpkg_cmake_configure()`](../vcpkg_cmake_configure.md)
- [`vcpkg_cmake_install()`](vcpkg-cmake/vcpkg_cmake_install.md)
- [`vcpkg_cmake_build()`](vcpkg-cmake/vcpkg_cmake_build.md)
- [`vcpkg_cmake_install()`](../vcpkg_cmake_install.md)
- [`vcpkg_cmake_build()`](../vcpkg_cmake_build.md)
38 changes: 0 additions & 38 deletions docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_build.md

This file was deleted.

25 changes: 0 additions & 25 deletions docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_install.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/maintainers/vcpkg_build_cmake.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vcpkg_build_cmake

**This function has been deprecated in favor of [`vcpkg_cmake_build`](ports/vcpkg-cmake/vcpkg_cmake_build.md) from the vcpkg-cmake port.**
**This function has been deprecated in favor of [`vcpkg_cmake_build`](vcpkg_cmake_build.md) from the vcpkg-cmake port.**

The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_build_cmake.md).

Expand Down
68 changes: 68 additions & 0 deletions docs/maintainers/vcpkg_cmake_build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# vcpkg_cmake_build

**The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_cmake_build.md).**

Build a cmake project with a custom install target.

Conventionally, CMake uses the target `install` to build and copy binaries into the [`CMAKE_INSTALL_PREFIX`](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html). In rare circumstances, a project might have more specific targets that should be used instead.

Ports should prefer calling [`vcpkg_cmake_install()`](vcpkg_cmake_install.md) when possible.

## Usage

```cmake
vcpkg_cmake_build(
[TARGET <target>]
[LOGFILE_BASE <base>]
[DISABLE_PARALLEL]
[ADD_BIN_TO_PATH]
)
```

To use this function, you must depend on the helper port [`vcpkg-cmake`](ports/vcpkg-cmake.md):
```no-highlight
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
```

## Parameters

All supported parameters to [`vcpkg_cmake_install()`] are supported by `vcpkg_cmake_build()`. See [`vcpkg_cmake_install()`] for additional parameter documentation.

[`vcpkg_cmake_install()`]: vcpkg_cmake_install.md#parameters

### TARGET
The CMake target to build.

If this parameter is not passed, no target will be passed to the build.

### LOGFILE_BASE
An alternate root name for the logs.

Defaults to `build-${TARGET_TRIPLET}`. It should not contain any path separators. Logs will be generated matching the pattern `${CURRENT_BUILDTREES_DIR}/${LOGFILE_BASE}-<suffix>.log`

## Examples

```cmake
vcpkg_from_github(OUT_SOURCE_PATH source_path ...)
vcpkg_cmake_configure(
SOURCE_PATH "${source_path}"
OPTIONS
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTS=OFF
)
vcpkg_cmake_build(TARGET my.install.target)
```

[Search microsoft/vcpkg for Examples](https://github.com/microsoft/vcpkg/search?q=vcpkg_cmake_build+path%3A%2Fports)

## Remarks

This command replaces [`vcpkg_build_cmake()`](vcpkg_build_cmake.md).

## Source
[ports/vcpkg-cmake/vcpkg\_cmake\_build.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-cmake/vcpkg_cmake_build.cmake)
8 changes: 5 additions & 3 deletions docs/maintainers/vcpkg_cmake_configure.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# vcpkg_cmake_configure

The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_cmake_configure.md).
**The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_cmake_configure.md).**

Configure a CMake-based project.

This command replaces [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md).

## Usage

```cmake
Expand Down Expand Up @@ -128,6 +126,10 @@ vcpkg_cmake_install()

[Search microsoft/vcpkg for Examples](https://github.com/microsoft/vcpkg/search?q=vcpkg_cmake_configure+path%3A%2Fports)

## Remarks

This command replaces [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md).

## Source
[ports/vcpkg-cmake/vcpkg\_cmake\_configure.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake)

Expand Down
53 changes: 53 additions & 0 deletions docs/maintainers/vcpkg_cmake_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# vcpkg_cmake_install

**The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_cmake_install.md).**

Build and install a cmake project.

## Usage

```cmake
vcpkg_cmake_install(
[DISABLE_PARALLEL]
[ADD_BIN_TO_PATH]
)
```

To use this function, you must depend on the helper port [`vcpkg-cmake`](ports/vcpkg-cmake.md):
```no-highlight
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
```

## Parameters

### DISABLE_PARALLEL
Disables running the build in parallel.

By default builds are run with up to [VCPKG_MAX_CONCURRENCY](../users/config-environment.md#VCPKG_MAX_CONCURRENCY) jobs. This option limits the build to a single job and should be used only if the underlying build is unable to run correctly with concurrency.

### ADD_BIN_TO_PATH
Adds the configuration-specific `bin/` directory to the `PATH` during the build.

When building for a Windows dynamic triplet, newly built executables may not be immediately executable because their dependency DLLs may not be findable from the build environment. This flag instructs vcpkg to add any additional paths needed to locate those dependency DLLs to the `PATH` environment variable. This is required if the project needs to execute newly built binaries as part of the build (such as to generate code).

## Examples:

```cmake
vcpkg_from_github(OUT_SOURCE_PATH source_path ...)
vcpkg_cmake_configure(SOURCE_PATH "${source_path}")
vcpkg_cmake_install()
```

[Search microsoft/vcpkg for Examples](https://github.com/microsoft/vcpkg/search?q=vcpkg_cmake_install+path%3A%2Fports)

## Remarks

This command replaces [`vcpkg_install_cmake()`](vcpkg_install_cmake.md).

## Source
[ports/vcpkg-cmake/vcpkg\_cmake\_install.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-cmake/vcpkg_cmake_install.cmake)
2 changes: 1 addition & 1 deletion docs/maintainers/vcpkg_install_cmake.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vcpkg_install_cmake

**This function has been deprecated in favor of [`vcpkg_cmake_install`](ports/vcpkg-cmake/vcpkg_cmake_install.md) from the vcpkg-cmake port.**
**This function has been deprecated in favor of [`vcpkg_cmake_install`](vcpkg_cmake_install.md) from the vcpkg-cmake port.**

The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_install_cmake.md).

Expand Down
3 changes: 2 additions & 1 deletion docs/users/config-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ pass in environment variables that should cause rebuilds on change, see [`VCPKG_

Example: `FOO_SDK_DIR;BAR_SDK_DIR`

<a name="VCPKG_MAX_CONCURRENCY"></a>
#### VCPKG_MAX_CONCURRENCY

This environment variables limits the amount of concurrency requested by underlying buildsystems. If unspecified, this defaults to logical cores + 1.
This environment variables limits the amount of concurrency used by underlying buildsystems. If unspecified, this defaults to logical cores + 1.

#### VCPKG_DEFAULT_BINARY_CACHE

Expand Down

0 comments on commit 23cc584

Please sign in to comment.