Skip to content

Commit

Permalink
Merge pull request microsoft#2 from microsoft/master
Browse files Browse the repository at this point in the history
Update to latest
  • Loading branch information
bucurb authored Jul 21, 2021
2 parents 22072f0 + 3c82e19 commit 5ea1f4c
Show file tree
Hide file tree
Showing 1,051 changed files with 9,792 additions and 4,469 deletions.
16 changes: 15 additions & 1 deletion README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ Para instalar las librerías para su proyecto, ejecute:
$ ./vcpkg/vcpkg install [paquetes a instalar]
```

Nota: por defecto se instalarán las librerías x86, para instalar x64, ejecute:

```cmd
> .\vcpkg\vcpkg install [paquete a instalar]:x64-windows
```

O si desea instalar varios paquetes:

```cmd
> .\vcpkg\vcpkg install [paquetes a instalar] --triplet=x64-windows
```

También puede buscar las librerías que necesita con el subcomando `search`:

```sh
Expand Down Expand Up @@ -365,7 +377,9 @@ ver la [documentación](docs/README.md) para tutoriales específicos, incluyendo
[agregando un nuevo paquete desde un archivo comprimido](docs/examples/packaging-zipfiles.md),
[agregando un nuevo paquete desde un repositorio en GitHub](docs/examples/packaging-github-repos.md).

