mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 01:30:55 +08:00
[vcpkg] Download vcpkg.exe rather than building it in bootstrap on Windows. (#15474)
This reduces bootstrap cost for Windows customers, resolving the issue initially submitted as #12502 . The `toolsrc` tree was extracted to https://github.com/microsoft/vcpkg-tool. `bootstrap.sh` was changed to download the right source tarball, extract, and build it. This was chosen over the previous attempt, a submodule, over concerns of accidentally destroying people's local modifications.
This commit is contained in:
parent
f226416d2e
commit
aa60b7efa5
9
.gitignore
vendored
9
.gitignore
vendored
@ -11,8 +11,6 @@
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
toolsrc/out*
|
||||
toolsrc/CMakeSettings.json
|
||||
# fuzzing
|
||||
sync_dir*
|
||||
|
||||
@ -30,8 +28,6 @@ bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
# VS Code build
|
||||
toolsrc/build
|
||||
# Ignore the executable
|
||||
/vcpkg
|
||||
/vcpkg.exe
|
||||
@ -290,11 +286,6 @@ __pycache__/
|
||||
/installed*/
|
||||
/packages/
|
||||
/scripts/buildsystems/tmp/
|
||||
/toolsrc/build.rel/
|
||||
/toolsrc/windows-bootstrap/msbuild.x86.debug/
|
||||
/toolsrc/windows-bootstrap/msbuild.x86.release/
|
||||
/toolsrc/windows-bootstrap/msbuild.x64.debug/
|
||||
/toolsrc/windows-bootstrap/msbuild.x64.release/
|
||||
#ignore custom triplets
|
||||
/triplets/*
|
||||
#add vcpkg-designed triplets back in
|
||||
|
@ -41,7 +41,7 @@ We collect various telemetry events such as the command line used, the time of i
|
||||
|
||||
You can see the telemetry events any command by appending `--printmetrics` after the vcpkg command line.
|
||||
|
||||
In the source code (included in `toolsrc\`), you can search for calls to the functions `track_property()`, `track_feature()`, `track_metric()`, and `track_buildtime()`
|
||||
In the source code (included at https://github.com/microsoft/vcpkg-tool/ ), you can search for calls to the functions `track_property()`, `track_feature()`, `track_metric()`, and `track_buildtime()`
|
||||
to see every specific data point we collect.
|
||||
|
||||
## Avoid inadvertent disclosure information
|
||||
|
@ -1,195 +0,0 @@
|
||||
# Benchmarking
|
||||
|
||||
Benchmarking new code against old code is extremely important whenever making
|
||||
large changes to how something works. If you are attempting to make something
|
||||
faster, and you end up slowing it down, you'll never know if you don't
|
||||
benchmark! We have benchmarks in the `toolsrc/src/vcpkg-test` directory, just
|
||||
like the tests -- they're treated as a special kind of test.
|
||||
|
||||
## Running Benchmarks
|
||||
|
||||
Unlike normal tests, benchmarks are hidden behind a special define -- `CATCH_CONFIG_ENABLE_BENCHMARKING` -- so that you never try to run benchmarks
|
||||
unless you specifically want to. This is because benchmarks actually take quite
|
||||
a long time! However, if you want to run benchmarks (and I recommend running
|
||||
only specific benchmarks at a time), you can do so by passing the
|
||||
`VCPKG_ENABLE_BENCHMARKING` option at cmake configure time.
|
||||
|
||||
```sh
|
||||
$ cmake -B toolsrc/out -S toolsrc -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DVCPKG_BUILD_BENCHMARKING=On
|
||||
|
||||
-- The C compiler identification is MSVC 19.22.27905.0
|
||||
-- The CXX compiler identification is MSVC 19.22.27905.0
|
||||
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe
|
||||
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe -- works
|
||||
-- Detecting C compiler ABI info
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Detecting C compile features
|
||||
-- Detecting C compile features - done
|
||||
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe
|
||||
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe -- works
|
||||
-- Detecting CXX compiler ABI info
|
||||
-- Detecting CXX compiler ABI info - done
|
||||
-- Detecting CXX compile features
|
||||
-- Detecting CXX compile features - done
|
||||
-- Looking for pthread.h
|
||||
-- Looking for pthread.h - not found
|
||||
-- Found Threads: TRUE
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: C:/Users/t-nimaz/src/vcpkg/toolsrc/out
|
||||
|
||||
$ cmake --build toolsrc/out
|
||||
|
||||
[0/2] Re-checking globbed directories...
|
||||
[80/80] Linking CXX executable vcpkg-test.exe
|
||||
```
|
||||
|
||||
You can then run benchmarks easily with the following command (which run the
|
||||
files benchmarks):
|
||||
|
||||
```sh
|
||||
$ ./toolsrc/out/vcpkg-test [!benchmark][file]
|
||||
```
|
||||
|
||||
You can switch out `[file]` for a different set -- `[hash]`, for example.
|
||||
|
||||
## Writing Benchmarks
|
||||
|
||||
First, before anything else, I recommend reading the
|
||||
[benchmarking documentation] at Catch2's repository.
|
||||
|
||||
Now, after that, let's say that you wanted to benchmark, say, our ASCII
|
||||
case-insensitive string compare against your new implementation. We place
|
||||
benchmarks for code in the same file as their tests, so open
|
||||
`vcpkg-test/strings.cpp`, and add the following at the bottom:
|
||||
|
||||
```cpp
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
TEST_CASE ("case insensitive ascii equals: benchmark", "[strings][!benchmark]")
|
||||
{
|
||||
BENCHMARK("qwertyuiop") {
|
||||
return vcpkg::Strings::case_insensitive_ascii_equals("qwertyuiop", "QWERTYUIOP");
|
||||
};
|
||||
}
|
||||
#endif
|
||||
```
|
||||
|
||||
Remember the `;` at the end of the benchmark -- it's not required for
|
||||
`TEST_CASE`s, but is for `BENCHMARK`s.
|
||||
|
||||
Now, let's rebuild and run:
|
||||
|
||||
```sh
|
||||
$ cmake --build toolsrc/out
|
||||
[0/2] Re-checking globbed directories...
|
||||
[2/2] Linking CXX executable vcpkg-test.exe
|
||||
$ ./toolsrc/out/vcpkg-test [strings][!benchmark]
|
||||
Filters: [strings][!benchmark]
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
vcpkg-test.exe is a Catch v2.9.1 host application.
|
||||
Run with -? for options
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
case insensitive ascii equals: benchmark
|
||||
-------------------------------------------------------------------------------
|
||||
C:\Users\t-nimaz\src\vcpkg\toolsrc\src\vcpkg-test\strings.cpp(36)
|
||||
...............................................................................
|
||||
|
||||
benchmark name samples iterations estimated
|
||||
mean low mean high mean
|
||||
std dev low std dev high std dev
|
||||
-------------------------------------------------------------------------------
|
||||
qwertyuiop 100 2088 3.9672 ms
|
||||
25 ns 24 ns 26 ns
|
||||
6 ns 5 ns 8 ns
|
||||
|
||||
|
||||
===============================================================================
|
||||
test cases: 1 | 1 passed
|
||||
assertions: - none -
|
||||
```
|
||||
|
||||
You've now written your first benchmark!
|
||||
|
||||
But wait. This seems kind of silly. Benchmarking the comparison of literal
|
||||
strings is great and all, but could we make it a little more realistic?
|
||||
|
||||
This is where `BENCHMARK_ADVANCED` comes in. `BENCHMARK_ADVANCED` allows one to
|
||||
write a benchmark that has a little setup to it without screwing up the numbers.
|
||||
Let's try it now:
|
||||
|
||||
```cpp
|
||||
TEST_CASE ("case insensitive ascii equals: benchmark", "[strings][!benchmark]")
|
||||
{
|
||||
BENCHMARK_ADVANCED("equal strings")(Catch::Benchmark::Chronometer meter)
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
strings.resize(meter.runs());
|
||||
std::mt19937_64 urbg;
|
||||
std::uniform_int_distribution<std::uint64_t> data_generator;
|
||||
|
||||
std::generate(strings.begin(), strings.end(), [&] {
|
||||
std::string result;
|
||||
for (std::size_t i = 0; i < 1000; ++i)
|
||||
{
|
||||
result += vcpkg::Strings::b32_encode(data_generator(urbg));
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
meter.measure(
|
||||
[&](int run) { return vcpkg::Strings::case_insensitive_ascii_equals(strings[run], strings[run]); });
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Then, run it again!
|
||||
|
||||
```sh
|
||||
$ cmake --build toolsrc/out
|
||||
[0/2] Re-checking globbed directories...
|
||||
[2/2] Linking CXX executable vcpkg-test.exe
|
||||
$ toolsrc/out/vcpkg-test [strings][!benchmark]
|
||||
Filters: [strings][!benchmark]
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
vcpkg-test.exe is a Catch v2.9.1 host application.
|
||||
Run with -? for options
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
case insensitive ascii equals: benchmark
|
||||
-------------------------------------------------------------------------------
|
||||
C:\Users\t-nimaz\src\vcpkg\toolsrc\src\vcpkg-test\strings.cpp(36)
|
||||
...............................................................................
|
||||
|
||||
benchmark name samples iterations estimated
|
||||
mean low mean high mean
|
||||
std dev low std dev high std dev
|
||||
-------------------------------------------------------------------------------
|
||||
equal strings 100 2 5.4806 ms
|
||||
22.098 us 21.569 us 23.295 us
|
||||
3.842 us 2.115 us 7.41 us
|
||||
|
||||
|
||||
===============================================================================
|
||||
test cases: 1 | 1 passed
|
||||
assertions: - none -
|
||||
```
|
||||
|
||||
And now you have a working benchmark to test the speed of the existing code, and
|
||||
of new code!
|
||||
|
||||
If you're writing a lot of benchmarks that follow the same sort of pattern, with
|
||||
some differences in constants, look into `vcpkg-test/files.cpp`'s benchmarks --
|
||||
there are a lot of things one can do to make writing new benchmarks really easy.
|
||||
|
||||
If you wish to add a benchmark for a piece of code that has not yet been tested,
|
||||
please read the [testing documentation], and please write some unit tests.
|
||||
The speed of your code isn't very important if it doesn't work at all!
|
||||
|
||||
[benchmarking documentation]: https://github.com/catchorg/Catch2/blob/master/docs/benchmarks.md#top
|
||||
[testing documentation]: ./testing.md#adding-new-test-files
|
@ -1,74 +0,0 @@
|
||||
# Layout of the vcpkg source tree
|
||||
|
||||
All vcpkg sources and build systems are in `toolsrc`. If you'd like to
|
||||
contribute to the vcpkg tool itself, most of your time will be spent in here.
|
||||
|
||||
## Build Files
|
||||
|
||||
These are the files used to build and configure the project. In order to build
|
||||
with CMake, the only files you should be interested in are `CMakeLists.txt`, and
|
||||
`.clang-format`; in order to build with msbuild or the Visual Studio IDE, you
|
||||
will be interested in `dirs.proj` or `vcpkg.sln`. However, if you add or remove
|
||||
files, you will need to edit the MSBuild project files in the `vcpkg*`
|
||||
directories no matter what system you use.
|
||||
|
||||
### Top Level
|
||||
|
||||
We have six files in this directory -- one `.clang-format` file, one
|
||||
`CMakeLists.txt` file, three Visual Studio files, and `VERSION.txt`.
|
||||
|
||||
- `.clang-format`: This is where we store the formatting settings of the
|
||||
project. If you want to format the project, you can use the `format` target
|
||||
with the CMake build system.
|
||||
- `CMakeLists.txt`: This is where the CMake build system definition lives. If
|
||||
you want to modify how one builds the project, or add a target, you can do
|
||||
it here.
|
||||
- `VERSION.txt`: This is a file which tells `vcpkg` to tell the user to
|
||||
rebuild. If this version is different from the version when the user built
|
||||
the binary (for example, after a `git pull` or a `vcpkg update`), then
|
||||
`vcpkg` will print a message to re-bootstrap. This is updated whenever major
|
||||
changes are made to the `vcpkg` tool.
|
||||
- The Visual Studio files:
|
||||
- `vcpkg.natvis`: NATVIS files allow one to visualize objects of user
|
||||
defined type in the debugger -- this one contains the definitions for
|
||||
`vcpkg`'s types.
|
||||
- `dirs.proj`: This is how one builds with `msbuild` without calling into
|
||||
the IDE.
|
||||
- `vcpkg.sln`: The solution file is how one opens the project in the VS IDE.
|
||||
|
||||
## Source Files
|
||||
|
||||
If you're modifying the project, it's likely that these are the directories that
|
||||
you're going to deal with.
|
||||
|
||||
### `include`
|
||||
|
||||
There's one file in here -- `pch.h`. This contains most of the C++ standard
|
||||
library, and acts as a [precompiled header]. You can read more at the link.
|
||||
|
||||
There are three directories:
|
||||
|
||||
- `catch2` -- This contains the single-header library [catch2]. We use this
|
||||
library for both [testing] and [benchmarking].
|
||||
- `vcpkg` -- This contains the header files for the `vcpkg` project. All of
|
||||
the interfaces for building, installing, and generally "port stuff" live
|
||||
here.
|
||||
- `vcpkg/base` -- This contains the interfaces for the
|
||||
"vcpkg standard library" -- file handling, hashing, strings,
|
||||
`Span<T>`, printing, etc.
|
||||
- `vcpkg-test` -- This contains the interfaces for any common utilities
|
||||
required by the tests.
|
||||
|
||||
### `src`
|
||||
|
||||
The source files live here. `pch.cpp` is the source file for the
|
||||
[precompiled header]; `vcpkg.cpp` is where the `vcpkg` binary lives.
|
||||
|
||||
The interesting files live in the `vcpkg` and `vcpkg-test` directories. In
|
||||
`vcpkg`, you have the implementation for the interfaces that live in
|
||||
`include/vcpkg`; and in `vcpkg-test`, you have the tests and benchmarks.
|
||||
|
||||
[precompiled header]: https://en.wikipedia.org/wiki/Precompiled_header
|
||||
[catch2]: https://github.com/catchorg/Catch2
|
||||
[testing]: ./testing.md
|
||||
[benchmarking]: ./benchmarking.md
|
@ -1,152 +0,0 @@
|
||||
# Testing
|
||||
|
||||
Testing vcpkg is important whenever one makes changes to the tool itself, and
|
||||
writing new tests and keeping them up to date is also very important. If one's
|
||||
code is subtly broken, we'd rather find it out right away than a few weeks down
|
||||
the line when someone complains!
|
||||
|
||||
## Running Tests
|
||||
|
||||
Before anything else, we should know whether you can actually run the tests!
|
||||
All you should need is a way to build vcpkg -- anything will do! All you have to
|
||||
do is follow the guide 😄
|
||||
|
||||
With `$VCPKG_DIRECTORY` being the directory where you have cloned vcpkg, create
|
||||
a build directory in `$VCPKG_DIRECTORY/toolsrc` (commonly named `out`), and
|
||||
`cd` into it. Make sure to clean it out if it already exists!
|
||||
|
||||
```sh
|
||||
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -G Ninja
|
||||
$ cmake --build .
|
||||
$ ./vcpkg-test # ./vcpkg-test [$SPECIFIC_TEST] for a specific set of tests
|
||||
$ # i.e., ./vcpkg-test [arguments]
|
||||
```
|
||||
|
||||
If you make any modifications to `vcpkg`, you'll have to do the
|
||||
`cmake --build .` step again.
|
||||
|
||||
## Writing Tests
|
||||
|
||||
In your journey to write new tests, and to modify existing tests, reading the
|
||||
[Catch2 documentation] will be very helpful! Come back after reading those 😀
|
||||
|
||||
You'll want to place your tests in one of the existing files, or, if it doesn't
|
||||
belong in any of those, in a [new file](#adding-new-test-files).
|
||||
|
||||
The layout of these tests is as follows:
|
||||
|
||||
```cpp
|
||||
// ... includes
|
||||
|
||||
TEST_CASE("Name of test", "[filename without the .cpp]") {
|
||||
// setup and the like
|
||||
REQUIRE(some boolean expression);
|
||||
}
|
||||
|
||||
// etc.
|
||||
```
|
||||
|
||||
You want to give these test cases good, descriptive, unique names, like
|
||||
`SourceParagraph construct minimum` -- it doesn't need to be extremely clear
|
||||
english, and shorthand is good, but make sure it's clear what the test is from
|
||||
the name. For the latter parameter, known as "tags", you should at least put the
|
||||
name of the file which the test case is in -- e.g., in `arguments.cpp`, you'd
|
||||
tag all of the test cases with `[arguments]`.
|
||||
|
||||
If you wish to add helper functions, make sure to place them in an anonymous
|
||||
namespace -- this will ensure that they don't trample over anybody else's
|
||||
space. Additionally, there are a few helper functions that live in
|
||||
`<vcpkg-test/util.h>` and `src/vcpkg-test/util.cpp` -- make sure to look into
|
||||
them so that you're not rewriting functionality.
|
||||
|
||||
That should be all you need to know to start writing your own tests!
|
||||
Remember to check out the [Catch2 documentation]
|
||||
if you'd like to get more advanced with your tests,
|
||||
and good luck on your testing journey!
|
||||
|
||||
## Adding New Test Files
|
||||
|
||||
Adding new test files should be easy and straightforward. All it requires is
|
||||
creating a new source file in `toolsrc/src/vcpkg-test`.
|
||||
|
||||
### Example
|
||||
|
||||
Let's try writing a new test file called `example` (very creative, I know).
|
||||
|
||||
First, we should create a file, `example.cpp`, in `toolsrc/src/vcpkg-test`:
|
||||
|
||||
```cpp
|
||||
// vcpkg-test/example.cpp
|
||||
#include <catch2/catch.hpp>
|
||||
```
|
||||
|
||||
This is the minimum file needed for tests; let's rebuild!
|
||||
|
||||
```sh
|
||||
$ cmake --build .
|
||||
[80/80] Linking CXX executable vcpkg.exe
|
||||
```
|
||||
|
||||
Okay, now let's make sure this worked; add a test case to `example.cpp`:
|
||||
|
||||
```cpp
|
||||
TEST_CASE("Example 1 - fail", "[example]") {
|
||||
REQUIRE(false);
|
||||
}
|
||||
```
|
||||
|
||||
Now build the tests again, and run them:
|
||||
|
||||
```sh
|
||||
$ cmake --build .
|
||||
[2/2] Linking CXX executable vcpkg-test.exe
|
||||
$ ./vcpkg-test
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
vcpkg-test.exe is a Catch v2.9.1 host application.
|
||||
Run with -? for options
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Example 1 - fail
|
||||
-------------------------------------------------------------------------------
|
||||
$VCPKG_DIRECTORY/toolsrc/src/vcpkg-test/example.cpp(3)
|
||||
...............................................................................
|
||||
|
||||
$VCPKG_DIRECTORY/toolsrc/src/vcpkg-test/example.cpp(14): FAILED:
|
||||
REQUIRE( false )
|
||||
|
||||
===============================================================================
|
||||
test cases: 102 | 101 passed | 1 failed
|
||||
assertions: 3611 | 3610 passed | 1 failed
|
||||
```
|
||||
|
||||
Hopefully, that worked! It should compile correctly, and have one failing test.
|
||||
Now let's try a more complex test, after deleting the old one;
|
||||
|
||||
```cpp
|
||||
// add #include <vcpkg/base/strings.h> to the top of the file
|
||||
namespace Strings = vcpkg::Strings;
|
||||
|
||||
TEST_CASE("Example 2 - success", "[example]") {
|
||||
std::string hello = "Hello";
|
||||
REQUIRE(Strings::case_insensitive_ascii_equals(hello, "hELLo"));
|
||||
REQUIRE_FALSE(Strings::case_insensitive_ascii_starts_with(hello, "E"));
|
||||
}
|
||||
```
|
||||
|
||||
Now compile and build the tests, and this time let's only run our example tests:
|
||||
|
||||
```sh
|
||||
$ cmake --build .
|
||||
[2/2] Linking CXX executable vcpkg-test.exe
|
||||
$ ./vcpkg-test [example]
|
||||
Filters: [example]
|
||||
===============================================================================
|
||||
All tests passed (2 assertions in 1 test case)
|
||||
```
|
||||
|
||||
Hopefully you have one test running and succeeding! If you have that, you have
|
||||
succeeded at adding a new file to vcpkg's tests. Congratulations! Have fun on
|
||||
the rest of your journey 🐱👤😁
|
||||
|
||||
[Catch2 documentation]: https://github.com/catchorg/Catch2/blob/master/docs/tutorial.md#top
|
@ -1,63 +0,0 @@
|
||||
<#
|
||||
#>
|
||||
[CmdletBinding(PositionalBinding=$False)]
|
||||
Param(
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]$Commit,
|
||||
|
||||
[Parameter()]
|
||||
[string]$GithubRepository = "spdx/license-list-data",
|
||||
|
||||
[Parameter()]
|
||||
[string]$LicensesOutFile = "$PSScriptRoot/../toolsrc/src/vcpkg/spdx-licenses.inc",
|
||||
|
||||
[Parameter()]
|
||||
[string]$ExceptionsOutFile = "$PSScriptRoot/../toolsrc/src/vcpkg/spdx-exceptions.inc"
|
||||
)
|
||||
|
||||
function Transform-JsonFile {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$Uri,
|
||||
[string]$OutFile,
|
||||
[string]$OuterName,
|
||||
[string]$Id
|
||||
)
|
||||
|
||||
$req = Invoke-WebRequest -Uri $Uri
|
||||
|
||||
if ($req.StatusCode -ne 200)
|
||||
{
|
||||
Write-Error "Failed to GET $Uri"
|
||||
throw
|
||||
}
|
||||
|
||||
$json = $req.Content | ConvertFrom-Json -Depth 10
|
||||
Write-Verbose "Writing output to $OutFile"
|
||||
|
||||
$fileContent = @(
|
||||
"// Data downloaded from $Uri",
|
||||
"// Generated by scripts/Generate-SpdxLicenseList.ps1",
|
||||
"{")
|
||||
$json.$OuterName | ForEach-Object {
|
||||
$fileContent += " `"$($_.$Id)`","
|
||||
}
|
||||
$fileContent += "}"
|
||||
|
||||
$fileContent -join "`n" | Out-File -FilePath $OutFile -Encoding 'utf8'
|
||||
}
|
||||
|
||||
$baseUrl = "https://raw.githubusercontent.com/$GithubRepository/$Commit/json"
|
||||
Write-Verbose "Getting json files from $baseUrl"
|
||||
|
||||
Transform-JsonFile `
|
||||
-Uri "$baseUrl/licenses.json" `
|
||||
-OutFile $LicensesOutFile `
|
||||
-OuterName 'licenses' `
|
||||
-Id 'licenseId'
|
||||
|
||||
Transform-JsonFile `
|
||||
-Uri "$baseUrl/exceptions.json" `
|
||||
-OutFile $ExceptionsOutFile `
|
||||
-OuterName 'exceptions' `
|
||||
-Id 'licenseExceptionId'
|
@ -1,50 +0,0 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]$Root
|
||||
)
|
||||
|
||||
$Root = Resolve-Path -LiteralPath $Root
|
||||
|
||||
$clangFormat = Get-Command 'clang-format' -ErrorAction 'SilentlyContinue'
|
||||
if ($null -ne $clangFormat)
|
||||
{
|
||||
$clangFormat = $clangFormat.Source
|
||||
}
|
||||
|
||||
if ($IsWindows)
|
||||
{
|
||||
if ([String]::IsNullOrEmpty($clangFormat) -or -not (Test-Path $clangFormat))
|
||||
{
|
||||
$clangFormat = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin\clang-format.exe'
|
||||
}
|
||||
if (-not (Test-Path $clangFormat))
|
||||
{
|
||||
$clangFormat = 'C:\Program Files\LLVM\bin\clang-format.exe'
|
||||
}
|
||||
}
|
||||
|
||||
if ([String]::IsNullOrEmpty($clangFormat) -or -not (Test-Path $clangFormat))
|
||||
{
|
||||
Write-Error 'clang-format not found; is it installed?'
|
||||
throw
|
||||
}
|
||||
|
||||
$toolsrc = Get-Item "$Root/toolsrc"
|
||||
Push-Location $toolsrc
|
||||
|
||||
try
|
||||
{
|
||||
$files = Get-ChildItem -Recurse -LiteralPath "$toolsrc/src" -Filter '*.cpp'
|
||||
$files += Get-ChildItem -Recurse -LiteralPath "$toolsrc/src" -Filter '*.c'
|
||||
$files += Get-ChildItem -Recurse -LiteralPath "$toolsrc/include/vcpkg" -Filter '*.h'
|
||||
$files += Get-ChildItem -Recurse -LiteralPath "$toolsrc/include/vcpkg-test" -Filter '*.h'
|
||||
$files += Get-Item "$toolsrc/include/pch.h"
|
||||
$fileNames = $files.FullName
|
||||
|
||||
& $clangFormat -style=file -i @fileNames
|
||||
}
|
||||
finally
|
||||
{
|
||||
Pop-Location
|
||||
}
|
@ -20,12 +20,6 @@ stages:
|
||||
- name: DiffFile
|
||||
value: $(Build.ArtifactStagingDirectory)\format.diff
|
||||
steps:
|
||||
- task: Powershell@2
|
||||
displayName: 'Format C++'
|
||||
inputs:
|
||||
filePath: 'scripts/azure-pipelines/Format-CxxCode.ps1'
|
||||
arguments: '-Root .'
|
||||
pwsh: true
|
||||
- task: Powershell@2
|
||||
displayName: 'Generate Documentation'
|
||||
inputs:
|
||||
@ -33,18 +27,18 @@ stages:
|
||||
arguments: '-VcpkgRoot . -WarningAction Stop'
|
||||
pwsh: true
|
||||
- script: .\bootstrap-vcpkg.bat
|
||||
displayName: 'Build vcpkg'
|
||||
- script: '.\vcpkg format-manifest --all'
|
||||
displayName: 'Bootstrap vcpkg'
|
||||
- script: '.\vcpkg.exe format-manifest --all'
|
||||
displayName: 'Format Manifests'
|
||||
- task: Powershell@2
|
||||
displayName: 'Create Diff'
|
||||
inputs:
|
||||
filePath: scripts/azure-pipelines/Create-FormatDiff.ps1
|
||||
filePath: scripts/azure-pipelines/Create-PRDiff.ps1
|
||||
arguments: '-DiffFile $(DiffFile)'
|
||||
pwsh: true
|
||||
- task: PublishBuildArtifacts@1
|
||||
condition: failed()
|
||||
displayName: 'Publish C++ Diff'
|
||||
displayName: 'Publish Format and Documentation Diff'
|
||||
inputs:
|
||||
PathtoPublish: '$(DiffFile)'
|
||||
ArtifactName: 'format.diff'
|
||||
|
@ -1,24 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
# Test that prohibiting backcompat features actually prohibits
|
||||
$backcompatFeaturePorts = @('vcpkg-uses-test-cmake', 'vcpkg-uses-vcpkg-common-functions')
|
||||
foreach ($backcompatFeaturePort in $backcompatFeaturePorts) {
|
||||
$succeedArgs = $commonArgs + @('install',$backcompatFeaturePort,'--no-binarycaching')
|
||||
$failArgs = $succeedArgs + @('--x-prohibit-backcompat-features')
|
||||
$CurrentTest = "Should fail: ./vcpkg $($failArgs -join ' ')"
|
||||
Run-Vcpkg @failArgs
|
||||
if ($LastExitCode -ne 0) {
|
||||
Write-Host "... failed (this is good!)."
|
||||
} else {
|
||||
throw $CurrentTest
|
||||
}
|
||||
|
||||
# Install failed when prohibiting backcompat features, so it should succeed if we allow them
|
||||
$CurrentTest = "Should succeeed: ./vcpkg $($succeedArgs -join ' ')"
|
||||
Run-Vcpkg @succeedArgs
|
||||
if ($LastExitCode -ne 0) {
|
||||
throw $CurrentTest
|
||||
} else {
|
||||
Write-Host "... succeeded."
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
if ($IsLinux) {
|
||||
# The tests below need a mono installation not currently available on the Linux agents.
|
||||
return
|
||||
}
|
||||
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
# Test simple installation
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "rapidjson", "--binarycaching", "--x-binarysource=clear;files,$ArchiveRoot,write;nuget,$NuGetRoot,readwrite"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
|
||||
# Test simple removal
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("remove", "rapidjson"))
|
||||
Throw-IfFailed
|
||||
Require-FileNotExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
|
||||
# Test restoring from files archive
|
||||
Remove-Item -Recurse -Force $installRoot
|
||||
Remove-Item -Recurse -Force $buildtreesRoot
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install","rapidjson","--binarycaching","--x-binarysource=clear;files,$ArchiveRoot,read"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
Require-FileNotExists "$buildtreesRoot/rapidjson/src"
|
||||
Require-FileExists "$buildtreesRoot/detect_compiler"
|
||||
|
||||
# Test --no-binarycaching
|
||||
Remove-Item -Recurse -Force $installRoot
|
||||
Remove-Item -Recurse -Force $buildtreesRoot
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install","rapidjson","--no-binarycaching","--x-binarysource=clear;files,$ArchiveRoot,read"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
Require-FileExists "$buildtreesRoot/rapidjson/src"
|
||||
Require-FileExists "$buildtreesRoot/detect_compiler"
|
||||
|
||||
# Test --editable
|
||||
Remove-Item -Recurse -Force $installRoot
|
||||
Remove-Item -Recurse -Force $buildtreesRoot
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install","rapidjson","--editable","--x-binarysource=clear;files,$ArchiveRoot,read"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
Require-FileExists "$buildtreesRoot/rapidjson/src"
|
||||
Require-FileNotExists "$buildtreesRoot/detect_compiler"
|
||||
|
||||
# Test restoring from nuget
|
||||
Remove-Item -Recurse -Force $installRoot
|
||||
Remove-Item -Recurse -Force $buildtreesRoot
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "rapidjson", "--binarycaching", "--x-binarysource=clear;nuget,$NuGetRoot"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
Require-FileNotExists "$buildtreesRoot/rapidjson/src"
|
||||
|
||||
# Test four-phase flow
|
||||
Remove-Item -Recurse -Force $installRoot -ErrorAction SilentlyContinue
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "rapidjson", "--dry-run", "--x-write-nuget-packages-config=$TestingRoot/packages.config"))
|
||||
Throw-IfFailed
|
||||
Require-FileNotExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
Require-FileNotExists "$buildtreesRoot/rapidjson/src"
|
||||
Require-FileExists "$TestingRoot/packages.config"
|
||||
if ($IsLinux -or $IsMacOS) {
|
||||
mono $(./vcpkg fetch nuget) restore $TestingRoot/packages.config -OutputDirectory "$NuGetRoot2" -Source "$NuGetRoot"
|
||||
} else {
|
||||
& $(./vcpkg fetch nuget) restore $TestingRoot/packages.config -OutputDirectory "$NuGetRoot2" -Source "$NuGetRoot"
|
||||
}
|
||||
Throw-IfFailed
|
||||
Remove-Item -Recurse -Force $NuGetRoot -ErrorAction SilentlyContinue
|
||||
mkdir $NuGetRoot
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "rapidjson", "tinyxml", "--binarycaching", "--x-binarysource=clear;nuget,$NuGetRoot2;nuget,$NuGetRoot,write"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
Require-FileExists "$installRoot/$Triplet/include/tinyxml.h"
|
||||
Require-FileNotExists "$buildtreesRoot/rapidjson/src"
|
||||
Require-FileExists "$buildtreesRoot/tinyxml/src"
|
||||
if ((Get-ChildItem $NuGetRoot -Filter '*.nupkg' | Measure-Object).Count -ne 1) {
|
||||
throw "In '$CurrentTest': did not create exactly 1 NuGet package"
|
||||
}
|
||||
|
||||
# Test export
|
||||
$CurrentTest = 'Exporting'
|
||||
Require-FileNotExists "$TestingRoot/vcpkg-export-output"
|
||||
Require-FileNotExists "$TestingRoot/vcpkg-export.1.0.0.nupkg"
|
||||
Require-FileNotExists "$TestingRoot/vcpkg-export-output.zip"
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("export", "rapidjson", "tinyxml", "--nuget", "--nuget-id=vcpkg-export", "--nuget-version=1.0.0", "--output=vcpkg-export-output", "--raw", "--zip", "--output-dir=$TestingRoot"))
|
||||
Require-FileExists "$TestingRoot/vcpkg-export-output"
|
||||
Require-FileExists "$TestingRoot/vcpkg-export.1.0.0.nupkg"
|
||||
Require-FileExists "$TestingRoot/vcpkg-export-output.zip"
|
@ -1,18 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
$CurrentTest = "Build Missing tests"
|
||||
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "rapidjson", "--only-binarycaching","--x-binarysource=clear;files,$ArchiveRoot,read"))
|
||||
Throw-IfNotFailed
|
||||
Require-FileNotExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
|
||||
# Create the rapidjson archive
|
||||
Remove-Item -Recurse -Force $installRoot
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "rapidjson","--x-binarysource=clear;files,$ArchiveRoot,write"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
||||
|
||||
Remove-Item -Recurse -Force $installRoot
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "rapidjson", "--only-binarycaching","--x-binarysource=clear;files,$ArchiveRoot,read"))
|
||||
Throw-IfFailed
|
||||
Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h"
|
@ -1,11 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
# Test bad command lines
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "zlib", "--vcpkg-rootttttt", "C:\"))
|
||||
Throw-IfNotFailed
|
||||
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "zlib", "--vcpkg-rootttttt=C:\"))
|
||||
Throw-IfNotFailed
|
||||
|
||||
Run-Vcpkg -TestArgs ($commonArgs + @("install", "zlib", "--fast")) # NB: --fast is not a switch
|
||||
Throw-IfNotFailed
|
@ -1,10 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
# Test vcpkg create
|
||||
$Script:CurrentTest = "create zlib"
|
||||
Write-Host $Script:CurrentTest
|
||||
./vcpkg --x-builtin-ports-root=$TestingRoot/ports create zlib https://github.com/madler/zlib/archive/v1.2.11.tar.gz zlib-1.2.11.tar.gz
|
||||
Throw-IfFailed
|
||||
|
||||
Require-FileExists "$TestingRoot/ports/zlib/portfile.cmake"
|
||||
Require-FileExists "$TestingRoot/ports/zlib/vcpkg.json"
|
@ -1,67 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
# Test that metrics are on by default
|
||||
$metricsTagName = 'vcpkg.disable-metrics'
|
||||
$metricsAreDisabledMessage = 'Warning: passed --sendmetrics, but metrics are disabled.'
|
||||
|
||||
function Test-Metrics-Enabled() {
|
||||
Param(
|
||||
[Parameter(ValueFromRemainingArguments)]
|
||||
[string[]]$TestArgs
|
||||
)
|
||||
|
||||
$actualArgs = @('version', '--sendmetrics')
|
||||
if ($TestArgs.Length -ne 0) {
|
||||
$actualArgs += $TestArgs
|
||||
}
|
||||
|
||||
$vcpkgOutput = Run-Vcpkg $actualArgs
|
||||
if ($vcpkgOutput -contains $metricsAreDisabledMessage) {
|
||||
Write-Host 'Metrics are disabled'
|
||||
return $false
|
||||
}
|
||||
|
||||
Write-Host 'Metrics are enabled'
|
||||
return $true
|
||||
}
|
||||
|
||||
# By default, metrics are enabled.
|
||||
Require-FileNotExists $metricsTagName
|
||||
if (-Not (Test-Metrics-Enabled)) {
|
||||
throw "Metrics were not on by default."
|
||||
}
|
||||
|
||||
if (Test-Metrics-Enabled '--disable-metrics') {
|
||||
throw "Metrics were not disabled by switch."
|
||||
}
|
||||
|
||||
$env:VCPKG_DISABLE_METRICS = 'ON'
|
||||
try {
|
||||
if (Test-Metrics-Enabled) {
|
||||
throw "Environment variable did not disable metrics."
|
||||
}
|
||||
|
||||
# Also test that you get no message without --sendmetrics
|
||||
$vcpkgOutput = Run-Vcpkg list
|
||||
if ($vcpkgOutput -contains $metricsAreDisabledMessage) {
|
||||
throw "Disabled metrics emit message even without --sendmetrics"
|
||||
}
|
||||
|
||||
if (-Not (Test-Metrics-Enabled '--no-disable-metrics')) {
|
||||
throw "Environment variable to disable metrics could not be overridden by switch."
|
||||
}
|
||||
} finally {
|
||||
Remove-Item env:VCPKG_DISABLE_METRICS
|
||||
}
|
||||
|
||||
# If the disable-metrics tag file exists, metrics are disabled even if attempted to be enabled on
|
||||
# the command line.
|
||||
Set-Content -Path $metricsTagName -Value ""
|
||||
try {
|
||||
if (Test-Metrics-Enabled '--disable-metrics') {
|
||||
throw "Metrics were not force-disabled by the disable-metrics tag file."
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Remove-Item $metricsTagName
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
if (-not $IsLinux -and -not $IsMacOS) {
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
$env:_VCPKG_TEST_TRACKED = "a"
|
||||
$env:_VCPKG_TEST_UNTRACKED = "b"
|
||||
|
||||
$x = ./vcpkg "--overlay-triplets=$PSScriptRoot/../../testing/env-passthrough" env "echo %_VCPKG_TEST_TRACKED% %_VCPKG_TEST_TRACKED2% %_VCPKG_TEST_UNTRACKED% %_VCPKG_TEST_UNTRACKED2%"
|
||||
if ($x -ne "%_VCPKG_TEST_TRACKED% %_VCPKG_TEST_TRACKED2% %_VCPKG_TEST_UNTRACKED% %_VCPKG_TEST_UNTRACKED2%")
|
||||
{
|
||||
throw "env should have cleaned the environment ($x)"
|
||||
}
|
||||
|
||||
$y = ./vcpkg "--overlay-triplets=$PSScriptRoot/../../testing/env-passthrough" env --triplet passthrough "echo %_VCPKG_TEST_TRACKED% %_VCPKG_TEST_TRACKED2% %_VCPKG_TEST_UNTRACKED% %_VCPKG_TEST_UNTRACKED2%"
|
||||
if ($y -ne "a %_VCPKG_TEST_TRACKED2% b %_VCPKG_TEST_UNTRACKED2%")
|
||||
{
|
||||
throw "env should have kept the environment ($y)"
|
||||
}
|
||||
|
||||
rm env:_VCPKG_TEST_TRACKED
|
||||
rm env:_VCPKG_TEST_UNTRACKED
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
if (-not $IsLinux -and -not $IsMacOS) {
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
# Test msbuild props and targets
|
||||
$Script:CurrentTest = "zlib:x86-windows-static msbuild scripts\testing\integrate-install\..."
|
||||
Write-Host $Script:CurrentTest
|
||||
./vcpkg $commonArgs install zlib:x86-windows-static --x-binarysource=clear
|
||||
Throw-IfFailed
|
||||
foreach ($project in @("VcpkgTriplet", "VcpkgTriplet2", "VcpkgUseStatic", "VcpkgUseStatic2")) {
|
||||
$Script:CurrentTest = "msbuild scripts\testing\integrate-install\$project.vcxproj"
|
||||
./vcpkg $commonArgs env "msbuild scripts\testing\integrate-install\$project.vcxproj /p:VcpkgRoot=$TestingRoot /p:IntDir=$TestingRoot\int\ /p:OutDir=$TestingRoot\out\ "
|
||||
Throw-IfFailed
|
||||
Remove-Item -Recurse -Force $TestingRoot\int
|
||||
Remove-Item -Recurse -Force $TestingRoot\out
|
||||
}
|
||||
$Script:CurrentTest = "zlib:x86-windows msbuild scripts\testing\integrate-install\..."
|
||||
Write-Host $Script:CurrentTest
|
||||
./vcpkg $commonArgs install zlib:x86-windows --x-binarysource=clear
|
||||
Throw-IfFailed
|
||||
foreach ($project in @("Project1", "NoProps")) {
|
||||
$Script:CurrentTest = "msbuild scripts\testing\integrate-install\$project.vcxproj"
|
||||
Write-Host $Script:CurrentTest
|
||||
./vcpkg $commonArgs env "msbuild scripts\testing\integrate-install\$project.vcxproj /p:VcpkgRoot=$TestingRoot /p:IntDir=$TestingRoot\int\ /p:OutDir=$TestingRoot\out\ "
|
||||
Throw-IfFailed
|
||||
Remove-Item -Recurse -Force $TestingRoot\int
|
||||
Remove-Item -Recurse -Force $TestingRoot\out
|
||||
}
|
||||
}
|
@ -1,192 +0,0 @@
|
||||
. "$PSScriptRoot/../end-to-end-tests-prelude.ps1"
|
||||
|
||||
|
||||
$builtinRegistryArgs = $commonArgs + @("--x-builtin-registry-versions-dir=$PSScriptRoot/../../e2e_ports/versions")
|
||||
|
||||
Run-Vcpkg install @builtinRegistryArgs 'vcpkg-internal-e2e-test-port'
|
||||
Throw-IfNotFailed
|
||||
|
||||
# We should not look into the versions directory unless we have a baseline,
|
||||
# even if we pass the registries feature flag
|
||||
Run-Vcpkg install @builtinRegistryArgs --feature-flags=registries 'vcpkg-internal-e2e-test-port'
|
||||
Throw-IfNotFailed
|
||||
|
||||
Run-Vcpkg install @builtinRegistryArgs --feature-flags=registries 'zlib'
|
||||
Throw-IfFailed
|
||||
|
||||
Write-Trace "Test git and filesystem registries"
|
||||
Refresh-TestRoot
|
||||
$filesystemRegistry = "$TestingRoot/filesystem-registry"
|
||||
$gitRegistryUpstream = "$TestingRoot/git-registry-upstream"
|
||||
|
||||
# build a filesystem registry
|
||||
Write-Trace "build a filesystem registry"
|
||||
New-Item -Path $filesystemRegistry -ItemType Directory
|
||||
$filesystemRegistry = (Get-Item $filesystemRegistry).FullName
|
||||
|
||||
Copy-Item -Recurse `
|
||||
-LiteralPath "$PSScriptRoot/../../e2e_ports/vcpkg-internal-e2e-test-port" `
|
||||
-Destination "$filesystemRegistry"
|
||||
New-Item `
|
||||
-Path "$filesystemRegistry/versions" `
|
||||
-ItemType Directory
|
||||
Copy-Item `
|
||||
-LiteralPath "$PSScriptRoot/../../e2e_ports/versions/baseline.json" `
|
||||
-Destination "$filesystemRegistry/versions/baseline.json"
|
||||
New-Item `
|
||||
-Path "$filesystemRegistry/versions/v-" `
|
||||
-ItemType Directory
|
||||
|
||||
$vcpkgInternalE2eTestPortJson = @{
|
||||
"versions" = @(
|
||||
@{
|
||||
"version-string" = "1.0.0";
|
||||
"path" = "$/vcpkg-internal-e2e-test-port"
|
||||
}
|
||||
)
|
||||
}
|
||||
New-Item `
|
||||
-Path "$filesystemRegistry/versions/v-/vcpkg-internal-e2e-test-port.json" `
|
||||
-ItemType File `
|
||||
-Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgInternalE2eTestPortJson)
|
||||
|
||||
|
||||
# build a git registry
|
||||
Write-Trace "build a git registry"
|
||||
New-Item -Path $gitRegistryUpstream -ItemType Directory
|
||||
$gitRegistryUpstream = (Get-Item $gitRegistryUpstream).FullName
|
||||
|
||||
Push-Location $gitRegistryUpstream
|
||||
try
|
||||
{
|
||||
$gitConfigOptions = @(
|
||||
'-c', 'user.name=Nobody',
|
||||
'-c', 'user.email=nobody@example.com',
|
||||
'-c', 'core.autocrlf=false'
|
||||
)
|
||||
|
||||
$CurrentTest = 'git init .'
|
||||
git @gitConfigOptions init .
|
||||
Throw-IfFailed
|
||||
Copy-Item -Recurse -LiteralPath "$PSScriptRoot/../../e2e_ports/vcpkg-internal-e2e-test-port" -Destination .
|
||||
New-Item -Path './vcpkg-internal-e2e-test-port/foobar' -Value 'this is just to get a distinct git tree'
|
||||
|
||||
$CurrentTest = 'git add -A'
|
||||
git @gitConfigOptions add -A
|
||||
Throw-IfFailed
|
||||
$CurrentTest = 'git commit'
|
||||
git @gitConfigOptions commit -m 'initial commit'
|
||||
Throw-IfFailed
|
||||
|
||||
$vcpkgInternalE2eTestPortGitTree = git rev-parse 'HEAD:vcpkg-internal-e2e-test-port'
|
||||
$vcpkgInternalE2eTestPortVersionsJson = @{
|
||||
"versions" = @(
|
||||
@{
|
||||
"version-string" = "1.0.0";
|
||||
"git-tree" = $vcpkgInternalE2eTestPortGitTree
|
||||
}
|
||||
)
|
||||
}
|
||||
$vcpkgBaseline = @{
|
||||
"default" = @{
|
||||
"vcpkg-internal-e2e-test-port" = @{
|
||||
"baseline" = "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
New-Item -Path './versions' -ItemType Directory
|
||||
New-Item -Path './versions/v-' -ItemType Directory
|
||||
|
||||
New-Item -Path './versions/baseline.json' -Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgBaseline)
|
||||
New-Item -Path './versions/v-/vcpkg-internal-e2e-test-port.json' -Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgInternalE2eTestPortVersionsJson)
|
||||
|
||||
$CurrentTest = 'git add -A'
|
||||
git @gitConfigOptions add -A
|
||||
Throw-IfFailed
|
||||
$CurrentTest = 'git commit'
|
||||
git @gitConfigOptions commit --amend --no-edit
|
||||
Throw-IfFailed
|
||||
}
|
||||
finally
|
||||
{
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# actually test the registries
|
||||
Write-Trace "actually test the registries"
|
||||
$vcpkgJson = @{
|
||||
"name" = "manifest-test";
|
||||
"version-string" = "1.0.0";
|
||||
"dependencies" = @(
|
||||
"vcpkg-internal-e2e-test-port"
|
||||
)
|
||||
}
|
||||
|
||||
# test the filesystem registry
|
||||
Write-Trace "test the filesystem registry"
|
||||
$manifestDir = "$TestingRoot/filesystem-registry-test-manifest-dir"
|
||||
|
||||
New-Item -Path $manifestDir -ItemType Directory
|
||||
$manifestDir = (Get-Item $manifestDir).FullName
|
||||
|
||||
Push-Location $manifestDir
|
||||
try
|
||||
{
|
||||
New-Item -Path 'vcpkg.json' -ItemType File `
|
||||
-Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgJson)
|
||||
|
||||
$vcpkgConfigurationJson = @{
|
||||
"default-registry" = $null;
|
||||
"registries" = @(
|
||||
@{
|
||||
"kind" = "filesystem";
|
||||
"path" = $filesystemRegistry;
|
||||
"packages" = @( "vcpkg-internal-e2e-test-port" )
|
||||
}
|
||||
)
|
||||
}
|
||||
New-Item -Path 'vcpkg-configuration.json' -ItemType File `
|
||||
-Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgConfigurationJson)
|
||||
|
||||
Run-Vcpkg install @builtinRegistryArgs '--feature-flags=registries,manifests'
|
||||
Throw-IfFailed
|
||||
}
|
||||
finally
|
||||
{
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# test the git registry
|
||||
Write-Trace "test the git registry"
|
||||
$manifestDir = "$TestingRoot/git-registry-test-manifest-dir"
|
||||
|
||||
New-Item -Path $manifestDir -ItemType Directory
|
||||
$manifestDir = (Get-Item $manifestDir).FullName
|
||||
|
||||
Push-Location $manifestDir
|
||||
try
|
||||
{
|
||||
New-Item -Path 'vcpkg.json' -ItemType File `
|
||||
-Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgJson)
|
||||
|
||||
$vcpkgConfigurationJson = @{
|
||||
"default-registry" = $null;
|
||||
"registries" = @(
|
||||
@{
|
||||
"kind" = "git";
|
||||
"repository" = $gitRegistryUpstream;
|
||||
"packages" = @( "vcpkg-internal-e2e-test-port" )
|
||||
}
|
||||
)
|
||||
}
|
||||
New-Item -Path 'vcpkg-configuration.json' -ItemType File `
|
||||
-Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgConfigurationJson)
|
||||
|
||||
Run-Vcpkg install @builtinRegistryArgs '--feature-flags=registries,manifests'
|
||||
Throw-IfFailed
|
||||
}
|
||||
finally
|
||||
{
|
||||
Pop-Location
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
##### Test spaces in the path
|
||||
$Script:CurrentTest = "zlib with spaces in path"
|
||||
Write-Host $Script:CurrentTest
|
||||
./vcpkg install zlib "--triplet" $Triplet `
|
||||
"--no-binarycaching" `
|
||||
"--x-buildtrees-root=$TestingRoot/build Trees" `
|
||||
"--x-install-root=$TestingRoot/instalL ed" `
|
||||
"--x-packages-root=$TestingRoot/packaG es"
|
||||
Throw-IfFailed
|
@ -1,22 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
$successCases = @('vcpkg-requires-current-date', 'vcpkg-requires-old-date')
|
||||
foreach ($successCase in $successCases) {
|
||||
$CurrentTest = "Should succeeed: ./vcpkg install $successCase"
|
||||
Write-Host $CurrentTest
|
||||
Run-Vcpkg install $successCase @commonArgs
|
||||
if ($LastExitCode -ne 0) {
|
||||
throw $CurrentTest
|
||||
} else {
|
||||
Write-Host "... succeeded."
|
||||
}
|
||||
}
|
||||
|
||||
$CurrentTest = "Should fail: ./vcpkg install vcpkg-requires-future-date"
|
||||
Write-Host $CurrentTest
|
||||
Run-Vcpkg install vcpkg-requires-future-date @commonArgs
|
||||
if ($LastExitCode -ne 0) {
|
||||
Write-Host "... failed (this is good!)."
|
||||
} else {
|
||||
throw $CurrentTest
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
# Test verify versions
|
||||
mkdir $VersionFilesRoot
|
||||
Copy-Item -Recurse "scripts/testing/version-files/versions_incomplete" $VersionFilesRoot
|
||||
$portsRedirectArgsOK = @(
|
||||
"--feature-flags=versions",
|
||||
"--x-builtin-ports-root=scripts/testing/version-files/ports",
|
||||
"--x-builtin-registry-versions-dir=scripts/testing/version-files/versions"
|
||||
)
|
||||
$portsRedirectArgsIncomplete = @(
|
||||
"--feature-flags=versions",
|
||||
"--x-builtin-ports-root=scripts/testing/version-files/ports_incomplete",
|
||||
"--x-builtin-registry-versions-dir=$VersionFilesRoot/versions_incomplete"
|
||||
)
|
||||
$CurrentTest = "x-verify-ci-versions (All files OK)"
|
||||
Write-Host $CurrentTest
|
||||
./vcpkg $portsRedirectArgsOK x-ci-verify-versions --verbose
|
||||
Throw-IfFailed
|
||||
|
||||
$CurrentTest = "x-verify-ci-versions (Incomplete)"
|
||||
./vcpkg $portsRedirectArgsIncomplete x-ci-verify-versions --verbose
|
||||
Throw-IfNotFailed
|
||||
|
||||
$CurrentTest = "x-add-version cat"
|
||||
# Do not fail if there's nothing to update
|
||||
./vcpkg $portsRedirectArgsIncomplete x-add-version cat
|
||||
Throw-IfFailed
|
||||
|
||||
$CurrentTest = "x-add-version dog"
|
||||
# Local version is not in baseline and versions file
|
||||
./vcpkg $portsRedirectArgsIncomplete x-add-version dog
|
||||
Throw-IfFailed
|
||||
|
||||
$CurrentTest = "x-add-version duck"
|
||||
# Missing versions file
|
||||
./vcpkg $portsRedirectArgsIncomplete x-add-version duck
|
||||
Throw-IfFailed
|
||||
|
||||
$CurrentTest = "x-add-version ferret"
|
||||
# Missing versions file and missing baseline entry
|
||||
./vcpkg $portsRedirectArgsIncomplete x-add-version ferret
|
||||
Throw-IfFailed
|
||||
|
||||
$CurrentTest = "x-add-version fish (must fail)"
|
||||
# Discrepancy between local SHA and SHA in fish.json. Requires --overwrite-version.
|
||||
$out = ./vcpkg $portsRedirectArgsIncomplete x-add-version fish
|
||||
Throw-IfNotFailed
|
||||
$CurrentTest = "x-add-version fish --overwrite-version"
|
||||
./vcpkg $portsRedirectArgsIncomplete x-add-version fish --overwrite-version
|
||||
Throw-IfFailed
|
||||
|
||||
$CurrentTest = "x-add-version mouse"
|
||||
# Missing baseline entry
|
||||
./vcpkg $portsRedirectArgsIncomplete x-add-version mouse
|
||||
Throw-IfFailed
|
||||
# Validate changes
|
||||
./vcpkg $portsRedirectArgsIncomplete x-ci-verify-versions --verbose
|
||||
Throw-IfFailed
|
||||
|
||||
$CurrentTest = "default baseline"
|
||||
$out = ./vcpkg $commonArgs "--feature-flags=versions" install --x-manifest-root=scripts/testing/version-files/default-baseline-1 2>&1 | Out-String
|
||||
Throw-IfNotFailed
|
||||
if ($out -notmatch ".*Error: while checking out baseline.*")
|
||||
{
|
||||
$out
|
||||
throw "Expected to fail due to missing baseline"
|
||||
}
|
||||
|
||||
git fetch https://github.com/vicroms/test-registries
|
||||
foreach ($opt_registries in @("",",registries"))
|
||||
{
|
||||
Write-Trace "testing baselines: $opt_registries"
|
||||
Refresh-TestRoot
|
||||
$CurrentTest = "without default baseline 2 -- enabling versions should not change behavior"
|
||||
Remove-Item -Recurse $buildtreesRoot/versioning -ErrorAction SilentlyContinue
|
||||
./vcpkg $commonArgs "--feature-flags=versions$opt_registries" install `
|
||||
"--dry-run" `
|
||||
"--x-manifest-root=scripts/testing/version-files/without-default-baseline-2" `
|
||||
"--x-builtin-registry-versions-dir=scripts/testing/version-files/default-baseline-2/versions"
|
||||
Throw-IfFailed
|
||||
Require-FileNotExists $buildtreesRoot/versioning
|
||||
|
||||
$CurrentTest = "default baseline 2"
|
||||
./vcpkg $commonArgs "--feature-flags=versions$opt_registries" install `
|
||||
"--dry-run" `
|
||||
"--x-manifest-root=scripts/testing/version-files/default-baseline-2" `
|
||||
"--x-builtin-registry-versions-dir=scripts/testing/version-files/default-baseline-2/versions"
|
||||
Throw-IfFailed
|
||||
Require-FileExists $buildtreesRoot/versioning
|
||||
|
||||
$CurrentTest = "using version features fails without flag"
|
||||
./vcpkg $commonArgs "--feature-flags=-versions$opt_registries" install `
|
||||
"--dry-run" `
|
||||
"--x-manifest-root=scripts/testing/version-files/default-baseline-2" `
|
||||
"--x-builtin-registry-versions-dir=scripts/testing/version-files/default-baseline-2/versions"
|
||||
Throw-IfNotFailed
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
$TestingRoot = Join-Path $WorkingRoot 'testing'
|
||||
$buildtreesRoot = Join-Path $TestingRoot 'buildtrees'
|
||||
$installRoot = Join-Path $TestingRoot 'installed'
|
||||
$packagesRoot = Join-Path $TestingRoot 'packages'
|
||||
$NuGetRoot = Join-Path $TestingRoot 'nuget'
|
||||
$NuGetRoot2 = Join-Path $TestingRoot 'nuget2'
|
||||
$ArchiveRoot = Join-Path $TestingRoot 'archives'
|
||||
$VersionFilesRoot = Join-Path $TestingRoot 'version-test'
|
||||
$commonArgs = @(
|
||||
"--triplet",
|
||||
$Triplet,
|
||||
"--x-buildtrees-root=$buildtreesRoot",
|
||||
"--x-install-root=$installRoot",
|
||||
"--x-packages-root=$packagesRoot",
|
||||
"--overlay-ports=$PSScriptRoot/../e2e_ports/overlays"
|
||||
)
|
||||
$Script:CurrentTest = 'unassigned'
|
||||
|
||||
if ($IsWindows)
|
||||
{
|
||||
$VcpkgExe = Get-Item './vcpkg.exe'
|
||||
}
|
||||
else
|
||||
{
|
||||
$VcpkgExe = Get-Item './vcpkg'
|
||||
}
|
||||
|
||||
function Refresh-TestRoot {
|
||||
Remove-Item -Recurse -Force $TestingRoot -ErrorAction SilentlyContinue
|
||||
mkdir $TestingRoot | Out-Null
|
||||
mkdir $NuGetRoot | Out-Null
|
||||
}
|
||||
|
||||
function Require-FileExists {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$File
|
||||
)
|
||||
if (-Not (Test-Path $File)) {
|
||||
throw "'$Script:CurrentTest' failed to create file '$File'"
|
||||
}
|
||||
}
|
||||
|
||||
function Require-FileNotExists {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$File
|
||||
)
|
||||
if (Test-Path $File) {
|
||||
throw "'$Script:CurrentTest' should not have created file '$File'"
|
||||
}
|
||||
}
|
||||
|
||||
function Throw-IfFailed {
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "'$Script:CurrentTest' had a step with a nonzero exit code"
|
||||
}
|
||||
}
|
||||
|
||||
function Throw-IfNotFailed {
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
throw "'$Script:CurrentTest' had a step with an unexpectedly zero exit code"
|
||||
}
|
||||
}
|
||||
|
||||
function Write-Trace ([string]$text) {
|
||||
Write-Host (@($MyInvocation.ScriptName, ":", $MyInvocation.ScriptLineNumber, ": ", $text) -join "")
|
||||
}
|
||||
|
||||
function Run-Vcpkg {
|
||||
Param(
|
||||
[Parameter(ValueFromRemainingArguments)]
|
||||
[string[]]$TestArgs
|
||||
)
|
||||
$Script:CurrentTest = "vcpkg $($testArgs -join ' ')"
|
||||
Write-Host $Script:CurrentTest
|
||||
& $VcpkgExe @testArgs
|
||||
}
|
||||
|
||||
Refresh-TestRoot
|
@ -1,55 +0,0 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
End-to-End tests for the vcpkg executable.
|
||||
|
||||
.DESCRIPTION
|
||||
These tests cover the command line interface and broad functions of vcpkg, including `install`, `remove` and certain
|
||||
binary caching scenarios. They use the vcpkg executable in the current directory.
|
||||
|
||||
.PARAMETER Triplet
|
||||
The triplet to use for testing purposes.
|
||||
|
||||
.PARAMETER WorkingRoot
|
||||
The location used as scratch space for testing.
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Triplet,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$WorkingRoot,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Filter
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (-Not (Test-Path $WorkingRoot)) {
|
||||
New-Item -Path $WorkingRoot -ItemType Directory
|
||||
}
|
||||
|
||||
$WorkingRoot = (Get-Item $WorkingRoot).FullName
|
||||
|
||||
$AllTests = Get-ChildItem $PSScriptRoot/end-to-end-tests-dir/*.ps1
|
||||
if ($Filter -ne $Null) {
|
||||
$AllTests = $AllTests | ? { $_.Name -match $Filter }
|
||||
}
|
||||
$n = 1
|
||||
$m = $AllTests.Count
|
||||
|
||||
$AllTests | % {
|
||||
Write-Host "[end-to-end-tests.ps1] [$n/$m] Running suite $_"
|
||||
& $_
|
||||
$n += 1
|
||||
}
|
||||
|
||||
Write-Host "[end-to-end-tests.ps1] All tests passed."
|
||||
$LASTEXITCODE = 0
|
@ -30,20 +30,9 @@ jobs:
|
||||
exit 0
|
||||
displayName: 'Create ${{ variables.VCPKG_DOWNLOADS }}'
|
||||
- task: Bash@3
|
||||
displayName: 'Build vcpkg'
|
||||
displayName: 'Bootstrap vcpkg'
|
||||
inputs:
|
||||
filePath: bootstrap-vcpkg.sh
|
||||
arguments: '-buildTests'
|
||||
- bash: toolsrc/build.rel/vcpkg-test
|
||||
displayName: 'Run vcpkg tests'
|
||||
env:
|
||||
VCPKG_DEBUG: 1
|
||||
- task: PowerShell@2
|
||||
displayName: 'Run vcpkg end-to-end tests'
|
||||
inputs:
|
||||
filePath: 'scripts/azure-pipelines/end-to-end-tests.ps1'
|
||||
arguments: '-Triplet x64-linux -WorkingRoot ${{ variables.WORKING_ROOT }}'
|
||||
pwsh: true
|
||||
- task: PowerShell@2
|
||||
displayName: '*** Test Modified Ports and Prepare Test Logs ***'
|
||||
inputs:
|
||||
|
@ -30,17 +30,6 @@ jobs:
|
||||
displayName: 'Build vcpkg'
|
||||
inputs:
|
||||
filePath: bootstrap-vcpkg.sh
|
||||
arguments: '-buildTests'
|
||||
- bash: toolsrc/build.rel/vcpkg-test
|
||||
displayName: 'Run vcpkg tests'
|
||||
env:
|
||||
VCPKG_DEBUG: 1
|
||||
- task: PowerShell@2
|
||||
displayName: 'Run vcpkg end-to-end tests'
|
||||
inputs:
|
||||
filePath: 'scripts/azure-pipelines/end-to-end-tests.ps1'
|
||||
arguments: '-Triplet x64-osx -WorkingRoot ${{ variables.WORKING_ROOT }}'
|
||||
pwsh: true
|
||||
- task: PowerShell@2
|
||||
displayName: '*** Test Modified Ports and Prepare Test Logs ***'
|
||||
inputs:
|
||||
|
@ -1,125 +0,0 @@
|
||||
# This script is used internally to produce signed vcpkg builds.
|
||||
# It uses machines / tasks that are not exposed here on GitHub, as
|
||||
# the hardware on which we allow signing is restricted.
|
||||
|
||||
trigger: none
|
||||
|
||||
variables:
|
||||
TeamName: vcpkg
|
||||
jobs:
|
||||
- job: windows
|
||||
displayName: "Windows"
|
||||
dependsOn:
|
||||
pool:
|
||||
name: 'VSEng-MicroBuildVS2019'
|
||||
demands:
|
||||
- CMAKE
|
||||
steps:
|
||||
- task: PoliCheck@1
|
||||
inputs:
|
||||
inputType: 'Basic'
|
||||
targetType: 'F'
|
||||
targetArgument: '$(Build.SourcesDirectory)'
|
||||
result: 'PoliCheck.xml'
|
||||
- task: CmdLine@2
|
||||
displayName: "Build vcpkg with CMake"
|
||||
inputs:
|
||||
failOnStderr: true
|
||||
script: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x86 -host_arch=x86
|
||||
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -B "$(Build.StagingDirectory)" -S toolsrc
|
||||
ninja.exe -C "$(Build.StagingDirectory)"
|
||||
- task: MicroBuildSigningPlugin@2
|
||||
inputs:
|
||||
signType: 'real'
|
||||
feedSource: 'https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
|
||||
- task: NuGetToolInstaller@1
|
||||
inputs:
|
||||
versionSpec: 5.7
|
||||
- task: NuGetCommand@2
|
||||
displayName: 'NuGet Restore MicroBuild Signing Extension'
|
||||
inputs:
|
||||
command: 'restore'
|
||||
restoreSolution: 'scripts/azure-pipelines/windows/signing.signproj'
|
||||
feedsToUse: 'config'
|
||||
restoreDirectory: '$(Build.SourcesDirectory)\scripts\azure-pipelines\packages'
|
||||
- task: MSBuild@1
|
||||
displayName: 'Sign vcpkg.exe'
|
||||
inputs:
|
||||
solution: 'scripts\azure-pipelines\windows\signing.signproj'
|
||||
msbuildArguments: '/p:OutDir=$(Build.ArtifactStagingDirectory)\ /p:IntermediateOutputPath=$(Build.StagingDirectory)\'
|
||||
- task: BinSkim@3
|
||||
inputs:
|
||||
InputType: 'CommandLine'
|
||||
arguments: 'analyze "$(Build.StagingDirectory)\vcpkg.exe"'
|
||||
- task: BinSkim@3
|
||||
inputs:
|
||||
InputType: 'CommandLine'
|
||||
arguments: 'analyze "$(Build.StagingDirectory)\tls12-download.exe"'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish vcpkg.exe'
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)\vcpkg.exe'
|
||||
ArtifactName: 'Windows'
|
||||
publishLocation: 'Container'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish vcpkg.pdb'
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)\vcpkg.pdb'
|
||||
ArtifactName: 'Windows'
|
||||
publishLocation: 'Container'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish tls12-download.exe'
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)\tls12-download.exe'
|
||||
ArtifactName: 'Windows'
|
||||
publishLocation: 'Container'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish tls12-download.pdb'
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)\tls12-download.pdb'
|
||||
ArtifactName: 'Windows'
|
||||
publishLocation: 'Container'
|
||||
- task: MicroBuildCleanup@1
|
||||
condition: succeededOrFailed()
|
||||
displayName: MicroBuild Cleanup
|
||||
- job: macos_build
|
||||
displayName: 'MacOS Build'
|
||||
pool:
|
||||
vmImage: macOS-10.15
|
||||
steps:
|
||||
- task: CmdLine@2
|
||||
displayName: "Build vcpkg with CMake"
|
||||
inputs:
|
||||
failOnStderr: true
|
||||
script: |
|
||||
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -B "$(Build.StagingDirectory)" -S toolsrc
|
||||
make -j 8 -C "$(Build.StagingDirectory)"
|
||||
zip "$(Build.StagingDirectory)/vcpkg.zip" "$(Build.StagingDirectory)/vcpkg"
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: "Publish Unsigned MacOS Binary"
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.StagingDirectory)/vcpkg.zip'
|
||||
ArtifactName: 'staging'
|
||||
publishLocation: 'Container'
|
||||
- job: macos_sign
|
||||
displayName: 'MacOS Sign'
|
||||
dependsOn: macos_build
|
||||
pool:
|
||||
name: VSEng-MicroBuildVS2019
|
||||
steps:
|
||||
- checkout: none
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download Unsigned Binary'
|
||||
inputs:
|
||||
artifactName: staging
|
||||
- task: ms-vseng.MicroBuildTasks.7973a23b-33e3-4b00-a7d9-c06d90f8297f.MicroBuildSignMacFiles@1
|
||||
displayName: 'Sign Mac Files'
|
||||
inputs:
|
||||
SigningTarget: '$(Build.ArtifactStagingDirectory)\staging\vcpkg.zip'
|
||||
SigningCert: 8003
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Signed Binary'
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)\staging\vcpkg.zip'
|
||||
ArtifactName: 'MacOS'
|
@ -24,34 +24,7 @@ jobs:
|
||||
pwsh: true
|
||||
# Note: D: is the Azure machines' temporary disk.
|
||||
- script: .\bootstrap-vcpkg.bat
|
||||
displayName: 'Build vcpkg'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Run vcpkg end-to-end tests'
|
||||
condition: eq('${{ parameters.triplet }}', 'x86-windows')
|
||||
inputs:
|
||||
filePath: 'scripts/azure-pipelines/end-to-end-tests.ps1'
|
||||
arguments: '-Triplet ${{ parameters.triplet }} -WorkingRoot ${{ variables.WORKING_ROOT }}'
|
||||
pwsh: true
|
||||
- task: CmdLine@2
|
||||
displayName: "Build vcpkg with CMake, with older VS, and Run Tests"
|
||||
condition: eq('${{ parameters.triplet }}', 'x86-windows')
|
||||
inputs:
|
||||
script: |
|
||||
:: TRANSITION, get these tools on the VMs next time we roll them
|
||||
.\vcpkg.exe fetch cmake
|
||||
.\vcpkg.exe fetch ninja
|
||||
set PATH=${{ variables.VCPKG_DOWNLOADS }}\tools\cmake-3.19.2-windows\cmake-3.19.2-win32-x86\bin;${{ variables.VCPKG_DOWNLOADS }}\tools\ninja-1.10.1-windows;%PATH%
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x86 -host_arch=x86
|
||||
rmdir /s /q build.x86.debug > nul 2> nul
|
||||
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=ON -B build.x86.debug -S toolsrc
|
||||
ninja.exe -C build.x86.debug
|
||||
set VCPKG_DEBUG=1
|
||||
build.x86.debug\vcpkg-test.exe
|
||||
cmake -G "Visual Studio 16 2019" -A Win32 -T v140 -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=OFF -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -B build.x86.vs2015 -S toolsrc
|
||||
cmake --build build.x86.vs2015
|
||||
cmake -G "Visual Studio 16 2019" -A Win32 -T v141 -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=OFF -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -B build.x86.vs2017 -S toolsrc
|
||||
cmake --build build.x86.vs2017
|
||||
failOnStderr: true
|
||||
displayName: 'Bootstrap vcpkg'
|
||||
- task: PowerShell@2
|
||||
displayName: '*** Test Modified Ports and Prepare Test Logs ***'
|
||||
inputs:
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.VisualStudioEng.MicroBuild.Core" version="0.4.1" targetFramework="native" developmentDependency="true" />
|
||||
</packages>
|
@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.props" Condition="Exists('..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.props')" />
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="0.4.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FilesToSign Include="$(IntermediateOutputPath)\vcpkg.exe">
|
||||
<Authenticode>Microsoft400</Authenticode>
|
||||
</FilesToSign>
|
||||
<FilesToSign Include="$(IntermediateOutputPath)\tls12-download.exe">
|
||||
<Authenticode>Microsoft400</Authenticode>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.targets" Condition="Exists('..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="Build">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(MSBuildThisFileDirectory)..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '$(MSBuildThisFileDirectory)..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.props'))" />
|
||||
<Error Condition="!Exists('$(MSBuildThisFileDirectory)..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(MSBuildThisFileDirectory)..\packages\Microsoft.VisualStudioEng.MicroBuild.Core.0.4.1\build\Microsoft.VisualStudioEng.MicroBuild.Core.targets'))" />
|
||||
</Target>
|
||||
|
||||
<!-- Define an empty build target as we don't really build anything -->
|
||||
<Target Name="Build" />
|
||||
|
||||
<!-- Target AfterBuild is required to trigger signing -->
|
||||
<Target Name="AfterBuild" AfterTargets="Build" />
|
||||
|
||||
</Project>
|
@ -1,10 +1,10 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
$badParam,
|
||||
[Parameter(Mandatory=$False)][switch]$disableMetrics = $false,
|
||||
[Parameter(Mandatory=$False)][switch]$win64 = $false,
|
||||
[Parameter(Mandatory=$False)][string]$withVSPath = "",
|
||||
[Parameter(Mandatory=$False)][string]$withWinSDK = ""
|
||||
[Parameter(Mandatory=$False)][string]$withWinSDK = "",
|
||||
[Parameter(Mandatory=$False)][switch]$disableMetrics = $false
|
||||
)
|
||||
Set-StrictMode -Version Latest
|
||||
# Powershell2-compatible way of forcing named-parameters
|
||||
@ -12,407 +12,48 @@ if ($badParam)
|
||||
{
|
||||
if ($disableMetrics -and $badParam -eq "1")
|
||||
{
|
||||
Write-Warning "'disableMetrics 1' is deprecated, please change to 'disableMetrics' (without '1')"
|
||||
Write-Warning "'disableMetrics 1' is deprecated, please change to 'disableMetrics' (without '1')."
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Only named parameters are allowed"
|
||||
throw "Only named parameters are allowed."
|
||||
}
|
||||
}
|
||||
|
||||
if ($win64)
|
||||
{
|
||||
Write-Warning "-win64 no longer has any effect; ignored."
|
||||
}
|
||||
|
||||
if (-Not [string]::IsNullOrWhiteSpace($withVSPath))
|
||||
{
|
||||
Write-Warning "-withVSPath no longer has any effect; ignored."
|
||||
}
|
||||
|
||||
if (-Not [string]::IsNullOrWhiteSpace($withWinSDK))
|
||||
{
|
||||
Write-Warning "-withWinSDK no longer has any effect; ignored."
|
||||
}
|
||||
|
||||
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
|
||||
$withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash
|
||||
|
||||
function vcpkgHasProperty([Parameter(Mandatory=$true)][AllowNull()]$object, [Parameter(Mandatory=$true)]$propertyName)
|
||||
{
|
||||
if ($null -eq $object)
|
||||
{
|
||||
return $false
|
||||
}
|
||||
|
||||
return [bool]($object.psobject.Properties | Where-Object { $_.Name -eq "$propertyName"})
|
||||
}
|
||||
|
||||
function getProgramFiles32bit()
|
||||
{
|
||||
$out = ${env:PROGRAMFILES(X86)}
|
||||
if ($null -eq $out)
|
||||
{
|
||||
$out = ${env:PROGRAMFILES}
|
||||
}
|
||||
|
||||
if ($null -eq $out)
|
||||
{
|
||||
throw "Could not find [Program Files 32-bit]"
|
||||
}
|
||||
|
||||
return $out
|
||||
}
|
||||
|
||||
$vcpkgRootDir = $scriptsDir
|
||||
while (!($vcpkgRootDir -eq "") -and !(Test-Path "$vcpkgRootDir\.vcpkg-root"))
|
||||
{
|
||||
Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root"
|
||||
$vcpkgRootDir = Split-path $vcpkgRootDir -Parent
|
||||
}
|
||||
|
||||
Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root - Found"
|
||||
|
||||
$vcpkgBootstrapPath = "$vcpkgRootDir\toolsrc\windows-bootstrap"
|
||||
& "$scriptsDir/tls12-download.exe" github.com "/microsoft/vcpkg-tool/releases/download/2021-01-13-768d8f95c9e752603d2c5901c7a7c7fbdb08af35/vcpkg.exe" "$vcpkgRootDir/vcpkg.exe"
|
||||
Write-Host ""
|
||||
|
||||
if (-not (Test-Path $vcpkgBootstrapPath))
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
Write-Error "Unable to determine vcpkg build directory. '$vcpkgBootstrapPath' does not exist."
|
||||
Write-Error "Downloading vcpkg.exe failed. Please check your internet connection, or consider downloading a recent vcpkg.exe from https://github.com/microsoft/vcpkg-tool with a browser."
|
||||
throw
|
||||
}
|
||||
|
||||
function getVisualStudioInstances()
|
||||
{
|
||||
$programFiles = getProgramFiles32bit
|
||||
$results = New-Object System.Collections.ArrayList
|
||||
$vswhereExe = "$programFiles\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
if (Test-Path $vswhereExe)
|
||||
{
|
||||
$output = & $vswhereExe -prerelease -legacy -products * -format xml
|
||||
[xml]$asXml = $output
|
||||
|
||||
foreach ($instance in $asXml.instances.instance)
|
||||
{
|
||||
$installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash
|
||||
$installationVersion = $instance.InstallationVersion
|
||||
|
||||
$isPrerelease = -7
|
||||
if (vcpkgHasProperty -object $instance -propertyName "isPrerelease")
|
||||
{
|
||||
$isPrerelease = $instance.isPrerelease
|
||||
}
|
||||
|
||||
if ($isPrerelease -eq 0)
|
||||
{
|
||||
$releaseType = "PreferenceWeight3::StableRelease"
|
||||
}
|
||||
elseif ($isPrerelease -eq 1)
|
||||
{
|
||||
$releaseType = "PreferenceWeight2::PreRelease"
|
||||
}
|
||||
else
|
||||
{
|
||||
$releaseType = "PreferenceWeight1::Legacy"
|
||||
}
|
||||
|
||||
# Placed like that for easy sorting according to preference
|
||||
$results.Add("${releaseType}::${installationVersion}::${installationPath}") > $null
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Verbose "Could not locate vswhere at $vswhereExe"
|
||||
}
|
||||
|
||||
if ("$env:vs140comntools" -ne "")
|
||||
{
|
||||
$installationPath = Split-Path -Parent $(Split-Path -Parent "$env:vs140comntools")
|
||||
$clExe = "$installationPath\VC\bin\cl.exe"
|
||||
$vcvarsallbat = "$installationPath\VC\vcvarsall.bat"
|
||||
|
||||
if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat))
|
||||
{
|
||||
$results.Add("PreferenceWeight1::Legacy::14.0::$installationPath") > $null
|
||||
}
|
||||
}
|
||||
|
||||
$installationPath = "$programFiles\Microsoft Visual Studio 14.0"
|
||||
$clExe = "$installationPath\VC\bin\cl.exe"
|
||||
$vcvarsallbat = "$installationPath\VC\vcvarsall.bat"
|
||||
|
||||
if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat))
|
||||
{
|
||||
$results.Add("PreferenceWeight1::Legacy::14.0::$installationPath") > $null
|
||||
}
|
||||
|
||||
$results.Sort()
|
||||
$results.Reverse()
|
||||
|
||||
return $results
|
||||
}
|
||||
|
||||
function findAnyMSBuildWithCppPlatformToolset([string]$withVSPath)
|
||||
{
|
||||
$VisualStudioInstances = getVisualStudioInstances
|
||||
if ($null -eq $VisualStudioInstances)
|
||||
{
|
||||
throw "Could not find Visual Studio. VS2015, VS2017, or VS2019 (with C++) needs to be installed."
|
||||
}
|
||||
|
||||
Write-Verbose "VS Candidates:`n`r$([system.String]::Join([Environment]::NewLine, $VisualStudioInstances))"
|
||||
foreach ($instanceCandidate in $VisualStudioInstances)
|
||||
{
|
||||
Write-Verbose "Inspecting: $instanceCandidate"
|
||||
$split = $instanceCandidate -split "::"
|
||||
# $preferenceWeight = $split[0]
|
||||
# $releaseType = $split[1]
|
||||
$version = $split[2]
|
||||
$path = $split[3]
|
||||
|
||||
if ($withVSPath -ne "" -and $withVSPath -ne $path)
|
||||
{
|
||||
Write-Verbose "Skipping: $instanceCandidate"
|
||||
continue
|
||||
}
|
||||
|
||||
$majorVersion = $version.Substring(0,2);
|
||||
if ($majorVersion -eq "16")
|
||||
{
|
||||
$VCFolder= "$path\VC\Tools\MSVC\"
|
||||
if (Test-Path $VCFolder)
|
||||
{
|
||||
Write-Verbose "Picking: $instanceCandidate"
|
||||
return "$path\MSBuild\Current\Bin\MSBuild.exe", "v142"
|
||||
}
|
||||
}
|
||||
|
||||
if ($majorVersion -eq "15")
|
||||
{
|
||||
$VCFolder= "$path\VC\Tools\MSVC\"
|
||||
if (Test-Path $VCFolder)
|
||||
{
|
||||
Write-Verbose "Picking: $instanceCandidate"
|
||||
return "$path\MSBuild\15.0\Bin\MSBuild.exe", "v141"
|
||||
}
|
||||
}
|
||||
|
||||
if ($majorVersion -eq "14")
|
||||
{
|
||||
$clExe= "$path\VC\bin\cl.exe"
|
||||
if (Test-Path $clExe)
|
||||
{
|
||||
Write-Verbose "Picking: $instanceCandidate"
|
||||
$programFilesPath = getProgramFiles32bit
|
||||
return "$programFilesPath\MSBuild\14.0\Bin\MSBuild.exe", "v140"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw "Could not find MSBuild version with C++ support. VS2015, VS2017, or VS2019 (with C++) needs to be installed."
|
||||
}
|
||||
function getWindowsSDK( [Parameter(Mandatory=$False)][switch]$DisableWin10SDK = $False,
|
||||
[Parameter(Mandatory=$False)][switch]$DisableWin81SDK = $False,
|
||||
[Parameter(Mandatory=$False)][string]$withWinSDK)
|
||||
{
|
||||
if ($DisableWin10SDK -and $DisableWin81SDK)
|
||||
{
|
||||
throw "Both Win10SDK and Win81SDK were disabled."
|
||||
}
|
||||
|
||||
Write-Verbose "Finding WinSDK"
|
||||
|
||||
$validInstances = New-Object System.Collections.ArrayList
|
||||
|
||||
# Windows 10 SDK
|
||||
function CheckWindows10SDK($path)
|
||||
{
|
||||
if ($null -eq $path)
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
$folder = (Join-Path $path "Include")
|
||||
if (!(Test-Path $folder))
|
||||
{
|
||||
Write-Verbose "$folder - Not Found"
|
||||
return
|
||||
}
|
||||
|
||||
Write-Verbose "$folder - Found"
|
||||
$win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object)
|
||||
[array]::Reverse($win10sdkVersions) # Newest SDK first
|
||||
|
||||
foreach ($win10sdk in $win10sdkVersions)
|
||||
{
|
||||
$win10sdkV = $win10sdk.Name
|
||||
$windowsheader = "$folder\$win10sdkV\um\windows.h"
|
||||
if (!(Test-Path $windowsheader))
|
||||
{
|
||||
Write-Verbose "$windowsheader - Not Found"
|
||||
continue
|
||||
}
|
||||
Write-Verbose "$windowsheader - Found"
|
||||
|
||||
$ddkheader = "$folder\$win10sdkV\shared\sdkddkver.h"
|
||||
if (!(Test-Path $ddkheader))
|
||||
{
|
||||
Write-Verbose "$ddkheader - Not Found"
|
||||
continue
|
||||
}
|
||||
|
||||
Write-Verbose "$ddkheader - Found"
|
||||
$win10sdkVersionString = $win10sdkV.ToString()
|
||||
Write-Verbose "Found $win10sdkVersionString"
|
||||
$validInstances.Add($win10sdkVersionString) > $null
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "`n"
|
||||
Write-Verbose "Looking for Windows 10 SDK"
|
||||
$regkey10 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue
|
||||
$regkey10Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue
|
||||
if (vcpkgHasProperty -object $regkey10 "KitsRoot10") { CheckWindows10SDK($regkey10.KitsRoot10) }
|
||||
if (vcpkgHasProperty -object $regkey10Wow6432 "KitsRoot10") { CheckWindows10SDK($regkey10Wow6432.KitsRoot10) }
|
||||
CheckWindows10SDK("$env:ProgramFiles\Windows Kits\10")
|
||||
CheckWindows10SDK("${env:ProgramFiles(x86)}\Windows Kits\10")
|
||||
|
||||
# Windows 8.1 SDK
|
||||
function CheckWindows81SDK($path)
|
||||
{
|
||||
if ($null -eq $path)
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
$folder = "$path\Include"
|
||||
if (!(Test-Path $folder))
|
||||
{
|
||||
Write-Verbose "$folder - Not Found"
|
||||
return
|
||||
}
|
||||
|
||||
Write-Verbose "$folder - Found"
|
||||
$win81sdkVersionString = "8.1"
|
||||
Write-Verbose "Found $win81sdkVersionString"
|
||||
$validInstances.Add($win81sdkVersionString) > $null
|
||||
}
|
||||
|
||||
Write-Verbose "`n"
|
||||
Write-Verbose "Looking for Windows 8.1 SDK"
|
||||
$regkey81 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue
|
||||
$regkey81Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue
|
||||
if (vcpkgHasProperty -object $regkey81 "KitsRoot81") { CheckWindows81SDK($regkey81.KitsRoot81) }
|
||||
if (vcpkgHasProperty -object $regkey81Wow6432 "KitsRoot81") { CheckWindows81SDK($regkey81Wow6432.KitsRoot81) }
|
||||
CheckWindows81SDK("$env:ProgramFiles\Windows Kits\8.1")
|
||||
CheckWindows81SDK("${env:ProgramFiles(x86)}\Windows Kits\8.1")
|
||||
|
||||
Write-Verbose "`n`n`n"
|
||||
Write-Verbose "The following Windows SDKs were found:"
|
||||
foreach ($instance in $validInstances)
|
||||
{
|
||||
Write-Verbose $instance
|
||||
}
|
||||
|
||||
# Selecting
|
||||
if ($withWinSDK -ne "")
|
||||
{
|
||||
foreach ($instance in $validInstances)
|
||||
{
|
||||
if ($instance -eq $withWinSDK)
|
||||
{
|
||||
return $instance
|
||||
}
|
||||
}
|
||||
|
||||
throw "Could not find the requested Windows SDK version: $withWinSDK"
|
||||
}
|
||||
|
||||
foreach ($instance in $validInstances)
|
||||
{
|
||||
if (!$DisableWin10SDK -and $instance -match "10.")
|
||||
{
|
||||
return $instance
|
||||
}
|
||||
|
||||
if (!$DisableWin81SDK -and $instance -match "8.1")
|
||||
{
|
||||
return $instance
|
||||
}
|
||||
}
|
||||
|
||||
throw "Could not detect a Windows SDK / TargetPlatformVersion"
|
||||
}
|
||||
|
||||
$msbuildExeWithPlatformToolset = findAnyMSBuildWithCppPlatformToolset $withVSPath
|
||||
$msbuildExe = $msbuildExeWithPlatformToolset[0]
|
||||
$platformToolset = $msbuildExeWithPlatformToolset[1]
|
||||
$windowsSDK = getWindowsSDK -withWinSDK $withWinSDK
|
||||
|
||||
$disableMetricsValue = "0"
|
||||
if ($disableMetrics)
|
||||
{
|
||||
$disableMetricsValue = "1"
|
||||
}
|
||||
|
||||
$platform = "x86"
|
||||
$vcpkgReleaseDir = "$vcpkgBootstrapPath\msbuild.x86.release"
|
||||
if($PSVersionTable.PSVersion.Major -le 2)
|
||||
{
|
||||
$architecture=(Get-WmiObject win32_operatingsystem | Select-Object osarchitecture).osarchitecture
|
||||
}
|
||||
else
|
||||
{
|
||||
$architecture=(Get-CimInstance win32_operatingsystem | Select-Object osarchitecture).osarchitecture
|
||||
}
|
||||
if ($win64)
|
||||
{
|
||||
if (-not $architecture -like "*64*")
|
||||
{
|
||||
throw "Cannot build 64-bit on non-64-bit system"
|
||||
}
|
||||
|
||||
$platform = "x64"
|
||||
$vcpkgReleaseDir = "$vcpkgBootstrapPath\msbuild.x64.release"
|
||||
}
|
||||
|
||||
if ($architecture -like "*64*")
|
||||
{
|
||||
$PreferredToolArchitecture = "x64"
|
||||
}
|
||||
else
|
||||
{
|
||||
$PreferredToolArchitecture = "x86"
|
||||
}
|
||||
|
||||
$arguments = (
|
||||
"`"/p:VCPKG_VERSION=unknownhash`"",
|
||||
"`"/p:VCPKG_BASE_VERSION=2021-01-13`"", # Note: This duplicate date version will be short lived. See https://github.com/microsoft/vcpkg/pull/15474
|
||||
"/p:Configuration=Release",
|
||||
"/p:Platform=$platform",
|
||||
"/p:PlatformToolset=$platformToolset",
|
||||
"/p:TargetPlatformVersion=$windowsSDK",
|
||||
"/p:PreferredToolArchitecture=$PreferredToolArchitecture",
|
||||
"/verbosity:minimal",
|
||||
"/m",
|
||||
"/nologo",
|
||||
"`"$vcpkgBootstrapPath\vcpkg.vcxproj`"") -join " "
|
||||
|
||||
function vcpkgInvokeCommandClean()
|
||||
{
|
||||
param ( [Parameter(Mandatory=$true)][string]$executable,
|
||||
[string]$arguments = "")
|
||||
|
||||
Write-Verbose "Clean-Executing: ${executable} ${arguments}"
|
||||
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
|
||||
$cleanEnvScript = "$scriptsDir\cleanEnvironmentHelper.ps1"
|
||||
$tripleQuotes = "`"`"`""
|
||||
$argumentsWithEscapedQuotes = $arguments -replace "`"", $tripleQuotes
|
||||
$command = ". $tripleQuotes$cleanEnvScript$tripleQuotes; & $tripleQuotes$executable$tripleQuotes $argumentsWithEscapedQuotes"
|
||||
$arg = "-NoProfile", "-ExecutionPolicy Bypass", "-command $command"
|
||||
|
||||
$process = Start-Process -FilePath powershell.exe -ArgumentList $arg -PassThru -NoNewWindow
|
||||
Wait-Process -InputObject $process
|
||||
$ec = $process.ExitCode
|
||||
Write-Verbose "Execution terminated with exit code $ec."
|
||||
return $ec
|
||||
}
|
||||
|
||||
# vcpkgInvokeCommandClean cmd "/c echo %PATH%"
|
||||
Write-Host "`nBuilding vcpkg.exe ...`n"
|
||||
$ec = vcpkgInvokeCommandClean $msbuildExe $arguments
|
||||
|
||||
if ($ec -ne 0)
|
||||
{
|
||||
Write-Error "Building vcpkg.exe failed. Please ensure you have installed Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++."
|
||||
throw
|
||||
}
|
||||
|
||||
Write-Host "`nBuilding vcpkg.exe... done.`n"
|
||||
|
||||
if ($disableMetrics)
|
||||
{
|
||||
Set-Content -Value "" -Path "$vcpkgRootDir\vcpkg.disable-metrics" -Force
|
||||
@ -433,9 +74,3 @@ or by setting the VCPKG_DISABLE_METRICS environment variable.
|
||||
Read more about vcpkg telemetry at docs/about/privacy.md
|
||||
"@
|
||||
}
|
||||
|
||||
Write-Verbose "Placing vcpkg.exe in the correct location"
|
||||
|
||||
Copy-Item "$vcpkgReleaseDir\vcpkg.exe" "$vcpkgRootDir\vcpkg.exe"
|
||||
|
||||
Remove-Item "$vcpkgReleaseDir" -Force -Recurse -ErrorAction SilentlyContinue
|
||||
|
@ -276,11 +276,29 @@ else
|
||||
fi
|
||||
|
||||
# Do the build
|
||||
buildDir="$vcpkgRootDir/toolsrc/build.rel"
|
||||
rm -rf "$buildDir"
|
||||
mkdir -p "$buildDir"
|
||||
vcpkgToolReleaseTag="2021-01-13-768d8f95c9e752603d2c5901c7a7c7fbdb08af35"
|
||||
vcpkgToolReleaseSha="99c9949637f83bf361ee23557edc889e2865c2105c45306c39c40855a3e1440e2f6fb5ec59e95176fca61eff33929462d23c7b49feb1975f24adb8ca443a98a6"
|
||||
vcpkgToolReleaseTarball="$vcpkgToolReleaseTag.tar.gz"
|
||||
vcpkgToolUrl="https://github.com/microsoft/vcpkg-tool/archive/$vcpkgToolReleaseTarball"
|
||||
baseBuildDir="$vcpkgRootDir/buildtrees/_vcpkg"
|
||||
buildDir="$baseBuildDir/build"
|
||||
tarballPath="$downloadsDir/$vcpkgToolReleaseTarball"
|
||||
srcBaseDir="$baseBuildDir/src"
|
||||
srcDir="$srcBaseDir/vcpkg-tool-$vcpkgToolReleaseTag"
|
||||
|
||||
(cd "$buildDir" && CXX="$CXX" "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DBUILD_TESTING=$vcpkgBuildTests" "-DVCPKG_DEVELOPMENT_WARNINGS=OFF" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1
|
||||
if [ -e "$tarballPath" ]; then
|
||||
vcpkgCheckEqualFileHash "$vcpkgToolUrl" "$tarballPath" "$vcpkgToolReleaseSha"
|
||||
else
|
||||
echo "Downloading vcpkg tool sources"
|
||||
vcpkgDownloadFile "$vcpkgToolUrl" "$tarballPath" "$vcpkgToolReleaseSha"
|
||||
fi
|
||||
|
||||
echo "Building vcpkg-tool..."
|
||||
rm -rf "$baseBuildDir"
|
||||
mkdir -p "$buildDir"
|
||||
vcpkgExtractArchive "$tarballPath" "$srcBaseDir"
|
||||
|
||||
(cd "$buildDir" && CXX="$CXX" "$cmakeExe" "$srcDir" -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DBUILD_TESTING=$vcpkgBuildTests" "-DVCPKG_DEVELOPMENT_WARNINGS=OFF" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1
|
||||
(cd "$buildDir" && "$cmakeExe" --build .) || exit 1
|
||||
|
||||
rm -rf "$vcpkgRootDir/vcpkg"
|
||||
|
@ -1,52 +0,0 @@
|
||||
# Capture environment variables for the System and User. Also add some special/built-in variables.
|
||||
# These will be used to synthesize a clean environment
|
||||
$specialEnvironmentMap = @{ "SystemDrive"=$env:SystemDrive; "SystemRoot"=$env:SystemRoot; "UserProfile"=$env:UserProfile; "TMP"=$env:TMP } # These are built-in and not set in the registry
|
||||
$machineEnvironmentMap = [Environment]::GetEnvironmentVariables('Machine') # HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
|
||||
$userEnvironmentMap = [Environment]::GetEnvironmentVariables('User') # HKEY_CURRENT_USER\Environment
|
||||
|
||||
# Identify the keySet of environment variable names
|
||||
$nameSet = ($specialEnvironmentMap.Keys + $machineEnvironmentMap.Keys + $userEnvironmentMap.Keys) | Sort-Object | Select-Object -Unique
|
||||
|
||||
# Any environment variable in the $nameSet should be restored to its original value
|
||||
foreach ($name in $nameSet)
|
||||
{
|
||||
if ($specialEnvironmentMap.ContainsKey($name))
|
||||
{
|
||||
[Environment]::SetEnvironmentVariable($name, $specialEnvironmentMap[$name], 'Process')
|
||||
continue;
|
||||
}
|
||||
|
||||
# PATH needs to be concatenated as it has values in both machine and user environment. Any other values should be set.
|
||||
if ($name -eq 'path')
|
||||
{
|
||||
$pathValuePartial = @()
|
||||
# Machine values before user values
|
||||
$pathValuePartial += $machineEnvironmentMap[$name] -split ';'
|
||||
$pathValuePartial += $userEnvironmentMap[$name] -split ';'
|
||||
$pathValue = $pathValuePartial -join ';'
|
||||
[Environment]::SetEnvironmentVariable($name, $pathValue, 'Process')
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($userEnvironmentMap.ContainsKey($name))
|
||||
{
|
||||
[Environment]::SetEnvironmentVariable($name, $userEnvironmentMap[$name], 'Process')
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($machineEnvironmentMap.ContainsKey($name))
|
||||
{
|
||||
[Environment]::SetEnvironmentVariable($name, $machineEnvironmentMap[$name], 'Process')
|
||||
continue;
|
||||
}
|
||||
|
||||
throw "Unreachable: Unknown variable $name"
|
||||
}
|
||||
|
||||
# Any environment variable NOT in the $nameSet should be removed
|
||||
$processEnvironmentMap = [Environment]::GetEnvironmentVariables('Process')
|
||||
$variablesForRemoval = $processEnvironmentMap.Keys | Where-Object {$nameSet -notcontains $_}
|
||||
foreach ($name in $variablesForRemoval)
|
||||
{
|
||||
[Environment]::SetEnvironmentVariable($name, $null, 'Process')
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
vcpkg_minimum_required(VERSION ${VCPKG_BASE_VERSION})
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "vcpkg-requires-current-date",
|
||||
"version-string": "1.0.0",
|
||||
"description": "A test port that verifies that vcpkg_minimum_required is inclusive by using the current base version value.",
|
||||
"homepage": ""
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
vcpkg_minimum_required(VERSION 2999-12-31)
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "vcpkg-requires-future-date",
|
||||
"version-string": "1.0.0",
|
||||
"description": "A test port that requires a vcpkg version from an impossibly far future.",
|
||||
"homepage": ""
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
vcpkg_minimum_required(VERSION 2020-01-12)
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "vcpkg-requires-old-date",
|
||||
"version-string": "1.0.0",
|
||||
"description": "A test port that requires a vcpkg version from before vcpkg_minimum_required's introduction.",
|
||||
"homepage": ""
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_test_cmake(args args args)
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "vcpkg-uses-test-cmake",
|
||||
"version-string": "1.0.0",
|
||||
"description": "A test port that uses the deprecated function vcpkg_test_cmake.",
|
||||
"homepage": ""
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
include(vcpkg_common_functions)
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "vcpkg-uses-vcpkg-common-functions",
|
||||
"version-string": "1.0.0",
|
||||
"description": "A test port that uses the deprecated file vcpkg_common_functions.",
|
||||
"homepage": ""
|
||||
}
|
@ -1 +0,0 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name": "vcpkg-internal-e2e-test-port",
|
||||
"version-string": "1.0.0"
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"default": {
|
||||
"vcpkg-internal-e2e-test-port": { "baseline": "1.0.0" }
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"version-string": "1.0.0",
|
||||
"git-tree": "1dc3e42a3c0cafe2884d379af4399273238b986e"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||
set(VCPKG_CRT_LINKAGE dynamic)
|
||||
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
||||
|
||||
set(VCPKG_ENV_PASSTHROUGH _VCPKG_TEST_TRACKED _VCPKG_TEST_TRACKED2)
|
||||
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED _VCPKG_TEST_UNTRACKED _VCPKG_TEST_UNTRACKED2)
|
@ -1,145 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
|
||||
<RootNamespace>Project1</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
|
||||
</Project>
|
@ -1,146 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
|
||||
<RootNamespace>Project1</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
|
||||
</Project>
|
@ -1,6 +0,0 @@
|
||||
#include <zlib.h>
|
||||
|
||||
int main() {
|
||||
zlibVersion();
|
||||
return 0;
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
|
||||
<RootNamespace>VcpkgUseStatic</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgTriplet>x86-windows-static</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
|
||||
</Project>
|
@ -1,149 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
|
||||
<RootNamespace>VcpkgUseStatic</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<VcpkgTriplet>x86-windows-static</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
|
||||
</Project>
|
@ -1,151 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
|
||||
<RootNamespace>VcpkgUseStatic</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
|
||||
</Project>
|
@ -1,149 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
|
||||
<RootNamespace>VcpkgUseStatic</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
|
||||
</Project>
|
BIN
scripts/tls12-download.exe
Normal file
BIN
scripts/tls12-download.exe
Normal file
Binary file not shown.
@ -1,54 +0,0 @@
|
||||
BasedOnStyle: WebKit
|
||||
Language: Cpp
|
||||
Standard: Cpp11
|
||||
|
||||
UseTab: Never
|
||||
IndentWidth: 4
|
||||
ColumnLimit: 120
|
||||
PointerAlignment: Left
|
||||
|
||||
BreakBeforeBraces: Allman
|
||||
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AlignAfterOpenBracket: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
Cpp11BracedListStyle: true
|
||||
IndentCaseLabels: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
NamespaceIndentation: All
|
||||
ForEachMacros: [TEST_CASE, SECTION]
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
DeriveLineEnding: false
|
||||
UseCRLF: false
|
||||
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^(<vcpkg/base/system_headers\.h>|"pch\.h")$'
|
||||
Priority: -1
|
||||
- Regex: '^<catch2/catch\.hpp>$'
|
||||
Priority: 1
|
||||
- Regex: '^<vcpkg/base/fwd/.*\.h>$'
|
||||
Priority: 2
|
||||
- Regex: '^<vcpkg/fwd/.*\.h>$'
|
||||
Priority: 3
|
||||
- Regex: '^<vcpkg/base/.*\.h>$'
|
||||
Priority: 4
|
||||
- Regex: '^<vcpkg/.*\.h>$'
|
||||
Priority: 5
|
||||
- Regex: '^<[a-z0-9_]*\.h>$'
|
||||
Priority: 6
|
||||
- Regex: '^<[a-z0-9_]*>$' # C++ standard library
|
||||
Priority: 7
|
@ -1,222 +0,0 @@
|
||||
if(WIN32)
|
||||
# 3.16 for MSVC_RUNTIME_LIBRARY
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
else()
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
endif()
|
||||
|
||||
project(vcpkg C CXX)
|
||||
include(cmake/utilities.cmake)
|
||||
|
||||
# ===============
|
||||
# === Options ===
|
||||
# ===============
|
||||
|
||||
include(CMakeDependentOption)
|
||||
|
||||
option(BUILD_TESTING "Option for enabling testing" ON)
|
||||
option(VCPKG_ALLOW_APPLE_CLANG "Option for allowing apple clang, even versions that we don't know will work" OFF)
|
||||
option(VCPKG_DEVELOPMENT_WARNINGS "Option for turning on all warnings" ON)
|
||||
option(VCPKG_WARNINGS_AS_ERRORS "Set warnings to be errors" ${VCPKG_DEVELOPMENT_WARNINGS})
|
||||
option(VCPKG_BUILD_FUZZING "Option for enabling vcpkg-fuzz support" OFF)
|
||||
option(VCPKG_EMBED_GIT_SHA "Option for to fill in the Git SHA version; off by default to avoid privacy concerns out of official builds" OFF)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(VCPKG_BUILD_BENCHMARKING "Option for enabling benchmarking" OFF
|
||||
"BUILD_TESTING" OFF)
|
||||
|
||||
if(WERROR)
|
||||
message(DEPRECATION "-DWERROR is no longer a supported flag. It doesn't do anything.")
|
||||
endif()
|
||||
if(DEFINE_DISABLE_METRICS OR VCPKG_DISABLE_METRICS)
|
||||
message(DEPRECATION "DEFINE_DISABLE_METRICS / VCPKG_DISABLE_METRICS are now handled by creating a "
|
||||
"file vcpkg.disable_metrics next to the binary.")
|
||||
endif()
|
||||
|
||||
# =============
|
||||
# === Files ===
|
||||
# =============
|
||||
|
||||
file(GLOB VCPKGLIB_SOURCES CONFIGURE_DEPENDS src/vcpkg/*.cpp)
|
||||
file(GLOB VCPKGLIB_BASE_SOURCES CONFIGURE_DEPENDS src/vcpkg/base/*.cpp)
|
||||
file(GLOB VCPKGLIB_INCLUDES CONFIGURE_DEPENDS include/vcpkg/*.h include/vcpkg/fwd/*.h)
|
||||
file(GLOB VCPKGLIB_BASE_INCLUDES CONFIGURE_DEPENDS include/vcpkg/base/*.h include/vcpkg/base/fwd/*.h)
|
||||
|
||||
set(VCPKG_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg.cpp)
|
||||
|
||||
file(GLOB VCPKG_TEST_SOURCES CONFIGURE_DEPENDS src/vcpkg-test/*.cpp)
|
||||
file(GLOB VCPKG_TEST_INCLUDES CONFIGURE_DEPENDS include/vcpkg-test/*.h)
|
||||
|
||||
file(GLOB VCPKG_FUZZ_SOURCES CONFIGURE_DEPENDS src/vcpkg-fuzz/*.cpp)
|
||||
|
||||
# ========================
|
||||
# === System detection ===
|
||||
# ========================
|
||||
|
||||
vcpkg_detect_compiler()
|
||||
vcpkg_detect_standard_library()
|
||||
vcpkg_detect_std_filesystem()
|
||||
|
||||
if (VCPKG_EMBED_GIT_SHA)
|
||||
find_package(Git REQUIRED)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" status --porcelain=v1
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
OUTPUT_VARIABLE VCPKG_GIT_STATUS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if (VCPKG_GIT_STATUS STREQUAL "")
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
OUTPUT_VARIABLE VCPKG_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
message(WARNING "Skipping embedding SHA due to local changes.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED VCPKG_VERSION OR VCPKG_VERSION STREQUAL "")
|
||||
set(VCPKG_VERSION "unknownhash")
|
||||
endif()
|
||||
|
||||
set(VCPKG_BASE_VERSION "2021-01-13")
|
||||
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
if(MSVC)
|
||||
string(REGEX REPLACE "[-/]W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /guard:cf")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /debugtype:cv,fixup /guard:cf")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
endif()
|
||||
|
||||
# ===============
|
||||
# === Targets ===
|
||||
# ===============
|
||||
|
||||
# === Target: vcpkglib ===
|
||||
|
||||
add_library(vcpkglib
|
||||
${VCPKGLIB_BASE_SOURCES}
|
||||
${VCPKGLIB_SOURCES}
|
||||
${VCPKGLIB_BASE_INCLUDES}
|
||||
${VCPKGLIB_INCLUDES})
|
||||
target_include_directories(vcpkglib PUBLIC include)
|
||||
|
||||
vcpkg_target_add_warning_options(vcpkglib)
|
||||
target_compile_definitions(vcpkglib PUBLIC
|
||||
VCPKG_USE_STD_FILESYSTEM=$<BOOL:${VCPKG_USE_STD_FILESYSTEM}>
|
||||
VCPKG_VERSION=${VCPKG_VERSION}
|
||||
VCPKG_BASE_VERSION=${VCPKG_BASE_VERSION}
|
||||
)
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(vcpkglib PRIVATE Threads::Threads)
|
||||
|
||||
if(VCPKG_CXXFS_LIBRARY)
|
||||
target_link_libraries(vcpkglib PRIVATE ${VCPKG_CXXFS_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
get_target_property(_srcs vcpkglib SOURCES)
|
||||
|
||||
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
|
||||
set_property(SOURCE src/pch.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
|
||||
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
|
||||
endif()
|
||||
|
||||
set_source_files_properties(src/pch.cpp PROPERTIES COMPILE_FLAGS "/Ycpch.h")
|
||||
target_sources(vcpkglib PRIVATE src/pch.cpp)
|
||||
target_compile_options(vcpkglib PRIVATE /Yupch.h /FIpch.h /Zm200)
|
||||
else()
|
||||
target_compile_options(vcpkglib PRIVATE -include "${CMAKE_CURRENT_SOURCE_DIR}/include/pch.h")
|
||||
endif()
|
||||
|
||||
if (MINGW)
|
||||
target_compile_definitions(vcpkglib
|
||||
PUBLIC
|
||||
UNICODE
|
||||
_WIN32_WINNT=0x0601
|
||||
WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY=4
|
||||
__fastfail=exit)
|
||||
target_link_libraries(vcpkglib PUBLIC winhttp bcrypt version ole32 uuid)
|
||||
endif()
|
||||
|
||||
# === Target: vcpkg ===
|
||||
|
||||
add_executable(vcpkg ${VCPKG_SOURCES})
|
||||
target_link_libraries(vcpkg PRIVATE vcpkglib)
|
||||
vcpkg_target_add_warning_options(vcpkg)
|
||||
|
||||
# === Target: vcpkg-test ===
|
||||
|
||||
if (BUILD_TESTING)
|
||||
enable_testing()
|
||||
|
||||
add_executable(vcpkg-test
|
||||
${VCPKG_TEST_SOURCES}
|
||||
${VCPKG_TEST_INCLUDES})
|
||||
target_link_libraries(vcpkg-test PRIVATE vcpkglib)
|
||||
vcpkg_target_add_warning_options(vcpkg-test)
|
||||
|
||||
add_test(NAME default COMMAND vcpkg-test --order rand --rng-seed time)
|
||||
|
||||
if (VCPKG_BUILD_BENCHMARKING)
|
||||
target_compile_options(vcpkg-test PRIVATE -DCATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# === Target: vcpkg-fuzz ===
|
||||
|
||||
if(VCPKG_BUILD_FUZZING)
|
||||
add_executable(vcpkg-fuzz ${VCPKG_FUZZ_SOURCES})
|
||||
target_link_libraries(vcpkg-fuzz PRIVATE vcpkglib)
|
||||
vcpkg_target_add_warning_options(vcpkg-fuzz)
|
||||
endif()
|
||||
|
||||
|
||||
# === Target: tls12-download ===
|
||||
|
||||
set(TLS12_DOWNLOAD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/tls12-download.c)
|
||||
if(WIN32)
|
||||
add_executable(tls12-download ${TLS12_DOWNLOAD_SOURCES})
|
||||
set_property(TARGET tls12-download PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
set_property(TARGET tls12-download APPEND PROPERTY LINK_OPTIONS "$<IF:$<CONFIG:Debug>,,/ENTRY:entry>")
|
||||
target_link_libraries(tls12-download winhttp)
|
||||
endif()
|
||||
|
||||
|
||||
# === Target: format ===
|
||||
|
||||
find_program(CLANG_FORMAT clang-format)
|
||||
if(CLANG_FORMAT)
|
||||
# doing all of these formats in one line has a tendency to overflow the command line length
|
||||
add_custom_target(format
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.cpp
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_BASE_SOURCES}
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_SOURCES}
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${CMAKE_CURRENT_SOURCE_DIR}/include/pch.h
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_BASE_INCLUDES}
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_INCLUDES}
|
||||
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_SOURCES}
|
||||
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_TEST_SOURCES}
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_TEST_INCLUDES}
|
||||
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_FUZZ_SOURCES}
|
||||
COMMAND ${CLANG_FORMAT} -i -verbose ${TLS12_DOWNLOAD_SOURCES}
|
||||
)
|
||||
endif()
|
@ -1,250 +0,0 @@
|
||||
# Outputs to Cache: VCPKG_COMPILER
|
||||
function(vcpkg_detect_compiler)
|
||||
if(NOT DEFINED CACHE{VCPKG_COMPILER})
|
||||
message(STATUS "Detecting the C++ compiler in use")
|
||||
if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
message(FATAL_ERROR [[
|
||||
The g++ version picked up is too old; please install a newer compiler such as g++-7.
|
||||
On Ubuntu try the following:
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install g++-7 -y
|
||||
On CentOS try the following:
|
||||
sudo yum install centos-release-scl
|
||||
sudo yum install devtoolset-7
|
||||
scl enable devtoolset-7 bash
|
||||
]])
|
||||
endif()
|
||||
|
||||
set(COMPILER "gcc")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
||||
#[[
|
||||
Note: CMAKE_SYSTEM_VERSION uses darwin versions
|
||||
- Darwin 19.0.0 = macOS 10.15, iOS 13
|
||||
- Darwin 18.0.0 = macOS 10.14, iOS 12
|
||||
- Darwin 17.0.0 = macOS 10.13, iOS 11
|
||||
- Darwin 16.0.0 = macOS 10.12, iOS 10
|
||||
]]
|
||||
if(CMAKE_SYSTEM_VERSION VERSION_LESS "19.0.0" AND NOT VCPKG_ALLOW_APPLE_CLANG)
|
||||
message(FATAL_ERROR [[
|
||||
Building the vcpkg tool requires support for the C++ Filesystem TS.
|
||||
macOS versions below 10.15 do not have support for it with Apple Clang.
|
||||
Please install gcc6 or newer from homebrew (brew install gcc).
|
||||
If you would like to try anyway, pass --allowAppleClang to bootstrap.sh.
|
||||
]])
|
||||
endif()
|
||||
set(COMPILER "clang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
||||
set(COMPILER "clang")
|
||||
elseif(MSVC)
|
||||
set(COMPILER "msvc")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
|
||||
set(VCPKG_COMPILER ${COMPILER}
|
||||
CACHE STRING
|
||||
"The compiler in use; one of gcc, clang, msvc")
|
||||
message(STATUS "Detecting the C++ compiler in use - ${VCPKG_COMPILER}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Outputs to Cache: VCPKG_STANDARD_LIBRARY
|
||||
function(vcpkg_detect_standard_library)
|
||||
if(NOT DEFINED CACHE{VCPKG_STANDARD_LIBRARY})
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
message(STATUS "Detecting the C++ standard library")
|
||||
|
||||
# note: since <ciso646> is the smallest header, generally it's used to get the standard library version
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
check_cxx_source_compiles([[
|
||||
#include <ciso646>
|
||||
#if !defined(__GLIBCXX__)
|
||||
#error "not libstdc++"
|
||||
#endif
|
||||
int main() {}
|
||||
]]
|
||||
_VCPKG_STANDARD_LIBRARY_LIBSTDCXX)
|
||||
check_cxx_source_compiles([[
|
||||
#include <ciso646>
|
||||
#if !defined(_LIBCPP_VERSION)
|
||||
#error "not libc++"
|
||||
#endif
|
||||
int main() {}
|
||||
]]
|
||||
_VCPKG_STANDARD_LIBRARY_LIBCXX)
|
||||
check_cxx_source_compiles([[
|
||||
#include <ciso646>
|
||||
#if !defined(_MSVC_STL_VERSION) && !(defined(_MSC_VER) && _MSC_VER <= 1900)
|
||||
#error "not MSVC stl"
|
||||
#endif
|
||||
int main() {}
|
||||
]]
|
||||
_VCPKG_STANDARD_LIBRARY_MSVC_STL)
|
||||
if(_VCPKG_STANDARD_LIBRARY_LIBSTDCXX)
|
||||
set(STANDARD_LIBRARY "libstdc++")
|
||||
elseif(_VCPKG_STANDARD_LIBRARY_LIBCXX)
|
||||
set(STANDARD_LIBRARY "libc++")
|
||||
elseif(_VCPKG_STANDARD_LIBRARY_MSVC_STL)
|
||||
set(STANDARD_LIBRARY "msvc-stl")
|
||||
else()
|
||||
message(FATAL_ERROR "Can't find which C++ runtime is in use")
|
||||
endif()
|
||||
|
||||
set(VCPKG_STANDARD_LIBRARY ${STANDARD_LIBRARY}
|
||||
CACHE STRING
|
||||
"The C++ standard library in use; one of libstdc++, libc++, msvc-stl")
|
||||
|
||||
message(STATUS "Detecting the C++ standard library - ${VCPKG_STANDARD_LIBRARY}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Outputs to Cache: VCPKG_USE_STD_FILESYSTEM, VCPKG_CXXFS_LIBRARY
|
||||
function(vcpkg_detect_std_filesystem)
|
||||
vcpkg_detect_standard_library()
|
||||
|
||||
if(NOT DEFINED CACHE{VCPKG_USE_STD_FILESYSTEM})
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
message(STATUS "Detecting how to use the C++ filesystem library")
|
||||
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
if(VCPKG_STANDARD_LIBRARY STREQUAL "libstdc++")
|
||||
check_cxx_source_compiles([[
|
||||
#include <ciso646>
|
||||
#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 9
|
||||
#error "libstdc++ after version 9 does not require -lstdc++fs"
|
||||
#endif
|
||||
int main() {}
|
||||
]]
|
||||
_VCPKG_REQUIRE_LINK_CXXFS)
|
||||
|
||||
check_cxx_source_compiles([[
|
||||
#include <ciso646>
|
||||
#if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < 8
|
||||
#error "libstdc++ before version 8 does not support <filesystem>"
|
||||
#endif
|
||||
int main() {}
|
||||
]]
|
||||
_VCPKG_USE_STD_FILESYSTEM)
|
||||
|
||||
if(_VCPKG_REQUIRE_LINK_CXXFS)
|
||||
set(_VCPKG_CXXFS_LIBRARY "stdc++fs")
|
||||
endif()
|
||||
elseif(VCPKG_STANDARD_LIBRARY STREQUAL "libc++")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
||||
# AppleClang never requires (or allows) -lc++fs, even with libc++ version 8.0.0
|
||||
set(_VCPKG_CXXFS_LIBRARY OFF)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
# As above, not required on this platform (tested at least on 6.8)
|
||||
set(_VCPKG_CXXFS_LIBRARY OFF)
|
||||
else()
|
||||
check_cxx_source_compiles([[
|
||||
#include <ciso646>
|
||||
#if _LIBCPP_VERSION >= 9000
|
||||
#error "libc++ after version 9 does not require -lc++fs"
|
||||
#endif
|
||||
int main() {}
|
||||
]]
|
||||
_VCPKG_REQUIRE_LINK_CXXFS)
|
||||
|
||||
if(_VCPKG_REQUIRE_LINK_CXXFS)
|
||||
set(_VCPKG_CXXFS_LIBRARY "c++fs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# We don't support versions of libc++ < 7.0.0, and libc++ 7.0.0 has <filesystem>
|
||||
set(_VCPKG_USE_STD_FILESYSTEM ON)
|
||||
elseif(VCPKG_STANDARD_LIBRARY STREQUAL "msvc-stl")
|
||||
check_cxx_source_compiles(
|
||||
"#include <ciso646>
|
||||
#if !defined(_MSVC_STL_UPDATE) || _MSVC_STL_UPDATE < 201803
|
||||
#error \"MSVC STL before 15.7 does not support <filesystem>\"
|
||||
#endif
|
||||
int main() {}"
|
||||
_VCPKG_USE_STD_FILESYSTEM)
|
||||
|
||||
set(_VCPKG_CXXFS_LIBRARY OFF)
|
||||
endif()
|
||||
|
||||
set(VCPKG_USE_STD_FILESYSTEM ${_VCPKG_USE_STD_FILESYSTEM}
|
||||
CACHE BOOL
|
||||
"Whether to use <filesystem>, as opposed to <experimental/filesystem>"
|
||||
FORCE)
|
||||
set(VCPKG_CXXFS_LIBRARY ${_VCPKG_CXXFS_LIBRARY}
|
||||
CACHE STRING
|
||||
"Library to link (if any) in order to use <filesystem>"
|
||||
FORCE)
|
||||
|
||||
if(VCPKG_USE_STD_FILESYSTEM)
|
||||
set(msg "<filesystem>")
|
||||
else()
|
||||
set(msg "<experimental/filesystem>")
|
||||
endif()
|
||||
if(VCPKG_CXXFS_LIBRARY)
|
||||
set(msg "${msg} with -l${VCPKG_CXXFS_LIBRARY}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Detecting how to use the C++ filesystem library - ${msg}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(vcpkg_target_add_warning_options TARGET)
|
||||
if(MSVC)
|
||||
# either MSVC, or clang-cl
|
||||
target_compile_options(${TARGET} PRIVATE -FC)
|
||||
|
||||
if (MSVC_VERSION GREATER 1900)
|
||||
# Visual Studio 2017 or later
|
||||
target_compile_options(${TARGET} PRIVATE -permissive- -utf-8)
|
||||
endif()
|
||||
|
||||
if(VCPKG_DEVELOPMENT_WARNINGS)
|
||||
target_compile_options(${TARGET} PRIVATE -W4)
|
||||
if(VCPKG_COMPILER STREQUAL "clang")
|
||||
# -Wno-range-loop-analysis is due to an LLVM bug which will be fixed in a
|
||||
# future version of clang https://reviews.llvm.org/D73007
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wmissing-prototypes
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-range-loop-analysis
|
||||
)
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE -analyze)
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE -W3)
|
||||
endif()
|
||||
|
||||
if(VCPKG_WARNINGS_AS_ERRORS)
|
||||
target_compile_options(${TARGET} PRIVATE -WX)
|
||||
endif()
|
||||
else()
|
||||
if(VCPKG_DEVELOPMENT_WARNINGS)
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wall -Wextra -Wpedantic
|
||||
-Wno-unknown-pragmas
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-redundant-move
|
||||
)
|
||||
|
||||
# GCC and clang have different names for the same warning
|
||||
if(VCPKG_COMPILER STREQUAL "gcc")
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wmissing-declarations
|
||||
)
|
||||
elseif(VCPKG_COMPILER STREQUAL "clang")
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wmissing-prototypes
|
||||
-Wno-range-loop-analysis
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(VCPKG_WARNINGS_AS_ERRORS)
|
||||
target_compile_options(${TARGET} PRIVATE -Werror)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
File diff suppressed because it is too large
Load Diff
@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/system_headers.h>
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <process.h>
|
||||
#include <shellapi.h>
|
||||
#include <winhttp.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <chrono>
|
||||
#include <codecvt>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <regex>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#if defined(_WIN32)
|
||||
#include <sys/timeb.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
@ -1,42 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/cmakevars.h>
|
||||
|
||||
namespace vcpkg::Test
|
||||
{
|
||||
struct MockCMakeVarProvider : CMakeVars::CMakeVarProvider
|
||||
{
|
||||
using SMap = std::unordered_map<std::string, std::string>;
|
||||
void load_generic_triplet_vars(Triplet triplet) const override
|
||||
{
|
||||
generic_triplet_vars.emplace(triplet, SMap{});
|
||||
}
|
||||
|
||||
void load_dep_info_vars(Span<const PackageSpec> specs) const override
|
||||
{
|
||||
for (auto&& spec : specs)
|
||||
dep_info_vars.emplace(spec, SMap{});
|
||||
}
|
||||
|
||||
void load_tag_vars(Span<const FullPackageSpec> specs,
|
||||
const PortFileProvider::PortFileProvider& port_provider) const override
|
||||
{
|
||||
for (auto&& spec : specs)
|
||||
tag_vars.emplace(spec.package_spec, SMap{});
|
||||
(void)(port_provider);
|
||||
}
|
||||
|
||||
Optional<const std::unordered_map<std::string, std::string>&> get_generic_triplet_vars(
|
||||
Triplet triplet) const override;
|
||||
|
||||
Optional<const std::unordered_map<std::string, std::string>&> get_dep_info_vars(
|
||||
const PackageSpec& spec) const override;
|
||||
|
||||
Optional<const std::unordered_map<std::string, std::string>&> get_tag_vars(
|
||||
const PackageSpec& spec) const override;
|
||||
|
||||
mutable std::unordered_map<PackageSpec, std::unordered_map<std::string, std::string>> dep_info_vars;
|
||||
mutable std::unordered_map<PackageSpec, std::unordered_map<std::string, std::string>> tag_vars;
|
||||
mutable std::unordered_map<Triplet, std::unordered_map<std::string, std::string>> generic_triplet_vars;
|
||||
};
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
#include <vcpkg/base/system_headers.h>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#include <vcpkg/statusparagraph.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define CHECK_EC(ec) \
|
||||
do \
|
||||
{ \
|
||||
if (ec) \
|
||||
{ \
|
||||
FAIL(ec.message()); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
template<>
|
||||
struct StringMaker<vcpkg::FullPackageSpec>
|
||||
{
|
||||
static std::string convert(vcpkg::FullPackageSpec const& value)
|
||||
{
|
||||
return vcpkg::Strings::concat(value.package_spec.name(),
|
||||
'[',
|
||||
vcpkg::Strings::join(",", value.features),
|
||||
"]:",
|
||||
value.package_spec.triplet());
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct StringMaker<vcpkg::Triplet>
|
||||
{
|
||||
static const std::string& convert(const vcpkg::Triplet& triplet) { return triplet.canonical_name(); }
|
||||
};
|
||||
}
|
||||
|
||||
namespace vcpkg::Test
|
||||
{
|
||||
std::unique_ptr<SourceControlFile> make_control_file(
|
||||
const char* name,
|
||||
const char* depends,
|
||||
const std::vector<std::pair<const char*, const char*>>& features = {},
|
||||
const std::vector<const char*>& default_features = {});
|
||||
|
||||
inline auto test_parse_control_file(const std::vector<std::unordered_map<std::string, std::string>>& v)
|
||||
{
|
||||
std::vector<vcpkg::Parse::Paragraph> pghs;
|
||||
for (auto&& p : v)
|
||||
{
|
||||
pghs.emplace_back();
|
||||
for (auto&& kv : p)
|
||||
pghs.back().emplace(kv.first, std::make_pair(kv.second, vcpkg::Parse::TextRowCol{}));
|
||||
}
|
||||
return vcpkg::SourceControlFile::parse_control_file("", std::move(pghs));
|
||||
}
|
||||
|
||||
std::unique_ptr<vcpkg::StatusParagraph> make_status_pgh(const char* name,
|
||||
const char* depends = "",
|
||||
const char* default_features = "",
|
||||
const char* triplet = "x86-windows");
|
||||
|
||||
std::unique_ptr<vcpkg::StatusParagraph> make_status_feature_pgh(const char* name,
|
||||
const char* feature,
|
||||
const char* depends = "",
|
||||
const char* triplet = "x86-windows");
|
||||
|
||||
extern const Triplet X86_WINDOWS;
|
||||
extern const Triplet X64_WINDOWS;
|
||||
extern const Triplet X86_UWP;
|
||||
extern const Triplet ARM_UWP;
|
||||
extern const Triplet X64_ANDROID;
|
||||
|
||||
/// <summary>
|
||||
/// Map of source control files by their package name.
|
||||
/// </summary>
|
||||
struct PackageSpecMap
|
||||
{
|
||||
std::unordered_map<std::string, SourceControlFileLocation> map;
|
||||
Triplet triplet;
|
||||
PackageSpecMap(Triplet t = X86_WINDOWS) noexcept : triplet(t) { }
|
||||
|
||||
PackageSpec emplace(const char* name,
|
||||
const char* depends = "",
|
||||
const std::vector<std::pair<const char*, const char*>>& features = {},
|
||||
const std::vector<const char*>& default_features = {});
|
||||
|
||||
PackageSpec emplace(vcpkg::SourceControlFileLocation&& scfl);
|
||||
};
|
||||
|
||||
template<class T, class S>
|
||||
T&& unwrap(vcpkg::ExpectedT<T, S>&& p)
|
||||
{
|
||||
REQUIRE(p.has_value());
|
||||
return std::move(*p.get());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T&& unwrap(vcpkg::Optional<T>&& opt)
|
||||
{
|
||||
REQUIRE(opt.has_value());
|
||||
return std::move(*opt.get());
|
||||
}
|
||||
|
||||
struct AllowSymlinks
|
||||
{
|
||||
enum Tag : bool
|
||||
{
|
||||
No = false,
|
||||
Yes = true,
|
||||
} tag;
|
||||
|
||||
constexpr AllowSymlinks(Tag tag) noexcept : tag(tag) { }
|
||||
|
||||
constexpr explicit AllowSymlinks(bool b) noexcept : tag(b ? Yes : No) { }
|
||||
|
||||
constexpr operator bool() const noexcept { return tag == Yes; }
|
||||
};
|
||||
|
||||
AllowSymlinks can_create_symlinks() noexcept;
|
||||
|
||||
const fs::path& base_temporary_directory() noexcept;
|
||||
|
||||
void create_symlink(const fs::path& file, const fs::path& target, std::error_code& ec);
|
||||
|
||||
void create_directory_symlink(const fs::path& file, const fs::path& target, std::error_code& ec);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/fwd/vcpkgpaths.h>
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
|
||||
namespace vcpkg::Archives
|
||||
{
|
||||
void extract_archive(const VcpkgPaths& paths, const fs::path& archive, const fs::path& to_path);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/lineinfo.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
|
||||
namespace vcpkg::Checks
|
||||
{
|
||||
void register_global_shutdown_handler(void (*func)());
|
||||
|
||||
// Note: for internal use
|
||||
[[noreturn]] void final_cleanup_and_exit(const int exit_code);
|
||||
|
||||
// Indicate that an internal error has occurred and exit the tool. This should be used when invariants have been
|
||||
// broken.
|
||||
[[noreturn]] void unreachable(const LineInfo& line_info);
|
||||
|
||||
[[noreturn]] void exit_with_code(const LineInfo& line_info, const int exit_code);
|
||||
|
||||
// Exit the tool without an error message.
|
||||
[[noreturn]] void exit_fail(const LineInfo& line_info);
|
||||
|
||||
// Exit the tool successfully.
|
||||
[[noreturn]] void exit_success(const LineInfo& line_info);
|
||||
|
||||
// Display an error message to the user and exit the tool.
|
||||
[[noreturn]] void exit_with_message(const LineInfo& line_info, StringView error_message);
|
||||
|
||||
// If expression is false, call exit_fail.
|
||||
void check_exit(const LineInfo& line_info, bool expression);
|
||||
|
||||
// if expression is false, call exit_with_message.
|
||||
void check_exit(const LineInfo& line_info, bool expression, StringView error_message);
|
||||
|
||||
// Display a message indicating that vcpkg should be upgraded and exit.
|
||||
[[noreturn]] void exit_maybe_upgrade(const LineInfo& line_info);
|
||||
[[noreturn]] void exit_maybe_upgrade(const LineInfo& line_info, StringView error_message);
|
||||
|
||||
// Check the indicated condition and call exit_maybe_upgrade if it is false.
|
||||
void check_maybe_upgrade(const LineInfo& line_info, bool condition);
|
||||
void check_maybe_upgrade(const LineInfo& line_info, bool condition, StringView error_message);
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
template<class Key, class Value, class Less = std::less<Key>>
|
||||
struct Cache
|
||||
{
|
||||
template<class F>
|
||||
Value const& get_lazy(const Key& k, const F& f) const
|
||||
{
|
||||
auto it = m_cache.find(k);
|
||||
if (it != m_cache.end()) return it->second;
|
||||
return m_cache.emplace(k, f()).first->second;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable std::map<Key, Value, Less> m_cache;
|
||||
};
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/basic_checks.h>
|
||||
#include <vcpkg/base/strings.h>
|
||||
|
||||
namespace vcpkg::Checks
|
||||
{
|
||||
// Additional convenience overloads on top of basic_checks.h that do formatting.
|
||||
|
||||
template<class Arg1, class... Args>
|
||||
// Display an error message to the user and exit the tool.
|
||||
[[noreturn]] void exit_with_message(const LineInfo& line_info,
|
||||
const char* error_message_template,
|
||||
const Arg1& error_message_arg1,
|
||||
const Args&... error_message_args)
|
||||
{
|
||||
exit_with_message(line_info,
|
||||
Strings::format(error_message_template, error_message_arg1, error_message_args...));
|
||||
}
|
||||
|
||||
template<class Conditional, class Arg1, class... Args>
|
||||
void check_exit(const LineInfo& line_info,
|
||||
Conditional&& expression,
|
||||
const char* error_message_template,
|
||||
const Arg1& error_message_arg1,
|
||||
const Args&... error_message_args)
|
||||
{
|
||||
if (!expression)
|
||||
{
|
||||
// Only create the string if the expression is false
|
||||
exit_with_message(line_info,
|
||||
Strings::format(error_message_template, error_message_arg1, error_message_args...));
|
||||
}
|
||||
}
|
||||
|
||||
template<class Arg1, class... Args>
|
||||
[[noreturn]] void exit_maybe_upgrade(const LineInfo& line_info,
|
||||
const char* error_message_template,
|
||||
const Arg1& error_message_arg1,
|
||||
const Args&... error_message_args)
|
||||
{
|
||||
exit_maybe_upgrade(line_info,
|
||||
Strings::format(error_message_template, error_message_arg1, error_message_args...));
|
||||
}
|
||||
|
||||
template<class Conditional, class Arg1, class... Args>
|
||||
void check_maybe_upgrade(const LineInfo& line_info,
|
||||
Conditional&& expression,
|
||||
const char* error_message_template,
|
||||
const Arg1& error_message_arg1,
|
||||
const Args&... error_message_args)
|
||||
{
|
||||
if (!expression)
|
||||
{
|
||||
// Only create the string if the expression is false
|
||||
exit_maybe_upgrade(line_info,
|
||||
Strings::format(error_message_template, error_message_arg1, error_message_args...));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/cstringview.h>
|
||||
#include <vcpkg/base/optional.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
namespace vcpkg::Chrono
|
||||
{
|
||||
class ElapsedTime
|
||||
{
|
||||
using duration = std::chrono::high_resolution_clock::time_point::duration;
|
||||
|
||||
public:
|
||||
constexpr ElapsedTime() noexcept : m_duration() { }
|
||||
constexpr ElapsedTime(duration d) noexcept : m_duration(d) { }
|
||||
|
||||
template<class TimeUnit>
|
||||
TimeUnit as() const
|
||||
{
|
||||
return std::chrono::duration_cast<TimeUnit>(m_duration);
|
||||
}
|
||||
|
||||
std::string to_string() const;
|
||||
void to_string(std::string& into) const;
|
||||
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point::duration m_duration;
|
||||
};
|
||||
|
||||
class ElapsedTimer
|
||||
{
|
||||
public:
|
||||
static ElapsedTimer create_started();
|
||||
|
||||
constexpr ElapsedTimer() noexcept : m_start_tick() { }
|
||||
|
||||
ElapsedTime elapsed() const
|
||||
{
|
||||
return ElapsedTime(std::chrono::high_resolution_clock::now() - this->m_start_tick);
|
||||
}
|
||||
|
||||
double microseconds() const { return elapsed().as<std::chrono::duration<double, std::micro>>().count(); }
|
||||
|
||||
std::string to_string() const;
|
||||
void to_string(std::string& into) const;
|
||||
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point m_start_tick;
|
||||
};
|
||||
|
||||
class CTime
|
||||
{
|
||||
public:
|
||||
static Optional<CTime> get_current_date_time();
|
||||
static Optional<CTime> parse(CStringView str);
|
||||
|
||||
constexpr CTime() noexcept : m_tm{} { }
|
||||
explicit constexpr CTime(tm t) noexcept : m_tm{t} { }
|
||||
|
||||
CTime add_hours(const int hours) const;
|
||||
|
||||
std::string to_string() const;
|
||||
|
||||
std::chrono::system_clock::time_point to_time_point() const;
|
||||
|
||||
private:
|
||||
mutable tm m_tm;
|
||||
};
|
||||
|
||||
tm get_current_date_time();
|
||||
|
||||
tm get_current_date_time_local();
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/machinetype.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace vcpkg::CoffFileReader
|
||||
{
|
||||
struct DllInfo
|
||||
{
|
||||
MachineType machine_type;
|
||||
};
|
||||
|
||||
struct LibInfo
|
||||
{
|
||||
std::vector<MachineType> machine_types;
|
||||
};
|
||||
|
||||
#if defined(_WIN32)
|
||||
DllInfo read_dll(const fs::path& path);
|
||||
|
||||
LibInfo read_lib(const fs::path& path);
|
||||
#endif
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
struct CStringView
|
||||
{
|
||||
constexpr CStringView() noexcept : cstr(nullptr) { }
|
||||
constexpr CStringView(const char* cstr) : cstr(cstr) { }
|
||||
constexpr CStringView(const CStringView&) = default;
|
||||
CStringView(const std::string& str) : cstr(str.c_str()) { }
|
||||
|
||||
constexpr const char* c_str() const { return cstr; }
|
||||
|
||||
void to_string(std::string& str) const { str.append(cstr); }
|
||||
|
||||
private:
|
||||
const char* cstr;
|
||||
};
|
||||
|
||||
namespace details
|
||||
{
|
||||
inline bool strequal(const char* l, const char* r) { return strcmp(l, r) == 0; }
|
||||
}
|
||||
|
||||
inline bool operator==(const CStringView& l, const CStringView& r)
|
||||
{
|
||||
return details::strequal(l.c_str(), r.c_str());
|
||||
}
|
||||
|
||||
inline bool operator==(const char* l, const CStringView& r) { return details::strequal(l, r.c_str()); }
|
||||
|
||||
inline bool operator==(const CStringView& r, const char* l) { return details::strequal(l, r.c_str()); }
|
||||
|
||||
inline bool operator==(const std::string& l, const CStringView& r) { return l == r.c_str(); }
|
||||
|
||||
inline bool operator==(const CStringView& r, const std::string& l) { return l == r.c_str(); }
|
||||
|
||||
// notequals
|
||||
inline bool operator!=(const CStringView& l, const CStringView& r)
|
||||
{
|
||||
return !details::strequal(l.c_str(), r.c_str());
|
||||
}
|
||||
|
||||
inline bool operator!=(const char* l, const CStringView& r) { return !details::strequal(l, r.c_str()); }
|
||||
|
||||
inline bool operator!=(const CStringView& r, const char* l) { return !details::strequal(l, r.c_str()); }
|
||||
|
||||
inline bool operator!=(const CStringView& r, const std::string& l) { return l != r.c_str(); }
|
||||
|
||||
inline bool operator!=(const std::string& l, const CStringView& r) { return l != r.c_str(); }
|
||||
|
||||
inline std::string operator+(std::string&& l, const CStringView& r) { return std::move(l) + r.c_str(); }
|
||||
|
||||
inline const char* to_printf_arg(const CStringView string_view) { return string_view.c_str(); }
|
||||
|
||||
static_assert(sizeof(CStringView) == sizeof(void*), "CStringView must be a simple wrapper around char*");
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/optional.h>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
// implements the equivalent of function static initialization for an object
|
||||
template<class T>
|
||||
struct DelayedInit
|
||||
{
|
||||
template<class F>
|
||||
const T& get(F&& f) const
|
||||
{
|
||||
std::call_once(underlying_->flag_, [&f, this]() { underlying_->storage_ = std::forward<F>(f)(); });
|
||||
return *underlying_->storage_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
struct Storage
|
||||
{
|
||||
std::once_flag flag_;
|
||||
Optional<T> storage_;
|
||||
};
|
||||
std::unique_ptr<Storage> underlying_ = std::make_unique<Storage>();
|
||||
};
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/optional.h>
|
||||
#include <vcpkg/base/view.h>
|
||||
|
||||
namespace vcpkg::Downloads
|
||||
{
|
||||
namespace details
|
||||
{
|
||||
struct SplitURIView
|
||||
{
|
||||
StringView scheme;
|
||||
Optional<StringView> authority;
|
||||
StringView path_query_fragment;
|
||||
};
|
||||
|
||||
// e.g. {"https","//example.org", "/index.html"}
|
||||
Optional<SplitURIView> split_uri_view(StringView uri);
|
||||
}
|
||||
|
||||
void verify_downloaded_file_hash(const Files::Filesystem& fs,
|
||||
const std::string& url,
|
||||
const fs::path& path,
|
||||
const std::string& sha512);
|
||||
|
||||
// Returns url that was successfully downloaded from
|
||||
std::string download_file(Files::Filesystem& fs,
|
||||
View<std::string> urls,
|
||||
const fs::path& download_path,
|
||||
const std::string& sha512);
|
||||
|
||||
void download_file(Files::Filesystem& fs,
|
||||
const std::string& url,
|
||||
const fs::path& download_path,
|
||||
const std::string& sha512);
|
||||
|
||||
std::vector<int> download_files(Files::Filesystem& fs, View<std::pair<std::string, fs::path>> url_pairs);
|
||||
int put_file(const Files::Filesystem&, StringView url, const fs::path& file);
|
||||
std::vector<int> url_heads(View<std::string> urls);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/cstringview.h>
|
||||
#include <vcpkg/base/lineinfo.h>
|
||||
|
||||
namespace vcpkg::Enums
|
||||
{
|
||||
std::string nullvalue_to_string(const CStringView enum_name);
|
||||
|
||||
[[noreturn]] void nullvalue_used(const LineInfo& line_info, const CStringView enum_name);
|
||||
}
|
@ -1,245 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/checks.h>
|
||||
#include <vcpkg/base/lineinfo.h>
|
||||
#include <vcpkg/base/stringliteral.h>
|
||||
#include <vcpkg/base/system.print.h>
|
||||
|
||||
#include <system_error>
|
||||
#include <type_traits>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
template<class Err>
|
||||
struct ErrorHolder
|
||||
{
|
||||
ErrorHolder() : m_is_error(false), m_err{} { }
|
||||
template<class U>
|
||||
ErrorHolder(U&& err) : m_is_error(true), m_err(std::forward<U>(err))
|
||||
{
|
||||
}
|
||||
|
||||
constexpr bool has_error() const { return m_is_error; }
|
||||
|
||||
const Err& error() const { return m_err; }
|
||||
Err& error() { return m_err; }
|
||||
|
||||
StringLiteral to_string() const { return "value was error"; }
|
||||
|
||||
private:
|
||||
bool m_is_error;
|
||||
Err m_err;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ErrorHolder<std::string>
|
||||
{
|
||||
ErrorHolder() : m_is_error(false) { }
|
||||
template<class U>
|
||||
ErrorHolder(U&& err) : m_is_error(true), m_err(std::forward<U>(err))
|
||||
{
|
||||
}
|
||||
|
||||
bool has_error() const { return m_is_error; }
|
||||
|
||||
const std::string& error() const { return m_err; }
|
||||
std::string& error() { return m_err; }
|
||||
|
||||
const std::string& to_string() const { return m_err; }
|
||||
|
||||
private:
|
||||
bool m_is_error;
|
||||
std::string m_err;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ErrorHolder<std::error_code>
|
||||
{
|
||||
ErrorHolder() = default;
|
||||
ErrorHolder(const std::error_code& err) : m_err(err) { }
|
||||
|
||||
bool has_error() const { return bool(m_err); }
|
||||
|
||||
const std::error_code& error() const { return m_err; }
|
||||
std::error_code& error() { return m_err; }
|
||||
|
||||
std::string to_string() const { return m_err.message(); }
|
||||
|
||||
private:
|
||||
std::error_code m_err;
|
||||
};
|
||||
|
||||
struct ExpectedLeftTag
|
||||
{
|
||||
};
|
||||
struct ExpectedRightTag
|
||||
{
|
||||
};
|
||||
constexpr ExpectedLeftTag expected_left_tag;
|
||||
constexpr ExpectedRightTag expected_right_tag;
|
||||
|
||||
template<class T>
|
||||
struct ExpectedHolder
|
||||
{
|
||||
ExpectedHolder() = default;
|
||||
ExpectedHolder(const T& t) : t(t) { }
|
||||
ExpectedHolder(T&& t) : t(std::move(t)) { }
|
||||
using pointer = T*;
|
||||
using const_pointer = const T*;
|
||||
T* get() { return &t; }
|
||||
const T* get() const { return &t; }
|
||||
T t;
|
||||
};
|
||||
template<class T>
|
||||
struct ExpectedHolder<T&>
|
||||
{
|
||||
ExpectedHolder(T& t) : t(&t) { }
|
||||
ExpectedHolder() : t(nullptr) { }
|
||||
using pointer = T*;
|
||||
using const_pointer = T*;
|
||||
T* get() { return t; }
|
||||
T* get() const { return t; }
|
||||
T* t;
|
||||
};
|
||||
|
||||
template<class T, class S>
|
||||
class ExpectedT
|
||||
{
|
||||
public:
|
||||
constexpr ExpectedT() = default;
|
||||
|
||||
// Constructors are intentionally implicit
|
||||
|
||||
ExpectedT(const S& s, ExpectedRightTag = {}) : m_s(s) { }
|
||||
template<class = std::enable_if<!std::is_reference<S>::value>>
|
||||
ExpectedT(S&& s, ExpectedRightTag = {}) : m_s(std::move(s))
|
||||
{
|
||||
}
|
||||
|
||||
ExpectedT(const T& t, ExpectedLeftTag = {}) : m_t(t) { }
|
||||
template<class = std::enable_if<!std::is_reference<T>::value>>
|
||||
ExpectedT(T&& t, ExpectedLeftTag = {}) : m_t(std::move(t))
|
||||
{
|
||||
}
|
||||
|
||||
ExpectedT(const ExpectedT&) = default;
|
||||
ExpectedT(ExpectedT&&) = default;
|
||||
ExpectedT& operator=(const ExpectedT&) = default;
|
||||
ExpectedT& operator=(ExpectedT&&) = default;
|
||||
|
||||
explicit constexpr operator bool() const noexcept { return !m_s.has_error(); }
|
||||
constexpr bool has_value() const noexcept { return !m_s.has_error(); }
|
||||
|
||||
T&& value_or_exit(const LineInfo& line_info) &&
|
||||
{
|
||||
exit_if_error(line_info);
|
||||
return std::move(*this->m_t.get());
|
||||
}
|
||||
|
||||
const T& value_or_exit(const LineInfo& line_info) const&
|
||||
{
|
||||
exit_if_error(line_info);
|
||||
return *this->m_t.get();
|
||||
}
|
||||
|
||||
const S& error() const& { return this->m_s.error(); }
|
||||
|
||||
S&& error() && { return std::move(this->m_s.error()); }
|
||||
|
||||
typename ExpectedHolder<T>::const_pointer get() const
|
||||
{
|
||||
if (!this->has_value())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return this->m_t.get();
|
||||
}
|
||||
|
||||
typename ExpectedHolder<T>::pointer get()
|
||||
{
|
||||
if (!this->has_value())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return this->m_t.get();
|
||||
}
|
||||
|
||||
template<class F>
|
||||
using map_t = decltype(std::declval<F&>()(*std::declval<typename ExpectedHolder<T>::const_pointer>()));
|
||||
|
||||
template<class F, class U = map_t<F>>
|
||||
ExpectedT<U, S> map(F f) const&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return {f(*m_t.get()), expected_left_tag};
|
||||
}
|
||||
else
|
||||
{
|
||||
return {error(), expected_right_tag};
|
||||
}
|
||||
}
|
||||
|
||||
template<class F>
|
||||
using move_map_t =
|
||||
decltype(std::declval<F&>()(std::move(*std::declval<typename ExpectedHolder<T>::pointer>())));
|
||||
|
||||
template<class F, class U = move_map_t<F>>
|
||||
ExpectedT<U, S> map(F f) &&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return {f(std::move(*m_t.get())), expected_left_tag};
|
||||
}
|
||||
else
|
||||
{
|
||||
return {std::move(*this).error(), expected_right_tag};
|
||||
}
|
||||
}
|
||||
|
||||
template<class F, class U = map_t<F>>
|
||||
U then(F f) const&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return f(*m_t.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
return U{error(), expected_right_tag};
|
||||
}
|
||||
}
|
||||
|
||||
template<class F, class U = move_map_t<F>>
|
||||
U then(F f) &&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return f(std::move(*m_t.get()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return U{std::move(*this).error(), expected_right_tag};
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void exit_if_error(const LineInfo& line_info) const
|
||||
{
|
||||
if (m_s.has_error())
|
||||
{
|
||||
System::print2(System::Color::error, m_s.to_string(), "\n");
|
||||
Checks::exit_fail(line_info);
|
||||
}
|
||||
}
|
||||
|
||||
ErrorHolder<S> m_s;
|
||||
ExpectedHolder<T> m_t;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
using Expected = ExpectedT<T, std::error_code>;
|
||||
|
||||
template<class T>
|
||||
using ExpectedS = ExpectedT<T, std::string>;
|
||||
}
|
@ -1,315 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/expected.h>
|
||||
#include <vcpkg/base/ignore_errors.h>
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(VCPKG_USE_STD_FILESYSTEM)
|
||||
#error The build system must set VCPKG_USE_STD_FILESYSTEM.
|
||||
#endif // !defined(VCPKG_USE_STD_FILESYSTEM)
|
||||
|
||||
#if VCPKG_USE_STD_FILESYSTEM
|
||||
#include <filesystem>
|
||||
#else
|
||||
#include <experimental/filesystem>
|
||||
#endif
|
||||
|
||||
namespace fs
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
struct IsSlash
|
||||
{
|
||||
bool operator()(const wchar_t c) const noexcept { return c == L'/' || c == L'\\'; }
|
||||
};
|
||||
#else
|
||||
struct IsSlash
|
||||
{
|
||||
bool operator()(const char c) const noexcept { return c == '/'; }
|
||||
};
|
||||
#endif
|
||||
|
||||
constexpr IsSlash is_slash;
|
||||
|
||||
#if VCPKG_USE_STD_FILESYSTEM
|
||||
namespace stdfs = std::filesystem;
|
||||
#else
|
||||
namespace stdfs = std::experimental::filesystem;
|
||||
#endif
|
||||
|
||||
using stdfs::copy_options;
|
||||
using stdfs::directory_iterator;
|
||||
using stdfs::path;
|
||||
using stdfs::perms;
|
||||
|
||||
path u8path(vcpkg::StringView s);
|
||||
inline path u8path(const char* first, const char* last) { return u8path(vcpkg::StringView{first, last}); }
|
||||
inline path u8path(std::initializer_list<char> il) { return u8path(vcpkg::StringView{il.begin(), il.end()}); }
|
||||
inline path u8path(const char* s) { return u8path(vcpkg::StringView{s, s + ::strlen(s)}); }
|
||||
|
||||
inline path u8path(std::string::const_iterator first, std::string::const_iterator last)
|
||||
{
|
||||
auto firstp = &*first;
|
||||
return u8path(vcpkg::StringView{firstp, firstp + (last - first)});
|
||||
}
|
||||
|
||||
std::string u8string(const path& p);
|
||||
std::string generic_u8string(const path& p);
|
||||
|
||||
// equivalent to p.lexically_normal()
|
||||
path lexically_normal(const path& p);
|
||||
|
||||
#if defined(_WIN32)
|
||||
enum class file_type
|
||||
{
|
||||
none = 0,
|
||||
not_found = -1,
|
||||
regular = 1,
|
||||
directory = 2,
|
||||
symlink = 3,
|
||||
block = 4,
|
||||
character = 5,
|
||||
fifo = 6,
|
||||
socket = 7,
|
||||
unknown = 8,
|
||||
// also stands for a junction
|
||||
directory_symlink = 42
|
||||
};
|
||||
|
||||
struct file_status
|
||||
{
|
||||
explicit file_status(file_type type = file_type::none, perms permissions = perms::unknown) noexcept
|
||||
: m_type(type), m_permissions(permissions)
|
||||
{
|
||||
}
|
||||
|
||||
file_type type() const noexcept { return m_type; }
|
||||
void type(file_type type) noexcept { m_type = type; }
|
||||
|
||||
perms permissions() const noexcept { return m_permissions; }
|
||||
void permissions(perms perm) noexcept { m_permissions = perm; }
|
||||
|
||||
private:
|
||||
file_type m_type;
|
||||
perms m_permissions;
|
||||
};
|
||||
|
||||
struct SystemHandle
|
||||
{
|
||||
using type = intptr_t; // HANDLE
|
||||
type system_handle = -1;
|
||||
|
||||
bool is_valid() const { return system_handle != -1; }
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
using stdfs::file_type;
|
||||
// to set up ADL correctly on `file_status` objects, we are defining
|
||||
// this in our own namespace
|
||||
struct file_status : private stdfs::file_status
|
||||
{
|
||||
using stdfs::file_status::file_status;
|
||||
using stdfs::file_status::permissions;
|
||||
using stdfs::file_status::type;
|
||||
};
|
||||
|
||||
struct SystemHandle
|
||||
{
|
||||
using type = int; // file descriptor
|
||||
type system_handle = -1;
|
||||
|
||||
bool is_valid() const { return system_handle != -1; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
inline bool operator==(SystemHandle lhs, SystemHandle rhs) noexcept
|
||||
{
|
||||
return lhs.system_handle == rhs.system_handle;
|
||||
}
|
||||
inline bool operator!=(SystemHandle lhs, SystemHandle rhs) noexcept { return !(lhs == rhs); }
|
||||
|
||||
inline bool is_symlink(file_status s) noexcept
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if (s.type() == file_type::directory_symlink) return true;
|
||||
#endif
|
||||
return s.type() == file_type::symlink;
|
||||
}
|
||||
inline bool is_regular_file(file_status s) { return s.type() == file_type::regular; }
|
||||
inline bool is_directory(file_status s) { return s.type() == file_type::directory; }
|
||||
inline bool exists(file_status s) { return s.type() != file_type::not_found && s.type() != file_type::none; }
|
||||
}
|
||||
|
||||
/*
|
||||
if someone attempts to use unqualified `symlink_status` or `is_symlink`,
|
||||
they might get the ADL version, which is broken.
|
||||
Therefore, put `(symlink_)?status` as deleted in the global namespace, so
|
||||
that they get an error.
|
||||
|
||||
We also want to poison the ADL on the other functions, because
|
||||
we don't want people calling these functions on paths
|
||||
*/
|
||||
void status(const fs::path& p) = delete;
|
||||
void status(const fs::path& p, std::error_code& ec) = delete;
|
||||
void symlink_status(const fs::path& p) = delete;
|
||||
void symlink_status(const fs::path& p, std::error_code& ec) = delete;
|
||||
void is_symlink(const fs::path& p) = delete;
|
||||
void is_symlink(const fs::path& p, std::error_code& ec) = delete;
|
||||
void is_regular_file(const fs::path& p) = delete;
|
||||
void is_regular_file(const fs::path& p, std::error_code& ec) = delete;
|
||||
void is_directory(const fs::path& p) = delete;
|
||||
void is_directory(const fs::path& p, std::error_code& ec) = delete;
|
||||
|
||||
namespace vcpkg::Files
|
||||
{
|
||||
struct Filesystem
|
||||
{
|
||||
std::string read_contents(const fs::path& file_path, LineInfo linfo) const;
|
||||
virtual Expected<std::string> read_contents(const fs::path& file_path) const = 0;
|
||||
/// <summary>Read text lines from a file</summary>
|
||||
/// <remarks>Lines will have up to one trailing carriage-return character stripped (CRLF)</remarks>
|
||||
virtual Expected<std::vector<std::string>> read_lines(const fs::path& file_path) const = 0;
|
||||
virtual fs::path find_file_recursively_up(const fs::path& starting_dir, const fs::path& filename) const = 0;
|
||||
virtual std::vector<fs::path> get_files_recursive(const fs::path& dir) const = 0;
|
||||
virtual std::vector<fs::path> get_files_non_recursive(const fs::path& dir) const = 0;
|
||||
void write_lines(const fs::path& file_path, const std::vector<std::string>& lines, LineInfo linfo);
|
||||
virtual void write_lines(const fs::path& file_path,
|
||||
const std::vector<std::string>& lines,
|
||||
std::error_code& ec) = 0;
|
||||
void write_contents(const fs::path& path, const std::string& data, LineInfo linfo);
|
||||
virtual void write_contents(const fs::path& file_path, const std::string& data, std::error_code& ec) = 0;
|
||||
void write_contents_and_dirs(const fs::path& path, const std::string& data, LineInfo linfo);
|
||||
virtual void write_contents_and_dirs(const fs::path& file_path,
|
||||
const std::string& data,
|
||||
std::error_code& ec) = 0;
|
||||
void rename(const fs::path& oldpath, const fs::path& newpath, LineInfo linfo);
|
||||
virtual void rename(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) = 0;
|
||||
virtual void rename_or_copy(const fs::path& oldpath,
|
||||
const fs::path& newpath,
|
||||
StringLiteral temp_suffix,
|
||||
std::error_code& ec) = 0;
|
||||
bool remove(const fs::path& path, LineInfo linfo);
|
||||
bool remove(const fs::path& path, ignore_errors_t);
|
||||
virtual bool remove(const fs::path& path, std::error_code& ec) = 0;
|
||||
|
||||
virtual void remove_all(const fs::path& path, std::error_code& ec, fs::path& failure_point) = 0;
|
||||
void remove_all(const fs::path& path, LineInfo li);
|
||||
void remove_all(const fs::path& path, ignore_errors_t);
|
||||
virtual void remove_all_inside(const fs::path& path, std::error_code& ec, fs::path& failure_point) = 0;
|
||||
void remove_all_inside(const fs::path& path, LineInfo li);
|
||||
void remove_all_inside(const fs::path& path, ignore_errors_t);
|
||||
bool exists(const fs::path& path, std::error_code& ec) const;
|
||||
bool exists(LineInfo li, const fs::path& path) const;
|
||||
bool exists(const fs::path& path, ignore_errors_t = ignore_errors) const;
|
||||
virtual bool is_directory(const fs::path& path) const = 0;
|
||||
virtual bool is_regular_file(const fs::path& path) const = 0;
|
||||
virtual bool is_empty(const fs::path& path) const = 0;
|
||||
virtual bool create_directory(const fs::path& path, std::error_code& ec) = 0;
|
||||
bool create_directory(const fs::path& path, ignore_errors_t);
|
||||
bool create_directory(const fs::path& path, LineInfo li);
|
||||
virtual bool create_directories(const fs::path& path, std::error_code& ec) = 0;
|
||||
bool create_directories(const fs::path& path, ignore_errors_t);
|
||||
bool create_directories(const fs::path& path, LineInfo);
|
||||
virtual void copy(const fs::path& oldpath, const fs::path& newpath, fs::copy_options opts) = 0;
|
||||
virtual bool copy_file(const fs::path& oldpath,
|
||||
const fs::path& newpath,
|
||||
fs::copy_options opts,
|
||||
std::error_code& ec) = 0;
|
||||
void copy_file(const fs::path& oldpath, const fs::path& newpath, fs::copy_options opts, LineInfo li);
|
||||
virtual void copy_symlink(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) = 0;
|
||||
virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0;
|
||||
virtual fs::file_status symlink_status(const fs::path& path, std::error_code& ec) const = 0;
|
||||
fs::file_status status(LineInfo li, const fs::path& p) const noexcept;
|
||||
fs::file_status status(const fs::path& p, ignore_errors_t) const noexcept;
|
||||
fs::file_status symlink_status(LineInfo li, const fs::path& p) const noexcept;
|
||||
fs::file_status symlink_status(const fs::path& p, ignore_errors_t) const noexcept;
|
||||
virtual fs::path absolute(const fs::path& path, std::error_code& ec) const = 0;
|
||||
fs::path absolute(LineInfo li, const fs::path& path) const;
|
||||
virtual fs::path canonical(const fs::path& path, std::error_code& ec) const = 0;
|
||||
fs::path canonical(LineInfo li, const fs::path& path) const;
|
||||
fs::path canonical(const fs::path& path, ignore_errors_t) const;
|
||||
virtual fs::path current_path(std::error_code&) const = 0;
|
||||
fs::path current_path(LineInfo li) const;
|
||||
virtual void current_path(const fs::path& path, std::error_code&) = 0;
|
||||
void current_path(const fs::path& path, LineInfo li);
|
||||
|
||||
// if the path does not exist, then (try_|)take_exclusive_file_lock attempts to create the file
|
||||
// (but not any path members above the file itself)
|
||||
// in other words, if `/a/b` is a directory, and you're attempting to lock `/a/b/c`,
|
||||
// then these lock functions create `/a/b/c` if it doesn't exist;
|
||||
// however, if `/a/b` doesn't exist, then the functions will fail.
|
||||
|
||||
// waits forever for the file lock
|
||||
virtual fs::SystemHandle take_exclusive_file_lock(const fs::path& path, std::error_code&) = 0;
|
||||
// waits, at most, 1.5 seconds, for the file lock
|
||||
virtual fs::SystemHandle try_take_exclusive_file_lock(const fs::path& path, std::error_code&) = 0;
|
||||
virtual void unlock_file_lock(fs::SystemHandle handle, std::error_code&) = 0;
|
||||
|
||||
virtual std::vector<fs::path> find_from_PATH(const std::string& name) const = 0;
|
||||
};
|
||||
|
||||
Filesystem& get_real_filesystem();
|
||||
|
||||
static constexpr const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
|
||||
|
||||
bool has_invalid_chars_for_filesystem(const std::string& s);
|
||||
|
||||
void print_paths(const std::vector<fs::path>& paths);
|
||||
|
||||
// Performs "lhs / rhs" according to the C++17 Filesystem Library Specification.
|
||||
// This function exists as a workaround for TS implementations.
|
||||
fs::path combine(const fs::path& lhs, const fs::path& rhs);
|
||||
|
||||
#if defined(_WIN32)
|
||||
constexpr char preferred_separator = '\\';
|
||||
#else
|
||||
constexpr char preferred_separator = '/';
|
||||
#endif // _WIN32
|
||||
|
||||
#if defined(_WIN32)
|
||||
fs::path win32_fix_path_case(const fs::path& source);
|
||||
#endif // _WIN32
|
||||
|
||||
struct ExclusiveFileLock
|
||||
{
|
||||
enum class Wait
|
||||
{
|
||||
Yes,
|
||||
No,
|
||||
};
|
||||
|
||||
ExclusiveFileLock() = default;
|
||||
ExclusiveFileLock(ExclusiveFileLock&&) = delete;
|
||||
ExclusiveFileLock& operator=(ExclusiveFileLock&&) = delete;
|
||||
|
||||
ExclusiveFileLock(Wait wait, Filesystem& fs, const fs::path& path_, std::error_code& ec) : m_fs(&fs)
|
||||
{
|
||||
switch (wait)
|
||||
{
|
||||
case Wait::Yes: m_handle = m_fs->take_exclusive_file_lock(path_, ec); break;
|
||||
case Wait::No: m_handle = m_fs->try_take_exclusive_file_lock(path_, ec); break;
|
||||
}
|
||||
}
|
||||
~ExclusiveFileLock() { clear(); }
|
||||
|
||||
explicit operator bool() const { return m_handle.is_valid(); }
|
||||
bool has_lock() const { return m_handle.is_valid(); }
|
||||
|
||||
void clear()
|
||||
{
|
||||
if (m_fs && m_handle.is_valid())
|
||||
{
|
||||
std::error_code ignore;
|
||||
m_fs->unlock_file_lock(std::exchange(m_handle, fs::SystemHandle{}), ignore);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Filesystem* m_fs;
|
||||
fs::SystemHandle m_handle;
|
||||
};
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg::Json
|
||||
{
|
||||
struct JsonStyle;
|
||||
enum class ValueKind : int;
|
||||
struct Value;
|
||||
struct Object;
|
||||
struct Array;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg::Util
|
||||
{
|
||||
template<class T>
|
||||
struct LockGuardPtr;
|
||||
|
||||
template<class T>
|
||||
struct LockGuarded;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
template<class T>
|
||||
struct Optional;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
template<class T>
|
||||
struct Span;
|
||||
|
||||
template<class T>
|
||||
using View = Span<const T>;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
struct StringView;
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/checks.h>
|
||||
#include <vcpkg/base/lineinfo.h>
|
||||
#include <vcpkg/base/system.print.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace vcpkg::Graphs
|
||||
{
|
||||
enum class ExplorationStatus
|
||||
{
|
||||
// We have not visited this vertex
|
||||
NOT_EXPLORED,
|
||||
|
||||
// We have visited this vertex but haven't visited all vertices in its subtree
|
||||
PARTIALLY_EXPLORED,
|
||||
|
||||
// We have visited this vertex and all vertices in its subtree
|
||||
FULLY_EXPLORED
|
||||
};
|
||||
|
||||
template<class V, class U>
|
||||
struct AdjacencyProvider
|
||||
{
|
||||
virtual std::vector<V> adjacency_list(const U& vertex) const = 0;
|
||||
virtual std::string to_string(const V& vertex) const = 0;
|
||||
virtual U load_vertex_data(const V& vertex) const = 0;
|
||||
};
|
||||
|
||||
struct Randomizer
|
||||
{
|
||||
virtual int random(int max_exclusive) = 0;
|
||||
|
||||
protected:
|
||||
~Randomizer() { }
|
||||
};
|
||||
|
||||
namespace details
|
||||
{
|
||||
template<class Container>
|
||||
void shuffle(Container& c, Randomizer* r)
|
||||
{
|
||||
if (!r) return;
|
||||
for (auto i = c.size(); i > 1; --i)
|
||||
{
|
||||
std::size_t j = r->random(static_cast<int>(i));
|
||||
if (j != i - 1)
|
||||
{
|
||||
std::swap(c[i - 1], c[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class V, class U>
|
||||
void topological_sort_internal(const V& vertex,
|
||||
const AdjacencyProvider<V, U>& f,
|
||||
std::unordered_map<V, ExplorationStatus>& exploration_status,
|
||||
std::vector<U>& sorted,
|
||||
Randomizer* randomizer)
|
||||
{
|
||||
ExplorationStatus& status = exploration_status[vertex];
|
||||
switch (status)
|
||||
{
|
||||
case ExplorationStatus::FULLY_EXPLORED: return;
|
||||
case ExplorationStatus::PARTIALLY_EXPLORED:
|
||||
{
|
||||
System::print2("Cycle detected within graph at ", f.to_string(vertex), ":\n");
|
||||
for (auto&& node : exploration_status)
|
||||
{
|
||||
if (node.second == ExplorationStatus::PARTIALLY_EXPLORED)
|
||||
{
|
||||
System::print2(" ", f.to_string(node.first), '\n');
|
||||
}
|
||||
}
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
case ExplorationStatus::NOT_EXPLORED:
|
||||
{
|
||||
status = ExplorationStatus::PARTIALLY_EXPLORED;
|
||||
U vertex_data = f.load_vertex_data(vertex);
|
||||
auto neighbours = f.adjacency_list(vertex_data);
|
||||
details::shuffle(neighbours, randomizer);
|
||||
for (const V& neighbour : neighbours)
|
||||
topological_sort_internal(neighbour, f, exploration_status, sorted, randomizer);
|
||||
|
||||
sorted.push_back(std::move(vertex_data));
|
||||
status = ExplorationStatus::FULLY_EXPLORED;
|
||||
return;
|
||||
}
|
||||
default: Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class Range, class V, class U>
|
||||
std::vector<U> topological_sort(Range starting_vertices, const AdjacencyProvider<V, U>& f, Randomizer* randomizer)
|
||||
{
|
||||
std::vector<U> sorted;
|
||||
std::unordered_map<V, ExplorationStatus> exploration_status;
|
||||
|
||||
details::shuffle(starting_vertices, randomizer);
|
||||
|
||||
for (auto&& vertex : starting_vertices)
|
||||
{
|
||||
details::topological_sort_internal(vertex, f, exploration_status, sorted, randomizer);
|
||||
}
|
||||
|
||||
return sorted;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace vcpkg::Hash
|
||||
{
|
||||
enum class Algorithm
|
||||
{
|
||||
Sha1,
|
||||
Sha256,
|
||||
Sha512,
|
||||
};
|
||||
|
||||
const char* to_string(Algorithm algo) noexcept;
|
||||
Optional<Algorithm> algorithm_from_string(StringView sv) noexcept;
|
||||
|
||||
struct Hasher
|
||||
{
|
||||
virtual void add_bytes(const void* start, const void* end) noexcept = 0;
|
||||
|
||||
// one may only call this once before calling `clear()` or the dtor
|
||||
virtual std::string get_hash() noexcept = 0;
|
||||
virtual void clear() noexcept = 0;
|
||||
virtual ~Hasher() = default;
|
||||
};
|
||||
|
||||
std::unique_ptr<Hasher> get_hasher_for(Algorithm algo) noexcept;
|
||||
|
||||
std::string get_bytes_hash(const void* first, const void* last, Algorithm algo) noexcept;
|
||||
std::string get_string_hash(StringView s, Algorithm algo) noexcept;
|
||||
std::string get_file_hash(const Files::Filesystem& fs,
|
||||
const fs::path& path,
|
||||
Algorithm algo,
|
||||
std::error_code& ec) noexcept;
|
||||
inline std::string get_file_hash(LineInfo li,
|
||||
const Files::Filesystem& fs,
|
||||
const fs::path& path,
|
||||
Algorithm algo) noexcept
|
||||
{
|
||||
std::error_code ec;
|
||||
const auto result = get_file_hash(fs, path, algo, ec);
|
||||
if (ec)
|
||||
{
|
||||
Checks::exit_with_message(
|
||||
li, "Failure to read file '%s' for hashing: %s", fs::u8string(path), ec.message());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
struct ignore_errors_t
|
||||
{
|
||||
};
|
||||
|
||||
constexpr ignore_errors_t ignore_errors;
|
||||
}
|
@ -1,302 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/fwd/json.h>
|
||||
|
||||
#include <vcpkg/base/expected.h>
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/parse.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace vcpkg::Json
|
||||
{
|
||||
struct JsonStyle
|
||||
{
|
||||
enum class Newline
|
||||
{
|
||||
Lf,
|
||||
CrLf
|
||||
} newline_kind = Newline::Lf;
|
||||
|
||||
constexpr JsonStyle() noexcept = default;
|
||||
|
||||
static JsonStyle with_tabs() noexcept { return JsonStyle{-1}; }
|
||||
static JsonStyle with_spaces(int indent) noexcept
|
||||
{
|
||||
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, indent >= 0);
|
||||
return JsonStyle{indent};
|
||||
}
|
||||
|
||||
void set_tabs() noexcept { this->indent = -1; }
|
||||
void set_spaces(int indent_) noexcept
|
||||
{
|
||||
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, indent >= 0);
|
||||
this->indent = indent_;
|
||||
}
|
||||
|
||||
bool use_tabs() const noexcept { return indent == -1; }
|
||||
bool use_spaces() const noexcept { return indent >= 0; }
|
||||
|
||||
int spaces() const noexcept
|
||||
{
|
||||
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, indent >= 0);
|
||||
return indent;
|
||||
}
|
||||
|
||||
const char* newline() const noexcept
|
||||
{
|
||||
switch (this->newline_kind)
|
||||
{
|
||||
case Newline::Lf: return "\n";
|
||||
case Newline::CrLf: return "\r\n";
|
||||
default: Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr explicit JsonStyle(int indent) : indent(indent) { }
|
||||
// -1 for tab, >=0 gives # of spaces
|
||||
int indent = 2;
|
||||
};
|
||||
|
||||
enum class ValueKind : int
|
||||
{
|
||||
Null,
|
||||
Boolean,
|
||||
Integer,
|
||||
Number,
|
||||
String,
|
||||
Array,
|
||||
Object
|
||||
};
|
||||
|
||||
namespace impl
|
||||
{
|
||||
struct ValueImpl;
|
||||
}
|
||||
|
||||
struct Value
|
||||
{
|
||||
Value() noexcept; // equivalent to Value::null()
|
||||
Value(Value&&) noexcept;
|
||||
Value(const Value&);
|
||||
Value& operator=(Value&&) noexcept;
|
||||
Value& operator=(const Value&);
|
||||
~Value();
|
||||
|
||||
ValueKind kind() const noexcept;
|
||||
|
||||
bool is_null() const noexcept;
|
||||
bool is_boolean() const noexcept;
|
||||
bool is_integer() const noexcept;
|
||||
// either integer _or_ number
|
||||
bool is_number() const noexcept;
|
||||
bool is_string() const noexcept;
|
||||
bool is_array() const noexcept;
|
||||
bool is_object() const noexcept;
|
||||
|
||||
// a.x() asserts when !a.is_x()
|
||||
bool boolean() const noexcept;
|
||||
int64_t integer() const noexcept;
|
||||
double number() const noexcept;
|
||||
StringView string() const noexcept;
|
||||
|
||||
const Array& array() const& noexcept;
|
||||
Array& array() & noexcept;
|
||||
Array&& array() && noexcept;
|
||||
|
||||
const Object& object() const& noexcept;
|
||||
Object& object() & noexcept;
|
||||
Object&& object() && noexcept;
|
||||
|
||||
static Value null(std::nullptr_t) noexcept;
|
||||
static Value boolean(bool) noexcept;
|
||||
static Value integer(int64_t i) noexcept;
|
||||
static Value number(double d) noexcept;
|
||||
static Value string(std::string s) noexcept;
|
||||
static Value array(Array&&) noexcept;
|
||||
static Value array(const Array&) noexcept;
|
||||
static Value object(Object&&) noexcept;
|
||||
static Value object(const Object&) noexcept;
|
||||
|
||||
friend bool operator==(const Value& lhs, const Value& rhs);
|
||||
friend bool operator!=(const Value& lhs, const Value& rhs) { return !(lhs == rhs); }
|
||||
|
||||
private:
|
||||
friend struct impl::ValueImpl;
|
||||
std::unique_ptr<impl::ValueImpl> underlying_;
|
||||
};
|
||||
|
||||
struct Array
|
||||
{
|
||||
private:
|
||||
using underlying_t = std::vector<Value>;
|
||||
|
||||
public:
|
||||
Array() = default;
|
||||
Array(Array const&) = default;
|
||||
Array(Array&&) = default;
|
||||
Array& operator=(Array const&) = default;
|
||||
Array& operator=(Array&&) = default;
|
||||
~Array() = default;
|
||||
|
||||
using iterator = underlying_t::iterator;
|
||||
using const_iterator = underlying_t::const_iterator;
|
||||
|
||||
Value& push_back(Value&& value);
|
||||
Object& push_back(Object&& value);
|
||||
Array& push_back(Array&& value);
|
||||
Value& insert_before(iterator it, Value&& value);
|
||||
Object& insert_before(iterator it, Object&& value);
|
||||
Array& insert_before(iterator it, Array&& value);
|
||||
|
||||
std::size_t size() const noexcept { return this->underlying_.size(); }
|
||||
|
||||
// asserts idx < size
|
||||
Value& operator[](std::size_t idx) noexcept
|
||||
{
|
||||
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, idx < this->size());
|
||||
return this->underlying_[idx];
|
||||
}
|
||||
const Value& operator[](std::size_t idx) const noexcept
|
||||
{
|
||||
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, idx < this->size());
|
||||
return this->underlying_[idx];
|
||||
}
|
||||
|
||||
iterator begin() { return underlying_.begin(); }
|
||||
iterator end() { return underlying_.end(); }
|
||||
const_iterator begin() const { return cbegin(); }
|
||||
const_iterator end() const { return cend(); }
|
||||
const_iterator cbegin() const { return underlying_.cbegin(); }
|
||||
const_iterator cend() const { return underlying_.cend(); }
|
||||
|
||||
friend bool operator==(const Array& lhs, const Array& rhs);
|
||||
friend bool operator!=(const Array& lhs, const Array& rhs) { return !(lhs == rhs); }
|
||||
|
||||
private:
|
||||
underlying_t underlying_;
|
||||
};
|
||||
|
||||
struct Object
|
||||
{
|
||||
private:
|
||||
using value_type = std::pair<std::string, Value>;
|
||||
using underlying_t = std::vector<value_type>;
|
||||
|
||||
underlying_t::const_iterator internal_find_key(StringView key) const noexcept;
|
||||
|
||||
public:
|
||||
// these are here for better diagnostics
|
||||
Object() = default;
|
||||
Object(Object const&) = default;
|
||||
Object(Object&&) = default;
|
||||
Object& operator=(Object const&) = default;
|
||||
Object& operator=(Object&&) = default;
|
||||
~Object() = default;
|
||||
|
||||
// asserts if the key is found
|
||||
Value& insert(std::string key, Value&& value);
|
||||
Value& insert(std::string key, const Value& value);
|
||||
Object& insert(std::string key, Object&& value);
|
||||
Object& insert(std::string key, const Object& value);
|
||||
Array& insert(std::string key, Array&& value);
|
||||
Array& insert(std::string key, const Array& value);
|
||||
|
||||
// replaces the value if the key is found, otherwise inserts a new
|
||||
// value.
|
||||
Value& insert_or_replace(std::string key, Value&& value);
|
||||
Value& insert_or_replace(std::string key, const Value& value);
|
||||
Object& insert_or_replace(std::string key, Object&& value);
|
||||
Object& insert_or_replace(std::string key, const Object& value);
|
||||
Array& insert_or_replace(std::string key, Array&& value);
|
||||
Array& insert_or_replace(std::string key, const Array& value);
|
||||
|
||||
// returns whether the key existed
|
||||
bool remove(StringView key) noexcept;
|
||||
|
||||
// asserts on lookup failure
|
||||
Value& operator[](StringView key) noexcept
|
||||
{
|
||||
auto res = this->get(key);
|
||||
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, res, "missing key: \"%s\"", key);
|
||||
return *res;
|
||||
}
|
||||
const Value& operator[](StringView key) const noexcept
|
||||
{
|
||||
auto res = this->get(key);
|
||||
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, res, "missing key: \"%s\"", key);
|
||||
return *res;
|
||||
}
|
||||
|
||||
Value* get(StringView key) noexcept;
|
||||
const Value* get(StringView key) const noexcept;
|
||||
|
||||
bool contains(StringView key) const noexcept { return this->get(key); }
|
||||
|
||||
bool is_empty() const noexcept { return size() == 0; }
|
||||
std::size_t size() const noexcept { return this->underlying_.size(); }
|
||||
|
||||
// sorts keys alphabetically
|
||||
void sort_keys();
|
||||
|
||||
struct const_iterator
|
||||
{
|
||||
using value_type = std::pair<StringView, const Value&>;
|
||||
using reference = value_type;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
|
||||
value_type operator*() const noexcept { return *underlying_; }
|
||||
const_iterator& operator++() noexcept
|
||||
{
|
||||
++underlying_;
|
||||
return *this;
|
||||
}
|
||||
const_iterator operator++(int) noexcept
|
||||
{
|
||||
auto res = *this;
|
||||
++underlying_;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool operator==(const_iterator other) const noexcept { return this->underlying_ == other.underlying_; }
|
||||
bool operator!=(const_iterator other) const noexcept { return !(this->underlying_ == other.underlying_); }
|
||||
|
||||
private:
|
||||
friend struct Object;
|
||||
explicit const_iterator(const underlying_t::const_iterator& it) : underlying_(it) { }
|
||||
underlying_t::const_iterator underlying_;
|
||||
};
|
||||
using iterator = const_iterator;
|
||||
|
||||
const_iterator begin() const noexcept { return this->cbegin(); }
|
||||
const_iterator end() const noexcept { return this->cend(); }
|
||||
const_iterator cbegin() const noexcept { return const_iterator{this->underlying_.begin()}; }
|
||||
const_iterator cend() const noexcept { return const_iterator{this->underlying_.end()}; }
|
||||
|
||||
friend bool operator==(const Object& lhs, const Object& rhs);
|
||||
friend bool operator!=(const Object& lhs, const Object& rhs) { return !(lhs == rhs); }
|
||||
|
||||
private:
|
||||
underlying_t underlying_;
|
||||
};
|
||||
|
||||
ExpectedT<std::pair<Value, JsonStyle>, std::unique_ptr<Parse::IParseError>> parse_file(
|
||||
const Files::Filesystem&, const fs::path&, std::error_code& ec) noexcept;
|
||||
ExpectedT<std::pair<Value, JsonStyle>, std::unique_ptr<Parse::IParseError>> parse(
|
||||
StringView text, const fs::path& filepath) noexcept;
|
||||
ExpectedT<std::pair<Value, JsonStyle>, std::unique_ptr<Parse::IParseError>> parse(StringView text,
|
||||
StringView origin = {}) noexcept;
|
||||
std::pair<Value, JsonStyle> parse_file(vcpkg::LineInfo linfo, const Files::Filesystem&, const fs::path&) noexcept;
|
||||
|
||||
std::string stringify(const Value&, JsonStyle style);
|
||||
std::string stringify(const Object&, JsonStyle style);
|
||||
std::string stringify(const Array&, JsonStyle style);
|
||||
}
|
@ -1,367 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/fwd/json.h>
|
||||
|
||||
#include <vcpkg/base/json.h>
|
||||
#include <vcpkg/base/optional.h>
|
||||
#include <vcpkg/base/strings.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
#include <vcpkg/base/view.h>
|
||||
|
||||
namespace vcpkg::Json
|
||||
{
|
||||
struct Reader;
|
||||
|
||||
template<class Type>
|
||||
struct IDeserializer
|
||||
{
|
||||
using type = Type;
|
||||
virtual StringView type_name() const = 0;
|
||||
|
||||
private:
|
||||
friend struct Reader;
|
||||
Optional<Type> visit(Reader&, const Value&);
|
||||
Optional<Type> visit(Reader&, const Object&);
|
||||
|
||||
public:
|
||||
virtual Optional<Type> visit_null(Reader&);
|
||||
virtual Optional<Type> visit_boolean(Reader&, bool);
|
||||
virtual Optional<Type> visit_integer(Reader& r, int64_t i);
|
||||
virtual Optional<Type> visit_number(Reader&, double);
|
||||
virtual Optional<Type> visit_string(Reader&, StringView);
|
||||
virtual Optional<Type> visit_array(Reader&, const Array&);
|
||||
virtual Optional<Type> visit_object(Reader&, const Object&);
|
||||
virtual View<StringView> valid_fields() const;
|
||||
|
||||
virtual ~IDeserializer() = default;
|
||||
|
||||
protected:
|
||||
IDeserializer() = default;
|
||||
IDeserializer(const IDeserializer&) = default;
|
||||
IDeserializer& operator=(const IDeserializer&) = default;
|
||||
IDeserializer(IDeserializer&&) = default;
|
||||
IDeserializer& operator=(IDeserializer&&) = default;
|
||||
};
|
||||
|
||||
struct Reader
|
||||
{
|
||||
const std::vector<std::string>& errors() const { return m_errors; }
|
||||
std::vector<std::string>& errors() { return m_errors; }
|
||||
|
||||
void add_missing_field_error(StringView type, StringView key, StringView key_type);
|
||||
void add_expected_type_error(StringView expected_type);
|
||||
void add_extra_field_error(StringView type, StringView fields, StringView suggestion = {});
|
||||
template<class... Args>
|
||||
void add_generic_error(StringView type, Args&&... args)
|
||||
{
|
||||
m_errors.push_back(Strings::concat(path(), " (", type, "): ", args...));
|
||||
}
|
||||
|
||||
std::string path() const noexcept;
|
||||
|
||||
private:
|
||||
template<class Type>
|
||||
friend struct IDeserializer;
|
||||
|
||||
std::vector<std::string> m_errors;
|
||||
struct Path
|
||||
{
|
||||
constexpr Path() = default;
|
||||
constexpr Path(int64_t i) : index(i) { }
|
||||
constexpr Path(StringView f) : field(f) { }
|
||||
|
||||
int64_t index = -1;
|
||||
StringView field;
|
||||
};
|
||||
std::vector<Path> m_path;
|
||||
|
||||
public:
|
||||
// checks that an object doesn't contain any fields which both:
|
||||
// * don't start with a `$`
|
||||
// * are not in `valid_fields`
|
||||
// if known_fields.empty(), then it's treated as if all field names are valid
|
||||
void check_for_unexpected_fields(const Object& obj, View<StringView> valid_fields, StringView type_name);
|
||||
|
||||
template<class Type>
|
||||
void required_object_field(
|
||||
StringView type, const Object& obj, StringView key, Type& place, IDeserializer<Type>& visitor)
|
||||
{
|
||||
if (auto value = obj.get(key))
|
||||
{
|
||||
visit_in_key(*value, key, place, visitor);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->add_missing_field_error(type, key, visitor.type_name());
|
||||
}
|
||||
}
|
||||
|
||||
// value should be the value at key of the currently visited object
|
||||
template<class Type>
|
||||
void visit_in_key(const Value& value, StringView key, Type& place, IDeserializer<Type>& visitor)
|
||||
{
|
||||
m_path.push_back(key);
|
||||
auto opt = visitor.visit(*this, value);
|
||||
|
||||
if (auto p_opt = opt.get())
|
||||
{
|
||||
place = std::move(*p_opt);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_expected_type_error(visitor.type_name());
|
||||
}
|
||||
m_path.pop_back();
|
||||
}
|
||||
|
||||
// value should be the value at key of the currently visited object
|
||||
template<class Type>
|
||||
void visit_at_index(const Value& value, int64_t index, Type& place, IDeserializer<Type>& visitor)
|
||||
{
|
||||
m_path.push_back(index);
|
||||
auto opt = visitor.visit(*this, value);
|
||||
|
||||
if (auto p_opt = opt.get())
|
||||
{
|
||||
place = std::move(*p_opt);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_expected_type_error(visitor.type_name());
|
||||
}
|
||||
m_path.pop_back();
|
||||
}
|
||||
|
||||
// returns whether key \in obj
|
||||
template<class Type>
|
||||
bool optional_object_field(const Object& obj, StringView key, Type& place, IDeserializer<Type>& visitor)
|
||||
{
|
||||
if (auto value = obj.get(key))
|
||||
{
|
||||
visit_in_key(*value, key, place, visitor);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
Optional<Type> visit(const Value& value, IDeserializer<Type>& visitor)
|
||||
{
|
||||
return visitor.visit(*this, value);
|
||||
}
|
||||
template<class Type>
|
||||
Optional<Type> visit(const Object& value, IDeserializer<Type>& visitor)
|
||||
{
|
||||
return visitor.visit(*this, value);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
Optional<std::vector<Type>> array_elements(const Array& arr, IDeserializer<Type>& visitor)
|
||||
{
|
||||
std::vector<Type> result;
|
||||
m_path.emplace_back();
|
||||
for (size_t i = 0; i < arr.size(); ++i)
|
||||
{
|
||||
m_path.back().index = static_cast<int64_t>(i);
|
||||
auto opt = visitor.visit(*this, arr[i]);
|
||||
if (auto p = opt.get())
|
||||
{
|
||||
result.push_back(std::move(*p));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->add_expected_type_error(visitor.type_name());
|
||||
for (++i; i < arr.size(); ++i)
|
||||
{
|
||||
m_path.back().index = static_cast<int64_t>(i);
|
||||
auto opt2 = visitor.visit(*this, arr[i]);
|
||||
if (!opt2) this->add_expected_type_error(visitor.type_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
m_path.pop_back();
|
||||
return std::move(result);
|
||||
}
|
||||
};
|
||||
|
||||
VCPKG_MSVC_WARNING(push)
|
||||
VCPKG_MSVC_WARNING(disable : 4505)
|
||||
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit(Reader& r, const Value& value)
|
||||
{
|
||||
switch (value.kind())
|
||||
{
|
||||
case ValueKind::Null: return visit_null(r);
|
||||
case ValueKind::Boolean: return visit_boolean(r, value.boolean());
|
||||
case ValueKind::Integer: return visit_integer(r, value.integer());
|
||||
case ValueKind::Number: return visit_number(r, value.number());
|
||||
case ValueKind::String: return visit_string(r, value.string());
|
||||
case ValueKind::Array: return visit_array(r, value.array());
|
||||
case ValueKind::Object: return visit(r, value.object()); // Call `visit` to get unexpected fields checking
|
||||
default: vcpkg::Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit(Reader& r, const Object& obj)
|
||||
{
|
||||
r.check_for_unexpected_fields(obj, valid_fields(), type_name());
|
||||
return visit_object(r, obj);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
View<StringView> IDeserializer<Type>::valid_fields() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit_null(Reader&)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit_boolean(Reader&, bool)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit_integer(Reader& r, int64_t i)
|
||||
{
|
||||
return this->visit_number(r, static_cast<double>(i));
|
||||
}
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit_number(Reader&, double)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit_string(Reader&, StringView)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit_array(Reader&, const Array&)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
template<class Type>
|
||||
Optional<Type> IDeserializer<Type>::visit_object(Reader&, const Object&)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
VCPKG_MSVC_WARNING(pop)
|
||||
|
||||
struct StringDeserializer final : IDeserializer<std::string>
|
||||
{
|
||||
virtual StringView type_name() const override { return type_name_; }
|
||||
virtual Optional<std::string> visit_string(Reader&, StringView sv) override { return sv.to_string(); }
|
||||
|
||||
explicit StringDeserializer(StringLiteral type_name_) : type_name_(type_name_) { }
|
||||
|
||||
private:
|
||||
StringLiteral type_name_;
|
||||
};
|
||||
|
||||
struct PathDeserializer final : IDeserializer<fs::path>
|
||||
{
|
||||
virtual StringView type_name() const override { return "a path"; }
|
||||
virtual Optional<fs::path> visit_string(Reader&, StringView sv) override { return fs::u8path(sv); }
|
||||
|
||||
static PathDeserializer instance;
|
||||
};
|
||||
|
||||
struct NaturalNumberDeserializer final : IDeserializer<int>
|
||||
{
|
||||
virtual StringView type_name() const override { return "a nonnegative integer"; }
|
||||
|
||||
virtual Optional<int> visit_integer(Reader&, int64_t value) override
|
||||
{
|
||||
if (value > std::numeric_limits<int>::max() || value < 0)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
return static_cast<int>(value);
|
||||
}
|
||||
|
||||
static NaturalNumberDeserializer instance;
|
||||
};
|
||||
|
||||
struct BooleanDeserializer final : IDeserializer<bool>
|
||||
{
|
||||
virtual StringView type_name() const override { return "a boolean"; }
|
||||
|
||||
virtual Optional<bool> visit_boolean(Reader&, bool b) override { return b; }
|
||||
|
||||
static BooleanDeserializer instance;
|
||||
};
|
||||
|
||||
template<class Underlying>
|
||||
struct ArrayDeserializer final : IDeserializer<std::vector<typename Underlying::type>>
|
||||
{
|
||||
using type = std::vector<typename Underlying::type>;
|
||||
|
||||
virtual StringView type_name() const override { return m_type_name; }
|
||||
|
||||
ArrayDeserializer(StringLiteral type_name_, Underlying&& t = {})
|
||||
: m_type_name(type_name_), m_underlying_visitor(static_cast<Underlying&&>(t))
|
||||
{
|
||||
}
|
||||
|
||||
virtual Optional<type> visit_array(Reader& r, const Array& arr) override
|
||||
{
|
||||
return r.array_elements(arr, m_underlying_visitor);
|
||||
}
|
||||
|
||||
private:
|
||||
StringLiteral m_type_name;
|
||||
Underlying m_underlying_visitor;
|
||||
};
|
||||
|
||||
struct ParagraphDeserializer final : IDeserializer<std::vector<std::string>>
|
||||
{
|
||||
virtual StringView type_name() const override { return "a string or array of strings"; }
|
||||
|
||||
virtual Optional<std::vector<std::string>> visit_string(Reader&, StringView sv) override;
|
||||
virtual Optional<std::vector<std::string>> visit_array(Reader& r, const Array& arr) override;
|
||||
|
||||
static ParagraphDeserializer instance;
|
||||
};
|
||||
|
||||
struct IdentifierDeserializer final : Json::IDeserializer<std::string>
|
||||
{
|
||||
virtual StringView type_name() const override { return "an identifier"; }
|
||||
|
||||
// [a-z0-9]+(-[a-z0-9]+)*, plus not any of {prn, aux, nul, con, lpt[1-9], com[1-9], core, default}
|
||||
static bool is_ident(StringView sv);
|
||||
|
||||
virtual Optional<std::string> visit_string(Json::Reader&, StringView sv) override;
|
||||
|
||||
static IdentifierDeserializer instance;
|
||||
};
|
||||
|
||||
struct IdentifierArrayDeserializer final : Json::IDeserializer<std::vector<std::string>>
|
||||
{
|
||||
virtual StringView type_name() const override { return "an array of identifiers"; }
|
||||
|
||||
virtual Optional<std::vector<std::string>> visit_array(Reader& r, const Array& arr) override;
|
||||
|
||||
static IdentifierArrayDeserializer instance;
|
||||
};
|
||||
|
||||
struct PackageNameDeserializer final : Json::IDeserializer<std::string>
|
||||
{
|
||||
virtual StringView type_name() const override { return "a package name"; }
|
||||
|
||||
static bool is_package_name(StringView sv);
|
||||
|
||||
virtual Optional<std::string> visit_string(Json::Reader&, StringView sv) override;
|
||||
|
||||
static PackageNameDeserializer instance;
|
||||
};
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
template<typename T>
|
||||
class Lazy
|
||||
{
|
||||
public:
|
||||
Lazy() : value(T()), initialized(false) { }
|
||||
|
||||
template<class F>
|
||||
T const& get_lazy(const F& f) const
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
value = f();
|
||||
initialized = true;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable T value;
|
||||
mutable bool initialized;
|
||||
};
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
struct LineInfo
|
||||
{
|
||||
int line_number;
|
||||
const char* file_name;
|
||||
};
|
||||
}
|
||||
|
||||
#define VCPKG_LINE_INFO \
|
||||
vcpkg::LineInfo { __LINE__, __FILE__ }
|
@ -1,35 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/fwd/lockguarded.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace vcpkg::Util
|
||||
{
|
||||
template<class T>
|
||||
struct LockGuarded
|
||||
{
|
||||
friend struct LockGuardPtr<T>;
|
||||
|
||||
LockGuardPtr<T> lock() { return *this; }
|
||||
|
||||
private:
|
||||
std::mutex m_mutex;
|
||||
T m_t;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct LockGuardPtr
|
||||
{
|
||||
T& operator*() { return m_ptr; }
|
||||
T* operator->() { return &m_ptr; }
|
||||
|
||||
T* get() { return &m_ptr; }
|
||||
|
||||
LockGuardPtr(LockGuarded<T>& sync) : m_lock(sync.m_mutex), m_ptr(sync.m_t) { }
|
||||
|
||||
private:
|
||||
std::unique_lock<std::mutex> m_lock;
|
||||
T& m_ptr;
|
||||
};
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
enum class MachineType : uint16_t
|
||||
{
|
||||
UNKNOWN = 0x0, // The contents of this field are assumed to be applicable to any machine type
|
||||
AM33 = 0x1d3, // Matsushita AM33
|
||||
AMD64 = 0x8664, // x64
|
||||
ARM = 0x1c0, // ARM little endian
|
||||
ARM64 = 0xaa64, // ARM64 little endian
|
||||
ARMNT = 0x1c4, // ARM Thumb-2 little endian
|
||||
EBC = 0xebc, // EFI byte code
|
||||
I386 = 0x14c, // Intel 386 or later processors and compatible processors
|
||||
IA64 = 0x200, // Intel Itanium processor family
|
||||
M32R = 0x9041, // Mitsubishi M32R little endian
|
||||
MIPS16 = 0x266, // MIPS16
|
||||
MIPSFPU = 0x366, // MIPS with FPU
|
||||
MIPSFPU16 = 0x466, // MIPS16 with FPU
|
||||
POWERPC = 0x1f0, // Power PC little endian
|
||||
POWERPCFP = 0x1f1, // Power PC with floating point support
|
||||
R4000 = 0x166, // MIPS little endian
|
||||
RISCV32 = 0x5032, // RISC-V 32-bit address space
|
||||
RISCV64 = 0x5064, // RISC-V 64-bit address space
|
||||
RISCV128 = 0x5128, // RISC-V 128-bit address space
|
||||
SH3 = 0x1a2, // Hitachi SH3
|
||||
SH3DSP = 0x1a3, // Hitachi SH3 DSP
|
||||
SH4 = 0x1a6, // Hitachi SH4
|
||||
SH5 = 0x1a8, // Hitachi SH5
|
||||
THUMB = 0x1c2, // Thumb
|
||||
WCEMIPSV2 = 0x169, // MIPS little-endian WCE v2
|
||||
};
|
||||
|
||||
MachineType to_machine_type(const uint16_t value);
|
||||
}
|
@ -1,382 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/fwd/optional.h>
|
||||
|
||||
#include <vcpkg/base/basic_checks.h>
|
||||
#include <vcpkg/base/lineinfo.h>
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
struct NullOpt
|
||||
{
|
||||
explicit constexpr NullOpt(int) { }
|
||||
};
|
||||
|
||||
const static constexpr NullOpt nullopt{0};
|
||||
|
||||
template<class T>
|
||||
struct Optional;
|
||||
|
||||
namespace details
|
||||
{
|
||||
template<class T, bool B = std::is_copy_constructible<T>::value>
|
||||
struct OptionalStorage
|
||||
{
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() { }
|
||||
constexpr OptionalStorage(const T& t) : m_is_present(true), m_t(t) { }
|
||||
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) { }
|
||||
template<class U, class = std::enable_if_t<!std::is_reference<U>::value>>
|
||||
explicit OptionalStorage(Optional<U>&& t) : m_is_present(false), m_inactive()
|
||||
{
|
||||
if (auto p = t.get())
|
||||
{
|
||||
m_is_present = true;
|
||||
new (&m_t) T(std::move(*p));
|
||||
}
|
||||
}
|
||||
template<class U>
|
||||
explicit OptionalStorage(const Optional<U>& t) : m_is_present(false), m_inactive()
|
||||
{
|
||||
if (auto p = t.get())
|
||||
{
|
||||
m_is_present = true;
|
||||
new (&m_t) T(*p);
|
||||
}
|
||||
}
|
||||
|
||||
~OptionalStorage() noexcept
|
||||
{
|
||||
if (m_is_present) m_t.~T();
|
||||
}
|
||||
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
OptionalStorage(const OptionalStorage& o) : m_is_present(o.m_is_present), m_inactive()
|
||||
{
|
||||
if (m_is_present) new (&m_t) T(o.m_t);
|
||||
}
|
||||
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive()
|
||||
{
|
||||
if (m_is_present)
|
||||
{
|
||||
new (&m_t) T(std::move(o.m_t));
|
||||
}
|
||||
}
|
||||
|
||||
OptionalStorage& operator=(const OptionalStorage& o)
|
||||
{
|
||||
if (m_is_present && o.m_is_present)
|
||||
{
|
||||
m_t = o.m_t;
|
||||
}
|
||||
else if (!m_is_present && o.m_is_present)
|
||||
{
|
||||
m_is_present = true;
|
||||
new (&m_t) T(o.m_t);
|
||||
}
|
||||
else if (m_is_present && !o.m_is_present)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
OptionalStorage& operator=(OptionalStorage&& o) noexcept
|
||||
{
|
||||
if (m_is_present && o.m_is_present)
|
||||
{
|
||||
m_t = std::move(o.m_t);
|
||||
}
|
||||
else if (!m_is_present && o.m_is_present)
|
||||
{
|
||||
m_is_present = true;
|
||||
new (&m_t) T(std::move(o.m_t));
|
||||
}
|
||||
else if (m_is_present && !o.m_is_present)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr bool has_value() const { return m_is_present; }
|
||||
|
||||
const T& value() const { return this->m_t; }
|
||||
T& value() { return this->m_t; }
|
||||
|
||||
private:
|
||||
void clear()
|
||||
{
|
||||
m_is_present = false;
|
||||
m_t.~T();
|
||||
m_inactive = '\0';
|
||||
}
|
||||
|
||||
bool m_is_present;
|
||||
union
|
||||
{
|
||||
char m_inactive;
|
||||
T m_t;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct OptionalStorage<T, false>
|
||||
{
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() { }
|
||||
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) { }
|
||||
|
||||
~OptionalStorage() noexcept
|
||||
{
|
||||
if (m_is_present) m_t.~T();
|
||||
}
|
||||
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive()
|
||||
{
|
||||
if (m_is_present)
|
||||
{
|
||||
new (&m_t) T(std::move(o.m_t));
|
||||
}
|
||||
}
|
||||
|
||||
OptionalStorage& operator=(OptionalStorage&& o) noexcept
|
||||
{
|
||||
if (m_is_present && o.m_is_present)
|
||||
{
|
||||
m_t = std::move(o.m_t);
|
||||
}
|
||||
else if (!m_is_present && o.m_is_present)
|
||||
{
|
||||
m_is_present = true;
|
||||
new (&m_t) T(std::move(o.m_t));
|
||||
}
|
||||
else if (m_is_present && !o.m_is_present)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr bool has_value() const { return m_is_present; }
|
||||
|
||||
const T& value() const { return this->m_t; }
|
||||
T& value() { return this->m_t; }
|
||||
|
||||
private:
|
||||
void clear()
|
||||
{
|
||||
m_is_present = false;
|
||||
m_t.~T();
|
||||
m_inactive = '\0';
|
||||
}
|
||||
|
||||
bool m_is_present;
|
||||
union
|
||||
{
|
||||
char m_inactive;
|
||||
T m_t;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T, bool B>
|
||||
struct OptionalStorage<T&, B>
|
||||
{
|
||||
constexpr OptionalStorage() noexcept : m_t(nullptr) { }
|
||||
constexpr OptionalStorage(T& t) : m_t(&t) { }
|
||||
constexpr OptionalStorage(Optional<T>& t) : m_t(t.get()) { }
|
||||
|
||||
constexpr bool has_value() const { return m_t != nullptr; }
|
||||
|
||||
T& value() const { return *this->m_t; }
|
||||
|
||||
private:
|
||||
T* m_t;
|
||||
};
|
||||
|
||||
template<class T, bool B>
|
||||
struct OptionalStorage<const T&, B>
|
||||
{
|
||||
constexpr OptionalStorage() noexcept : m_t(nullptr) { }
|
||||
constexpr OptionalStorage(const T& t) : m_t(&t) { }
|
||||
constexpr OptionalStorage(const Optional<T>& t) : m_t(t.get()) { }
|
||||
constexpr OptionalStorage(const Optional<const T>& t) : m_t(t.get()) { }
|
||||
constexpr OptionalStorage(Optional<T>&& t) = delete;
|
||||
constexpr OptionalStorage(Optional<const T>&& t) = delete;
|
||||
|
||||
constexpr bool has_value() const { return m_t != nullptr; }
|
||||
|
||||
const T& value() const { return *this->m_t; }
|
||||
|
||||
private:
|
||||
const T* m_t;
|
||||
};
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct Optional
|
||||
{
|
||||
constexpr Optional() noexcept { }
|
||||
|
||||
// Constructors are intentionally implicit
|
||||
constexpr Optional(NullOpt) { }
|
||||
|
||||
template<class U, class = std::enable_if_t<!std::is_same<std::decay_t<U>, Optional>::value>>
|
||||
constexpr Optional(U&& t) : m_base(std::forward<U>(t))
|
||||
{
|
||||
}
|
||||
|
||||
T&& value_or_exit(const LineInfo& line_info) &&
|
||||
{
|
||||
Checks::check_exit(line_info, this->m_base.has_value(), "Value was null");
|
||||
return std::move(this->m_base.value());
|
||||
}
|
||||
|
||||
T& value_or_exit(const LineInfo& line_info) &
|
||||
{
|
||||
Checks::check_exit(line_info, this->m_base.has_value(), "Value was null");
|
||||
return this->m_base.value();
|
||||
}
|
||||
|
||||
const T& value_or_exit(const LineInfo& line_info) const&
|
||||
{
|
||||
Checks::check_exit(line_info, this->m_base.has_value(), "Value was null");
|
||||
return this->m_base.value();
|
||||
}
|
||||
|
||||
constexpr explicit operator bool() const { return this->m_base.has_value(); }
|
||||
|
||||
constexpr bool has_value() const { return this->m_base.has_value(); }
|
||||
|
||||
template<class U>
|
||||
T value_or(U&& default_value) const&
|
||||
{
|
||||
return this->m_base.has_value() ? this->m_base.value() : static_cast<T>(std::forward<U>(default_value));
|
||||
}
|
||||
|
||||
T value_or(T&& default_value) const&
|
||||
{
|
||||
return this->m_base.has_value() ? this->m_base.value() : static_cast<T&&>(default_value);
|
||||
}
|
||||
|
||||
template<class U>
|
||||
T value_or(U&& default_value) &&
|
||||
{
|
||||
return this->m_base.has_value() ? std::move(this->m_base.value())
|
||||
: static_cast<T>(std::forward<U>(default_value));
|
||||
}
|
||||
T value_or(T&& default_value) &&
|
||||
{
|
||||
return this->m_base.has_value() ? std::move(this->m_base.value()) : static_cast<T&&>(default_value);
|
||||
}
|
||||
|
||||
typename std::add_pointer<const T>::type get() const
|
||||
{
|
||||
return this->m_base.has_value() ? &this->m_base.value() : nullptr;
|
||||
}
|
||||
|
||||
typename std::add_pointer<T>::type get() { return this->m_base.has_value() ? &this->m_base.value() : nullptr; }
|
||||
|
||||
template<class F>
|
||||
using map_t = decltype(std::declval<F&>()(std::declval<const T&>()));
|
||||
|
||||
template<class F, class U = map_t<F>>
|
||||
Optional<U> map(F f) const&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return f(this->m_base.value());
|
||||
}
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
template<class F, class U = map_t<F>>
|
||||
U then(F f) const&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return f(this->m_base.value());
|
||||
}
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
template<class F>
|
||||
using move_map_t = decltype(std::declval<F&>()(std::declval<T&&>()));
|
||||
|
||||
template<class F, class U = move_map_t<F>>
|
||||
Optional<U> map(F f) &&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return f(std::move(this->m_base.value()));
|
||||
}
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
template<class F, class U = move_map_t<F>>
|
||||
U then(F f) &&
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
return f(std::move(this->m_base.value()));
|
||||
}
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
friend bool operator==(const Optional& lhs, const Optional& rhs)
|
||||
{
|
||||
if (lhs.m_base.has_value())
|
||||
{
|
||||
if (rhs.m_base.has_value())
|
||||
{
|
||||
return lhs.m_base.value() == rhs.m_base.value();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return !rhs.m_base.has_value();
|
||||
}
|
||||
|
||||
private:
|
||||
details::OptionalStorage<T> m_base;
|
||||
};
|
||||
|
||||
template<class U>
|
||||
Optional<std::decay_t<U>> make_optional(U&& u)
|
||||
{
|
||||
return Optional<std::decay_t<U>>(std::forward<U>(u));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool operator==(const Optional<T>& o, const T& t)
|
||||
{
|
||||
if (auto p = o.get()) return *p == t;
|
||||
return false;
|
||||
}
|
||||
template<class T>
|
||||
bool operator==(const T& t, const Optional<T>& o)
|
||||
{
|
||||
if (auto p = o.get()) return t == *p;
|
||||
return false;
|
||||
}
|
||||
template<class T>
|
||||
bool operator!=(const Optional<T>& o, const T& t)
|
||||
{
|
||||
if (auto p = o.get()) return *p != t;
|
||||
return true;
|
||||
}
|
||||
template<class T>
|
||||
bool operator!=(const T& t, const Optional<T>& o)
|
||||
{
|
||||
if (auto p = o.get()) return t != *p;
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/cstringview.h>
|
||||
#include <vcpkg/base/optional.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
#include <vcpkg/base/unicode.h>
|
||||
|
||||
#include <vcpkg/textrowcol.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace vcpkg::Parse
|
||||
{
|
||||
struct IParseError
|
||||
{
|
||||
virtual ~IParseError() = default;
|
||||
virtual std::string format() const = 0;
|
||||
virtual const std::string& get_message() const = 0;
|
||||
};
|
||||
|
||||
struct ParseError : IParseError
|
||||
{
|
||||
ParseError(std::string origin, int row, int column, int caret_col, std::string line, std::string message)
|
||||
: origin(std::move(origin))
|
||||
, row(row)
|
||||
, column(column)
|
||||
, caret_col(caret_col)
|
||||
, line(std::move(line))
|
||||
, message(std::move(message))
|
||||
{
|
||||
}
|
||||
|
||||
const std::string origin;
|
||||
const int row;
|
||||
const int column;
|
||||
const int caret_col;
|
||||
const std::string line;
|
||||
const std::string message;
|
||||
|
||||
virtual std::string format() const override;
|
||||
virtual const std::string& get_message() const override;
|
||||
};
|
||||
|
||||
struct ParserBase
|
||||
{
|
||||
struct SourceLoc
|
||||
{
|
||||
Unicode::Utf8Decoder it;
|
||||
Unicode::Utf8Decoder start_of_line;
|
||||
int row;
|
||||
int column;
|
||||
};
|
||||
|
||||
ParserBase(StringView text, StringView origin, TextRowCol init_rowcol = {});
|
||||
|
||||
static constexpr bool is_whitespace(char32_t ch) { return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n'; }
|
||||
static constexpr bool is_lower_alpha(char32_t ch) { return ch >= 'a' && ch <= 'z'; }
|
||||
static constexpr bool is_upper_alpha(char32_t ch) { return ch >= 'A' && ch <= 'Z'; }
|
||||
static constexpr bool is_ascii_digit(char32_t ch) { return ch >= '0' && ch <= '9'; }
|
||||
static constexpr bool is_lineend(char32_t ch) { return ch == '\r' || ch == '\n' || ch == Unicode::end_of_file; }
|
||||
static constexpr bool is_alphanum(char32_t ch)
|
||||
{
|
||||
return is_upper_alpha(ch) || is_lower_alpha(ch) || is_ascii_digit(ch);
|
||||
}
|
||||
static constexpr bool is_alphanumdash(char32_t ch) { return is_alphanum(ch) || ch == '-'; }
|
||||
|
||||
StringView skip_whitespace() { return match_zero_or_more(is_whitespace); }
|
||||
StringView skip_tabs_spaces()
|
||||
{
|
||||
return match_zero_or_more([](char32_t ch) { return ch == ' ' || ch == '\t'; });
|
||||
}
|
||||
void skip_to_eof() { m_it = m_it.end(); }
|
||||
void skip_newline()
|
||||
{
|
||||
if (cur() == '\r') next();
|
||||
if (cur() == '\n') next();
|
||||
}
|
||||
void skip_line()
|
||||
{
|
||||
match_until(is_lineend);
|
||||
skip_newline();
|
||||
}
|
||||
|
||||
template<class Pred>
|
||||
StringView match_zero_or_more(Pred p)
|
||||
{
|
||||
const char* start = m_it.pointer_to_current();
|
||||
auto ch = cur();
|
||||
while (ch != Unicode::end_of_file && p(ch))
|
||||
ch = next();
|
||||
return {start, m_it.pointer_to_current()};
|
||||
}
|
||||
template<class Pred>
|
||||
StringView match_until(Pred p)
|
||||
{
|
||||
const char* start = m_it.pointer_to_current();
|
||||
auto ch = cur();
|
||||
while (ch != Unicode::end_of_file && !p(ch))
|
||||
ch = next();
|
||||
return {start, m_it.pointer_to_current()};
|
||||
}
|
||||
|
||||
StringView text() const { return m_text; }
|
||||
Unicode::Utf8Decoder it() const { return m_it; }
|
||||
char32_t cur() const { return m_it == m_it.end() ? Unicode::end_of_file : *m_it; }
|
||||
SourceLoc cur_loc() const { return {m_it, m_start_of_line, m_row, m_column}; }
|
||||
TextRowCol cur_rowcol() const { return {m_row, m_column}; }
|
||||
char32_t next();
|
||||
bool at_eof() const { return m_it == m_it.end(); }
|
||||
|
||||
void add_error(std::string message) { add_error(std::move(message), cur_loc()); }
|
||||
void add_error(std::string message, const SourceLoc& loc);
|
||||
|
||||
const Parse::IParseError* get_error() const { return m_err.get(); }
|
||||
std::unique_ptr<Parse::IParseError> extract_error() { return std::move(m_err); }
|
||||
|
||||
private:
|
||||
Unicode::Utf8Decoder m_it;
|
||||
Unicode::Utf8Decoder m_start_of_line;
|
||||
int m_row;
|
||||
int m_column;
|
||||
|
||||
StringView m_text;
|
||||
StringView m_origin;
|
||||
|
||||
std::unique_ptr<IParseError> m_err;
|
||||
};
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1911
|
||||
// [[nodiscard]] is not recognized before VS 2017 version 15.3
|
||||
#pragma warning(disable : 5030)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1910
|
||||
// https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4800?view=vs-2019
|
||||
#pragma warning(disable : 4800)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ < 7
|
||||
// [[nodiscard]] is not recognized before GCC version 7
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <sal.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define ASSUME(expr) __assume(expr)
|
||||
#else
|
||||
#define ASSUME(expr)
|
||||
#endif
|
||||
|
||||
// the static_assert(true, "")s are to avoid the extra ';' warning
|
||||
#ifdef _MSC_VER
|
||||
#define VCPKG_MSVC_WARNING(...) __pragma(warning(__VA_ARGS__))
|
||||
#define GCC_DIAGNOSTIC(...)
|
||||
#else
|
||||
#define VCPKG_MSVC_WARNING(...)
|
||||
#define GCC_DIAGNOSTIC(...) _Pragma("diagnostic " #__VA_ARGS__)
|
||||
#endif
|
@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
// Add more forwarding functions to the m_data std::vector as needed.
|
||||
namespace vcpkg
|
||||
{
|
||||
template<class T>
|
||||
class SortedVector
|
||||
{
|
||||
public:
|
||||
using size_type = typename std::vector<T>::size_type;
|
||||
using iterator = typename std::vector<T>::const_iterator;
|
||||
|
||||
SortedVector() : m_data() { }
|
||||
|
||||
explicit SortedVector(std::vector<T> v) : m_data(std::move(v))
|
||||
{
|
||||
if (!std::is_sorted(m_data.begin(), m_data.end()))
|
||||
{
|
||||
std::sort(m_data.begin(), m_data.end());
|
||||
}
|
||||
}
|
||||
|
||||
template<class Compare>
|
||||
SortedVector(std::vector<T> v, Compare comp) : m_data(std::move(v))
|
||||
{
|
||||
if (!std::is_sorted(m_data.cbegin(), m_data.cend(), comp))
|
||||
{
|
||||
std::sort(m_data.begin(), m_data.end(), comp);
|
||||
}
|
||||
}
|
||||
|
||||
iterator begin() const { return this->m_data.cbegin(); }
|
||||
|
||||
iterator end() const { return this->m_data.cend(); }
|
||||
|
||||
iterator cbegin() const { return this->m_data.cbegin(); }
|
||||
|
||||
iterator cend() const { return this->m_data.cend(); }
|
||||
|
||||
bool empty() const { return this->m_data.empty(); }
|
||||
|
||||
size_type size() const { return this->m_data.size(); }
|
||||
|
||||
const T& operator[](int i) const { return this->m_data[i]; }
|
||||
|
||||
private:
|
||||
std::vector<T> m_data;
|
||||
};
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/fwd/span.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
template<class T>
|
||||
struct Span
|
||||
{
|
||||
public:
|
||||
static_assert(std::is_object<T>::value, "Span<non-object-type> is illegal");
|
||||
|
||||
using value_type = std::decay_t<T>;
|
||||
using element_type = T;
|
||||
using pointer = std::add_pointer_t<T>;
|
||||
using reference = std::add_lvalue_reference_t<T>;
|
||||
using iterator = pointer;
|
||||
|
||||
constexpr Span() noexcept : m_ptr(nullptr), m_count(0) { }
|
||||
constexpr Span(std::nullptr_t) noexcept : m_ptr(nullptr), m_count(0) { }
|
||||
constexpr Span(pointer ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) { }
|
||||
constexpr Span(pointer ptr_begin, pointer ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) { }
|
||||
|
||||
template<size_t N>
|
||||
constexpr Span(T (&arr)[N]) noexcept : m_ptr(arr), m_count(N)
|
||||
{
|
||||
}
|
||||
|
||||
template<class Range,
|
||||
class = decltype(std::declval<Range>().data()),
|
||||
class = std::enable_if_t<!std::is_same<std::decay_t<Range>, Span>::value>>
|
||||
constexpr Span(Range&& v) noexcept : Span(v.data(), v.size())
|
||||
{
|
||||
static_assert(std::is_same<typename std::decay_t<Range>::value_type, value_type>::value,
|
||||
"Cannot convert incompatible ranges");
|
||||
}
|
||||
|
||||
constexpr iterator begin() const { return m_ptr; }
|
||||
constexpr iterator end() const { return m_ptr + m_count; }
|
||||
|
||||
constexpr reference operator[](size_t i) const { return m_ptr[i]; }
|
||||
constexpr pointer data() const { return m_ptr; }
|
||||
constexpr size_t size() const { return m_count; }
|
||||
|
||||
private:
|
||||
pointer m_ptr;
|
||||
size_t m_count;
|
||||
};
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/zstringview.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
struct StringLiteral : ZStringView
|
||||
{
|
||||
template<int N>
|
||||
constexpr StringLiteral(const char (&str)[N]) : ZStringView(str)
|
||||
{
|
||||
}
|
||||
|
||||
operator std::string() const { return std::string(data(), size()); }
|
||||
};
|
||||
}
|
@ -1,306 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/cstringview.h>
|
||||
#include <vcpkg/base/optional.h>
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
#include <vcpkg/base/stringliteral.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
#include <vcpkg/base/view.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace vcpkg::Strings::details
|
||||
{
|
||||
template<class T>
|
||||
auto to_string(const T& t) -> decltype(t.to_string())
|
||||
{
|
||||
return t.to_string();
|
||||
}
|
||||
|
||||
// first looks up to_string on `T` using ADL; then, if that isn't found,
|
||||
// uses the above definition which returns t.to_string()
|
||||
template<class T, class = std::enable_if_t<!std::is_arithmetic<T>::value>>
|
||||
auto to_printf_arg(const T& t) -> decltype(to_string(t))
|
||||
{
|
||||
return to_string(t);
|
||||
}
|
||||
|
||||
inline const char* to_printf_arg(const std::string& s) { return s.c_str(); }
|
||||
|
||||
inline const char* to_printf_arg(const char* s) { return s; }
|
||||
|
||||
inline const wchar_t* to_printf_arg(const wchar_t* s) { return s; }
|
||||
|
||||
template<class T, class = std::enable_if_t<std::is_arithmetic<T>::value>>
|
||||
T to_printf_arg(T s)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string format_internal(const char* fmtstr, ...);
|
||||
|
||||
inline void append_internal(std::string& into, char c) { into += c; }
|
||||
template<class T, class = decltype(std::to_string(std::declval<T>()))>
|
||||
inline void append_internal(std::string& into, T x)
|
||||
{
|
||||
into += std::to_string(x);
|
||||
}
|
||||
inline void append_internal(std::string& into, const char* v) { into.append(v); }
|
||||
inline void append_internal(std::string& into, const std::string& s) { into.append(s); }
|
||||
inline void append_internal(std::string& into, StringView s) { into.append(s.begin(), s.end()); }
|
||||
|
||||
template<class T, class = decltype(std::declval<const T&>().to_string(std::declval<std::string&>()))>
|
||||
void append_internal(std::string& into, const T& t)
|
||||
{
|
||||
t.to_string(into);
|
||||
}
|
||||
|
||||
template<class T, class = void, class = decltype(to_string(std::declval<std::string&>(), std::declval<const T&>()))>
|
||||
void append_internal(std::string& into, const T& t)
|
||||
{
|
||||
to_string(into, t);
|
||||
}
|
||||
|
||||
struct tolower_char
|
||||
{
|
||||
char operator()(char c) const { return (c < 'A' || c > 'Z') ? c : c - 'A' + 'a'; }
|
||||
};
|
||||
}
|
||||
|
||||
namespace vcpkg::Strings
|
||||
{
|
||||
template<class Arg>
|
||||
std::string& append(std::string& into, const Arg& a)
|
||||
{
|
||||
details::append_internal(into, a);
|
||||
return into;
|
||||
}
|
||||
template<class Arg, class... Args>
|
||||
std::string& append(std::string& into, const Arg& a, const Args&... args)
|
||||
{
|
||||
append(into, a);
|
||||
return append(into, args...);
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
[[nodiscard]] std::string concat(const Args&... args)
|
||||
{
|
||||
std::string ret;
|
||||
append(ret, args...);
|
||||
return ret;
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
[[nodiscard]] std::string concat(std::string&& first, const Args&... args)
|
||||
{
|
||||
append(first, args...);
|
||||
return std::move(first);
|
||||
}
|
||||
|
||||
template<class... Args, class = void>
|
||||
std::string concat_or_view(const Args&... args)
|
||||
{
|
||||
return Strings::concat(args...);
|
||||
}
|
||||
|
||||
template<class T, class = std::enable_if_t<std::is_convertible<T, StringView>::value>>
|
||||
StringView concat_or_view(const T& v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
std::string format(const char* fmtstr, const Args&... args)
|
||||
{
|
||||
using vcpkg::Strings::details::to_printf_arg;
|
||||
return details::format_internal(fmtstr, to_printf_arg(to_printf_arg(args))...);
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
std::wstring to_utf16(StringView s);
|
||||
|
||||
std::string to_utf8(const wchar_t* w);
|
||||
inline std::string to_utf8(const std::wstring& ws) { return to_utf8(ws.c_str()); }
|
||||
#endif
|
||||
|
||||
std::string escape_string(std::string&& s, char char_to_escape, char escape_char);
|
||||
|
||||
bool case_insensitive_ascii_contains(StringView s, StringView pattern);
|
||||
|
||||
bool case_insensitive_ascii_equals(StringView left, StringView right);
|
||||
|
||||
template<class It>
|
||||
void ascii_to_lowercase(It first, It last)
|
||||
{
|
||||
std::transform(first, last, first, details::tolower_char{});
|
||||
}
|
||||
std::string ascii_to_lowercase(std::string&& s);
|
||||
|
||||
std::string ascii_to_uppercase(std::string&& s);
|
||||
|
||||
bool case_insensitive_ascii_starts_with(StringView s, StringView pattern);
|
||||
bool ends_with(StringView s, StringView pattern);
|
||||
bool starts_with(StringView s, StringView pattern);
|
||||
|
||||
template<class InputIterator, class Transformer>
|
||||
std::string join(const char* delimiter, InputIterator begin, InputIterator end, Transformer transformer)
|
||||
{
|
||||
if (begin == end)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string output;
|
||||
append(output, transformer(*begin));
|
||||
for (auto it = std::next(begin); it != end; ++it)
|
||||
{
|
||||
output.append(delimiter);
|
||||
append(output, transformer(*it));
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
template<class Container, class Transformer>
|
||||
std::string join(const char* delimiter, const Container& v, Transformer transformer)
|
||||
{
|
||||
const auto begin = std::begin(v);
|
||||
const auto end = std::end(v);
|
||||
|
||||
return join(delimiter, begin, end, transformer);
|
||||
}
|
||||
|
||||
template<class InputIterator>
|
||||
std::string join(const char* delimiter, InputIterator begin, InputIterator end)
|
||||
{
|
||||
using Element = decltype(*begin);
|
||||
return join(delimiter, begin, end, [](const Element& x) -> const Element& { return x; });
|
||||
}
|
||||
|
||||
template<class Container>
|
||||
std::string join(const char* delimiter, const Container& v)
|
||||
{
|
||||
using Element = decltype(*std::begin(v));
|
||||
return join(delimiter, v, [](const Element& x) -> const Element& { return x; });
|
||||
}
|
||||
|
||||
std::string replace_all(std::string&& s, StringView search, StringView rep);
|
||||
|
||||
void inplace_replace_all(std::string& s, StringView search, StringView rep);
|
||||
|
||||
void inplace_replace_all(std::string& s, char search, char rep) noexcept;
|
||||
|
||||
std::string trim(std::string&& s);
|
||||
|
||||
StringView trim(StringView sv);
|
||||
|
||||
void trim_all_and_remove_whitespace_strings(std::vector<std::string>* strings);
|
||||
|
||||
std::vector<std::string> split(StringView s, const char delimiter);
|
||||
|
||||
std::vector<std::string> split_paths(StringView s);
|
||||
|
||||
const char* find_first_of(StringView searched, StringView candidates);
|
||||
|
||||
std::vector<StringView> find_all_enclosed(StringView input, StringView left_delim, StringView right_delim);
|
||||
|
||||
StringView find_exactly_one_enclosed(StringView input, StringView left_tag, StringView right_tag);
|
||||
|
||||
Optional<StringView> find_at_most_one_enclosed(StringView input, StringView left_tag, StringView right_tag);
|
||||
|
||||
bool equals(StringView a, StringView b);
|
||||
|
||||
template<class T>
|
||||
std::string serialize(const T& t)
|
||||
{
|
||||
std::string ret;
|
||||
serialize(t, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Equivalent to one of the `::strto[T]` functions. Returns `nullopt` if there is an error.
|
||||
template<class T>
|
||||
Optional<T> strto(CStringView sv);
|
||||
|
||||
template<>
|
||||
inline Optional<double> strto<double>(CStringView sv)
|
||||
{
|
||||
char* endptr = nullptr;
|
||||
double res = strtod(sv.c_str(), &endptr);
|
||||
if (endptr == sv.c_str())
|
||||
{
|
||||
// no digits
|
||||
return nullopt;
|
||||
}
|
||||
// else, we may have HUGE_VAL but we expect the caller to deal with that
|
||||
return res;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Optional<long> strto<long>(CStringView sv)
|
||||
{
|
||||
char* endptr = nullptr;
|
||||
long res = strtol(sv.c_str(), &endptr, 10);
|
||||
if (endptr == sv.c_str())
|
||||
{
|
||||
// no digits
|
||||
return nullopt;
|
||||
}
|
||||
if (errno == ERANGE)
|
||||
{
|
||||
// out of bounds
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Optional<long long> strto<long long>(CStringView sv)
|
||||
{
|
||||
char* endptr = nullptr;
|
||||
long long res = strtoll(sv.c_str(), &endptr, 10);
|
||||
if (endptr == sv.c_str())
|
||||
{
|
||||
// no digits
|
||||
return nullopt;
|
||||
}
|
||||
if (errno == ERANGE)
|
||||
{
|
||||
// out of bounds
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Optional<int> strto<int>(CStringView sv)
|
||||
{
|
||||
auto res = strto<long>(sv);
|
||||
if (auto r = res.get())
|
||||
{
|
||||
if (*r < INT_MIN || *r > INT_MAX)
|
||||
{
|
||||
return nullopt;
|
||||
}
|
||||
return static_cast<int>(*r);
|
||||
}
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
const char* search(StringView haystack, StringView needle);
|
||||
|
||||
bool contains(StringView haystack, StringView needle);
|
||||
|
||||
// base 32 encoding, following IETC RFC 4648
|
||||
std::string b32_encode(std::uint64_t x) noexcept;
|
||||
|
||||
// Implements https://en.wikipedia.org/wiki/Levenshtein_distance with a "give-up" clause for large strings
|
||||
// Guarantees 0 for equal strings and nonzero for inequal strings.
|
||||
size_t byte_edit_distance(StringView a, StringView b);
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/fwd/stringview.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
struct StringView
|
||||
{
|
||||
constexpr StringView() = default;
|
||||
StringView(const std::string& s) noexcept; // Implicit by design
|
||||
|
||||
// NOTE: we do this instead of the delegating constructor since delegating ctors are a perf footgun
|
||||
template<size_t Sz>
|
||||
constexpr StringView(const char (&arr)[Sz]) noexcept : m_ptr(arr), m_size(Sz - 1)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr StringView(const char* ptr, size_t size) noexcept : m_ptr(ptr), m_size(size) { }
|
||||
constexpr StringView(const char* b, const char* e) noexcept : m_ptr(b), m_size(static_cast<size_t>(e - b)) { }
|
||||
|
||||
constexpr const char* begin() const noexcept { return m_ptr; }
|
||||
constexpr const char* end() const noexcept { return m_ptr + m_size; }
|
||||
|
||||
std::reverse_iterator<const char*> rbegin() const noexcept { return std::make_reverse_iterator(end()); }
|
||||
std::reverse_iterator<const char*> rend() const noexcept { return std::make_reverse_iterator(begin()); }
|
||||
|
||||
constexpr const char* data() const noexcept { return m_ptr; }
|
||||
constexpr size_t size() const noexcept { return m_size; }
|
||||
constexpr bool empty() const noexcept { return m_size == 0; }
|
||||
|
||||
std::string to_string() const;
|
||||
void to_string(std::string& out) const;
|
||||
|
||||
StringView substr(size_t pos, size_t count = std::numeric_limits<size_t>::max()) const noexcept;
|
||||
|
||||
constexpr char byte_at_index(size_t pos) const noexcept { return m_ptr[pos]; }
|
||||
|
||||
private:
|
||||
const char* m_ptr = 0;
|
||||
size_t m_size = 0;
|
||||
};
|
||||
|
||||
bool operator==(StringView lhs, StringView rhs) noexcept;
|
||||
bool operator!=(StringView lhs, StringView rhs) noexcept;
|
||||
bool operator<(StringView lhs, StringView rhs) noexcept;
|
||||
bool operator>(StringView lhs, StringView rhs) noexcept;
|
||||
bool operator<=(StringView lhs, StringView rhs) noexcept;
|
||||
bool operator>=(StringView lhs, StringView rhs) noexcept;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/chrono.h>
|
||||
#include <vcpkg/base/lineinfo.h>
|
||||
#include <vcpkg/base/system.print.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace vcpkg::Debug
|
||||
{
|
||||
extern std::atomic<bool> g_debugging;
|
||||
|
||||
template<class... Args>
|
||||
void print(const Args&... args)
|
||||
{
|
||||
if (g_debugging) System::print2("[DEBUG] ", args...);
|
||||
}
|
||||
|
||||
template<class F, class R = std::result_of_t<F && ()>, class = std::enable_if_t<!std::is_void<R>::value>>
|
||||
R time(LineInfo line, F&& f)
|
||||
{
|
||||
if (g_debugging)
|
||||
{
|
||||
auto timer = Chrono::ElapsedTimer::create_started();
|
||||
auto&& result = f();
|
||||
System::print2("[DEBUG] ", line, " took ", timer, '\n');
|
||||
return static_cast<R&&>(result);
|
||||
}
|
||||
else
|
||||
return f();
|
||||
}
|
||||
|
||||
template<class F, class R = std::result_of_t<F && ()>, class = std::enable_if_t<std::is_void<R>::value>>
|
||||
void time(LineInfo line, F&& f)
|
||||
{
|
||||
if (g_debugging)
|
||||
{
|
||||
auto timer = Chrono::ElapsedTimer::create_started();
|
||||
f();
|
||||
System::print2("[DEBUG] ", line, " took ", timer, '\n');
|
||||
}
|
||||
else
|
||||
f();
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/optional.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
#include <vcpkg/base/zstringview.h>
|
||||
|
||||
namespace vcpkg::System
|
||||
{
|
||||
Optional<std::string> get_environment_variable(ZStringView varname) noexcept;
|
||||
void set_environment_variable(ZStringView varname, Optional<ZStringView> value) noexcept;
|
||||
|
||||
const ExpectedS<fs::path>& get_home_dir() noexcept;
|
||||
|
||||
const ExpectedS<fs::path>& get_platform_cache_home() noexcept;
|
||||
|
||||
#ifdef _WIN32
|
||||
const ExpectedS<fs::path>& get_appdata_local() noexcept;
|
||||
#endif
|
||||
|
||||
Optional<std::string> get_registry_string(void* base_hkey, StringView subkey, StringView valuename);
|
||||
|
||||
long get_process_id();
|
||||
|
||||
enum class CPUArchitecture
|
||||
{
|
||||
X86,
|
||||
X64,
|
||||
ARM,
|
||||
ARM64,
|
||||
S390X,
|
||||
PPC64LE,
|
||||
};
|
||||
|
||||
Optional<CPUArchitecture> to_cpu_architecture(StringView arch);
|
||||
|
||||
ZStringView to_zstring_view(CPUArchitecture arch) noexcept;
|
||||
|
||||
CPUArchitecture get_host_processor();
|
||||
|
||||
std::vector<CPUArchitecture> get_supported_host_architectures();
|
||||
|
||||
const Optional<fs::path>& get_program_files_32_bit();
|
||||
|
||||
const Optional<fs::path>& get_program_files_platform_bitness();
|
||||
|
||||
int get_num_logical_cores();
|
||||
|
||||
Optional<CPUArchitecture> guess_visual_studio_prompt_target_architecture();
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/strings.h>
|
||||
#include <vcpkg/base/view.h>
|
||||
|
||||
namespace vcpkg::System
|
||||
{
|
||||
enum class Color
|
||||
{
|
||||
success = 10,
|
||||
error = 12,
|
||||
warning = 14,
|
||||
};
|
||||
|
||||
namespace details
|
||||
{
|
||||
void print(StringView message);
|
||||
void print(const Color c, StringView message);
|
||||
}
|
||||
|
||||
template<class Arg1, class... Args>
|
||||
void printf(const char* message_template, const Arg1& message_arg1, const Args&... message_args)
|
||||
{
|
||||
return ::vcpkg::System::details::print(Strings::format(message_template, message_arg1, message_args...));
|
||||
}
|
||||
|
||||
template<class Arg1, class... Args>
|
||||
void printf(const Color c, const char* message_template, const Arg1& message_arg1, const Args&... message_args)
|
||||
{
|
||||
return ::vcpkg::System::details::print(c, Strings::format(message_template, message_arg1, message_args...));
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
void print2(const Color c, const Args&... args)
|
||||
{
|
||||
::vcpkg::System::details::print(c, Strings::concat_or_view(args...));
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
void print2(const Args&... args)
|
||||
{
|
||||
::vcpkg::System::details::print(Strings::concat_or_view(args...));
|
||||
}
|
||||
|
||||
class BufferedPrint
|
||||
{
|
||||
::std::string stdout_buffer;
|
||||
static constexpr ::std::size_t buffer_size_target = 2048;
|
||||
static constexpr ::std::size_t expected_maximum_print = 256;
|
||||
static constexpr ::std::size_t alloc_size = buffer_size_target + expected_maximum_print;
|
||||
|
||||
public:
|
||||
BufferedPrint() { stdout_buffer.reserve(alloc_size); }
|
||||
BufferedPrint(const BufferedPrint&) = delete;
|
||||
BufferedPrint& operator=(const BufferedPrint&) = delete;
|
||||
void append(::vcpkg::StringView nextView)
|
||||
{
|
||||
stdout_buffer.append(nextView.data(), nextView.size());
|
||||
if (stdout_buffer.size() > buffer_size_target)
|
||||
{
|
||||
::vcpkg::System::details::print(stdout_buffer);
|
||||
stdout_buffer.clear();
|
||||
}
|
||||
}
|
||||
~BufferedPrint() { ::vcpkg::System::details::print(stdout_buffer); }
|
||||
};
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/zstringview.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace vcpkg::System
|
||||
{
|
||||
struct CMakeVariable
|
||||
{
|
||||
CMakeVariable(const StringView varname, const char* varvalue);
|
||||
CMakeVariable(const StringView varname, const std::string& varvalue);
|
||||
CMakeVariable(const StringView varname, const fs::path& path);
|
||||
CMakeVariable(std::string var);
|
||||
|
||||
std::string s;
|
||||
};
|
||||
|
||||
struct Command
|
||||
{
|
||||
Command() = default;
|
||||
explicit Command(const fs::path& p) { path_arg(p); }
|
||||
explicit Command(StringView s) { string_arg(s); }
|
||||
explicit Command(const std::string& s) { string_arg(s); }
|
||||
explicit Command(const char* s) { string_arg({s, ::strlen(s)}); }
|
||||
|
||||
Command& path_arg(const fs::path& p) & { return string_arg(fs::u8string(p)); }
|
||||
Command& string_arg(StringView s) &;
|
||||
Command& raw_arg(StringView s) &
|
||||
{
|
||||
buf.push_back(' ');
|
||||
buf.append(s.data(), s.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
Command&& path_arg(const fs::path& p) && { return std::move(path_arg(p)); }
|
||||
Command&& string_arg(StringView s) && { return std::move(string_arg(s)); };
|
||||
Command&& raw_arg(StringView s) && { return std::move(raw_arg(s)); }
|
||||
|
||||
std::string&& extract() && { return std::move(buf); }
|
||||
StringView command_line() const { return buf; }
|
||||
|
||||
void clear() { buf.clear(); }
|
||||
bool empty() const { return buf.empty(); }
|
||||
|
||||
private:
|
||||
std::string buf;
|
||||
};
|
||||
|
||||
struct CommandLess
|
||||
{
|
||||
bool operator()(const Command& lhs, const Command& rhs) const
|
||||
{
|
||||
return lhs.command_line() < rhs.command_line();
|
||||
}
|
||||
};
|
||||
|
||||
Command make_basic_cmake_cmd(const fs::path& cmake_tool_path,
|
||||
const fs::path& cmake_script,
|
||||
const std::vector<CMakeVariable>& pass_variables);
|
||||
|
||||
fs::path get_exe_path_of_current_process();
|
||||
|
||||
struct ExitCodeAndOutput
|
||||
{
|
||||
int exit_code;
|
||||
std::string output;
|
||||
};
|
||||
|
||||
struct Environment
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
std::wstring m_env_data;
|
||||
#endif
|
||||
};
|
||||
|
||||
const Environment& get_clean_environment();
|
||||
Environment get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
|
||||
const std::string& prepend_to_path = {});
|
||||
|
||||
struct InWorkingDirectory
|
||||
{
|
||||
const fs::path& working_directory;
|
||||
};
|
||||
|
||||
int cmd_execute(const Command& cmd_line, InWorkingDirectory wd, const Environment& env = {});
|
||||
inline int cmd_execute(const Command& cmd_line, const Environment& env = {})
|
||||
{
|
||||
return cmd_execute(cmd_line, InWorkingDirectory{fs::path()}, env);
|
||||
}
|
||||
|
||||
int cmd_execute_clean(const Command& cmd_line, InWorkingDirectory wd);
|
||||
inline int cmd_execute_clean(const Command& cmd_line)
|
||||
{
|
||||
return cmd_execute_clean(cmd_line, InWorkingDirectory{fs::path()});
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
Environment cmd_execute_modify_env(const Command& cmd_line, const Environment& env = {});
|
||||
|
||||
void cmd_execute_background(const Command& cmd_line);
|
||||
#endif
|
||||
|
||||
ExitCodeAndOutput cmd_execute_and_capture_output(const Command& cmd_line,
|
||||
InWorkingDirectory wd,
|
||||
const Environment& env = {});
|
||||
inline ExitCodeAndOutput cmd_execute_and_capture_output(const Command& cmd_line, const Environment& env = {})
|
||||
{
|
||||
return cmd_execute_and_capture_output(cmd_line, InWorkingDirectory{fs::path()}, env);
|
||||
}
|
||||
|
||||
int cmd_execute_and_stream_lines(const Command& cmd_line,
|
||||
InWorkingDirectory wd,
|
||||
std::function<void(StringView)> per_line_cb,
|
||||
const Environment& env = {});
|
||||
inline int cmd_execute_and_stream_lines(const Command& cmd_line,
|
||||
std::function<void(StringView)> per_line_cb,
|
||||
const Environment& env = {})
|
||||
{
|
||||
return cmd_execute_and_stream_lines(cmd_line, InWorkingDirectory{fs::path()}, std::move(per_line_cb), env);
|
||||
}
|
||||
|
||||
int cmd_execute_and_stream_data(const Command& cmd_line,
|
||||
InWorkingDirectory wd,
|
||||
std::function<void(StringView)> data_cb,
|
||||
const Environment& env = {});
|
||||
inline int cmd_execute_and_stream_data(const Command& cmd_line,
|
||||
std::function<void(StringView)> data_cb,
|
||||
const Environment& env = {})
|
||||
{
|
||||
return cmd_execute_and_stream_data(cmd_line, InWorkingDirectory{fs::path()}, std::move(data_cb), env);
|
||||
}
|
||||
|
||||
void register_console_ctrl_handler();
|
||||
#if defined(_WIN32)
|
||||
void initialize_global_job_object();
|
||||
void enter_interactive_subprocess();
|
||||
void exit_interactive_subprocess();
|
||||
#endif
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user