Nuestra documentación se encuentra online en ReadTheDocs: <https://vcpkg.readthedocs.io/>!
Nuestra documentación también esta disponible en nuestro sitio web [vcpkg.io](https://vcpkg.io/).
Si necesita ayuda puede [crear un incidente](https://github.com/vcpkg/vcpkg.github.io/issues).
¡Apreciamos cualquier retroalimentación!

Ver un [video de demostración](https://www.youtube.com/watch?v=y41WFKbQFTw) de 4 minutos.

Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This too
- [Common CMake definitions](maintainers/vcpkg_common_definitions.md)
- [Maintainer Guidelines](maintainers/maintainer-guide.md)
- [Creating Registries](maintainers/registries.md)
- [CMake Guidelines](maintainers/cmake-guidelines.md)

### [Vcpkg-Tool](https://github.com/microsoft/vcpkg-tool) Maintainer Help

Expand Down
27 changes: 15 additions & 12 deletions docs/examples/versioning.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Create a folder with the following files:
"dependencies": [
{
"name": "fmt",
"version>=": "7.1.3"
"version>=": "7.1.3#1"
},
"zlib"
],
"builtin-baseline": "b60f003ccf5fe8613d029f49f835c8929a66eb61"
"builtin-baseline": "3426db05b996481ca31e95fff3734cf23e0f51bc"
}
```

Expand Down Expand Up @@ -69,8 +69,10 @@ PS D:\versions-test\build> cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/script
-- Running vcpkg install
Detecting compiler hash for triplet x86-windows...
The following packages will be built and installed:
fmt[core]:x86-windows -> 7.1.3 -- D:\vcpkg\buildtrees\versioning\versions\fmt\dd8cf5e1a2dce2680189a0744102d4b0f1cfb8b6
zlib[core]:x86-windows -> 1.2.11#9 -- D:\vcpkg\buildtrees\versioning\versions\zlib\827111046e37c98153d9d82bb6fa4183b6d728e4
fmt[core]:x64-windows -> 7.1.3#1 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\fmt\4f8427eb0bd40da1856d4e67bde39a4fda689d72
vcpkg-cmake[core]:x64-windows -> 2021-02-26 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\vcpkg-cmake\51896aa8073adb5c8450daa423d03eedf0dfc61f
vcpkg-cmake-config[core]:x64-windows -> 2021-02-26 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\vcpkg-cmake-config\d255b3d566a8861dcc99a958240463e678528066
zlib[core]:x64-windows -> 1.2.11#9 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\zlib\827111046e37c98153d9d82bb6fa4183b6d728e4
...
```

Expand All @@ -90,7 +92,8 @@ zlib version is 1.2.11
Take a look at the output:

```
fmt[core]:x86-windows -> 7.1.3 -- D:\vcpkg\buildtrees\versioning\versions\fmt\dd8cf5e1a2dce2680189a0744102d4b0f1cfb8b6
fmt[core]:x86-windows -> 7.1.3#1 -- D:\vcpkg\buildtrees\versioning\versions\fmt\4f8427eb0bd40da1856d4e67bde39a4fda689d72
...
zlib[core]:x86-windows -> 1.2.11#9 -- D:\vcpkg\buildtrees\versioning\versions\zlib\827111046e37c98153d9d82bb6fa4183b6d728e4
```

Expand Down Expand Up @@ -130,23 +133,23 @@ Version scheme | Description
}
```

This property is used to express minimum version constraints, it is allowed only as part of the `"dependencies"` declarations. In our example we set an explicit constraint on version `7.1.3` of `fmt`.
This property is used to express minimum version constraints, it is allowed only as part of the `"dependencies"` declarations. In our example we set an explicit constraint on version `7.1.3#1` of `fmt`.

Vcpkg is allowed to upgrade this constraint if a transitive dependency requires a newer version. For example, if `zlib` were to declare a dependency on `fmt` version `7.1.4` then vcpkg would install `7.1.4` instead.

Vcpkg uses a minimum version approach, in our example, even if `fmt` version `8.0.0` were to be released, vcpkg would still install version `7.1.3` as that is the minimum version that satisfies the constraint. The advantages of this approach are that you don't get unexpected dependency upgrades when you update vcpkg and you get reproducible builds (in terms of version used) as long as you use the same manifest.
Vcpkg uses a minimum version approach, in our example, even if `fmt` version `8.0.0` were to be released, vcpkg would still install version `7.1.3#1` as that is the minimum version that satisfies the constraint. The advantages of this approach are that you don't get unexpected dependency upgrades when you update vcpkg and you get reproducible builds (in terms of version used) as long as you use the same manifest.

If you want to upgrade your dependencies, you can bump the minimum version constraint or use a newer baseline.

#### **`builtin-baseline`**

```json
{ "builtin-baseline": "b60f003ccf5fe8613d029f49f835c8929a66eb61" }
{ "builtin-baseline": "3426db05b996481ca31e95fff3734cf23e0f51bc" }
```

This field declares the versioning baseline for all ports. Setting a baseline is required to enable versioning, otherwise you will get the current versions on the ports directory. You can run 'git rev-parse HEAD' to get the current commit of vcpkg and set it as the builtin-baseline. See the [`builtin-baseline` documentation](../users/versioning.md#builtin-baseline) for more information.

In our example, you can notice that we do not declare a version constraint for `zlib`; instead, the version is taken from the baseline. Internally, vcpkg will look in commit `b60f003ccf5fe8613d029f49f835c8929a66eb61` to find out what version of `zlib` was the latest at that point in time (in our case it was `1.2.11#9`).
In our example, you can notice that we do not declare a version constraint for `zlib`; instead, the version is taken from the baseline. Internally, vcpkg will look in commit `3426db05b996481ca31e95fff3734cf23e0f51bc` to find out what version of `zlib` was the latest at that point in time (in our case it was `1.2.11#9`).

During version resolution, baseline versions are treated as minimum version constraints. If you declare an explicit constraint that is lower than a baseline version, the explicit constraint will be upgraded to the baseline version.

Expand All @@ -155,7 +158,7 @@ For example, if we modified our dependencies like this:
{ "dependencies": [
{
"name": "fmt",
"version>=": "7.1.3"
"version>=": "7.1.3#1"
},
{
"name": "zlib",
Expand Down Expand Up @@ -187,14 +190,14 @@ Let's modify our example once more, this time to force vcpkg to use version `6.0
"dependencies": [
{
"name": "fmt",
"version>=": "7.1.3"
"version>=": "7.1.3#1"
},
{
"name": "zlib",
"version>=": "1.2.11#7"
}
],
"builtin-baseline": "b60f003ccf5fe8613d029f49f835c8929a66eb61",
"builtin-baseline": "3426db05b996481ca31e95fff3734cf23e0f51bc",
"overrides": [
{
"name": "fmt",
Expand Down
127 changes: 127 additions & 0 deletions docs/maintainers/cmake-guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# CMake Guidelines

We expect that all CMake scripts that are either:

- In the `scripts/` directory, or
- In a `vcpkg-*` port

should follow the guidelines laid out in this document.
Existing scripts may not follow these guidelines yet;
it is expected that we will continue to update old scripts
to fall in line with these guidelines.

These guidelines are intended to create stability in our scripts.
We hope that they will make both forwards and backwards compatibility easier.

## The Guidelines

- Except for out-parameters, we always use `cmake_parse_arguments()`
rather than function parameters or referring to `${ARG<N>}`.
- This doesn't necessarily need to be followed for "script-local helper functions"
- In this case, positional parameters should be put in the function
declaration (rather than using `${ARG<N>}`),
and should be named according to local rules (i.e. `snake_case`).
- Exception: positional parameters that are optional should be
given a name via `set(argument_name "${ARG<N>}")`, after checking `ARGC`.
- Out-parameters should be the first parameter to a function. Example:
```cmake
function(format out_var)
cmake_parse_arguments(PARSE_ARGV 1 "arg" ...)
# ... set(buffer "output")
set("${out_var}" "${buffer}" PARENT_SCOPE)
endfunction()
```
- There are no unparsed or unused arguments.
Always check for `ARGN` or `arg_UNPARSED_ARGUMENTS`.
`FATAL_ERROR` when possible, `WARNING` if necessary for backwards compatibility.
- All `cmake_parse_arguments` must use `PARSE_ARGV`.
- All `foreach` loops must use `IN LISTS` and `IN ITEMS`.
- The variables `${ARGV}` and `${ARGN}` are unreferenced,
except in helpful messages to the user.
- (i.e., `message(FATAL_ERROR "blah was passed extra arguments: ${ARGN}")`)
- We always use functions, not macros or top level code.
- Exception: "script-local helper macros". It is sometimes helpful to define a small macro.
This should be done sparingly, and functions should be preferred.
- Exception: `vcpkg.cmake`'s `find_package`.
- Scripts in the scripts tree should not be expected to need observable changes
as part of normal operation.
- Example violation: `vcpkg_acquire_msys()` has hard-coded packages and versions that need updating over time due to the MSYS project dropping old packages.
- Example exception: `vcpkg_from_sourceforge()` has a list of mirrors which needs maintenance but does not have an observable behavior impact on the callers.
- All variable expansions are in quotes `""`,
except those which are intended to be passed as multiple arguments.
- Example:
```cmake
set(working_directory "")
if(DEFINED arg_WORKING_DIRECTORY)
set(working_directory "WORKING_DIRECTORY" "${arg_WORKING_DIRECTORY}")
endif()
# calls do_the_thing() if NOT DEFINED arg_WORKING_DIRECTORY,
# else calls do_the_thing(WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}")
do_the_thing(${working_directory})
```
- There are no "pointer" or "in-out" parameters
(where a user passes a variable name rather than the contents),
except for simple out-parameters.
- Variables are not assumed to be empty.
If the variable is intended to be used locally,
it must be explicitly initialized to empty with `set(foo "")`.
- All variables expected to be inherited from the parent scope across an API boundary (i.e. not a file-local function) should be documented. Note that all variables mentioned in triplets.md are considered documented.
- Out parameters are only set in `PARENT_SCOPE` and are never read.
See also the helper `z_vcpkg_forward_output_variable()` to forward out parameters through a function scope.
- `CACHE` variables are used only for global variables which are shared internally among strongly coupled
functions and for internal state within a single function to avoid duplicating work.
These should be used extremely sparingly and should use the `Z_VCPKG_` prefix to avoid
colliding with any local variables that would be defined by any other code.
- Examples:
- `vcpkg_cmake_configure`'s `Z_VCPKG_CMAKE_GENERATOR`
- `z_vcpkg_get_cmake_vars`'s `Z_VCPKG_GET_CMAKE_VARS_FILE`
- `include()`s are only allowed in `ports.cmake` or `vcpkg-port-config.cmake`.
- `foreach(RANGE)`'s arguments _must always be_ natural numbers,
and `<start>` _must always be_ less than or equal to `<stop>`.
- This must be checked by something like:
```cmake
if(start LESS_EQUAL end)
foreach(RANGE start end)
...
endforeach()
endif()
```
- All port-based scripts must use `include_guard(GLOBAL)`
to avoid being included multiple times.
- `set(var)` should not be used. Use `unset(var)` to unset a variable,
and `set(var "")` to set it to the empty value. _Note: this works for use as a list and as a string_

### CMake Versions to Require

- All CMake scripts, except for `vcpkg.cmake`,
may assume the version of CMake that is present in the
`cmake_minimum_required` of `ports.cmake`.
- This `cmake_minimum_required` should be bumped every time a new version
of CMake is added to `vcpkgTools.xml`, as should the
`cmake_minimum_required` in all of the helper `CMakeLists.txt` files.
- `vcpkg.cmake` must assume a version of CMake back to 3.1 in general
- Specific functions and options may assume a greater CMake version;
if they do, make sure to comment that function or option
with the required CMake version.


### Changing Existing Functions

- Never remove arguments in non-internal functions;
if they should no longer do anything, just take them as normal and warn on use.
- Never add a new mandatory argument.

### Naming Variables

- `cmake_parse_arguments`: set prefix to `"arg"`
- Local variables are named with `snake_case`
- Internal global variable names are prefixed with `Z_VCPKG_`.
- External experimental global variable names are prefixed with `X_VCPKG_`.

- Internal functions are prefixed with `z_vcpkg_`
- Functions which are internal to a single function (i.e., helper functions)
are named `[z_]<func>_<name>`, where `<func>` is the name of the function they are
a helper to, and `<name>` is what the helper function does.
- `z_` should be added to the front if `<func>` doesn't have a `z_`,
but don't name a helper function `z_z_foo_bar`.
- Public global variables are named `VCPKG_`.
38 changes: 38 additions & 0 deletions docs/maintainers/internal/z_vcpkg_forward_output_variable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# z_vcpkg_forward_output_variable

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

This macro helps with forwarding values from inner function calls,
through a local function scope, into pointer out parameters.

```cmake
z_vcpkg_forward_output_variable(ptr_to_parent_var var_to_forward)
```

is equivalent to

```cmake
if(DEFINED ptr_to_parent_var)
if(DEFINED value_var)
set("${ptr_to_parent_var}" "${value_var}" PARENT_SCOPE)
else()
unset("${ptr_to_parent_var}" PARENT_SCOPE)
endif()
endif()
```

Take note that the first argument should be a local variable that has a value of the parent variable name.
Most commonly, this local is the result of a pointer-out parameter to a function.
If the variable in the first parameter is not defined, this function does nothing,
simplifying functions with optional out parameters.
Most commonly, this should be used in cases like:

```cmake
function(my_function out_var)
file(SHA512 "somefile.txt" local_var)
z_vcpkg_forward_output_variable(out_var local_var)
endfunction()
```

## Source
[scripts/cmake/z\_vcpkg\_forward\_output\_variable.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/z_vcpkg_forward_output_variable.cmake)
2 changes: 2 additions & 0 deletions docs/maintainers/portfile-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@
- [vcpkg\_install\_msbuild](vcpkg_install_msbuild.md)
- [vcpkg\_install\_nmake](vcpkg_install_nmake.md)
- [vcpkg\_install\_qmake](vcpkg_install_qmake.md)
- [vcpkg\_list](vcpkg_list.md)
- [vcpkg\_minimum\_required](vcpkg_minimum_required.md)
- [vcpkg\_replace\_string](vcpkg_replace_string.md)

## Internal Functions

- [vcpkg\_internal\_get\_cmake\_vars](internal/vcpkg_internal_get_cmake_vars.md)
- [z\_vcpkg\_apply\_patches](internal/z_vcpkg_apply_patches.md)
- [z\_vcpkg\_forward\_output\_variable](internal/z_vcpkg_forward_output_variable.md)
- [z\_vcpkg\_function\_arguments](internal/z_vcpkg_function_arguments.md)
- [z\_vcpkg\_prettify\_command\_line](internal/z_vcpkg_prettify_command_line.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Additionally corrects common issues with targets, such as absolute paths and inc
vcpkg_cmake_config_fixup(
[PACKAGE_NAME <name>]
[CONFIG_PATH <config-directory>]
[DO_NOT_DELETE_CONFIG_PATH_PARENT]
[DO_NOT_DELETE_PARENT_CONFIG_PATH]
[NO_PREFIX_CORRECTION]
)
```
Expand Down
7 changes: 7 additions & 0 deletions docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ vcpkg_cmake_configure(
<configure-setting>...]
[OPTIONS_DEBUG
<configure-setting>...]
[MAYBE_UNUSED_VARIABLES
<variable-name>...]
)
```

Expand Down Expand Up @@ -56,6 +58,11 @@ By default, this function adds flags to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`
which set the default character set to utf-8 for MSVC.
If the library sets its own code page, pass the `NO_CHARSET_FLAG` option.

This function makes certain that all options passed in are used by the
underlying CMake build system. If there are options that might be unused,
perhaps on certain platforms, pass those variable names to
`MAYBE_UNUSED_VARIABLES`.

`LOGFILE_BASE` is used to set the base of the logfile names;
by default, this is `config`, and thus the logfiles end up being something like
`config-x86-windows-dbg.log`. You can set it to anything you like;
Expand Down
2 changes: 1 addition & 1 deletion docs/maintainers/vcpkg_clean_msbuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vcpkg_clean_msbuild()

## Examples

* [xalan-c](https://github.com/Microsoft/vcpkg/blob/master/ports/xalan-c/portfile.cmake)
* [python3](https://github.com/Microsoft/vcpkg/blob/master/ports/python3/portfile.cmake)

## Source
[scripts/cmake/vcpkg\_clean\_msbuild.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_clean_msbuild.cmake)
4 changes: 4 additions & 0 deletions docs/maintainers/vcpkg_configure_cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ vcpkg_configure_cmake(
[OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
[OPTIONS_RELEASE <-DOPTIMIZE=1>...]
[OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
[MAYBE_UNUSED_VARIABLES <option-name>...]
)
```

Expand Down Expand Up @@ -55,6 +56,9 @@ Additional options passed to CMake during the Release configuration. These are i
### OPTIONS_DEBUG
Additional options passed to CMake during the Debug configuration. These are in addition to `OPTIONS`.

### MAYBE_UNUSED_VARIABLES
Any CMake variables which are explicitly passed in, but which may not be used on all platforms.

### LOGNAME
Name of the log to write the output of the configure call to.

Expand Down
6 changes: 6 additions & 0 deletions docs/maintainers/vcpkg_download_distfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ vcpkg_download_distfile(
URLS <http://mainUrl> <http://mirror1>...
FILENAME <output.zip>
SHA512 <5981de...>
[ALWAYS_REDOWNLOAD]
)
```
## Parameters
Expand All @@ -38,6 +39,11 @@ Skip SHA512 hash check for file.

This switch is only valid when building with the `--head` command line flag.

### ALWAYS_REDOWNLOAD
Avoid caching; this is a REST call or otherwise unstable.

Requires `SKIP_SHA512`.

### HEADERS
A list of headers to append to the download request. This can be used for authentication during a download.

Expand Down
Loading

0 comments on commit 5ea1f4c

Please sign in to comment.