diff options
| author | JackBoosY <47264268+JackBoosY@users.noreply.github.com> | 2019-08-16 10:01:32 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-16 10:01:32 +0800 |
| commit | adb84c2658b9774ff535eb88f377ee818dd429be (patch) | |
| tree | fcfcf4a93057037152a14aa2885598b45c5b03bd | |
| parent | 2865da8f4a6d911617cdd9b147816c4cd02bbf7e (diff) | |
| parent | 22e787f9448a25dae734ca06c80e7e5af5fb6537 (diff) | |
| download | vcpkg-adb84c2658b9774ff535eb88f377ee818dd429be.tar.gz vcpkg-adb84c2658b9774ff535eb88f377ee818dd429be.zip | |
Merge branch 'master' into dev/jack/4167
725 files changed, 32290 insertions, 7918 deletions
diff --git a/.github/ISSUE_TEMPLATE/i-have-a-question.md b/.github/ISSUE_TEMPLATE/i-have-a-question.md new file mode 100644 index 000000000..712997630 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/i-have-a-question.md @@ -0,0 +1,10 @@ +--- +name: I have a question +about: I have a question and don't see a clear answer in documentation +title: How do I ... +labels: Question +assignees: '' + +--- + +When asking a question please also include where you looked for an answer (so we can update the documentation if needed). diff --git a/.github/ISSUE_TEMPLATE/other-type-of-bug-report.md b/.github/ISSUE_TEMPLATE/other-type-of-bug-report.md new file mode 100644 index 000000000..85c296745 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other-type-of-bug-report.md @@ -0,0 +1,31 @@ +--- +name: Other type of bug report +about: Let us know about an issues that does not fit into any of the other issues + types +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Environment** +- OS: [e.g. Windows/Linux etc...] +- Compiler: revision + +**To Reproduce** +Steps to reproduce the behavior: +1. ./vcpkg install xxxx +2. See error +Repro code when + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Failure logs** +-(please attached failure logs) + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/report-package-build-failure.md b/.github/ISSUE_TEMPLATE/report-package-build-failure.md new file mode 100644 index 000000000..e42ff43f8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/report-package-build-failure.md @@ -0,0 +1,23 @@ +--- +name: Report package build failure +about: Let us know about build failures in ports. +title: "[<port name>] build failure" +labels: port bug +assignees: '' + +--- + +**Host Environment** +- OS: [e.g. Windows/Linux etc...] +- Compiler: revision + +**To Reproduce** +Steps to reproduce the behavior: +`./vcpkg install xxxx` + +**Failure logs** +-Cut and past the appropriate build messages from the console output. +-Please attach any additional failure logs mentioned in the console output. + +**Additional context** +Add any other context about the problem here, such as what you have already tried to resolve the issue. diff --git a/.github/ISSUE_TEMPLATE/request-a-feature-or-improvement-to-a-port.md b/.github/ISSUE_TEMPLATE/request-a-feature-or-improvement-to-a-port.md new file mode 100644 index 000000000..a40036f95 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-a-feature-or-improvement-to-a-port.md @@ -0,0 +1,22 @@ +--- +name: Request a feature or improvement to a port +about: Suggest an improvement to one the the ports/libraries in vcpkg +title: "[<portname>] <short description of feature>" +labels: port feature +assignees: '' + +--- + +**** + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Proposed solution** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered if applicable. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/request-a-feature-or-improvement.md b/.github/ISSUE_TEMPLATE/request-a-feature-or-improvement.md new file mode 100644 index 000000000..55d06b16a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-a-feature-or-improvement.md @@ -0,0 +1,22 @@ +--- +name: Request a feature or improvement +about: Suggest an improvement to vcpkg +title: '' +labels: vcpkg feature +assignees: '' + +--- + +**** + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Proposed solution** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/request-a-new-port.md b/.github/ISSUE_TEMPLATE/request-a-new-port.md new file mode 100644 index 000000000..65c9bf01c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-a-new-port.md @@ -0,0 +1,18 @@ +--- +name: Request a new port +about: Request a new port/library that vcpkg should support +title: "[New Port Request] <library name here>" +labels: new port request - consider making a PR! +assignees: '' + +--- + +Library name: + +Library description: + +Source repository URL: + +Project homepage (if different from the source repository): + +Anything else that is useful to know when adding (such as optional features the library may have that should be included): diff --git a/.github/ISSUE_TEMPLATE/request-an-update-to-an-existing-port.md b/.github/ISSUE_TEMPLATE/request-an-update-to-an-existing-port.md new file mode 100644 index 000000000..f1689b097 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-an-update-to-an-existing-port.md @@ -0,0 +1,14 @@ +--- +name: Request an update to an existing port +about: Let us know about a new version of a library we should pick up. +title: "[<port name>] update to <version>" +labels: port feature +assignees: '' + +--- + +Library name: + +New version number: + +Other information that may be useful (release notes, etc...) diff --git a/.gitignore b/.gitignore index f38bc90a9..dbc801901 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ *.userosscache *.sln.docstates -toolsrc/out +toolsrc/out* toolsrc/CMakeSettings.json # User-specific files (MonoDevelop/Xamarin Studio) diff --git a/CHANGELOG.md b/CHANGELOG.md index 499023e9d..ad2091da9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,625 @@ +vcpkg (2019.7.31) +--- +#### Total port count: 1105 +#### Total port count per triplet (tested): +|triplet|ports available| +|---|---| +|**x64-windows**|1039| +|x86-windows|1009| +|x64-windows-static|928| +|**x64-linux**|866| +|**x64-osx**|788| +|arm64-windows|678| +|x64-uwp|546| +|arm-uwp|522| + +#### The following commands and options have been updated: +- --scripts-root ***[NEW OPTION]*** + - Specify a directory to use in place of `<vcpkg root>/scripts`. Enables a shared script directory for those using a single vcpkg instance to manage distributed port directories + - [(#6552)](https://github.com/microsoft/vcpkg/pull/6552) Allow redirection of the scripts folder. +- depend-info + - Allow `vcpkg depend-info port[feature]` to display port-dependency information for a given port and the specified feature. + - [(#6797)](https://github.com/microsoft/vcpkg/pull/6797) Make `depend-info` subcommand able to handle features + +#### The following documentation has been updated: +- [Overlay triplets example: build dynamic libraries on Linux](docs/examples/overlay-triplets-linux-dynamic.md) ***[NEW]*** + - [(#7291)](https://github.com/microsoft/vcpkg/pull/7291) Example: Building dynamic libraries on Linux using overlay triplets +- [vcpkg_from_git](docs/maintainers/vcpkg_from_git.md) + - [(#7082)](https://github.com/microsoft/vcpkg/pull/7082) Fix vcpkg_from_git +- [Maintainer Guidelines and Policies](docs/maintainers/maintainer-guide.md) + - [(#7390)](https://github.com/microsoft/vcpkg/pull/7390) [docs] add notes about manual-link + +#### The following *remarkable* changes have been made to vcpkg's infrastructure: +- `VCPKG_ENV_PASSTHROUGH` triplet variable and `environment-overrides.cmake` + - Port authors can add an `environment-overrides.cmake` file to a port to override triplet settings globally or to define behavior of the vpckg binary on a per port basis + - [(#7290)](https://github.com/microsoft/vcpkg/pull/7290) [vcpkg] Environment Variable Passthrough + - [(#7292)](https://github.com/microsoft/vcpkg/pull/7292) [vcpkg] Portfile Settings +- Testing overhaul + - Tests have been migrated from the Visual Studio unit testing framework to the cross-platform [Catch2](https://github.com/catchorg/Catch2) + - [(#7315)](https://github.com/microsoft/vcpkg/pull/7315) Rewrite the tests! now they're cross-platform! + +#### The following *additional* changes have been made to vcpkg's infrastructure: +- [(#7080)](https://github.com/microsoft/vcpkg/pull/7080) [vcpkg] Use spaces instead of semicolons in the output +- [(#6791)](https://github.com/microsoft/vcpkg/pull/6791) Update python2, python3, perl, aria2, ninja, ruby, 7z +- [(#7082)](https://github.com/microsoft/vcpkg/pull/7082) Fix vcpkg_from_git +- [(#7117)](https://github.com/microsoft/vcpkg/pull/7117) Revert Visual Studio projects versions +- [(#7051)](https://github.com/microsoft/vcpkg/pull/7051) Fix Python3 tool on Windows +- [(#7135)](https://github.com/microsoft/vcpkg/pull/7135) revert ninja update +- [(#7136)](https://github.com/microsoft/vcpkg/pull/7136) Bump version to warn of outdated vcpkg sources +- [(#7094)](https://github.com/microsoft/vcpkg/pull/7094) [vcpkg] Fix powershell font corruption bug +- [(#7158)](https://github.com/microsoft/vcpkg/pull/7158) [vcpkg] Fix incorrect setting of FEATURE_OPTIONS +- [(#6792)](https://github.com/microsoft/vcpkg/pull/6792) Cleanup vcpkg_configure_cmake.cmake +- [(#7175)](https://github.com/microsoft/vcpkg/pull/7175) Added nasm mirror as nasm.us is down again +- [(#7216)](https://github.com/microsoft/vcpkg/pull/7216) [vcpkg] allow spaces in pathname on linux +- [(#7243)](https://github.com/microsoft/vcpkg/pull/7243) Testing for --overlay-ports and --overlay-triplets args +- [(#7294)](https://github.com/microsoft/vcpkg/pull/7294) Add June changelog +- [(#7229)](https://github.com/microsoft/vcpkg/pull/7229) Better error message when VCPKG_ROOT is independently defined +- [(#7336)](https://github.com/microsoft/vcpkg/pull/7336) Create issue templates +- [(#7322)](https://github.com/microsoft/vcpkg/pull/7322) Resolves "project is never up-to-date" problem (issue 6179) +- [(#7228)](https://github.com/microsoft/vcpkg/pull/7228) Parallel file operations +- [(#7403)](https://github.com/microsoft/vcpkg/pull/7403) Add third party notices -- copied from chakracore +- [(#7407)](https://github.com/microsoft/vcpkg/pull/7407) Modify CMakeLists to split up vcpkglib +- [(#7430)](https://github.com/microsoft/vcpkg/pull/7430) [vcpkg] Fix RealFilesystem::remove_all + +<details> +<summary><b>The following 37 ports have been added:</b></summary> + +|port|version| +|---|---| +|[septag-sx](https://github.com/microsoft/vcpkg/pull/6327)| 2019-05-07-1 +|[librdkafka](https://github.com/microsoft/vcpkg/pull/5921)| 1.1.0 +|[soxr](https://github.com/microsoft/vcpkg/pull/6478)| 0.1.3. +|[czmq](https://github.com/microsoft/vcpkg/pull/4979)<sup>[#7186](https://github.com/microsoft/vcpkg/pull/7186) </sup>| 2019-06-10-1 +|[cppmicroservices](https://github.com/microsoft/vcpkg/pull/6388)| 4.0.0-pre1 +|[zookeeper](https://github.com/microsoft/vcpkg/pull/7000)| 3.5.5 +|[xmlsec](https://github.com/microsoft/vcpkg/pull/7196)| 1.2.28 +|[librsvg](https://github.com/microsoft/vcpkg/pull/6807)| 2.40.20 +|[7zip](https://github.com/microsoft/vcpkg/pull/6920)| 19.00 +|[genann](https://github.com/microsoft/vcpkg/pull/7195)| 2019-07-10 +|[offscale-libetcd-cpp](https://github.com/microsoft/vcpkg/pull/6999)| 2019-07-10 +|[rabit](https://github.com/microsoft/vcpkg/pull/7234)| 0.1 +|[zyre](https://github.com/microsoft/vcpkg/pull/7189)| 2019-07-07 +|[cpp-peglib](https://github.com/microsoft/vcpkg/pull/7254)| 0.1.0 +|[paho-mqttpp3](https://github.com/microsoft/vcpkg/pull/7033)| 1.0.1 +|[openxr-loader](https://github.com/microsoft/vcpkg/pull/6339)<sup>[#7376](https://github.com/microsoft/vcpkg/pull/7376) [#7488](https://github.com/microsoft/vcpkg/pull/7488) </sup>| 1.0.0-1 +|[wintoast](https://github.com/microsoft/vcpkg/pull/7006)| 1.2.0 +|[scnlib](https://github.com/microsoft/vcpkg/pull/7014)| 0.1.2 +|[mongoose](https://github.com/microsoft/vcpkg/pull/7089)| 6.15-1 +|[nameof](https://github.com/microsoft/vcpkg/pull/7250)| 2019-07-13 +|[leaf](https://github.com/microsoft/vcpkg/pull/7319)<sup>[#7468](https://github.com/microsoft/vcpkg/pull/7468) </sup>| 0.2.1-2 +|[otl](https://github.com/microsoft/vcpkg/pull/7272)| 4.0.442 +|[dbg-macro](https://github.com/microsoft/vcpkg/pull/7237)| 2019-07-11 +|[p-ranav-csv](https://github.com/microsoft/vcpkg/pull/7236)| 2019-07-11 +|[lastools](https://github.com/microsoft/vcpkg/pull/7220)| 2019-07-10 +|[basisu](https://github.com/microsoft/vcpkg/pull/6995)<sup>[#7468](https://github.com/microsoft/vcpkg/pull/7468) </sup>| 0.0.1-1 +|[cmcstl2](https://github.com/microsoft/vcpkg/pull/7348)| 2019-07-20 +|[libconfuse](https://github.com/microsoft/vcpkg/pull/7252)| 2019-07-14 +|[boolinq](https://github.com/microsoft/vcpkg/pull/7362)| 2019-07-22 +|[libzippp](https://github.com/microsoft/vcpkg/pull/6801)| 2019-07-22 +|[mimalloc](https://github.com/microsoft/vcpkg/pull/7011)| 2019-06-25 +|[liblas](https://github.com/microsoft/vcpkg/pull/6746)| 1.8.1 +|[xtensor-io](https://github.com/microsoft/vcpkg/pull/7398)| 0.7.0 +|[easycl](https://github.com/microsoft/vcpkg/pull/7387)| 0.3 +|[nngpp](https://github.com/microsoft/vcpkg/pull/7417)| 2019-07-25 +|[mpi](https://github.com/microsoft/vcpkg/pull/7142)| 1 +|[openmpi](https://github.com/microsoft/vcpkg/pull/7142)| 4.0.1 +</details> + +<details> +<summary><b>The following 160 ports have been updated:</b></summary> + +- openssl-unix `1.0.2q` -> `1.0.2s-1` + - [(#6854)](https://github.com/microsoft/vcpkg/pull/6854) Openssl version bump 1.0.2s + - [(#6512)](https://github.com/microsoft/vcpkg/pull/6512) [openssl-unix] Shared library support + +- openssl-windows `1.0.2q-2` -> `1.0.2s-1` + - [(#6854)](https://github.com/microsoft/vcpkg/pull/6854) Openssl version bump 1.0.2s + +- mongo-cxx-driver `3.4.0-2` -> `3.4.0-3` + - [(#7050)](https://github.com/microsoft/vcpkg/pull/7050) [mongo-cxx-driver] Do not delete the third_party include folder when building with mnmlstc + +- fdlibm `5.3-3` -> `5.3-4` + - [(#7082)](https://github.com/microsoft/vcpkg/pull/7082) Fix vcpkg_from_git + +- azure-iot-sdk-c `2019-05-16.1` -> `2019-07-01.1` + - [(#7123)](https://github.com/microsoft/vcpkg/pull/7123) [azure] Update azure-iot-sdk-c for public-preview release of 2019-07-01 + +- open62541 `0.3.0-1` -> `0.3.0-2` + - [(#7051)](https://github.com/microsoft/vcpkg/pull/7051) Fix Python3 tool on Windows + +- lua `5.3.5-1` -> `5.3.5-2` + - [(#7101)](https://github.com/microsoft/vcpkg/pull/7101) [lua] Add [cpp] feature to additionally build lua-c++ + +- flann `1.9.1-1` -> `2019-04-07-1` + - [(#7125)](https://github.com/microsoft/vcpkg/pull/7125) [flann]Change the version tag to the corresponding time of commit id. + +- tbb `2019_U7` -> `2019_U7-1` + - [(#6510)](https://github.com/microsoft/vcpkg/pull/6510) [tbb] Add shared library support for Linux and OSX + +- dcmtk `3.6.4` -> `3.6.4-1` + - [(#7059)](https://github.com/microsoft/vcpkg/pull/7059) [dcmtk] support wchar_t* filename + +- libmupdf `1.15.0` -> `1.15.0-1` + - [(#7107)](https://github.com/microsoft/vcpkg/pull/7107) [libmupdf] Enable the old patch for fixing C2169 + +- mongo-c-driver `1.14.0-2` -> `1.14.0-3` + - [(#7048)](https://github.com/microsoft/vcpkg/pull/7048) [mongo-c-driver] Add usage + - [(#7338)](https://github.com/microsoft/vcpkg/pull/7338) [mongo-c-driver] Disable snappy auto-detection + +- openimageio `1.8.16` -> `2.0.8` + - [(#7173)](https://github.com/microsoft/vcpkg/pull/7173) [openimageio] Upgrade to version 2.0.8 + +- duktape `2.3.0` -> `2.3.0-2` + - [(#7170)](https://github.com/microsoft/vcpkg/pull/7170) [duktape] Fix package not found by find_package. + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- poco `2.0.0-pre-2` -> `2.0.0-pre-3` + - [(#7169)](https://github.com/microsoft/vcpkg/pull/7169) [Poco] Add missing ipjlpapi.lib to foundation library + +- gsoap `2.8.84-1` -> `2.8.87-1` + - [(#7145)](https://github.com/microsoft/vcpkg/pull/7145) [gsoap] Update to 2.8.87 + +- qt5-mqtt `5.12.3` -> `5.12.3-1` + - [(#7130)](https://github.com/microsoft/vcpkg/pull/7130) [qt5-mqtt] crossplatform add to path + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- botan `2.9.0-1` -> `2.9.0-2` + - [(#7140)](https://github.com/microsoft/vcpkg/pull/7140) [botan] Fix build error C2039 with Visual Studio 2019 and C++17 + - [(#7303)](https://github.com/microsoft/vcpkg/pull/7303) [botan] Fix parallel build + +- kinectsdk2 `2.0` -> `2.0-1` + - [(#7143)](https://github.com/microsoft/vcpkg/pull/7143) kinectsdk2: fix missing header files + +- civetweb `1.11-1` -> `2019-07-05` + - [(#7166)](https://github.com/microsoft/vcpkg/pull/7166) [civetweb] Upgrade and enable feature websocket + +- curl `7.65.0-2` -> `7.65.2-1` + - [(#7156)](https://github.com/microsoft/vcpkg/pull/7156) [curl] Add features. + - [(#7093)](https://github.com/microsoft/vcpkg/pull/7093) [curl] Update to 7.65.2 + +- aws-checksums `0.1.2` -> `0.1.3` + - [(#7154)](https://github.com/microsoft/vcpkg/pull/7154) [aws-checksums]Upgrade version to 0.1.3 + +- rapidjson `1.1.0-3` -> `d87b698-1` + - [(#7152)](https://github.com/microsoft/vcpkg/pull/7152) [rapidjson] Update to the latest commit and also fix #3401. + - [(#7273)](https://github.com/microsoft/vcpkg/pull/7273) [rapidjson] Fix path RapidJSON_INCLUDE_DIRS + +- freetype `2.10.0` -> `2.10.1-1` + - [(#7141)](https://github.com/microsoft/vcpkg/pull/7141) [freetype]Re-fixed the issue of exporting symbols when building dynamic library. + - [(#7341)](https://github.com/microsoft/vcpkg/pull/7341) [freetype] Update to 2.10.1 + +- llvm `7.0.0-3` -> `8.0.0` + - [(#7209)](https://github.com/microsoft/vcpkg/pull/7209) [llvm] Update to 8.0.0 + +- reproc `6.0.0-1` -> `6.0.0-2` + - [(#7208)](https://github.com/microsoft/vcpkg/pull/7208) [reproc] Fix reproc++ installation path + +- wil `2019-06-10` -> `2019-07-16` + - [(#7215)](https://github.com/microsoft/vcpkg/pull/7215) [wil] Update + - [(#7285)](https://github.com/microsoft/vcpkg/pull/7285) Update wil port to match the commit used for NuGet package 1.0.190716.2 + +- tesseract `4.0.0-3` -> `4.1.0-1` + - [(#7144)](https://github.com/microsoft/vcpkg/pull/7144) [tesseract] Fix Port. Making it crossplatform + - [(#7227)](https://github.com/microsoft/vcpkg/pull/7227) [tesseract] port update to 4.1.0 release + - [(#7360)](https://github.com/microsoft/vcpkg/pull/7360) [tesseract[training_tools]] Fix build error + +- zeromq `2019-05-07` -> `2019-07-09` + - [(#7203)](https://github.com/microsoft/vcpkg/pull/7203) [zeromq] Update to 4.3.2 + +- spirv-tools `2019.3-dev` -> `2019.3-dev-1` + - [(#7204)](https://github.com/microsoft/vcpkg/pull/7204) [spirv-tools] Fix removed patch + +- libraqm `0.6.0` -> `0.7.0` + - [(#7149)](https://github.com/microsoft/vcpkg/pull/7149) [libraqm] Update libraqm to 0.7.0 + - [(#7263)](https://github.com/microsoft/vcpkg/pull/7263) [libraqm] Fix copying raqm-version.h to include directory + +- pthreads `3.0.0-1` -> `3.0.0-2` + - [(#7178)](https://github.com/microsoft/vcpkg/pull/7178) [pthreads4W] vcpkg wrapper fixes + +- libkml `1.3.0-2` -> `1.3.0-3` + - [(#7194)](https://github.com/microsoft/vcpkg/pull/7194) [libkml] Fix install path + - [(#7282)](https://github.com/microsoft/vcpkg/pull/7282) [minizip] Make BZip2 an optional feature + +- gherkin-c `4.1.2` -> `2019-10-07-1` + - [(#7231)](https://github.com/microsoft/vcpkg/pull/7231) [gherkin-b] update to latest + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- google-cloud-cpp `0.10.0` -> `0.11.0` + - [(#7134)](https://github.com/microsoft/vcpkg/pull/7134) Upgrade google-cloud-cpp to v0.11.0. + +- sqlite3 `3.28.0-1` -> `3.29.0-1` + - [(#7202)](https://github.com/microsoft/vcpkg/pull/7202) [sqlite3-tool]Fix build error on arm/uwp platform. + - [(#7342)](https://github.com/microsoft/vcpkg/pull/7342) [sqlite3] Update to 3.29.0 + +- nonius `2019-04-20` -> `2019-04-20-1` + - [(#7258)](https://github.com/microsoft/vcpkg/pull/7258) [nonius] properly install noniusConfig.cmake + +- leveldb `1.22` -> `1.22-1` + - [(#7245)](https://github.com/microsoft/vcpkg/pull/7245) [leveldb] Fix cmake config + +- bond `8.1.0` -> `8.1.0-2` + - [(#7273)](https://github.com/microsoft/vcpkg/pull/7273) [rapidjson] Fix path RapidJSON_INCLUDE_DIRS + - [(#7306)](https://github.com/microsoft/vcpkg/pull/7306) [bond] make haskell an external dependency + - [(#7142)](https://github.com/microsoft/vcpkg/pull/7142) [OpenMPI] add a new port + +- cpprestsdk `2.10.13-1` -> `2.10.14` + - [(#7286)](https://github.com/microsoft/vcpkg/pull/7286) Update cpprestsdk to v2.10.14. + +- qt5-base `5.12.3-1` -> `5.12.3-3` + - [(#6983)](https://github.com/microsoft/vcpkg/pull/6983) [qt5-base]Add a print message to inform the user to install the dependency package. + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-3d `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-activeqt `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-charts `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-connectivity `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-datavis3d `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-declarative `5.12.3-1` -> `5.12.3-2` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-gamepad `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-graphicaleffects `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-imageformats `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-location `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-macextras `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-modularscripts `2019-04-30` -> `2019-04-30-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-multimedia `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-networkauth `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-purchasing `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-quickcontrols `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-quickcontrols2 `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-remoteobjects `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-script `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-scxml `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-sensors `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-serialport `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-speech `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-svg `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-tools `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-virtualkeyboard `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-webchannel `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-websockets `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-webview `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- qt5-winextras `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + - [(#7298)](https://github.com/microsoft/vcpkg/pull/7298) [qt5-winextras, ecsutil, soundtouch] Fix build-depends + +- qt5-xmlpatterns `5.12.3` -> `5.12.3-1` + - [(#7230)](https://github.com/microsoft/vcpkg/pull/7230) [qt5]Fix build failure in linux + +- rocksdb `6.0.2` -> `6.1.2` + - [(#7304)](https://github.com/microsoft/vcpkg/pull/7304) [rocksdb] Update rocksdb to 6.1.2, adds optional zstd feature + +- metis `5.1.0-3` -> `5.1.0-5` + - [(#7299)](https://github.com/microsoft/vcpkg/pull/7299) [metis] Fix linux build error. + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- ecsutil `1.0.6.1` -> `1.0.7.2` + - [(#7298)](https://github.com/microsoft/vcpkg/pull/7298) [qt5-winextras, ecsutil, soundtouch] Fix build-depends + - [(#7427)](https://github.com/microsoft/vcpkg/pull/7427) [ECSUtil] update library to v1.0.7.2 + +- soundtouch `2.0.0-2` -> `2.0.0-3` + - [(#7298)](https://github.com/microsoft/vcpkg/pull/7298) [qt5-winextras, ecsutil, soundtouch] Fix build-depends + +- libsodium `1.0.18` -> `1.0.18-1` + - [(#7297)](https://github.com/microsoft/vcpkg/pull/7297) [libsodium] Fix Linux build error. + +- irrlicht `1.8.4` -> `1.8.4-2` + - [(#7296)](https://github.com/microsoft/vcpkg/pull/7296) [irrlicht] add vcpkg-cmake-wrapper + - [(#7354)](https://github.com/microsoft/vcpkg/pull/7354) [irrlicht] use unicode path on windows + +- libyaml `0.2.2` -> `0.2.2-1` + - [(#7277)](https://github.com/microsoft/vcpkg/pull/7277) [libyaml] Fix build error + +- eastl `3.13.05-1` -> `3.14.00` + - [(#7276)](https://github.com/microsoft/vcpkg/pull/7276) [eastl] Upgrade to 3.14 + +- boost-asio `1.70.0-1` -> `1.70.0-2` + - [(#7267)](https://github.com/microsoft/vcpkg/pull/7267) Fixed boost-asio on Windows + +- minizip `1.2.11-4` -> `1.2.11-5` + - [(#7282)](https://github.com/microsoft/vcpkg/pull/7282) [minizip] Make BZip2 an optional feature + +- blend2d `beta_2019-04-30` -> `beta_2019-07-16` + - [(#7239)](https://github.com/microsoft/vcpkg/pull/7239) [blend2d] Port update + +- so5extra `1.2.3-1` -> `1.3.1` + - [(#7238)](https://github.com/microsoft/vcpkg/pull/7238) [sobjectizer, so5extra] updates + +- sobjectizer `5.5.24.4-1` -> `5.6.0.2` + - [(#7238)](https://github.com/microsoft/vcpkg/pull/7238) [sobjectizer, so5extra] updates + +- directxtk `apr2019` -> `apr2019-1` + - [(#7233)](https://github.com/microsoft/vcpkg/pull/7233) [DirectXTK] Fix UWP build error + +- restbed `4.16-07-28-2018` -> `4.16-07-28-2018-1` + - [(#7232)](https://github.com/microsoft/vcpkg/pull/7232) [restbed] Add openssl feature + +- clapack `3.2.1-9` -> `3.2.1-10` + - [(#6786)](https://github.com/microsoft/vcpkg/pull/6786) [openblas/clapack] FindLapack/FindBLAS was not working. + +- geogram `1.6.9-6` -> `1.6.9-7` + - [(#6786)](https://github.com/microsoft/vcpkg/pull/6786) [openblas/clapack] FindLapack/FindBLAS was not working. + +- mlpack `3.1.1` -> `3.1.1-1` + - [(#6786)](https://github.com/microsoft/vcpkg/pull/6786) [openblas/clapack] FindLapack/FindBLAS was not working. + +- openblas `0.3.6-4` -> `0.3.6-5` + - [(#6786)](https://github.com/microsoft/vcpkg/pull/6786) [openblas/clapack] FindLapack/FindBLAS was not working. + +- pprint `2019-06-01` -> `2019-07-19` + - [(#7317)](https://github.com/microsoft/vcpkg/pull/7317) [pprint] Fix #7301 + +- boost-type-erasure `1.70.0` -> `1.70.0-1` + - [(#7325)](https://github.com/microsoft/vcpkg/pull/7325) [boost-type-erasure] fix depends on arm + +- armadillo `2019-04-16-3` -> `2019-04-16-4` + - [(#7041)](https://github.com/microsoft/vcpkg/pull/7041) [armadillo] Fix installation path + +- cutelyst2 `2.7.0` -> `2.8.0` + - [(#7327)](https://github.com/microsoft/vcpkg/pull/7327) [cutelyst2]Upgrade version to 2.8.0 + +- sdl2-image `2.0.4-3` -> `2.0.5` + - [(#7355)](https://github.com/microsoft/vcpkg/pull/7355) [sdl2-image] Updated to 2.0.5 + +- qhull `7.2.1-3` -> `7.3.2` + - [(#7340)](https://github.com/microsoft/vcpkg/pull/7340) [qhull] Update to 7.3.2 and fix postbuild validation + +- libexif `0.6.21-1` -> `0.6.21-2` + - [(#7344)](https://github.com/microsoft/vcpkg/pull/7344) [Libexif] update download location + +- arrow `0.13.0-4` -> `0.14.1` + - [(#7211)](https://github.com/microsoft/vcpkg/pull/7211) [Arrow] Update to Arrow v0.14.1 + +- date `ed0368f` -> `2019-05-18-1` + - [(#7399)](https://github.com/microsoft/vcpkg/pull/7399) [date] Fix issue with feature remote-api + +- libmariadb `3.0.10-1` -> `3.0.10-3` + - [(#7396)](https://github.com/microsoft/vcpkg/pull/7396) [libmariadb] Fix build library type and install path + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- inja `2.1.0` -> `2.1.0-1` + - [(#7402)](https://github.com/microsoft/vcpkg/pull/7402) [inja] Use inja CMakeLists.txt + +- pcl `1.9.1-4` -> `1.9.1-5` + - [(#7388)](https://github.com/microsoft/vcpkg/pull/7388) [pcl] Fix cuda building compatability issues with cuda 10.1 + +- thrift `2019-05-07-2` -> `2019-05-07-3` + - [(#7302)](https://github.com/microsoft/vcpkg/pull/7302) [Thrift] Make Thrift static again + +- forest `12.0.0` -> `12.0.3` + - [(#7410)](https://github.com/microsoft/vcpkg/pull/7410) [forest] Update to Version 12.0.3 + +- nlohmann-json `3.6.1` -> `3.7.0` + - [(#7459)](https://github.com/microsoft/vcpkg/pull/7459) [nlohmann-json] Update to 3.7.0 + +- ecm `5.58.0` -> `5.60.0-1` + - [(#7457)](https://github.com/microsoft/vcpkg/pull/7457) [ecm] Update library to v5.60.0 + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- gl2ps `1.4.0-1` -> `1.4.0-3` + - [(#7453)](https://github.com/microsoft/vcpkg/pull/7453) [gl2ps]Update to use vcpkg new functions(vcpkg_from_gitlab). + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- darknet `0.2.5-4` -> `0.2.5-5` + - [(#7450)](https://github.com/microsoft/vcpkg/pull/7450) [darknet] add training feature + +- g3log `2019-05-14-1` -> `2019-07-29` + - [(#7448)](https://github.com/microsoft/vcpkg/pull/7448) [g3log] Fix https://github.com/KjellKod/g3log/issues/319 + +- azure-storage-cpp `6.1.0` -> `6.1.0-2` + - [(#7404)](https://github.com/microsoft/vcpkg/pull/7404) [azure-storage-cpp] Removed gcov dependency in debug Linux build (#7311) + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- ace `6.5.5-1` -> `6.5.6` + - [(#7466)](https://github.com/microsoft/vcpkg/pull/7466) [ace] ace 6.5.6 + +- bullet3 `2.88` -> `2.88-1` + - [(#7474)](https://github.com/microsoft/vcpkg/pull/7474) [Bullet3] feature for multithreading + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- alembic `1.7.11-2` -> `1.7.11-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- ampl-mp `2019-03-21` -> `2019-03-21-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- anax `2.1.0-5` -> `2.1.0-6` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- apr `1.6.5-1` -> `1.6.5-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- blosc `1.16.3-1` -> `1.16.3-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- capnproto `0.7.0-2` -> `0.7.0-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- cgicc `3.2.19-1` -> `3.2.19-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- charls `2.0.0-1` -> `2.0.0-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- collada-dom `2.5.0-1` -> `2.5.0-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- ctemplate `2017-06-23-44b7c5-3` -> `2017-06-23-44b7c5-4` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- dlfcn-win32 `1.1.1-1` -> `1.1.1-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- easyloggingpp `9.96.7` -> `9.96.7-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- fastfeat `391d5e9` -> `391d5e9-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- fastlz `1.0-2` -> `1.0-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- freeglut `3.0.0-6` -> `3.0.0-7` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- glbinding `3.1.0-1` -> `3.1.0-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- glew `2.1.0-4` -> `2.1.0-5` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- glfw3 `3.3` -> `3.3-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- graphicsmagick `1.3.32` -> `1.3.32-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- hypre `2.11.2-1` -> `2.11.2-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + - [(#7142)](https://github.com/microsoft/vcpkg/pull/7142) [OpenMPI] add a new port + +- jack2 `1.9.12-1` -> `1.9.12-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- jxrlib `1.1-7` -> `1.1-8` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- kangaru `4.1.3-1` -> `4.1.3-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libconfig `1.7.2` -> `1.7.2-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libfreenect2 `0.2.0-2` -> `0.2.0-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libmad `0.15.1-2` -> `0.15.1-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libmspack `0.10.1` -> `0.10.1-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libnice `0.1.15` -> `0.1.15-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libodb-boost `2.4.0-2` -> `2.4.0-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libodb-mysql `2.4.0-2` -> `2.4.0-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libodb-pgsql `2.4.0-2` -> `2.4.0-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libodb-sqlite `2.4.0-3` -> `2.4.0-4` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libodb `2.4.0-4` -> `2.4.0-5` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- librabbitmq `0.9.0` -> `0.9.0-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libsamplerate `0.1.9.0` -> `0.1.9.0-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- libwebsockets `3.1.0-2` -> `3.1.0-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- lmdb `0.9.23-1` -> `0.9.23-2` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- mozjpeg `3.2-2` -> `3.2-3` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- nanodbc `2.12.4-3` -> `2.12.4-4` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- nmslib `1.7.3.6` -> `1.7.3.6-1` + - [(#7468)](https://github.com/microsoft/vcpkg/pull/7468) Add PREFER_NINJA to many ports + +- amqpcpp `4.1.4` -> `4.1.5` + - [(#7475)](https://github.com/microsoft/vcpkg/pull/7475) [amqpcpp] Update library to v4.1.5 + +- cxxopts `2.1.2-1` -> `2.2.0` + - [(#7473)](https://github.com/microsoft/vcpkg/pull/7473) [cxxopts] Bumped to v2.2.0 + +- boost-mpi `1.70.0-1` -> `1.70.0-2` + - [(#7142)](https://github.com/microsoft/vcpkg/pull/7142) [OpenMPI] add a new port + +- hdf5 `1.10.5-7` -> `1.10.5-8` + - [(#7142)](https://github.com/microsoft/vcpkg/pull/7142) [OpenMPI] add a new port + +- kealib `1.4.11` -> `1.4.11-1` + - [(#7142)](https://github.com/microsoft/vcpkg/pull/7142) [OpenMPI] add a new port + +- parmetis `4.0.3-2` -> `4.0.3-3` + - [(#7142)](https://github.com/microsoft/vcpkg/pull/7142) [OpenMPI] add a new port + +- vtk `8.2.0-4` -> `8.2.0-5` + - [(#7142)](https://github.com/microsoft/vcpkg/pull/7142) [OpenMPI] add a new port + +</details> + +-- vcpkg team vcpkg@microsoft.com THU, 01 Aug 07:00:00 -0800 + vcpkg (2019.6.30) --- #### Total port count: 1068 @@ -7,8 +629,8 @@ vcpkg (2019.6.30) |**x64-windows**|1006| |x86-windows|977| |x64-windows-static|895| -|**x64-osx**|823| -|**x64-linux**|755| +|**x64-osx**|755| +|**x64-linux**|823| |arm64-windows|654| |x64-uwp|532| |arm-uwp|504| diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 000000000..0e2e96048 --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,46 @@ +vcpkg uses third party material from the projects listed below. +The original copyright notice and the license under which Microsoft +received such third party material are set forth below. Microsoft +reserves all other rights not expressly granted, whether by +implication, estoppel or otherwise. + +In the event that we accidentally failed to list a required notice, please +bring it to our attention by posting an issue. + +THIRD-PARTY SOFTWARE NOTICES AND INFORMATION +Do Not Translate or Localize + +vcpkg incorporates third party material from the projects listed below. +The original copyright notice and the license under which Microsoft received +such third party materials are set forth below. Microsoft reserved all other +rights not expressly granted, whether by implication, estoppel or otherwise. + +1. Catch2 + +%% Catch2 NOTICES, INFORMATION, AND LICENSE BEGIN HERE +========================================= +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +========================================= +END OF Catch2 NOTICES, INFORMATION, AND LICENSE diff --git a/docs/examples/overlay-triplets-linux-dynamic.md b/docs/examples/overlay-triplets-linux-dynamic.md index 6168d85e6..b2868e2fd 100644 --- a/docs/examples/overlay-triplets-linux-dynamic.md +++ b/docs/examples/overlay-triplets-linux-dynamic.md @@ -1,66 +1,41 @@ -# Overlay triplets example: build dynamic libraries on Linux
+# Overlay triplets example
-Using **vcpkg** you can build libraries for the following triplets:
+## Building dynamic libraries on Linux
-<div>
- <ul style="columns: 3;">
- <li> arm-uwp</li>
- <li> arm-windows</li>
- <li> arm64-uwp</li>
- <li> arm64-windows</li>
- <li> x86-uwp</li>
- <li> x86-windows</li>
- <li> x86-windows-static</li>
- <li> x64-uwp</li>
- <li> x64-linux</li>
- <li> x64-osx</li>
- <li> x64-windows</li>
- <li> x64-windows-static</li>
- </ul>
-</div>
+Using **vcpkg** you can build libraries for many configurations out of the box. However, this doesn't currently include shared libraries on Linux and Mac OS.
+This doesn't mean that you cannot use **vcpkg** to build your dynamic libraries on these platforms! This document will guide you through creating your own custom triplets with `--overlay-triplets` to easily build dynamic libraries on Linux.
-
-By design **vcpkg** builds only static libraries for Linux and Mac OS.
-However, this doesn't mean that you cannot use **vcpkg** to build your dynamic libraries on these platforms.
-
-This document will guide you through creating your own custom triplets to build dynamic libraries on Linux using **vcpkg**.
-
-### Step 1: Create a folder to contain your custom triplets
-
-```
-~/vcpkg$ mkdir ../custom-triplets
-```
-
-### Step 2: Create the custom triplet files
+### Step 1: Create the custom triplet files
To save time, copy the existing `x64-linux.cmake` triplet file.
-```
-~/vcpkg$ cp ./triplets/x64-linux.cmake ../custom-triplets/x64-linux-dynamic.cmake
+```sh
+~/git$ mkdir custom-triplets
+~/git$ cp vcpkg/triplets/x64-linux.cmake custom-triplets/x64-linux-dynamic.cmake
```
And modify `custom-triplets/x64-linux-dynamic.cmake` to match the contents below:
-```
+```cmake
+# ~/git/custom-triplets/x64-linux-dynamic.cmake
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
-# Change VCPKG_LIBRARY_LINKAGE from static to dynamic
-set(VCPKG_LIBRARY_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE dynamic) # This changed from static to dynamic
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
```
-### Step 3: Use `--overlay-triplets` to build dynamic libraries
+### Step 2: Use `--overlay-triplets` to build dynamic libraries
Use the `--overlay-triplets` option to include the triplets in the `custom-triplets` directory.
```
-./vcpkg install sqlite3:x64-linux-dynamic --overlay-triplets=../custom-triplets
+~/git$ vcpkg/vcpkg install sqlite3:x64-linux-dynamic --overlay-triplets=custom-triplets
The following packages will be built and installed:
- sqlite3[core]:x64-linux
+ sqlite3[core]:x64-linux-dynamic
Starting package 1/1: sqlite3:x64-linux-dynamic
Building package sqlite3[core]:x64-linux-dynamic...
--- Loading triplet configuration from: /home/custom-triplets/x64-linux-dynamic.cmake
+-- Loading triplet configuration from: /home/victor/git/custom-triplets/x64-linux-dynamic.cmake
-- Downloading https://sqlite.org/2019/sqlite-amalgamation-3280000.zip...
-- Extracting source /home/victor/git/vcpkg/downloads/sqlite-amalgamation-3280000.zip
-- Applying patch fix-arm-uwp.patch
@@ -84,7 +59,7 @@ The package sqlite3:x64-linux-dynamic provides CMake targets: target_link_libraries(main PRIVATE sqlite3)
```
-Overlay triplets will add your custom triplet files when using `vcpkg install`, `vcpkg update`, `vcpkg upgrade`, and `vcpkg remove`.
+Overlay triplets enables your custom triplet files when using `vcpkg install`, `vcpkg update`, `vcpkg upgrade`, and `vcpkg remove`.
When using the `--overlay-triplets` option, a message like the following lets you know that a custom triplet is being used:
@@ -94,40 +69,33 @@ When using the `--overlay-triplets` option, a message like the following lets yo ## Overriding default triplets
-As you may have noticed, the default triplets for Windows (`x86-windows` and `x64-windows`) install dynamic libraries, while a suffix (`-static`) is needed for static libraries. This is inconsistent with Linux and Mac OS where only static libraries are built.
+As you may have noticed, the default triplets for Windows (`x86-windows` and `x64-windows`) install dynamic libraries, while a suffix (`-static`) is needed for static libraries. This is different with Linux and Mac OS where static libraries are built by `x64-linux` and `x64-osx`.
Using `--overlay-ports` it is possible to override the default triplets to accomplish the same behavior on Linux:
* `x64-linux`: Builds dynamic libraries,
* `x64-linux-static`: Builds static libraries.
-### Step 1: Create the overriden triplet
-
-Using the custom triplet created in the previous example, rename `custom-triplets/x64-linux-dynamic.cmake` to `custom-triplets/x64-linux.cmake`.
-
-```
-~/vcpkg$ mv ../custom-triplets/x64-linux-dynamic.cmake ../custom-triplets/x64-linux.cmake
-```
+### Step 1: Create the overlay triplets
-### Step 2: Copy and rename the default triplet
+Using the custom triplet created in the previous example, rename `custom-triplets/x64-linux-dynamic.cmake` to `custom-triplets/x64-linux.cmake`. Then, copy the default `x64-linux` triplet (which builds static libraries) in your `custom-triplets` folder and rename it to `x64-linux-static.cmake`.
-Then, copy the default `x64-linux` triplet (which builds static libraries) in your `/custom-triplets` folder and rename it to `x64-linux-static.cmake`.
-
-```
-~/vcpkg$ cp ./triplets/x64-linux.cmake ../custom-triplets/x64-linux-static.cmake
+```sh
+~/git$ mv custom-triplets/x64-linux-dynamic.cmake custom-triplets/x64-linux.cmake
+~/git$ cp vcpkg/triplets/x64-linux.cmake custom-triplets/x64-linux-static.cmake
```
-### Step 3: Use `--overlay-ports` to override default triplets
+### Step 2: Use `--overlay-ports` to override default triplets
Use the `--overlay-triplets` option to include the triplets in the `custom-triplets` directory.
```
-./vcpkg install sqlite3:x64-linux --overlay-triplets=../custom-triplets
+~/git$ vcpkg/vcpkg install sqlite3:x64-linux --overlay-triplets=custom-triplets
The following packages will be built and installed:
sqlite3[core]:x64-linux
Starting package 1/1: sqlite3:x64-linux
Building package sqlite3[core]:x64-linux...
--- Loading triplet configuration from: /home/custom-triplets/x64-linux.cmake
+-- Loading triplet configuration from: /home/victor/git/custom-triplets/x64-linux.cmake
-- Downloading https://sqlite.org/2019/sqlite-amalgamation-3280000.zip...
-- Extracting source /home/victor/git/vcpkg/downloads/sqlite-amalgamation-3280000.zip
-- Applying patch fix-arm-uwp.patch
@@ -154,5 +122,5 @@ The package sqlite3:x64-linux provides CMake targets: Note that the default triplet is masked by your custom triplet:
```
--- Loading triplet configuration from: /home/custom-triplets/x64-linux.cmake
+-- Loading triplet configuration from: /home/victor/git/custom-triplets/x64-linux.cmake
```
diff --git a/docs/index.md b/docs/index.md index 5d83b5804..b2f0a53b2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -21,6 +21,11 @@ Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This too - [Portfile functions](maintainers/portfile-functions.md) - [Maintainer Guidelines](maintainers/maintainer-guide.md) +### Tool Maintainer Help + +- [Testing](tool-maintainers/testing.md) +- [Maintainer Guidelines](maintainers/maintainer-guide.md) + ### Specifications - [Export](specifications/export-command.md) diff --git a/docs/maintainers/maintainer-guide.md b/docs/maintainers/maintainer-guide.md index 0baa45a02..e4938844f 100644 --- a/docs/maintainers/maintainer-guide.md +++ b/docs/maintainers/maintainer-guide.md @@ -34,7 +34,7 @@ At this time, the following helpers are deprecated: ### Avoid excessive comments in portfiles
-Ideally, portfiles should be short, simple, and as declarative as possible. Remove any helper comments introduced by the `create` command before submitting a PR.
+Ideally, portfiles should be short, simple, and as declarative as possible. Remove any boiler plate comments introduced by the `create` command before submitting a PR.
## Build Techniques
@@ -85,6 +85,15 @@ vcpkg_configure_cmake( Note that `ZLIB` in the above is case-sensitive. See the [cmake documentation](https://cmake.org/cmake/help/v3.15/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html) for more details.
+### Place conflicting libs in a `manual-link` directory
+
+A lib is considered conflicting if it does any of the following:
++ Define `main`
++ Define malloc
++ Define symbols that are also declared in other libraries
+
+Conflicting libs are typically by design and not considered a defect. Because some build systems link against everything in the lib directory, these should be moved into a subdirectory named `manual-link`.
+
## Versioning
### Follow common conventions for the `Version:` field
@@ -157,7 +166,7 @@ While `portfile.cmake`'s and `CMakeLists.txt`'s share a common syntax and core C Portfiles have direct access to variables set in the triplet file, but `CMakeLists.txt`s do not (though there is often a translation that happens -- `VCPKG_LIBRARY_LINKAGE` versus `BUILD_SHARED_LIBS`).
-Finally, portfiles and CMake builds invoked by portfiles are run in different processes. Conceptually:
+Portfiles and CMake builds invoked by portfiles are run in different processes. Conceptually:
```no-highlight
+----------------------------+ +------------------------------------+
diff --git a/docs/maintainers/portfile-functions.md b/docs/maintainers/portfile-functions.md index b98d89192..eadebf49a 100644 --- a/docs/maintainers/portfile-functions.md +++ b/docs/maintainers/portfile-functions.md @@ -24,4 +24,5 @@ - [vcpkg\_from\_gitlab](vcpkg_from_gitlab.md)
- [vcpkg\_install\_cmake](vcpkg_install_cmake.md)
- [vcpkg\_install\_msbuild](vcpkg_install_msbuild.md)
+- [vcpkg\_prettify\_command](vcpkg_prettify_command.md)
- [vcpkg\_test\_cmake](vcpkg_test_cmake.md)
diff --git a/docs/maintainers/vcpkg_check_features.md b/docs/maintainers/vcpkg_check_features.md index 46ee9051a..cec01dde2 100644 --- a/docs/maintainers/vcpkg_check_features.md +++ b/docs/maintainers/vcpkg_check_features.md @@ -1,71 +1,148 @@ # vcpkg_check_features - -Check if one or more features are a part of the package installation. +Check if one or more features are a part of a package installation. ## Usage ```cmake vcpkg_check_features( - <feature1> <output_variable1> - [<feature2> <output_variable2>] - ... + OUT_FEATURE_OPTIONS <FEATURE_OPTIONS> + [FEATURES + <cuda> <WITH_CUDA> + [<opencv> <WITH_OPENCV>] + ...] + [INVERTED_FEATURES + <cuda> <IGNORE_PACKAGE_CUDA> + [<opencv> <IGNORE_PACKAGE_OPENCV>] + ...] ) ``` +`vcpkg_check_features()` accepts these parameters: -`vcpkg_check_features` accepts a list of (feature, output_variable) pairs. If a feature is specified, the corresponding output variable will be set as `ON`, or `OFF` otherwise. The syntax is similar to the `PROPERTIES` argument of `set_target_properties`. +* `OUT_FEATURE_OPTIONS`: + An output variable, the function will clear the variable passed to `OUT_FEATURE_OPTIONS` + and then set it to contain a list of option definitions (`-D<OPTION_NAME>=ON|OFF`). + + This should be set to `FEATURE_OPTIONS` by convention. + +* `FEATURES`: + A list of (`FEATURE_NAME`, `OPTION_NAME`) pairs. + For each `FEATURE_NAME` a definition is added to `OUT_FEATURE_OPTIONS` in the form of: + + * `-D<OPTION_NAME>=ON`, if a feature is specified for installation, + * `-D<OPTION_NAME>=OFF`, otherwise. + +* `INVERTED_FEATURES`: + A list of (`FEATURE_NAME`, `OPTION_NAME`) pairs, uses reversed logic from `FEATURES`. + For each `FEATURE_NAME` a definition is added to `OUT_FEATURE_OPTIONS` in the form of: + + * `-D<OPTION_NAME>=OFF`, if a feature is specified for installation, + * `-D<OPTION_NAME>=ON`, otherwise. -`vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the parent scope, which you can pass as a part of `OPTIONS` argument when calling functions like `vcpkg_config_cmake`: -```cmake -vcpkg_config_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS - -DBUILD_TESTING=ON - ${FEATURE_OPTIONS} -) -``` ## Notes + +The `FEATURES` name parameter can be omitted if no `INVERTED_FEATURES` are used. + +At least one (`FEATURE_NAME`, `OPTION_NAME`) pair must be passed to the function call. + +Arguments passed to `FEATURES` and `INVERTED_FEATURES` are not validated to prevent duplication. +If the same (`FEATURE_NAME`, `OPTION_NAME`) pair is passed to both lists, +two conflicting definitions are added to `OUT_FEATURE_OPTIONS`. + + +## Examples + +### Example 1: Regular features + ```cmake -vcpkg_check_features(<feature> <output_variable>) -``` -can be used as a replacement of: -```cmake -if(<feature> IN_LIST FEATURES) - set(<output_variable> ON) -else() - set(<output_variable> OFF) -endif() +$ ./vcpkg install mimalloc[asm,secure] + +# ports/mimalloc/portfile.cmake +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + # Keyword FEATURES is optional if INVERTED_FEATURES are not used + asm MI_SEE_ASM + override MI_OVERRIDE + secure MI_SECURE +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + # Expands to "-DMI_SEE_ASM=ON; -DMI_OVERRIDE=OFF; -DMI_SECURE=ON" + ${FEATURE_OPTIONS} +) ``` -However, if you have a feature that was checked like this before: +### Example 2: Inverted features + ```cmake -if(<feature> IN_LIST FEATURES) - set(<output_variable> OFF) -else() - set(<output_variable> ON) -endif() +$ ./vcpkg install cpprestsdk[websockets] + +# ports/cpprestsdk/portfile.cmake +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + INVERTED_FEATURES # <- Keyword INVERTED_FEATURES required + brotli CPPREST_EXCLUDE_BROTLI + websockets CPPREST_EXCLUDE_WEBSOCKETS +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + # Expands to "-DCPPREST_EXCLUDE_BROTLI=ON; -DCPPREST_EXCLUDE_WEBSOCKETS=OFF" + ${FEATURE_OPTIONS} +) ``` -then you should not use `vcpkg_check_features` instead. [```oniguruma```](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake), for example, has a feature named `non-posix` which is checked with: + +### Example 3: Set multiple options for same feature + ```cmake -if("non-posix" IN_LIST FEATURES) - set(ENABLE_POSIX_API OFF) -else() - set(ENABLE_POSIX_API ON) -endif() -``` -and by replacing these code with: +$ ./vcpkg install pcl[cuda] + +# ports/pcl/portfile.cmake +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + cuda WITH_CUDA + cuda BUILD_CUDA + cuda BUILD_GPU +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + # Expands to "-DWITH_CUDA=ON; -DBUILD_CUDA=ON; -DBUILD_GPU=ON" + ${FEATURE_OPTIONS} +) +``` + +### Example 4: Use regular and inverted features + ```cmake -vcpkg_check_features(non-posix ENABLE_POSIX_API) -``` -is totally wrong. +$ ./vcpkg install rocksdb[tbb] -`vcpkg_check_features` is supposed to be called only once. Otherwise, the `FEATURE_OPTIONS` variable set by a previous call will be overwritten. +# ports/rocksdb/portfile.cmake +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES # <- Keyword FEATURES is required because INVERTED_FEATURES are being used + tbb WITH_TBB + INVERTED_FEATURES + tbb ROCKSDB_IGNORE_PACKAGE_TBB +) -## Examples +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + # Expands to "-DWITH_TBB=ON; -DROCKSDB_IGNORE_PACKAGE_TBB=OFF" + ${FEATURE_OPTIONS} +) +``` + +## Examples in portfiles + +* [cpprestsdk](https://github.com/microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) +* [pcl](https://github.com/microsoft/vcpkg/blob/master/ports/pcl/portfile.cmake) +* [rocksdb](https://github.com/microsoft/vcpkg/blob/master/ports/rocksdb/portfile.cmake) -* [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake) -* [xsimd](https://github.com/microsoft/vcpkg/blob/master/ports/xsimd/portfile.cmake) -* [xtensor](https://github.com/microsoft/vcpkg/blob/master/ports/xtensor/portfile.cmake) ## Source [scripts/cmake/vcpkg_check_features.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_check_features.cmake)
diff --git a/docs/maintainers/vcpkg_configure_cmake.md b/docs/maintainers/vcpkg_configure_cmake.md index b78ef54d9..ebbd92ed1 100644 --- a/docs/maintainers/vcpkg_configure_cmake.md +++ b/docs/maintainers/vcpkg_configure_cmake.md @@ -18,14 +18,15 @@ vcpkg_configure_cmake( ## Parameters ### SOURCE_PATH -Specifies the directory containing the `CMakeLists.txt`. By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. +Specifies the directory containing the `CMakeLists.txt`. +By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. ### PREFER_NINJA -Indicates that, when available, Vcpkg should use Ninja to perform the build. This should be specified unless the port is known to not work under Ninja. +Indicates that, when available, Vcpkg should use Ninja to perform the build. +This should be specified unless the port is known to not work under Ninja. ### DISABLE_PARALLEL_CONFIGURE Disables running the CMake configure step in parallel. - This is needed for libraries which write back into their source directory during configure. ### NO_CHARSET_FLAG @@ -36,7 +37,8 @@ This is needed for libraries that set their own source code's character set. ### GENERATOR Specifies the precise generator to use. -This is useful if some project-specific buildsystem has been wrapped in a cmake script that won't perform an actual build. If used for this purpose, it should be set to "NMake Makefiles". +This is useful if some project-specific buildsystem has been wrapped in a cmake script that won't perform an actual build. +If used for this purpose, it should be set to "NMake Makefiles". ### OPTIONS Additional options passed to CMake during the configuration. diff --git a/docs/maintainers/vcpkg_prettify_command.md b/docs/maintainers/vcpkg_prettify_command.md new file mode 100644 index 000000000..1856e06b4 --- /dev/null +++ b/docs/maintainers/vcpkg_prettify_command.md @@ -0,0 +1,17 @@ +# vcpkg_prettify_command + +Turns list of command arguments into a formatted string. + +## Usage +```cmake +vcpkg_prettify_command() +``` + +## Examples + +* `scripts/cmake/vcpkg_execute_build_process.cmake` +* `scripts/cmake/vcpkg_execute_required_process.cmake` +* `scripts/cmake/vcpkg_execute_required_process_repeat.cmake` + +## Source +[scripts/cmake/vcpkg_prettify_command.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_prettify_command.cmake)
diff --git a/docs/tool-maintainers/testing.md b/docs/tool-maintainers/testing.md new file mode 100644 index 000000000..28cc9e099 --- /dev/null +++ b/docs/tool-maintainers/testing.md @@ -0,0 +1,162 @@ +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`, and then rerunning +`CMake` in order to pick up the glob changes. + +### 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 <vcpkg-test/catch.h> +``` + +This is the minimum file needed for tests; let's rebuild our CMake directory. +You'll have to clean out the existing `out` directory for CMake to rerun +globbing. + +```sh +$ cmake .. -DCMAKE_BUILD_TYPE=Debug -G Ninja +# ... +-- Build files have been written to: $VCPKG_DIRECTORY/toolsrc/out +$ 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 diff --git a/ports/ace/CONTROL b/ports/ace/CONTROL index 4153cdc48..64ef84425 100644 --- a/ports/ace/CONTROL +++ b/ports/ace/CONTROL @@ -1,5 +1,5 @@ Source: ace -Version: 6.5.5-1 +Version: 6.5.6 Homepage: https://www.dre.vanderbilt.edu/~schmidt/ACE.html Description: The ADAPTIVE Communication Environment diff --git a/ports/ace/portfile.cmake b/ports/ace/portfile.cmake index 264829dfb..81c9534d0 100644 --- a/ports/ace/portfile.cmake +++ b/ports/ace/portfile.cmake @@ -28,9 +28,9 @@ set(ACE_ROOT ${CURRENT_BUILDTREES_DIR}/src/ACE_wrappers) set(ENV{ACE_ROOT} ${ACE_ROOT}) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ACE_wrappers/ace) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_5/ACE-src-6.5.5.zip" - FILENAME ACE-src-6.5.5.zip - SHA512 65696e6f2776fd9c015adb78a92f1c87edacde62ff11f20f88c416d4420a6fc6e5176412c5f93262d06e67b89717499f8108f68582f70fea6ce05466c53415e9 + URLS "https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_6/ACE-src-6.5.6.zip" + FILENAME ACE-src-6.5.6.zip + SHA512 4ee42aafc86af159ab20dbb14c7c2a49bed733645f5cc3afa8cef3e9688ff929002f3420eb33e859afe10a534afc276340faa21d029fa56bd07bd9aed3403ab4 ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/ade/CONTROL b/ports/ade/CONTROL index ccce7f1db..fd8286ecd 100644 --- a/ports/ade/CONTROL +++ b/ports/ade/CONTROL @@ -1,3 +1,3 @@ Source: ade
-Version: 0.1.1d
+Version: 0.1.1f
Description: ADE Framework is a graph construction, manipulation, and processing framework. ADE Framework is suitable for organizing data flow processing and execution.
\ No newline at end of file diff --git a/ports/ade/portfile.cmake b/ports/ade/portfile.cmake index 95d001828..83d8503b8 100644 --- a/ports/ade/portfile.cmake +++ b/ports/ade/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO opencv/ade
- REF v0.1.1d
- SHA512 c493cb57e59ba859ca0cbf5d48bae4233f22104dfb4a96864d07e9422bb700c27af2d53a602f2230d68b7bcc598920d0652c3d9fdf8fad94a7e5b4d21664a44e
+ REF v0.1.1f
+ SHA512 fbdec8f3d5811a573abb81f1ceb6fb8d40274439013f749645db5430c6d9cdc52227c25203f1a68177b263d648bb65197ea7c2bea7871264a06585e59892631c
HEAD_REF master
)
diff --git a/ports/alembic/CONTROL b/ports/alembic/CONTROL index a1a47a3ff..9c886b755 100644 --- a/ports/alembic/CONTROL +++ b/ports/alembic/CONTROL @@ -1,5 +1,5 @@ Source: alembic -Version: 1.7.11-2 +Version: 1.7.11-4 Build-Depends: ilmbase, hdf5 Description: Alembic is an open framework for storing and sharing scene data that includes a C++ library, a file format, and client plugins and applications. Homepage: https://alembic.io/ diff --git a/ports/alembic/bypass-findhdf5.patch b/ports/alembic/bypass-findhdf5.patch deleted file mode 100644 index 91cb37fab..000000000 --- a/ports/alembic/bypass-findhdf5.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ce0a8e0..229fc77 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -226,7 +226,24 @@ INCLUDE_DIRECTORIES(${ALEMBIC_ILMBASE_INCLUDE_DIRECTORY}) - IF (USE_HDF5) - FIND_PACKAGE(ZLIB REQUIRED) - SET(ALEMBIC_WITH_HDF5 "1") -- INCLUDE("./cmake/AlembicHDF5.cmake") -+ #INCLUDE("./cmake/AlembicHDF5.cmake") -+ FIND_LIBRARY(HDF5_LIBRARIES_RELEASE -+ NAMES hdf5 -+ PATHS ${HDF5_ROOT}/lib -+ ) -+ MESSAGE(STATUS ${HDF5_LIBRARIES_RELEASE}) -+ FIND_LIBRARY(HDF5_LIBRARIES_DEBUG -+ NAMES hdf5_D -+ PATHS ${HDF5_ROOT}/debug/lib -+ ) -+ MESSAGE(STATUS ${HDF5_LIBRARIES_DEBUG}) -+ SET(HDF5_LIBRARIES -+ optimized ${HDF5_LIBRARIES_RELEASE} -+ debug ${HDF5_LIBRARIES_DEBUG} -+ ) -+ SET(HDF5_INCLUDE_DIRS -+ ${HDF5_ROOT}/include -+ ) - INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DH5_USE_18_API") - ENDIF() diff --git a/ports/alembic/fix-hdf5link.patch b/ports/alembic/fix-hdf5link.patch deleted file mode 100644 index b9729f1ca..000000000 --- a/ports/alembic/fix-hdf5link.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/lib/Alembic/CMakeLists.txt b/lib/Alembic/CMakeLists.txt -index 5028c91..1f81d50 100644 ---- a/lib/Alembic/CMakeLists.txt -+++ b/lib/Alembic/CMakeLists.txt -@@ -49,6 +49,12 @@ ADD_SUBDIRECTORY(AbcMaterial) - ADD_SUBDIRECTORY(Ogawa) - - ADD_LIBRARY(Alembic ${LIB_TYPE} ${CXX_FILES}) -+IF (USE_HDF5) -+ TARGET_LINK_LIBRARIES(Alembic -+ ${HDF5_LIBRARIES} -+ ) -+ ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB) -+ENDIF() - - TARGET_INCLUDE_DIRECTORIES(Alembic - PUBLIC diff --git a/ports/alembic/portfile.cmake b/ports/alembic/portfile.cmake index 8b3e8568d..2d000871f 100644 --- a/ports/alembic/portfile.cmake +++ b/ports/alembic/portfile.cmake @@ -16,16 +16,14 @@ vcpkg_from_github( SHA512 94b9c218a2fe6e2e24205aff4a2f6bab784851c2aa15592fb60ea91f0e8038b0c0656a118f3a5cba0d3de8917dd90b74d0e2d1c4ac034b9ee3f5d0741d9f6b70 HEAD_REF master PATCHES - fix-hdf5link.patch - bypass-findhdf5.patch fix-C1083.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DUSE_HDF5=ON - -DHDF5_ROOT=${CURRENT_INSTALLED_DIR} ) vcpkg_install_cmake() diff --git a/ports/ampl-mp/CONTROL b/ports/ampl-mp/CONTROL index 84523e281..d45564c4f 100644 --- a/ports/ampl-mp/CONTROL +++ b/ports/ampl-mp/CONTROL @@ -1,3 +1,3 @@ Source: ampl-mp -Version: 2019-03-21 +Version: 2019-03-21-1 Description: An open-source library for mathematical programming diff --git a/ports/ampl-mp/portfile.cmake b/ports/ampl-mp/portfile.cmake index dafdb10fd..00d577e56 100644 --- a/ports/ampl-mp/portfile.cmake +++ b/ports/ampl-mp/portfile.cmake @@ -20,6 +20,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DBUILD=asl -DBUILD_TESTING=OFF diff --git a/ports/amqpcpp/CONTROL b/ports/amqpcpp/CONTROL index d0642edb4..4e8799805 100644 --- a/ports/amqpcpp/CONTROL +++ b/ports/amqpcpp/CONTROL @@ -1,4 +1,4 @@ Source: amqpcpp -Version: 4.1.4 +Version: 4.1.5 Description: AMQP-CPP is a C++ library for communicating with a RabbitMQ message broker Build-Depends: openssl (linux) diff --git a/ports/amqpcpp/portfile.cmake b/ports/amqpcpp/portfile.cmake index 697b8f802..7f4847903 100644 --- a/ports/amqpcpp/portfile.cmake +++ b/ports/amqpcpp/portfile.cmake @@ -5,8 +5,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO CopernicaMarketingSoftware/AMQP-CPP - REF v4.1.4 - SHA512 d589756ad8e27ce6b6772128479083293c4dbb8c7aa79b7b08f0036ced9ab76ecb75e55458f04de8e2745c9732a6322f4e910f3f8611633c5cd5c35fb7dcaed1 + REF v4.1.5 + SHA512 71c54ddf43230fb3e9726257b073d117a329030052f768f985c2e9ebde5a320f0042d2ef67604b87940bfa1ed61339c334af0362238d10f30845521dff8ce43c HEAD_REF master PATCHES find-openssl.patch diff --git a/ports/anax/CONTROL b/ports/anax/CONTROL index 14b10c9af..a672637cf 100644 --- a/ports/anax/CONTROL +++ b/ports/anax/CONTROL @@ -1,4 +1,4 @@ Source: anax
-Version: 2.1.0-5
+Version: 2.1.0-6
Description: An open source C++ entity system.
Homepage: https://github.com/miguelmartin75/anax
diff --git a/ports/anax/portfile.cmake b/ports/anax/portfile.cmake index 346e45edb..bdecbf39e 100644 --- a/ports/anax/portfile.cmake +++ b/ports/anax/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA DISABLE_PARALLEL_CONFIGURE ) diff --git a/ports/apr/CONTROL b/ports/apr/CONTROL index 7a35c5b48..41c7c453a 100644 --- a/ports/apr/CONTROL +++ b/ports/apr/CONTROL @@ -1,5 +1,5 @@ Source: apr -Version: 1.6.5-1 +Version: 1.6.5-2 Homepage: https://apr.apache.org/ Description: The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems. diff --git a/ports/apr/portfile.cmake b/ports/apr/portfile.cmake index 1e9de7ffb..6ef062bf3 100644 --- a/ports/apr/portfile.cmake +++ b/ports/apr/portfile.cmake @@ -22,6 +22,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DINSTALL_PDB=OFF -DMIN_WINDOWS_VER=Windows7 diff --git a/ports/argh/CONTROL b/ports/argh/CONTROL index 36c062da4..db804708f 100644 --- a/ports/argh/CONTROL +++ b/ports/argh/CONTROL @@ -1,3 +1,3 @@ Source: argh
-Version: 2018-12-18
+Version: 2018-12-18-1
Description: Argh! A minimalist argument handler.
diff --git a/ports/argh/portfile.cmake b/ports/argh/portfile.cmake index 5e8b8bccd..40e7fbc84 100644 --- a/ports/argh/portfile.cmake +++ b/ports/argh/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_from_github( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
+ DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_TESTS=OFF
-DBUILD_EXAMPLES=OFF
diff --git a/ports/armadillo/CONTROL b/ports/armadillo/CONTROL index 78f0a66c3..ef0c926a5 100644 --- a/ports/armadillo/CONTROL +++ b/ports/armadillo/CONTROL @@ -1,4 +1,4 @@ Source: armadillo -Version: 2019-04-16-3 +Version: 2019-04-16-4 Description: Armadillo is a high quality linear algebra library (matrix maths) for the C++ language, aiming towards a good balance between speed and ease of use Build-Depends: openblas (!osx), clapack (!osx) diff --git a/ports/armadillo/fix-CMakePath.patch b/ports/armadillo/fix-CMakePath.patch new file mode 100644 index 000000000..58cca5c64 --- /dev/null +++ b/ports/armadillo/fix-CMakePath.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9fea721..e6a273d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -473,7 +473,7 @@ install(EXPORT ArmadilloLibraryDepends DESTINATION + # and install it + set(ARMADILLO_INCLUDE_DIRS "${CMAKE_INSTALL_FULL_INCLUDEDIR}") + set(ARMADILLO_LIB_DIR "${CMAKE_INSTALL_FULL_LIBDIR}") +-set(ARMADILLO_CMAKE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/Armadillo/CMake") ++set(ARMADILLO_CMAKE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/Armadillo") + + + message(STATUS "Generating '${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake'") diff --git a/ports/armadillo/portfile.cmake b/ports/armadillo/portfile.cmake index 143591de6..4e5798f9b 100644 --- a/ports/armadillo/portfile.cmake +++ b/ports/armadillo/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_from_gitlab( HEAD_REF 9.400.x PATCHES remove_custom_modules.patch + fix-CMakePath.patch ) file(REMOVE ${SOURCE_PATH}/cmake_aux/Modules/ARMA_FindBLAS.cmake) @@ -31,6 +32,13 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/Armadillo) +file(GLOB SHARE_CONTENT ${CURRENT_PACKAGES_DIR}/share/Armadillo) +list(LENGTH SHARE_CONTENT SHARE_LEN) +if(SHARE_LEN EQUAL 0) + # On case sensitive file system there is an extra empty directory created that should be removed + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/Armadillo) +endif() + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/armadillo) file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/armadillo RENAME copyright) diff --git a/ports/armadillo/usage b/ports/armadillo/usage new file mode 100644 index 000000000..58066f6a9 --- /dev/null +++ b/ports/armadillo/usage @@ -0,0 +1,4 @@ +The package armadillo provides CMake targets:
+
+ find_package(Armadillo CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE ${ARMADILLO_LIBRARIES})
diff --git a/ports/arrow/CONTROL b/ports/arrow/CONTROL index ada95e2d0..ea787e24a 100644 --- a/ports/arrow/CONTROL +++ b/ports/arrow/CONTROL @@ -1,5 +1,5 @@ Source: arrow -Version: 0.13.0-4 +Version: 0.14.1 Build-Depends: boost-system, boost-filesystem, boost-multiprecision, boost-algorithm, flatbuffers, rapidjson, zlib, lz4, brotli, zstd, snappy, gflags, thrift, double-conversion, glog, uriparser Homepage: https://github.com/apache/arrow Description: Apache Arrow is a columnar in-memory analytics layer designed to accelerate big data. It houses a set of canonical in-memory representations of flat and hierarchical data along with multiple language-bindings for structure manipulation. It also provides IPC and common algorithm implementations. diff --git a/ports/arrow/all.patch b/ports/arrow/all.patch index 3257dc437..0675356ff 100644 --- a/ports/arrow/all.patch +++ b/ports/arrow/all.patch @@ -1,120 +1,21 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index 52081c4..e1e13b5 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -804,6 +804,9 @@ if(ARROW_USE_GLOG) - list(APPEND ARROW_LINK_LIBS GLOG::glog) - list(APPEND ARROW_STATIC_LINK_LIBS GLOG::glog) - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS GLOG::glog) -+ if(ARROW_NEED_GFLAGS) -+ list(APPEND ARROW_STATIC_LINK_LIBS gflags::gflags) -+ endif() - add_definitions("-DARROW_USE_GLOG") - endif() - -diff --git a/cpp/cmake_modules/FindBrotli.cmake b/cpp/cmake_modules/FindBrotli.cmake -index e1429a2..6dee036 100644 ---- a/cpp/cmake_modules/FindBrotli.cmake -+++ b/cpp/cmake_modules/FindBrotli.cmake -@@ -18,6 +18,7 @@ - # find_package(Brotli) - - pkg_check_modules(BROTLI_PC libbrotlicommon libbrotlienc libbrotlidec) -+ - if(BROTLI_PC_FOUND) - set(BROTLI_INCLUDE_DIR "${BROTLI_PC_libbrotlicommon_INCLUDEDIR}") - -@@ -25,80 +26,16 @@ if(BROTLI_PC_FOUND) - list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlicommon_LIBDIR}") - list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlienc_LIBDIR}") - list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlidec_LIBDIR}") -- -- find_library(BROTLI_COMMON_LIBRARY brotlicommon -- PATHS ${BROTLI_PC_LIBRARY_DIRS} -- NO_DEFAULT_PATH) -- find_library(BROTLI_ENC_LIBRARY brotlienc -- PATHS ${BROTLI_PC_LIBRARY_DIRS} -- NO_DEFAULT_PATH) -- find_library(BROTLI_DEC_LIBRARY brotlidec -- PATHS ${BROTLI_PC_LIBRARY_DIRS} -- NO_DEFAULT_PATH) - elseif(BROTLI_ROOT) -- find_library( -- BROTLI_COMMON_LIBRARY -- NAMES brotlicommon -- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlicommon${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon-static${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon_static${CMAKE_STATIC_LIBRARY_SUFFIX} -- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" -- PATH_SUFFIXES "lib64" "lib" "bin" -- NO_DEFAULT_PATH) -- find_library( -- BROTLI_ENC_LIBRARY -- NAMES brotlienc -- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlienc${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc-static${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc_static${CMAKE_STATIC_LIBRARY_SUFFIX} -- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" -- PATH_SUFFIXES "lib64" "lib" "bin" -- NO_DEFAULT_PATH) -- find_library( -- BROTLI_DEC_LIBRARY -- NAMES brotlidec -- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlidec${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec-static${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec_static${CMAKE_STATIC_LIBRARY_SUFFIX} -- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" -- PATH_SUFFIXES "lib64" "lib" "bin" -- NO_DEFAULT_PATH) -- find_path(BROTLI_INCLUDE_DIR -- NAMES brotli/decode.h -- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" -- NO_DEFAULT_PATH -- PATH_SUFFIXES "include") -+ find_path(BROTLI_INCLUDE_DIR NAMES brotli/decode.h PATH_SUFFIXES "include") - else() -- find_library( -- BROTLI_COMMON_LIBRARY -- NAMES brotlicommon -- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlicommon${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon-static${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon_static${CMAKE_STATIC_LIBRARY_SUFFIX} -- PATH_SUFFIXES "lib64" "lib" "bin") -- find_library( -- BROTLI_ENC_LIBRARY -- NAMES brotlienc -- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlienc${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc-static${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc_static${CMAKE_STATIC_LIBRARY_SUFFIX} -- PATH_SUFFIXES "lib64" "lib" "bin") -- find_library( -- BROTLI_DEC_LIBRARY -- NAMES brotlidec -- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlidec${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec-static${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec_static${CMAKE_STATIC_LIBRARY_SUFFIX} -- PATH_SUFFIXES "lib64" "lib" "bin") - find_path(BROTLI_INCLUDE_DIR NAMES brotli/decode.h PATH_SUFFIXES "include") - endif() +diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake +index 4ef2948..9c3c121 100644 +--- a/cpp/cmake_modules/BuildUtils.cmake ++++ b/cpp/cmake_modules/BuildUtils.cmake +@@ -305,7 +305,7 @@ function(ADD_ARROW_LIB LIB_NAME) + target_include_directories(${LIB_NAME}_static PRIVATE ${ARG_PRIVATE_INCLUDES}) + endif() -+find_library(BROTLI_COMMON_LIBRARY NAMES brotlicommon brotlicommon-static libbrotlicommon libbrotlicommon-static) -+find_library(BROTLI_ENC_LIBRARY NAMES libbrotlienc libbrotlienc-static brotlienc brotlienc-static) -+find_library(BROTLI_DEC_LIBRARY NAMES brotlidec libbrotlidec libbrotlidec-static brotlidec brotlidec-static) -+ - find_package_handle_standard_args(Brotli - REQUIRED_VARS - BROTLI_COMMON_LIBRARY +- if(MSVC) ++ if(MSVC AND 0) + set(LIB_NAME_STATIC ${LIB_NAME}_static) + else() + set(LIB_NAME_STATIC ${LIB_NAME}) diff --git a/cpp/cmake_modules/FindLz4.cmake b/cpp/cmake_modules/FindLz4.cmake -index 3606f5c..1d18b7c 100644 +index 8410916..a196b25 100644 --- a/cpp/cmake_modules/FindLz4.cmake +++ b/cpp/cmake_modules/FindLz4.cmake -@@ -19,24 +19,26 @@ if(MSVC AND NOT DEFINED LZ4_MSVC_STATIC_LIB_SUFFIX) +@@ -19,14 +19,16 @@ if(MSVC AND NOT DEFINED LZ4_MSVC_STATIC_LIB_SUFFIX) set(LZ4_MSVC_STATIC_LIB_SUFFIX "_static") endif() @@ -126,42 +27,36 @@ index 3606f5c..1d18b7c 100644 -set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_STATIC_LIB_SUFFIX}) +set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_MSVC_STATIC_LIB_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) - pkg_check_modules(LZ4_PC liblz4) - if(LZ4_PC_FOUND) - set(LZ4_INCLUDE_DIR "${LZ4_PC_INCLUDEDIR}") - - list(APPEND LZ4_PC_LIBRARY_DIRS "${LZ4_PC_LIBDIR}") -- find_library(LZ4_LIB lz4 -+ find_library(LZ4_LIB lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} - PATHS ${LZ4_PC_LIBRARY_DIRS} - NO_DEFAULT_PATH - PATH_SUFFIXES "${CMAKE_LIBRARY_ARCHITECTURE}") - elseif(LZ4_ROOT) + if(LZ4_ROOT) find_library( LZ4_LIB - NAMES lz4 ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} -- "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" + NAMES lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} -+ "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}" - PATHS ${LZ4_ROOT} "${LZ4_ROOT}/Library" - PATH_SUFFIXES "lib64" "lib" "bin" - NO_DEFAULT_PATH) -@@ -48,8 +50,8 @@ elseif(LZ4_ROOT) - else() - find_library( - LZ4_LIB -- NAMES lz4 ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} -- "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" -+ NAMES lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} -+ "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}" - PATH_SUFFIXES "lib64" "lib" "bin") - find_path(LZ4_INCLUDE_DIR NAMES lz4.h PATH_SUFFIXES "include") - endif() + "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" + PATHS ${LZ4_ROOT} + PATH_SUFFIXES ${LIB_PATH_SUFFIXES} +@@ -43,14 +45,14 @@ else() + set(LZ4_INCLUDE_DIR "${LZ4_PC_INCLUDEDIR}") + + list(APPEND LZ4_PC_LIBRARY_DIRS "${LZ4_PC_LIBDIR}") +- find_library(LZ4_LIB lz4 ++ find_library(LZ4_LIB lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} + PATHS ${LZ4_PC_LIBRARY_DIRS} + NO_DEFAULT_PATH + PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) + else() + find_library( + LZ4_LIB +- NAMES lz4 ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} ++ NAMES lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} + "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" + PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) + find_path(LZ4_INCLUDE_DIR NAMES lz4.h PATH_SUFFIXES ${INCLUDE_PATH_SUFFIXES}) diff --git a/cpp/cmake_modules/FindThrift.cmake b/cpp/cmake_modules/FindThrift.cmake -index a4decf7..78ec7c8 100644 +index 87cc24e..4de0760 100644 --- a/cpp/cmake_modules/FindThrift.cmake +++ b/cpp/cmake_modules/FindThrift.cmake -@@ -65,6 +65,10 @@ if(MSVC AND NOT THRIFT_MSVC_STATIC_LIB_SUFFIX) +@@ -54,6 +54,10 @@ if(MSVC AND NOT THRIFT_MSVC_STATIC_LIB_SUFFIX) set(THRIFT_MSVC_STATIC_LIB_SUFFIX md) endif() @@ -169,33 +64,33 @@ index a4decf7..78ec7c8 100644 + set(THRIFT_LIB_NAME_DEBUG_SUFFIX d) +endif() + - pkg_check_modules(THRIFT_PC thrift) - - # THRIFT-4760: The pkgconfig files are currently only installed when using autotools. -@@ -74,15 +78,13 @@ if(THRIFT_PC_FOUND) - - list(APPEND THRIFT_PC_LIBRARY_DIRS "${THRIFT_PC_LIBDIR}") - -- find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} -- PATHS ${THRIFT_PC_LIBRARY_DIRS} -- NO_DEFAULT_PATH) -+ find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} -+ PATHS ${THRIFT_PC_LIBRARY_DIRS}) - find_program(THRIFT_COMPILER thrift - HINTS ${THRIFT_PC_PREFIX} -- NO_DEFAULT_PATH - PATH_SUFFIXES "bin") - else() -- find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} -+ find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} - HINTS ${Thrift_ROOT} - PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") - find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h + if(Thrift_ROOT) + find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} + PATHS ${Thrift_ROOT} +@@ -71,15 +75,13 @@ else() + + list(APPEND THRIFT_PC_LIBRARY_DIRS "${THRIFT_PC_LIBDIR}") + +- find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} +- PATHS ${THRIFT_PC_LIBRARY_DIRS} +- NO_DEFAULT_PATH) ++ find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} ++ PATHS ${THRIFT_PC_LIBRARY_DIRS}) + find_program(THRIFT_COMPILER thrift + HINTS ${THRIFT_PC_PREFIX} +- NO_DEFAULT_PATH + PATH_SUFFIXES "bin") + else() +- find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} ++ find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} + PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") + find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h PATH_SUFFIXES "include") + find_program(THRIFT_COMPILER thrift PATH_SUFFIXES "bin") diff --git a/cpp/cmake_modules/FindZSTD.cmake b/cpp/cmake_modules/FindZSTD.cmake -index 17b58a3..fa2ab05 100644 +index 8e47086..d7ce559 100644 --- a/cpp/cmake_modules/FindZSTD.cmake +++ b/cpp/cmake_modules/FindZSTD.cmake -@@ -19,7 +19,11 @@ if(MSVC AND NOT DEFINED ZSTD_MSVC_STATIC_LIB_SUFFIX) +@@ -19,14 +19,18 @@ if(MSVC AND NOT DEFINED ZSTD_MSVC_STATIC_LIB_SUFFIX) set(ZSTD_MSVC_STATIC_LIB_SUFFIX "_static") endif() @@ -207,91 +102,29 @@ index 17b58a3..fa2ab05 100644 +set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") set(ZSTD_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}zstd${ZSTD_STATIC_LIB_SUFFIX}) - pkg_check_modules(ZSTD_PC libzstd) -@@ -27,18 +31,15 @@ if(ZSTD_PC_FOUND) - set(ZSTD_INCLUDE_DIR "${ZSTD_PC_INCLUDEDIR}") - - list(APPEND ZSTD_PC_LIBRARY_DIRS "${ZSTD_PC_LIBDIR}") -- find_library(ZSTD_LIB zstd -+ find_library(ZSTD_LIB zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} - PATHS ${ZSTD_PC_LIBRARY_DIRS} - NO_DEFAULT_PATH - PATH_SUFFIXES "${CMAKE_LIBRARY_ARCHITECTURE}") - elseif(ZSTD_ROOT) + # First, find via if specified ZTD_ROOT + if(ZSTD_ROOT) message(STATUS "Using ZSTD_ROOT: ${ZSTD_ROOT}") find_library(ZSTD_LIB - NAMES zstd "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" -- "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" -- PATHS ${ZSTD_ROOT} "${ZSTD_ROOT}/Library" -- PATH_SUFFIXES "lib64" "lib" "bin" -- NO_DEFAULT_PATH) -+ NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" -+ "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") - find_path(ZSTD_INCLUDE_DIR - NAMES zstd.h - PATHS ${ZSTD_ROOT} "${ZSTD_ROOT}/Library" -@@ -46,9 +47,8 @@ elseif(ZSTD_ROOT) - PATH_SUFFIXES "include") - else() - find_library(ZSTD_LIB -- NAMES zstd "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" -- "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" -- PATH_SUFFIXES "lib64" "lib" "bin") + NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" -+ "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") - find_path(ZSTD_INCLUDE_DIR NAMES zstd.h PATH_SUFFIXES "include") - endif() - -diff --git a/cpp/cmake_modules/FindgflagsAlt.cmake b/cpp/cmake_modules/FindgflagsAlt.cmake -index a9b8684..fdb815a 100644 ---- a/cpp/cmake_modules/FindgflagsAlt.cmake -+++ b/cpp/cmake_modules/FindgflagsAlt.cmake -@@ -15,18 +15,13 @@ - # specific language governing permissions and limitations - # under the License. - --if(gflags_ROOT) -- find_library(gflags_LIB NAMES gflags PATHS ${gflags_ROOT} NO_DEFAULT_PATH) -- find_path(GFLAGS_INCLUDE_DIR -- NAMES gflags/gflags.h -- PATHS ${gflags_ROOT} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "include") --else() -- find_library(gflags_LIB NAMES gflags) -- find_path(GFLAGS_INCLUDE_DIR NAMES gflags/gflags.h PATH_SUFFIXES "include") -+if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(GFLAGS_LIB_NAME_DEBUG_SUFFIX _debug) - endif() - -+find_library(gflags_LIB NAMES gflags${GFLAGS_LIB_NAME_DEBUG_SUFFIX} gflags_static${GFLAGS_LIB_NAME_DEBUG_SUFFIX}) -+find_path(GFLAGS_INCLUDE_DIR NAMES gflags/gflags.h PATH_SUFFIXES "include") -+ - find_package_handle_standard_args(gflagsAlt REQUIRED_VARS gflags_LIB GFLAGS_INCLUDE_DIR) - - if(gflagsAlt_FOUND) -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index bdb122b..58c123e 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -923,10 +923,7 @@ if(ARROW_NEED_GFLAGS) - elseif(gflags_SOURCE STREQUAL "SYSTEM") - # gflagsConfig.cmake is not installed on Ubuntu/Debian - # TODO: Make a bug report upstream -- find_package(gflags) -- if(NOT gflags_FOUND) -- find_package(gflagsAlt REQUIRED) -- endif() -+ find_package(gflagsAlt REQUIRED) - endif() - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) -@@ -1558,7 +1555,7 @@ if(ARROW_WITH_FLATBUFFERS) - elseif(Flatbuffers_SOURCE STREQUAL "BUNDLED") - build_flatbuffers() - elseif(Flatbuffers_SOURCE STREQUAL "SYSTEM") -- find_package(Flatbuffers QUIET) -+ #find_package(Flatbuffers QUIET) - disabled because on vcpkg this looks in the wrong place for the fb compiler and causes an error - if(NOT Flatbuffers_FOUND) - find_package(FlatbuffersAlt REQUIRED) - endif() + "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" + PATHS ${ZSTD_ROOT} + PATH_SUFFIXES ${LIB_PATH_SUFFIXES} +@@ -44,14 +48,14 @@ else() + set(ZSTD_INCLUDE_DIR "${ZSTD_PC_INCLUDEDIR}") + + list(APPEND ZSTD_PC_LIBRARY_DIRS "${ZSTD_PC_LIBDIR}") +- find_library(ZSTD_LIB zstd ++ find_library(ZSTD_LIB zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} + PATHS ${ZSTD_PC_LIBRARY_DIRS} + NO_DEFAULT_PATH + PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) + # Third, check all other CMake paths + else() + find_library(ZSTD_LIB +- NAMES zstd "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" ++ NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" + "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" + PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) + find_path(ZSTD_INCLUDE_DIR NAMES zstd.h PATH_SUFFIXES ${INCLUDE_PATH_SUFFIXES}) diff --git a/ports/arrow/findzstd.patch b/ports/arrow/findzstd.patch deleted file mode 100644 index ac77202f9..000000000 --- a/ports/arrow/findzstd.patch +++ /dev/null @@ -1,79 +0,0 @@ -diff --git a/cpp/cmake_modules/FindZSTD.cmake b/cpp/cmake_modules/FindZSTD.cmake -index 21b4981ec..818e4b5e1 100644 ---- a/cpp/cmake_modules/FindZSTD.cmake -+++ b/cpp/cmake_modules/FindZSTD.cmake -@@ -19,44 +19,60 @@ if(MSVC AND NOT DEFINED ZSTD_MSVC_STATIC_LIB_SUFFIX) - set(ZSTD_MSVC_STATIC_LIB_SUFFIX "_static")
- endif()
-
--if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
-- set(ZSTD_LIB_NAME_DEBUG_SUFFIX d)
--endif()
--
-+set(ZSTD_LIB_NAME_DEBUG_SUFFIX d)
--set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") -+set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}")
- set(ZSTD_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}zstd${ZSTD_STATIC_LIB_SUFFIX})
-
-+set(ZSTD_LIB_NAMES_RELEASE zstd "${ZSTD_STATIC_LIB_NAME}"
-+ "${CMAKE_SHARED_LIBRARY_PREFIX}zstd")
-+set(ZSTD_LIB_NAMES_DEBUG)
-+foreach(_zstd_name ${ZSTD_LIB_NAMES_RELEASE})
-+ list(APPEND ZSTD_LIB_NAMES_DEBUG ${_zstd_name}${ZSTD_LIB_NAME_DEBUG_SUFFIX})
-+ if(DEFINED CMAKE_DEBUG_POSTFIX)
-+ list(APPEND ZSTD_LIB_NAMES_DEBUG ${_zstd_name}${CMAKE_DEBUG_POSTFIX})
-+ endif()
-+endforeach()
-+
- pkg_check_modules(ZSTD_PC libzstd)
- if(ZSTD_PC_FOUND)
- set(ZSTD_INCLUDE_DIR "${ZSTD_PC_INCLUDEDIR}")
-
- list(APPEND ZSTD_PC_LIBRARY_DIRS "${ZSTD_PC_LIBDIR}")
-- find_library(ZSTD_LIB zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX}
-+ find_library(ZSTD_LIBRARY_RELEASE ${ZSTD_LIB_NAMES_RELEASE}
- PATHS ${ZSTD_PC_LIBRARY_DIRS}
- NO_DEFAULT_PATH
- PATH_SUFFIXES "${CMAKE_LIBRARY_ARCHITECTURE}")
-+ find_library(ZSTD_LIBRARY_DEBUG ${ZSTD_LIB_NAMES_DEBUG}
-+ PATHS ${ZSTD_PC_LIBRARY_DIRS}
-+ NO_DEFAULT_PATH
-+ PATH_SUFFIXES "${CMAKE_LIBRARY_ARCHITECTURE}")
-+
- elseif(ZSTD_ROOT)
- message(STATUS "Using ZSTD_ROOT: ${ZSTD_ROOT}")
-- find_library(ZSTD_LIB
-- NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}"
-- "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-+ find_library(ZSTD_LIBRARY_RELEASE
-+ NAMES ${ZSTD_LIB_NAMES_RELEASE})
-+ find_library(ZSTD_LIBRARY_DEBUG
-+ NAMES ${ZSTD_LIB_NAMES_DEBUG})
- find_path(ZSTD_INCLUDE_DIR
- NAMES zstd.h
- PATHS ${ZSTD_ROOT} "${ZSTD_ROOT}/Library"
- NO_DEFAULT_PATH
- PATH_SUFFIXES "include")
- else()
-- find_library(ZSTD_LIB
-- NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}"
-- "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-+ find_library(ZSTD_LIBRARY_RELEASE
-+ NAMES ${ZSTD_LIB_NAMES_RELEASE})
-+ find_library(ZSTD_LIBRARY_DEBUG
-+ NAMES ${ZSTD_LIB_NAMES_DEBUG})
- find_path(ZSTD_INCLUDE_DIR NAMES zstd.h PATH_SUFFIXES "include")
- endif()
-- -+select_library_configurations(ZSTD)
-+set(ZSTD_LIB ${ZSTD_LIBRARY})
- find_package_handle_standard_args(ZSTD REQUIRED_VARS ZSTD_LIB ZSTD_INCLUDE_DIR)
-
- if(ZSTD_FOUND)
- add_library(ZSTD::zstd UNKNOWN IMPORTED)
- set_target_properties(ZSTD::zstd
-- PROPERTIES IMPORTED_LOCATION "${ZSTD_LIB}"
-+ PROPERTIES IMPORTED_LOCATION_RELEASE "${ZSTD_LIBRARY_RELEASE}"
-+ IMPORTED_LOCATION_DEBUG "${ZSTD_LIBRARY_DEBUG}"
- INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_INCLUDE_DIR}")
- endif()
diff --git a/ports/arrow/msvc-libname.patch b/ports/arrow/msvc-libname.patch deleted file mode 100644 index a997822d0..000000000 --- a/ports/arrow/msvc-libname.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake
-index 0f014ba..fd2e7b3 100644
---- a/cpp/cmake_modules/BuildUtils.cmake
-+++ b/cpp/cmake_modules/BuildUtils.cmake
-@@ -289,7 +289,7 @@ function(ADD_ARROW_LIB LIB_NAME)
- target_include_directories(${LIB_NAME}_static PRIVATE ${ARG_PRIVATE_INCLUDES})
- endif()
-
-- if(MSVC)
-+ if(MSVC AND 0)
- set(LIB_NAME_STATIC ${LIB_NAME}_static)
- else()
- set(LIB_NAME_STATIC ${LIB_NAME})
diff --git a/ports/arrow/portfile.cmake b/ports/arrow/portfile.cmake index fd8fd52fc..58b6f489c 100644 --- a/ports/arrow/portfile.cmake +++ b/ports/arrow/portfile.cmake @@ -7,13 +7,11 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO apache/arrow - REF apache-arrow-0.13.0 - SHA512 bbb14d11abf267a6902c7c9e0215ba7c5284f07482be2de42707145265d2809c89c2d4d8f8b918fdb8c33a5ecbd650875b987a1a694cdf653e766822be67a47d + REF apache-arrow-0.14.1 + SHA512 f5493a62becaaee9d26e05f33509f51c98e96a5efd5d5bbdffdf70456c254b62075f1c9bc63d1119289a22d00359dfe9862078a284f8e063ecf13bd338a50728 HEAD_REF master PATCHES all.patch - msvc-libname.patch - findzstd.patch ) string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "dynamic" ARROW_BUILD_SHARED) diff --git a/ports/aws-lambda-cpp/CONTROL b/ports/aws-lambda-cpp/CONTROL index 048f28fac..53d7a917f 100644 --- a/ports/aws-lambda-cpp/CONTROL +++ b/ports/aws-lambda-cpp/CONTROL @@ -1,4 +1,4 @@ Source: aws-lambda-cpp -Version: 0.1.0-1 +Version: 0.1.0-2 Build-Depends: curl Description: C++ Runtime for AWS Lambda. diff --git a/ports/aws-lambda-cpp/portfile.cmake b/ports/aws-lambda-cpp/portfile.cmake index 4a4cddafd..7ba33e8f1 100644 --- a/ports/aws-lambda-cpp/portfile.cmake +++ b/ports/aws-lambda-cpp/portfile.cmake @@ -1,8 +1,9 @@ include(vcpkg_common_functions) -if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") - message(FATAL_ERROR "aws-lambda-cpp currently only supports Linux and Mac platforms") -endif() +vcpkg_fail_port_install(MESSAGE "aws-lambda-cpp currently only supports Linux and Mac platforms" ON_TARGET "Windows") +#if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") +# message(FATAL_ERROR "aws-lambda-cpp currently only supports Linux and Mac platforms") +#endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH diff --git a/ports/azure-storage-cpp/CONTROL b/ports/azure-storage-cpp/CONTROL index 720f07efb..563c3d15f 100644 --- a/ports/azure-storage-cpp/CONTROL +++ b/ports/azure-storage-cpp/CONTROL @@ -1,5 +1,5 @@ Source: azure-storage-cpp -Version: 6.1.0 +Version: 6.1.0-2 Build-Depends: cpprestsdk[core], atlmfc (windows), boost-log (!windows&!uwp), boost-locale (!windows&!uwp), libxml2 (!windows&!uwp), libuuid (!windows&!uwp&!osx), gettext Description: Microsoft Azure Storage Client SDK for C++ A client library for working with Microsoft Azure storage services including blobs, files, tables, and queues. This client library enables working with the Microsoft Azure storage services which include the blob service for storing binary and text data, the file service for storing binary and text data, the table service for storing structured non-relational data, and the queue service for storing messages that may be accessed by a client. diff --git a/ports/azure-storage-cpp/portfile.cmake b/ports/azure-storage-cpp/portfile.cmake index 0a9662af3..b558fa51d 100644 --- a/ports/azure-storage-cpp/portfile.cmake +++ b/ports/azure-storage-cpp/portfile.cmake @@ -13,10 +13,12 @@ vcpkg_from_github( PATCHES # on osx use the uuid.h that is part of the osx sdk builtin-uuid-osx.patch + remove-gcov-dependency.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/Microsoft.WindowsAzure.Storage + PREFER_NINJA OPTIONS -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_TESTS=OFF diff --git a/ports/azure-storage-cpp/remove-gcov-dependency.patch b/ports/azure-storage-cpp/remove-gcov-dependency.patch new file mode 100644 index 000000000..7083fe3fa --- /dev/null +++ b/ports/azure-storage-cpp/remove-gcov-dependency.patch @@ -0,0 +1,14 @@ +diff --git a/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt b/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt +index 6443f8e..db20749 100644 +--- a/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt ++++ b/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt +@@ -63,9 +63,6 @@ if(UNIX OR WIN32) + ) + endif() + +-if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") +-endif() + if (APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS}") + else() diff --git a/ports/basisu/CONTROL b/ports/basisu/CONTROL new file mode 100644 index 000000000..f31edab07 --- /dev/null +++ b/ports/basisu/CONTROL @@ -0,0 +1,5 @@ +Source: basisu
+Version: 0.0.1-1
+Homepage: https://github.com/BinomialLLC/basis_universal
+Description: Basis Universal is a supercompressed GPU texture and video compression format that outputs a highly compressed intermediate file format (.basis) that can be quickly transcoded to a wide variety of GPU texture compression formats.
+Build-Depends: lodepng
\ No newline at end of file diff --git a/ports/basisu/portfile.cmake b/ports/basisu/portfile.cmake new file mode 100644 index 000000000..7882f0d22 --- /dev/null +++ b/ports/basisu/portfile.cmake @@ -0,0 +1,42 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO jherico/basis_universal + REF 11aa181a4bbf051475a01a1e73e39bf388819215 + SHA512 62d7de6c6ca5e6235c8a377767389a7d5393e05bb5d0c024ce756e77d235132efa48280c9d529b6a91eddf0c906c3c84b6b78fdf339b1a47039b28d04161d2fe + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_TESTS=OFF +) + +vcpkg_install_cmake() + +#vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/basisu) +if (WIN32) + set(TOOL_NAME basisu_tool.exe) +else() + set(TOOL_NAME basisu_tool) +endif() + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/basisu) +file(COPY ${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/basisu) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/basisu/LICENSE ${CURRENT_PACKAGES_DIR}/share/basisu/copyright) + +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/basisu) + +# Remove unnecessary files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME}) +file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +vcpkg_copy_pdbs() diff --git a/ports/bento4/CONTROL b/ports/bento4/CONTROL new file mode 100644 index 000000000..eff84ed98 --- /dev/null +++ b/ports/bento4/CONTROL @@ -0,0 +1,5 @@ +Source: bento4
+Version: 1.5.1-628
+Homepage: https://github.com/axiomatic-systems/Bento4
+Description: Bento4 is a C++ class library and tools designed to read and write ISO-MP4 files. This format is defined in international specifications ISO/IEC 14496-12, 14496-14 and 14496-15.
+
diff --git a/ports/bento4/LICENSE b/ports/bento4/LICENSE new file mode 100644 index 000000000..c1d00b26c --- /dev/null +++ b/ports/bento4/LICENSE @@ -0,0 +1,6 @@ +Bento4 is developed by Axiomatic Systems LLC in San Francisco, California.
+
+This software is available under two different licenses
+For applications that are entirely distributable under the terms of the GPL(https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html), the Bento4 GPL license applies.
+For applications that cannot be entirely distributable under the terms of the GPL (either the application, or code modules linked with the application are not compatible with the terms of the GPL licence), a non-GPL commercial license is available from Axiomatic Systems LLC.
+Contact Gilles Boccon-Gibod (licensing@axiosys.com or bok@bok.net) for more information.
\ No newline at end of file diff --git a/ports/bento4/fix-install-and-c4996-error.patch b/ports/bento4/fix-install-and-c4996-error.patch new file mode 100644 index 000000000..c99fdc411 --- /dev/null +++ b/ports/bento4/fix-install-and-c4996-error.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2f08b2f..fccf2a8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -35,6 +35,8 @@ endif()
+
+ add_library(ap4 STATIC ${AP4_SOURCES})
+
++add_definitions(-D_CRT_SECURE_NO_WARNINGS)
++
+ # Includes
+ include_directories(
+ ${SOURCE_CORE}
+@@ -43,6 +45,14 @@ include_directories(
+ ${SOURCE_METADATA}
+ )
+
++# AP4 includes
++file(GLOB AP4_INCLUDES
++ ${SOURCE_CODECS}/*.h
++ ${SOURCE_CORE}/*.h
++ ${SOURCE_CRYPTO}/*.h
++ ${SOURCE_METADATA}/*.h
++)
++
+ # Apps
+ file(GLOB BENTO4_APPS RELATIVE ${SOURCE_ROOT}/Apps ${SOURCE_ROOT}/Apps/*)
+ foreach(app ${BENTO4_APPS})
+@@ -50,3 +60,13 @@ foreach(app ${BENTO4_APPS})
+ add_executable(${binary_name} ${SOURCE_ROOT}/Apps/${app}/${app}.cpp)
+ target_link_libraries(${binary_name} ap4)
+ endforeach()
++
++# Install targets
++install(TARGETS ap4
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib
++)
++
++# Install headers
++install(FILES ${AP4_INCLUDES} DESTINATION include)
+\ No newline at end of file
diff --git a/ports/bento4/portfile.cmake b/ports/bento4/portfile.cmake new file mode 100644 index 000000000..b485fbb19 --- /dev/null +++ b/ports/bento4/portfile.cmake @@ -0,0 +1,25 @@ +include(vcpkg_common_functions) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO axiomatic-systems/Bento4 + REF v1.5.1-628 + SHA512 2bf44f55307178cc9128e323904acbfaa2f88e06beff26cf27fc0a7707875942de89778a0ee1a8315ef2c3b19754edad77d32fdb74f3d651f03c2623e7a9122d + HEAD_REF master + PATCHES fix-install-and-c4996-error.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +vcpkg_copy_pdbs() + +file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/blend2d/CONTROL b/ports/blend2d/CONTROL index ef22b5264..1854d3862 100644 --- a/ports/blend2d/CONTROL +++ b/ports/blend2d/CONTROL @@ -1,10 +1,10 @@ Source: blend2d -Version: beta_2019-04-30 +Version: beta_2019-07-16 Description: Beta 2D Vector Graphics Powered by a JIT Compiler Default-Features: jit, logging Feature: jit -Description: asmjit is used to jit compile pipelines +Description: Default feature. Enables jit pipeline compilation. Not supported for ARM and UWP. Feature: logging -Description: enables logging +Description: Default feature. Enables logging. diff --git a/ports/blend2d/portfile.cmake b/ports/blend2d/portfile.cmake index c23c90afd..39f665afd 100644 --- a/ports/blend2d/portfile.cmake +++ b/ports/blend2d/portfile.cmake @@ -3,12 +3,12 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO blend2d/blend2d - REF 69141350b5a654f328c8529ae301aa1e6bad5342 - SHA512 d9bdd234f443c0ef8793dba1a76cc567bab3f9cf32d835d9e285f7ad946a56e0bc03eab30f61bbce51318e18a74ecfcfc965ac94e1ff6cef21e9b3ccc6a42120 + REF 934d07161971aeef5c4ac3b15e69ff57929445ac + SHA512 71b17611c20a8a7d27a37b0984918ce4ed608d8d2d053d116cd4c0ca9b7fcad742f39ef9939d9addf600113c2ad399d1dc4ee72b5f036ccda58b7d4237316928 HEAD_REF master ) -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BLEND2D_BUILD_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BLEND2D_STATIC) if(NOT ("jit" IN_LIST FEATURES)) set(BLEND2D_BUILD_NO_JIT TRUE) @@ -17,14 +17,13 @@ if(NOT ("logging" IN_LIST FEATURES)) set(BLEND2D_BUILD_NO_LOGGING TRUE) endif() - if(NOT BLEND2D_BUILD_NO_JIT) vcpkg_from_github( OUT_SOURCE_PATH ASMJIT_SOURCE_PATH REPO asmjit/asmjit - REF f4e685cef003c40ad0d348d0c9eb2a1fe63d8521 - SHA512 77981fc32e746fc88f5707b4a8e8557283261b2657248f0d4900f47bd500de4efe47619a53f32413ea3c6f116e084cac6fdb48b6b92d75e824585d94c785d2b1 - HEAD_REF next-wip + REF 5d40561d14f93dc45613bfa03155d1dfb4f5825a + SHA512 88f16fc1ff8e9eb1b8d7441d7bd2e08d238a2104f3de94aaa16972faac704bf526996fa1556a3831701fb370f051df6839b4058690cf2f49ea5aeb1224c84fe0 + HEAD_REF master ) file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/asmjit) @@ -38,7 +37,7 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DBLEND2D_BUILD_STATIC=${BLEND2D_BUILD_STATIC} + -DBLEND2D_STATIC=${BLEND2D_STATIC} -DBLEND2D_BUILD_NO_JIT=${BLEND2D_BUILD_NO_JIT} -DBLEND2D_BUILD_NO_LOGGING=${BLEND2D_BUILD_NO_LOGGING} ) @@ -50,11 +49,16 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -if(BLEND2D_BUILD_STATIC) +if(BLEND2D_STATIC) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() # Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/blend2d RENAME copyright) +configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) + +if(BLEND2D_STATIC) + # Install usage + configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY) +endif() diff --git a/ports/blend2d/usage b/ports/blend2d/usage new file mode 100644 index 000000000..b6d8a652c --- /dev/null +++ b/ports/blend2d/usage @@ -0,0 +1 @@ +Define BL_STATIC before any @PORT@ includes. diff --git a/ports/blosc/0001-find-deps.patch b/ports/blosc/0001-find-deps.patch new file mode 100644 index 000000000..af0f92150 --- /dev/null +++ b/ports/blosc/0001-find-deps.patch @@ -0,0 +1,107 @@ +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 1d1bebe..3a7a51c 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -109,7 +109,7 @@ endif(NOT DEACTIVATE_ZLIB) + + if (NOT DEACTIVATE_ZSTD) + if (ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ set(LIBS ${LIBS} ${ZSTD_LIBRARIES}) + else (ZSTD_FOUND) + file(GLOB ZSTD_FILES + ${ZSTD_LOCAL_DIR}/common/*.c +diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake +index e581a80..8ce17c5 100644 +--- a/cmake/FindLZ4.cmake ++++ b/cmake/FindLZ4.cmake +@@ -1,10 +1,13 @@ +-find_path(LZ4_INCLUDE_DIR lz4.h) ++find_path(LZ4_INCLUDE_DIRS NAMES lz4.h) + +-find_library(LZ4_LIBRARY NAMES lz4) ++find_library(LZ4_LIBRARY_DEBUG NAMES lz4d) ++find_library(LZ4_LIBRARY_RELEASE NAMES lz4) + +-if (LZ4_INCLUDE_DIR AND LZ4_LIBRARY) +- set(LZ4_FOUND TRUE) +- message(STATUS "Found LZ4 library: ${LZ4_LIBRARY}") +-else () +- message(STATUS "No LZ4 library found. Using internal sources.") +-endif () ++include(SelectLibraryConfigurations) ++select_library_configurations(LZ4) ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args( ++ LZ4 ++ REQUIRED_VARS LZ4_LIBRARIES LZ4_INCLUDE_DIRS ++) +diff --git a/cmake/FindSnappy.cmake b/cmake/FindSnappy.cmake +index 688d4d5..c8b9a05 100644 +--- a/cmake/FindSnappy.cmake ++++ b/cmake/FindSnappy.cmake +@@ -1,10 +1,13 @@ +-find_path(SNAPPY_INCLUDE_DIR snappy-c.h) ++find_path(SNAPPY_INCLUDE_DIR snappy.h) + +-find_library(SNAPPY_LIBRARY NAMES snappy) ++find_library(SNAPPY_LIBRARY_DEBUG NAMES snappyd) ++find_library(SNAPPY_LIBRARY_RELEASE NAMES snappy) + +-if (SNAPPY_INCLUDE_DIR AND SNAPPY_LIBRARY) +- set(SNAPPY_FOUND TRUE) +- message(STATUS "Found SNAPPY library: ${SNAPPY_LIBRARY}") +-else () +- message(STATUS "No snappy found. Using internal sources.") +-endif () ++include(SelectLibraryConfigurations) ++select_library_configurations(SNAPPY) ++ ++include(FindPackageHandleStandardArgs) ++FIND_PACKAGE_HANDLE_STANDARD_ARGS( ++ SNAPPY DEFAULT_MSG ++ SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR ++) +diff --git a/cmake/FindZstd.cmake b/cmake/FindZstd.cmake +index 7db4bb9..ba20ba6 100644 +--- a/cmake/FindZstd.cmake ++++ b/cmake/FindZstd.cmake +@@ -1,10 +1,30 @@ ++include(FindPackageHandleStandardArgs) ++ + find_path(ZSTD_INCLUDE_DIR zstd.h) + +-find_library(ZSTD_LIBRARY NAMES zstd) ++get_filename_component(_prefix_path ${ZSTD_INCLUDE_DIR} PATH) ++ ++find_library( ++ ZSTD_LIBRARY_DEBUG ++ NAMES zstdd ++ PATHS ${_prefix_path}/debug/lib ++ NO_DEFAULT_PATH ++) ++ ++find_library( ++ ZSTD_LIBRARY_RELEASE ++ NAMES zstd ++ PATHS ${_prefix_path}/lib ++ NO_DEFAULT_PATH ++) ++ ++unset(_prefix_path) ++ ++include(SelectLibraryConfigurations) ++select_library_configurations(ZSTD) + +-if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY) +- set(ZSTD_FOUND TRUE) +- message(STATUS "Found Zstd library: ${ZSTD_LIBRARY}") +-else () +- message(STATUS "No Zstd library found. Using internal sources.") +-endif () ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args( ++ ZSTD ++ REQUIRED_VARS ZSTD_LIBRARIES ZSTD_INCLUDE_DIR ++) diff --git a/ports/blosc/CONTROL b/ports/blosc/CONTROL index 4dc7bf81f..414685489 100644 --- a/ports/blosc/CONTROL +++ b/ports/blosc/CONTROL @@ -1,5 +1,5 @@ Source: blosc -Version: 1.16.3-1 +Version: 1.17.0-1 Build-Depends: lz4, snappy, zlib, zstd Homepage: https://github.com/Blosc/c-blosc Description: A blocking, shuffling and loss-less compression library that can be faster than `memcpy()` diff --git a/ports/blosc/FindBlosc.cmake b/ports/blosc/FindBlosc.cmake new file mode 100644 index 000000000..11385d46d --- /dev/null +++ b/ports/blosc/FindBlosc.cmake @@ -0,0 +1,33 @@ +include(FindPackageHandleStandardArgs)
+
+find_path(
+ BLOSC_INCLUDE_DIRS
+ blosc.h
+)
+
+get_filename_component(_prefix_path ${BLOSC_INCLUDE_DIRS} PATH)
+
+find_library(
+ BLOSC_LIBRARY_DEBUG
+ NAMES blosc
+ PATHS ${_prefix_path}/debug/lib
+ NO_DEFAULT_PATH
+)
+
+find_library(
+ SNAPPY_LIBRARY_RELEASE
+ NAMES blosc
+ PATHS ${_prefix_path}/lib
+ NO_DEFAULT_PATH
+)
+
+unset(_prefix_path)
+
+include(SelectLibraryConfigurations)
+select_library_configurations(blosc)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ blosc
+ REQUIRED_VARS BLOSC_LIBRARIES BLOSC_INCLUDE_DIRS
+)
diff --git a/ports/blosc/portfile.cmake b/ports/blosc/portfile.cmake index 367c59194..aaf61eee0 100644 --- a/ports/blosc/portfile.cmake +++ b/ports/blosc/portfile.cmake @@ -3,9 +3,11 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Blosc/c-blosc - REF v1.16.3 - SHA512 2ff67a6e955a641c3a2330140e5887d0ce3fdcbf6b205507798a4e848a35ba2e22bf8fd91133291bc73c4e48fb01c02139e47ab8e4774d0e2288872e625c9ffd + REF v1.17.0 + SHA512 7fe517e9d050a36839ddf963e718881533cc10a7c8963222b3167fd48ec84455614206c1cc2c248f52042a019262fa0419c4c1a828eb1ae64294c55bbaf56f6e HEAD_REF master + PATCHES + 0001-find-deps.patch ) if (VCPKG_LIBRARY_LINKAGE STREQUAL static) @@ -20,6 +22,7 @@ file(REMOVE_RECURSE ${SOURCE_PATH}/internal-complibs) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DPREFER_EXTERNAL_LZ4=ON -DPREFER_EXTERNAL_SNAPPY=ON -DPREFER_EXTERNAL_ZLIB=ON @@ -50,3 +53,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSES/BLOSC.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/blosc RENAME copyright) +file(COPY + "${CMAKE_CURRENT_LIST_DIR}/FindBlosc.cmake" + DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} +) diff --git a/ports/bond/CONTROL b/ports/bond/CONTROL index 6e5daf0a9..a4361dfb0 100644 --- a/ports/bond/CONTROL +++ b/ports/bond/CONTROL @@ -1,6 +1,6 @@ -Source: bond -Maintainer: bond@microsoft.com -Version: 8.1.0-2 -Description: Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. -Homepage: https://github.com/Microsoft/bond -Build-Depends: rapidjson, boost-config, boost-utility, boost-assign +Source: bond
+Maintainer: bond@microsoft.com
+Version: 8.1.0-2
+Description: Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services.
+Homepage: https://github.com/Microsoft/bond
+Build-Depends: rapidjson, boost-config, boost-utility, boost-assign
diff --git a/ports/boolinq/CONTROL b/ports/boolinq/CONTROL new file mode 100644 index 000000000..aa246d2dc --- /dev/null +++ b/ports/boolinq/CONTROL @@ -0,0 +1,4 @@ +Source: boolinq +Version: 2019-07-22 +Description: Super tiny C++11 single-file header-only LINQ library +Homepage: https://github.com/k06a/boolinq diff --git a/ports/boolinq/portfile.cmake b/ports/boolinq/portfile.cmake new file mode 100644 index 000000000..35ad4994f --- /dev/null +++ b/ports/boolinq/portfile.cmake @@ -0,0 +1,16 @@ +# Single-file header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO k06a/boolinq + REF 1d09dc8b3df79801062e5c0e758572552fa4ce98 + SHA512 0714a97d09bb8299d39062803a8cd5de28834c372f7826afc36e17ea6aa90d2ec368d5bbb907914ad1ca5a65be41a5caeaa1583f66358577d7ea88d3c0906238 + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/include/boolinq/boolinq.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/boolinq) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/boost-asio/CONTROL b/ports/boost-asio/CONTROL index 3d93e7c07..123d9f854 100644 --- a/ports/boost-asio/CONTROL +++ b/ports/boost-asio/CONTROL @@ -1,6 +1,6 @@ # Automatically generated by boost-vcpkg-helpers/generate-ports.ps1
Source: boost-asio
-Version: 1.70.0-1
+Version: 1.70.0-2
Build-Depends: boost-array, boost-assert, boost-bind, boost-chrono, boost-compatibility, boost-config, boost-coroutine (!uwp), boost-date-time, boost-detail, boost-function, boost-integer, boost-regex, boost-smart-ptr, boost-system, boost-throw-exception, boost-type-traits, boost-utility, boost-vcpkg-helpers, openssl
Homepage: https://github.com/boostorg/asio
Description: Boost asio module
diff --git a/ports/boost-asio/portfile.cmake b/ports/boost-asio/portfile.cmake index dbb2b239c..f24dd1aed 100644 --- a/ports/boost-asio/portfile.cmake +++ b/ports/boost-asio/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( REF boost-1.70.0
SHA512 394c7e557d97bbb8b98453846a098c8ab7f4eb92d752bd4089d2020e0d5060cff1e53f5e50b2f8910e64b66c934b2bde4a7137bd1a6050e8b1279c2e4576b2e5
HEAD_REF master
+ PATCHES windows_alloca_header.patch
)
include(${CURRENT_INSTALLED_DIR}/share/boost-vcpkg-helpers/boost-modular-headers.cmake)
diff --git a/ports/boost-asio/windows_alloca_header.patch b/ports/boost-asio/windows_alloca_header.patch new file mode 100644 index 000000000..609e1ebfe --- /dev/null +++ b/ports/boost-asio/windows_alloca_header.patch @@ -0,0 +1,15 @@ +diff --git a/include/boost/asio/detail/impl/socket_ops.ipp b/include/boost/asio/detail/impl/socket_ops.ipp +index 7d7c31f..d2cd468 100644 +--- a/include/boost/asio/detail/impl/socket_ops.ipp ++++ b/include/boost/asio/detail/impl/socket_ops.ipp +@@ -27,6 +27,10 @@ + #include <boost/asio/detail/socket_ops.hpp> + #include <boost/asio/error.hpp> + ++#if defined(BOOST_ASIO_WINDOWS) ++#include <malloc.h> ++#endif ++ + #if defined(BOOST_ASIO_WINDOWS_RUNTIME) + # include <codecvt> + # include <locale> diff --git a/ports/boost-callable-traits/CONTROL b/ports/boost-callable-traits/CONTROL index af030d66f..7539e399e 100644 --- a/ports/boost-callable-traits/CONTROL +++ b/ports/boost-callable-traits/CONTROL @@ -1,6 +1,6 @@ # Automatically generated by boost-vcpkg-helpers/generate-ports.ps1
Source: boost-callable-traits
-Version: 1.70.0
+Version: 2.3.2
Build-Depends: boost-vcpkg-helpers
Homepage: https://github.com/boostorg/callable_traits
Description: Boost callable_traits module
diff --git a/ports/boost-callable-traits/portfile.cmake b/ports/boost-callable-traits/portfile.cmake index 8bc97f738..05e67919b 100644 --- a/ports/boost-callable-traits/portfile.cmake +++ b/ports/boost-callable-traits/portfile.cmake @@ -5,8 +5,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO boostorg/callable_traits
- REF boost-1.70.0
- SHA512 73742aa4094cef8f4b24833036f99449343dd6c572919db8fb464f76dc527d99a5a57e52bbfe6b20089041aa43ecb7a87ec528a7aea2fef5a8b15f6ced553769
+ REF 2.3.2
+ SHA512 32d69cc0bdaecfcf69f9e6079f6b80738ea95937cb2ef802d4d26771745c0d7179c9074ed6312ef1c2d45cf1711979ecf9a8407677d18e625bfb859bca1aa319
HEAD_REF master
)
diff --git a/ports/boost-mpi/CONTROL b/ports/boost-mpi/CONTROL index 3e788cd09..8440a2f95 100644 --- a/ports/boost-mpi/CONTROL +++ b/ports/boost-mpi/CONTROL @@ -1,6 +1,6 @@ # Automatically generated by boost-vcpkg-helpers/generate-ports.ps1
Source: boost-mpi
-Version: 1.70.0-1
-Build-Depends: boost-assert, boost-build, boost-compatibility, boost-config, boost-core, boost-foreach, boost-function, boost-graph, boost-integer, boost-iterator, boost-lexical-cast, boost-math, boost-modular-build-helper, boost-mpl, boost-optional, boost-property-map, boost-python (windows), boost-serialization, boost-smart-ptr, boost-static-assert, boost-throw-exception, boost-type-traits, boost-utility, boost-vcpkg-helpers, msmpi
+Version: 1.70.0-2
+Build-Depends: boost-assert, boost-build, boost-compatibility, boost-config, boost-core, boost-foreach, boost-function, boost-graph, boost-integer, boost-iterator, boost-lexical-cast, boost-math, boost-modular-build-helper, boost-mpl, boost-optional, boost-property-map, boost-python (windows), boost-serialization, boost-smart-ptr, boost-static-assert, boost-throw-exception, boost-type-traits, boost-utility, boost-vcpkg-helpers, mpi
Homepage: https://github.com/boostorg/mpi
Description: Boost mpi module
diff --git a/ports/boost-type-erasure/CONTROL b/ports/boost-type-erasure/CONTROL index d9090d787..ef2b1699e 100644 --- a/ports/boost-type-erasure/CONTROL +++ b/ports/boost-type-erasure/CONTROL @@ -1,6 +1,6 @@ # Automatically generated by boost-vcpkg-helpers/generate-ports.ps1
Source: boost-type-erasure
-Version: 1.70.0
-Build-Depends: boost-assert, boost-build, boost-config, boost-detail, boost-fusion, boost-iterator, boost-modular-build-helper, boost-mp11, boost-mpl, boost-preprocessor, boost-smart-ptr, boost-thread (!arm), boost-throw-exception, boost-typeof, boost-type-traits, boost-utility, boost-vcpkg-helpers, boost-vmd
+Version: 1.70.0-1
+Build-Depends: boost-assert, boost-build, boost-config, boost-detail, boost-fusion, boost-iterator, boost-modular-build-helper, boost-mp11, boost-mpl, boost-preprocessor, boost-smart-ptr, boost-thread, boost-throw-exception, boost-typeof, boost-type-traits, boost-utility, boost-vcpkg-helpers, boost-vmd
Homepage: https://github.com/boostorg/type_erasure
Description: Boost type_erasure module
diff --git a/ports/boost-vcpkg-helpers/generate-ports.ps1 b/ports/boost-vcpkg-helpers/generate-ports.ps1 index 7ab6c9680..8a6dc79d1 100644 --- a/ports/boost-vcpkg-helpers/generate-ports.ps1 +++ b/ports/boost-vcpkg-helpers/generate-ports.ps1 @@ -368,7 +368,7 @@ foreach ($library in $libraries) }
elseif ($library -eq "mpi")
{
- $deps += @("msmpi")
+ $deps += @("mpi")
}
Generate `
diff --git a/ports/brigand/CONTROL b/ports/brigand/CONTROL new file mode 100644 index 000000000..2fba63f77 --- /dev/null +++ b/ports/brigand/CONTROL @@ -0,0 +1,6 @@ +Source: brigand +Version: 1.3.0 +Homepage: https://github.com/edouarda/brigand +Description: Brigand is a light-weight, fully functional, instant-compile time C++ 11 meta-programming library. +Build-Depends: boost + diff --git a/ports/brigand/fix-install-targets.patch b/ports/brigand/fix-install-targets.patch new file mode 100644 index 000000000..248948ab1 --- /dev/null +++ b/ports/brigand/fix-install-targets.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 13ea689..9d20700 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -292,3 +292,9 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/brigand
+ install(FILES ${CMAKE_BINARY_DIR}/libbrigand.pc
+ DESTINATION lib/pkgconfig
+ )
++
++install(TARGETS brigand
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib
++)
diff --git a/ports/brigand/portfile.cmake b/ports/brigand/portfile.cmake new file mode 100644 index 000000000..c7c17907f --- /dev/null +++ b/ports/brigand/portfile.cmake @@ -0,0 +1,29 @@ +include(vcpkg_common_functions) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO edouarda/brigand + REF 1.3.0 + SHA512 538d288d84265cc9a4563f1e84d55a174db461ffd1e4f510bfdaef04af9fbf8e7ca79817f9118378bf7d58d578699aae3072bbffa3fd727b2d93ee783337aea6 + HEAD_REF master + PATCHES fix-install-targets.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/pkgconfig) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) + diff --git a/ports/brynet/CONTROL b/ports/brynet/CONTROL index 5566fad32..341076cba 100644 --- a/ports/brynet/CONTROL +++ b/ports/brynet/CONTROL @@ -1,5 +1,5 @@ Source: brynet -Version: 1.0.2 +Version: 1.0.3 Homepage: https://github.com/IronsDu/brynet Description: A C++ cross platform high performance tcp network library, and support SSL/HTTP/Websocket. Build-Depends: openssl diff --git a/ports/brynet/portfile.cmake b/ports/brynet/portfile.cmake index 141711827..f707948ac 100644 --- a/ports/brynet/portfile.cmake +++ b/ports/brynet/portfile.cmake @@ -5,8 +5,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO IronsDu/brynet - REF v1.0.2 - SHA512 b07ceb858ed125959b3901415d6099939acf51a194950de8c65f063b6462a0ab424494659aedd889378bd4388cc9e71a0aedcb30108b6c2eef4d5e6ebea2cce8 + REF v1.0.3 + SHA512 8759b522da34be68a7ba0959ed3d85382965efe5080e4cdd403001f3911d36398b7fe9d039fd9fb485a0d557cec0fa53863a512eb88f13f3ff222b6e30642baf HEAD_REF master ) diff --git a/ports/bullet3/CONTROL b/ports/bullet3/CONTROL index 437908356..d313255a5 100644 --- a/ports/bullet3/CONTROL +++ b/ports/bullet3/CONTROL @@ -1,4 +1,7 @@ Source: bullet3
-Version: 2.88
+Version: 2.88-1
Homepage: https://github.com/bulletphysics/bullet3
Description: Bullet Physics is a professional collision detection, rigid body, and soft body dynamics library
+
+Feature: multithreading
+Description: Multithreading funcitonality for bullet3
\ No newline at end of file diff --git a/ports/bullet3/portfile.cmake b/ports/bullet3/portfile.cmake index aef9757a7..031ddf23f 100644 --- a/ports/bullet3/portfile.cmake +++ b/ports/bullet3/portfile.cmake @@ -10,8 +10,14 @@ vcpkg_from_github( HEAD_REF master ) +set(BULLET_MULTITHREADING OFF) +if ("multithreading" IN_LIST FEATURES) + set(BULLET_MULTITHREADING ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON -DBUILD_DEMOS=OFF @@ -21,6 +27,7 @@ vcpkg_configure_cmake( -DBUILD_EXTRAS=OFF -DBUILD_UNIT_TESTS=OFF -DINSTALL_LIBS=ON + -DBULLET2_MULTITHREADING=${BULLET_MULTITHREADING} ) vcpkg_install_cmake() diff --git a/ports/capnproto/CONTROL b/ports/capnproto/CONTROL index 694469b1f..02cc080f1 100644 --- a/ports/capnproto/CONTROL +++ b/ports/capnproto/CONTROL @@ -1,5 +1,5 @@ Source: capnproto -Version: 0.7.0-2 +Version: 0.7.0-3 Description: Data interchange format and capability-based RPC system Homepage: https://capnproto.org/ Build-Depends: zlib diff --git a/ports/capnproto/portfile.cmake b/ports/capnproto/portfile.cmake index 5c189acc7..4e149a035 100644 --- a/ports/capnproto/portfile.cmake +++ b/ports/capnproto/portfile.cmake @@ -15,7 +15,10 @@ vcpkg_from_github( PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-fix-capnpc-extension-handling-on-Windows.patch" ) -vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH}) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) vcpkg_install_cmake() diff --git a/ports/casclib/CMakeLists.txt b/ports/casclib/CMakeLists.txt index 4165814f5..ad05df424 100644 --- a/ports/casclib/CMakeLists.txt +++ b/ports/casclib/CMakeLists.txt @@ -1,22 +1,13 @@ cmake_minimum_required(VERSION 3.9)
-project(CascLib)
-set(HEADER_FILES
- src/CascCommon.h
- src/CascLib.h
- src/CascLib.def
- src/CascPort.h
- src/common/Array.h
- src/common/Common.h
- src/common/Csv.h
- src/common/FileStream.h
- src/common/FileTree.h
- src/common/ListFile.h
- src/common/Map.h
- src/jenkins/lookup.h
-)
+project(casclib)
+set(PROJECT_VERSION_MAJOR 1)
+set(PROJECT_VERSION_MINOR 50)
+
+option(INSTALL_HEADERS "Install header files" ON)
set(SRC_FILES
+ src/CascLib.def
src/CascCommon.cpp
src/CascDecompress.cpp
src/CascDecrypt.cpp
@@ -57,18 +48,36 @@ set(ZLIB_FILES src/zlib/zutil.c
)
+add_library(casclib ${SRC_FILES} ${ZLIB_FILES} ${MD5_FILES})
+target_include_directories(casclib
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+ $<INSTALL_INTERFACE:include/casclib>)
if(WIN32)
- add_definitions(-DUNICODE -D_UNICODE)
+ target_compile_definitions(casclib PRIVATE UNICODE _UNICODE)
endif()
-add_library(CascLib ${SRC_FILES} ${HEADER_FILES} ${TOMCRYPT_FILES} ${ZLIB_FILES} ${MD5_FILES})
+install(TARGETS casclib
+ EXPORT casclibTargets
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+)
-set_target_properties(CascLib PROPERTIES PUBLIC_HEADER "src/CascLib.h;src/CascPort.h")
+include(CMakePackageConfigHelpers)
-install(TARGETS CascLib
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
- FRAMEWORK DESTINATION /Library/Frameworks
- PUBLIC_HEADER DESTINATION include
- INCLUDES DESTINATION include)
\ No newline at end of file +set(VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/temp/casclibConfigVersion.cmake")
+set(PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/temp/casclibConfig.cmake")
+set(INSTALL_DIR "share/casclib")
+
+write_basic_package_version_file("${VERSION_CONFIG}" VERSION 1.50 COMPATIBILITY SameMajorVersion)
+configure_package_config_file("Config.cmake.in"
+ "${PROJECT_CONFIG}"
+ INSTALL_DESTINATION "${INSTALL_DIR}")
+
+install(FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" DESTINATION "${INSTALL_DIR}")
+install(EXPORT casclibTargets DESTINATION "${INSTALL_DIR}")
+
+if(INSTALL_HEADERS)
+ install(FILES "src/CascLib.h" "src/CascPort.h" DESTINATION include/casclib)
+endif()
diff --git a/ports/casclib/CONTROL b/ports/casclib/CONTROL index a9a10ac9b..4622f5200 100644 --- a/ports/casclib/CONTROL +++ b/ports/casclib/CONTROL @@ -1,4 +1,4 @@ Source: casclib
-Version: 1.50
+Version: 1.50-1
Build-Depends: zlib
-Description: An open-source implementation of library for reading CASC storage from Blizzard games since 2014
\ No newline at end of file +Description: An open-source implementation of library for reading CASC storage from Blizzard games since 2014
diff --git a/ports/casclib/Config.cmake.in b/ports/casclib/Config.cmake.in new file mode 100644 index 000000000..96f515427 --- /dev/null +++ b/ports/casclib/Config.cmake.in @@ -0,0 +1,7 @@ +@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+find_dependency(ZLIB REQUIRED)
+
+include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
+check_required_components("@PROJECT_NAME@")
diff --git a/ports/casclib/portfile.cmake b/ports/casclib/portfile.cmake index bf17bc545..9604ac618 100644 --- a/ports/casclib/portfile.cmake +++ b/ports/casclib/portfile.cmake @@ -10,14 +10,24 @@ vcpkg_from_github( ctype_for_mac.patch
)
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY
+ ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
+ ${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in
+ DESTINATION
+ ${SOURCE_PATH}
+)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
+ OPTIONS_DEBUG
+ -DINSTALL_HEADERS=OFF
)
vcpkg_install_cmake()
-file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/casclib RENAME copyright)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
\ No newline at end of file +vcpkg_fixup_cmake_targets()
+
+file(INSTALL ${SOURCE_PATH}/LICENSE
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/casclib
+ RENAME copyright)
diff --git a/ports/catch2/CONTROL b/ports/catch2/CONTROL index 1a8c9265d..810b18dd1 100644 --- a/ports/catch2/CONTROL +++ b/ports/catch2/CONTROL @@ -1,4 +1,4 @@ Source: catch2 -Version: 2.7.2-2 +Version: 2.9.2 Description: A modern, header-only test framework for unit testing. Homepage: https://github.com/catchorg/Catch2 diff --git a/ports/catch2/portfile.cmake b/ports/catch2/portfile.cmake index d79098572..b19ebeab4 100644 --- a/ports/catch2/portfile.cmake +++ b/ports/catch2/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO catchorg/Catch2 - REF v2.7.2 - SHA512 ac58cb3b676c73a361a494492e7b1f1b85cba7d08feb2d09b2269109a89b66aa37efead6b0a9fca64678f42a3395a3b02b6d461b4cb35310451ce849a79d04ae + REF v2.9.2 + SHA512 06430322dbeb637902f3bdc1c4df04e2525bc3ad9aea47aaf284b311401f26f489092971a2822d5a54041ef1d01d1b1bda3eedea2ba5041ae89903d8e56db121 HEAD_REF master ) diff --git a/ports/ccfits/CONTROL b/ports/ccfits/CONTROL index 18937d5e7..f6eb51488 100644 --- a/ports/ccfits/CONTROL +++ b/ports/ccfits/CONTROL @@ -1,5 +1,5 @@ Source: ccfits -Version: 2.5-2 +Version: 2.5-3 Homepage: https://heasarc.gsfc.nasa.gov/fitsio/ccfits Description: CCfits is an object oriented interface to the cfitsio library. It is designed to make the capabilities of cfitsio available to programmers working in C++. Build-Depends: cfitsio diff --git a/ports/ccfits/dll_exports.patch b/ports/ccfits/dll_exports.patch index 4ec4a8284..6321cbb4e 100644 --- a/ports/ccfits/dll_exports.patch +++ b/ports/ccfits/dll_exports.patch @@ -1,10 +1,7 @@ -Index: FITS.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- FITS.h (date 1502267716000) -+++ FITS.h (revision ) +diff --git a/FITS.h b/FITS.h +index e21f3db..3e97c83 100644 +--- a/FITS.h ++++ b/FITS.h @@ -21,6 +21,8 @@ #include "HDUCreator.h" // FitsError @@ -14,42 +11,33 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP namespace CCfits { class FITSBase; -@@ -665,9 +667,8 @@ +@@ -665,7 +667,7 @@ do this either). - class FITS -- { -- -+ class CCFITS_EXPORT FITS -+ { - public: - ++ class CCFITS_EXPORT FITS + { -Index: HDU.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- HDU.h (date 1502267716000) -+++ HDU.h (revision ) -@@ -568,7 +568,7 @@ + public: +diff --git a/HDU.h b/HDU.h +index 07f68e7..047e731 100644 +--- a/HDU.h ++++ b/HDU.h +@@ -568,7 +568,7 @@ and return its value. - class HDU -+ class CCFITS_EXPORT HDU ++ class CCFITS_EXPORT HDU { public: -Index: Table.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- Table.h (date 1502267716000) -+++ Table.h (revision ) -@@ -268,7 +268,7 @@ +diff --git a/Table.h b/Table.h +index a0c1afe..9a8a5db 100644 +--- a/Table.h ++++ b/Table.h +@@ -268,7 +268,7 @@ namespace CCfits { @@ -58,19 +46,16 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: -Index: Column.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- Column.h (date 1502267716000) -+++ Column.h (revision ) -@@ -838,14 +838,14 @@ +diff --git a/Column.h b/Column.h +index e4496a7..b798947 100644 +--- a/Column.h ++++ b/Column.h +@@ -838,14 +838,14 @@ namespace CCfits { - class Column -+ class CCFITS_EXPORT Column ++ class CCFITS_EXPORT Column { public: @@ -82,7 +67,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: RangeError (const String& msg, bool silent = true); -@@ -857,7 +857,7 @@ +@@ -857,7 +857,7 @@ namespace CCfits { @@ -91,7 +76,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: InvalidDataType (const String& str = string(), bool silent = true); -@@ -869,7 +869,7 @@ +@@ -869,7 +869,7 @@ namespace CCfits { @@ -100,7 +85,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: InvalidRowParameter (const String& diag, bool silent = true); -@@ -881,7 +881,7 @@ +@@ -881,7 +881,7 @@ namespace CCfits { @@ -109,7 +94,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: WrongColumnType (const String& diag, bool silent = true); -@@ -893,7 +893,7 @@ +@@ -893,7 +893,7 @@ namespace CCfits { @@ -118,7 +103,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: UnspecifiedLengths (const String& diag, bool silent = true); -@@ -905,7 +905,7 @@ +@@ -905,7 +905,7 @@ namespace CCfits { @@ -127,7 +112,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: InvalidRowNumber (const String& diag, bool silent = true); -@@ -917,7 +917,7 @@ +@@ -917,7 +917,7 @@ namespace CCfits { @@ -136,7 +121,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: InsufficientElements (const String& msg, bool silent = true); -@@ -929,7 +929,7 @@ +@@ -929,7 +929,7 @@ namespace CCfits { @@ -145,7 +130,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: NoNullValue (const String& diag, bool silent = true); -@@ -941,7 +941,7 @@ +@@ -941,7 +941,7 @@ namespace CCfits { @@ -154,14 +139,11 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: InvalidNumberOfRows (int number, bool silent = true); -Index: AsciiTable.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- AsciiTable.h (date 1502267716000) -+++ AsciiTable.h (revision ) -@@ -133,7 +133,7 @@ +diff --git a/AsciiTable.h b/AsciiTable.h +index 620cf41..d03aa44 100644 +--- a/AsciiTable.h ++++ b/AsciiTable.h +@@ -133,7 +133,7 @@ namespace CCfits { @@ -170,14 +152,11 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: -Index: CCfits.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- CCfits.h (date 1502267716000) -+++ CCfits.h (revision ) -@@ -23,7 +23,7 @@ +diff --git a/CCfits.h b/CCfits.h +index d09438a..a62b8a6 100644 +--- a/CCfits.h ++++ b/CCfits.h +@@ -23,7 +23,7 @@ namespace CCfits { #include <sys/types.h> #include "longnam.h" #include "float.h" @@ -186,7 +165,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP namespace CCfits { /*! \namespace CCfits -@@ -32,8 +32,8 @@ +@@ -32,8 +32,8 @@ namespace CCfits { static const int BITPIX = -32; static const int NAXIS = 2; static const int MAXDIM = 99; @@ -197,46 +176,37 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP extern char BSCALE[7]; extern char BZERO[6]; -Index: FITSBase.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- FITSBase.h (date 1502267716000) -+++ FITSBase.h (revision ) -@@ -30,7 +30,7 @@ +diff --git a/FITSBase.h b/FITSBase.h +index 996fdae..0c985f9 100644 +--- a/FITSBase.h ++++ b/FITSBase.h +@@ -30,7 +30,7 @@ namespace CCfits { - class FITSBase -+ class CCFITS_EXPORT FITSBase ++ class CCFITS_EXPORT FITSBase { public: -Index: Keyword.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- Keyword.h (date 1502267716000) -+++ Keyword.h (revision ) -@@ -195,7 +195,7 @@ +diff --git a/Keyword.h b/Keyword.h +index 816c119..b6df1f1 100644 +--- a/Keyword.h ++++ b/Keyword.h +@@ -195,7 +195,7 @@ namespace CCfits { - class Keyword -+ class CCFITS_EXPORT Keyword ++ class CCFITS_EXPORT Keyword { public: -Index: ExtHDU.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- ExtHDU.h (date 1502267716000) -+++ ExtHDU.h (revision ) -@@ -435,7 +435,7 @@ +diff --git a/ExtHDU.h b/ExtHDU.h +index d075fa1..e2d7dc6 100644 +--- a/ExtHDU.h ++++ b/ExtHDU.h +@@ -435,7 +435,7 @@ namespace CCfits { @@ -245,14 +215,11 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: -Index: PHDU.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- PHDU.h (date 1502267716000) -+++ PHDU.h (revision ) -@@ -264,7 +264,7 @@ +diff --git a/PHDU.h b/PHDU.h +index fe5f799..d9669b4 100644 +--- a/PHDU.h ++++ b/PHDU.h +@@ -264,7 +264,7 @@ namespace CCfits { @@ -261,14 +228,11 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: -Index: BinTable.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- BinTable.h (date 1502267716000) -+++ BinTable.h (revision ) -@@ -127,7 +127,7 @@ +diff --git a/BinTable.h b/BinTable.h +index 68851e3..906005a 100644 +--- a/BinTable.h ++++ b/BinTable.h +@@ -127,7 +127,7 @@ namespace CCfits { @@ -277,63 +241,41 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: -Index: Image.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- Image.h (date 1502267716000) -+++ Image.h (revision ) -@@ -32,7 +32,7 @@ - - - template <typename T> -- class Image -+ class Image - { - - public: -Index: ColumnCreator.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- ColumnCreator.h (date 1502267716000) -+++ ColumnCreator.h (revision ) -@@ -28,7 +28,7 @@ +diff --git a/ColumnCreator.h b/ColumnCreator.h +index 104bd4f..15cd0ea 100644 +--- a/ColumnCreator.h ++++ b/ColumnCreator.h +@@ -28,7 +28,7 @@ namespace CCfits { - class ColumnCreator -+ class CCFITS_EXPORT ColumnCreator ++ class CCFITS_EXPORT ColumnCreator { public: -Index: FitsError.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- FitsError.h (date 1502267716000) -+++ FitsError.h (revision ) -@@ -14,6 +14,7 @@ +diff --git a/FitsError.h b/FitsError.h +index 593723c..52941f6 100644 +--- a/FitsError.h ++++ b/FitsError.h +@@ -13,6 +13,7 @@ + //#include <exception> //#include <iostream> //#include <stl.h> - #include <string> +#include "ccfits_export.h" + #include <string> using std::string; - -@@ -90,7 +91,7 @@ +@@ -90,7 +91,7 @@ namespace CCfits { - class FitsException -+ class CCFITS_EXPORT FitsException ++ class CCFITS_EXPORT FitsException { public: FitsException (const string& msg, bool& silent); -@@ -109,7 +110,7 @@ +@@ -109,7 +110,7 @@ namespace CCfits { @@ -342,40 +284,34 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: FitsError (int errornum, bool silent = true); -@@ -123,7 +124,7 @@ +@@ -123,7 +124,7 @@ namespace CCfits { - class FitsFatal -+ class CCFITS_EXPORT FitsFatal ++ class CCFITS_EXPORT FitsFatal { public: FitsFatal (const string& diag); -Index: HDUCreator.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- HDUCreator.h (date 1502267716000) -+++ HDUCreator.h (revision ) -@@ -35,7 +35,7 @@ +diff --git a/HDUCreator.h b/HDUCreator.h +index 65b82b7..2b5f717 100644 +--- a/HDUCreator.h ++++ b/HDUCreator.h +@@ -35,7 +35,7 @@ namespace CCfits { - class HDUCreator -+ class CCFITS_EXPORT HDUCreator ++ class CCFITS_EXPORT HDUCreator { public: -Index: ccfits_export.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- ccfits_export.h (revision ) -+++ ccfits_export.h (revision ) -@@ -0,0 +1,42 @@ -+ +diff --git a/ccfits_export.h b/ccfits_export.h +new file mode 100644 +index 0000000..a2540a6 100644 +--- /dev/null ++++ b/ccfits_export.h +@@ -0,0 +1,41 @@ +#ifndef CCFITS_EXPORT_H +#define CCFITS_EXPORT_H + @@ -417,13 +353,11 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +#endif + +#endif -Index: FITSUtil.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- FITSUtil.h (date 1502267716000) -+++ FITSUtil.h (revision ) +\ No newline at end of file +diff --git a/FITSUtil.h b/FITSUtil.h +index 762d430..e2eee33 100644 +--- a/FITSUtil.h ++++ b/FITSUtil.h @@ -22,6 +22,7 @@ #include <string> // FitsError @@ -432,7 +366,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP #include <typeinfo> -@@ -287,21 +288,21 @@ +@@ -287,21 +288,21 @@ object. template <typename T> void swap(std::vector<T>& left, std::vector<T>& right); @@ -459,7 +393,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { bool operator()(const string& left, const string& right) const; }; -@@ -323,7 +324,7 @@ +@@ -323,7 +324,7 @@ object. char** CharArray(const std::vector<string>& inArray); @@ -468,7 +402,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP template <typename S, typename T> -@@ -633,7 +634,7 @@ +@@ -633,7 +634,7 @@ object. @@ -477,19 +411,78 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP { public: UnrecognizedType (string diag, bool silent = true); -Index: KeywordCreator.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- KeywordCreator.h (date 1502267716000) -+++ KeywordCreator.h (revision ) -@@ -24,7 +24,7 @@ +diff --git a/KeywordCreator.h b/KeywordCreator.h +index d878a26..b2c0c70 100644 +--- a/KeywordCreator.h ++++ b/KeywordCreator.h +@@ -24,7 +24,7 @@ namespace CCfits { - class KeywordCreator -+ class CCFITS_EXPORT KeywordCreator ++ class CCFITS_EXPORT KeywordCreator { public: +diff --git a/CCfits b/CCfits +index e9848c9..f30c9ad 100644 +--- a/CCfits ++++ b/CCfits +@@ -2,20 +2,20 @@ + #ifndef CCFITS + #define CCFITS 20031208 + +-#include <CCfits/CCfits.h> ++#include <CCfits.h> + +-#include <CCfits/FITS.h> +-#include <CCfits/BinTable.h> +-#include <CCfits/AsciiTable.h> +-#include <CCfits/ColumnVectorData.h> +-#include <CCfits/ColumnData.h> +-#include <CCfits/ColumnT.h> +-#include <CCfits/ExtHDUT.h> +-#include <CCfits/KeywordT.h> +-#include <CCfits/KeyData.h> +-#include <CCfits/FitsError.h> +-#include <CCfits/FITSUtilT.h> +-#include <CCfits/PHDUT.h> ++#include <FITS.h> ++#include <BinTable.h> ++#include <AsciiTable.h> ++#include <ColumnVectorData.h> ++#include <ColumnData.h> ++#include <ColumnT.h> ++#include <ExtHDUT.h> ++#include <KeywordT.h> ++#include <KeyData.h> ++#include <FitsError.h> ++#include <FITSUtilT.h> ++#include <PHDUT.h> + + + #endif +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b958fc7..0b1fb4e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -30,6 +30,11 @@ IF (BUILD_SHARED_LIBS) + SET (LIB_TYPE SHARED) + ENDIF (BUILD_SHARED_LIBS) + ++ ++IF (NOT BUILD_SHARED_LIBS) ++ ADD_DEFINITIONS(-DCCFITS_STATIC_DEFINE) ++ENDIF() ++ + FILE(GLOB H_FILES "*.h") + SET(H_FILES ${H_FILES} CCfits) + +@@ -55,6 +60,7 @@ SET(SRC_FILES + ) + + ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) ++ + TARGET_LINK_LIBRARIES(${LIB_NAME} ${CFITSIO_LIBRARY} + ) + diff --git a/ports/ccfits/portfile.cmake b/ports/ccfits/portfile.cmake index 6aeecfd62..c3d2fef1e 100644 --- a/ports/ccfits/portfile.cmake +++ b/ports/ccfits/portfile.cmake @@ -9,14 +9,11 @@ vcpkg_download_distfile(ARCHIVE FILENAME "CCfits-2.5.tar.gz" SHA512 63ab4d153063960510cf60651d5c832824cf85f937f84adc5390c7c2fb46eb8e9f5d8cda2554d79d24c7a4f1b6cf0b7a6e20958fb69920b65d7c362c0a5f26b5 ) -vcpkg_extract_source_archive(${ARCHIVE}) - -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CCfits - PATCHES "${CMAKE_CURRENT_LIST_DIR}/dll_exports.patch" - ) -endif() +vcpkg_extract_source_archive_ex( + ARCHIVE ${ARCHIVE} + OUT_SOURCE_PATH SOURCE_PATH + PATCHES dll_exports.patch +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/cgicc/CONTROL b/ports/cgicc/CONTROL index 9e18277a9..1e3716e0e 100644 --- a/ports/cgicc/CONTROL +++ b/ports/cgicc/CONTROL @@ -1,4 +1,4 @@ Source: cgicc
-Version: 3.2.19-1
+Version: 3.2.19-2
Homepage: https://www.gnu.org/software/cgicc/
Description: GNU Cgicc is an ANSI C++ compliant class library that greatly simplifies the creation of CGI applications for the World Wide Web
diff --git a/ports/cgicc/portfile.cmake b/ports/cgicc/portfile.cmake index 58a970877..24447e884 100644 --- a/ports/cgicc/portfile.cmake +++ b/ports/cgicc/portfile.cmake @@ -15,6 +15,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON -DDISABLE_INSTALL_TOOLS=ON ) diff --git a/ports/chakracore/CONTROL b/ports/chakracore/CONTROL index 919391eb6..0f496998e 100644 --- a/ports/chakracore/CONTROL +++ b/ports/chakracore/CONTROL @@ -1,4 +1,4 @@ Source: chakracore -Version: 1.11.9 +Version: 1.11.12 Homepage: https://github.com/Microsoft/ChakraCore Description: Core part of the Chakra Javascript engine diff --git a/ports/chakracore/portfile.cmake b/ports/chakracore/portfile.cmake index 04b253b15..924bc1e91 100644 --- a/ports/chakracore/portfile.cmake +++ b/ports/chakracore/portfile.cmake @@ -9,8 +9,8 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Microsoft/ChakraCore - REF v1.11.9 - SHA512 4703e28f04925074bfc2057dcccee0427aacdd48f7b9f715d08a9385e4de9e804e1620cd49e8b3db7cd330d00ecd374bfaa3205dbe1f3cfce51ed0eea439a55e + REF v1.11.12 + SHA512 6ff8b8fa379bd290d547ca9900c5aca47b6148f0112e58c11ab757fb2a9080119be59611fb5cb73fabae99802e8df2da35d7b8f1c351a32b452444d090d3b069 HEAD_REF master ) diff --git a/ports/charls/CONTROL b/ports/charls/CONTROL index 00f6777a4..e8fabbf22 100644 --- a/ports/charls/CONTROL +++ b/ports/charls/CONTROL @@ -1,4 +1,4 @@ Source: charls -Version: 2.0.0-1 +Version: 2.0.0-2 Homepage: https://github.com/team-charls/charls Description: CharLS, a C++ JPEG-LS library implementation. diff --git a/ports/charls/portfile.cmake b/ports/charls/portfile.cmake index 69726f1c3..0f622c7e3 100644 --- a/ports/charls/portfile.cmake +++ b/ports/charls/portfile.cmake @@ -15,6 +15,7 @@ vcpkg_apply_patches( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DBUILD_TESTING=OFF ) diff --git a/ports/cjson/CONTROL b/ports/cjson/CONTROL index 7029313e3..f8eada28b 100644 --- a/ports/cjson/CONTROL +++ b/ports/cjson/CONTROL @@ -1,5 +1,5 @@ Source: cjson
-Version: 1.7.10-1
+Version: 1.7.12
Description: Ultralightweight JSON parser in ANSI C
Feature: utils
diff --git a/ports/cjson/portfile.cmake b/ports/cjson/portfile.cmake index 7db22d9ae..753c4ed2a 100644 --- a/ports/cjson/portfile.cmake +++ b/ports/cjson/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DaveGamble/cJSON
- REF v1.7.10
- SHA512 f8d7c9fe798b51ec3c69cabe4124d2f6372f0e6d282285e3ca951c58c971a9a520d87550530d750ff7f8055c0b6ff566f237b9af9eb345cf4f4fc4ff8c910740
+ REF v1.7.12
+ SHA512 d767b7261eff3a1a50ea46cc5573f9504f5734a891ea211ad348835bfb4b80acf7f744da2d34bb1fa270cd4d44576c21bc6f52c0604b7e6ffdeb61ecb396b376
HEAD_REF master
PATCHES
fix-install-path.patch
diff --git a/ports/clapack/CONTROL b/ports/clapack/CONTROL index 2b5d137fc..9e7328e70 100644 --- a/ports/clapack/CONTROL +++ b/ports/clapack/CONTROL @@ -1,5 +1,5 @@ Source: clapack -Version: 3.2.1-9 +Version: 3.2.1-10 Homepage: https://www.netlib.org/clapack Description: CLAPACK (f2c'ed version of LAPACK) Build-Depends: openblas (!osx) diff --git a/ports/clapack/FindLAPACK.cmake b/ports/clapack/FindLAPACK.cmake index 002218eb8..0b5924ff4 100644 --- a/ports/clapack/FindLAPACK.cmake +++ b/ports/clapack/FindLAPACK.cmake @@ -1,237 +1,468 @@ -#.rst: -# clapack config for vcpkg -# ------------ -# -# Find the clapack includes and library. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This script defines the following variables: -# -# ``CLAPACK_FOUND`` -# True if clapack library found -# -# ``CLAPACK_VERSION`` -# Containing the clapack version tag (manually defined) -# -# ``CLAPACK_INCLUDE_DIR`` -# Location of clapack headers -# -# ``CLAPACK_LIBRARY`` -# List of libraries to link with when using clapack -# -# Result Targets -# ^^^^^^^^^^^^^^ -# -# This script defines the following targets: -# -# ``clapack::clapack`` -# Target to use clapack -# -# Compatibility Variables -# ^^^^^^^^^^^^^^^^^^^^^^^ -# -# This script defines the following variables for compatibility reasons: -# -# ``F2C_FOUND`` -# True if f2c (fortran-to-c wrap layer) library found -# -# ``F2C_INCLUDE_DIR`` -# Location of clapack headers -# -# ``F2C_LIBRARY`` -# Library containing the fortran-to-c wrap layer, necessary for clapack and automatically included when used -# -# ``LAPACK_FOUND`` -# True if clapack library found -# -# ``LAPACK_VERSION`` -# Containing the clapack version tag (manually defined) -# -# ``LAPACK_INCLUDE_DIR`` -# Location of clapack headers -# -# ``LAPACK_LIBRARY`` -# List of libraries to link with when using clapack -# -# Compatibility Targets -# ^^^^^^^^^^^^^^ -# -# This script defines the following targets for compatibility reasons: -# -# ``lapack`` -# Target to use lapack - -include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) -include(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake) -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -include(${CMAKE_ROOT}/Modules/CMakeFindDependencyMacro.cmake) - -set(CLAPACK_VERSION "3.2.1") - -set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -find_dependency(Threads) - -if(UNIX) - find_library(ADDITIONAL_LAPACK_LIBRARY m) - set(PTHREAD_LINK_NAME "-pthread") -endif() - -if(NOT F2C_LIBRARY) - find_library(F2C_LIBRARY_RELEASE NAMES f2c libf2c) - find_library(F2C_LIBRARY_DEBUG NAMES f2cd libf2cd) - select_library_configurations(F2C) - - #keep a list of "pure" f2c libs, without dependencies - set(oF2C_LIBRARY_RELEASE ${F2C_LIBRARY_RELEASE}) - set(oF2C_LIBRARY_DEBUG ${F2C_LIBRARY_DEBUG}) - set(oF2C_LIBRARY ${F2C_LIBRARY}) - - list(APPEND F2C_LIBRARY ${ADDITIONAL_LAPACK_LIBRARY}) -endif() - -if(NOT LAPACK_LIBRARY) - find_library(LAPACK_LIBRARY_RELEASE NAMES lapack) - find_library(LAPACK_LIBRARY_DEBUG NAMES lapackd) - - #keep a list of "pure" lapack libs, without dependencies - set(oLAPACK_LIBRARY_RELEASE ${LAPACK_LIBRARY_RELEASE}) - set(oLAPACK_LIBRARY_DEBUG ${LAPACK_LIBRARY_DEBUG}) - select_library_configurations(oLAPACK) - - list(APPEND LAPACK_LIBRARY_RELEASE ${F2C_LIBRARY_RELEASE}) - list(APPEND LAPACK_LIBRARY_DEBUG ${F2C_LIBRARY_DEBUG}) - - find_dependency(BLAS) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_RELEASE) - if(NOT _loc) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_RELEASE) - endif() - set(LAPACK_BLAS_LIBRARY_RELEASE ${_loc}) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_DEBUG) - if(NOT _loc) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_DEBUG) - endif() - set(LAPACK_BLAS_LIBRARY_DEBUG ${_loc}) - select_library_configurations(LAPACK_BLAS) - list(APPEND LAPACK_LIBRARY_RELEASE ${LAPACK_BLAS_LIBRARY_RELEASE}) - list(APPEND LAPACK_LIBRARY_DEBUG ${LAPACK_BLAS_LIBRARY_DEBUG}) - - select_library_configurations(LAPACK) - list(APPEND LAPACK_LIBRARY Threads::Threads) -endif() - -if(NOT F2C_INCLUDE_DIR) - find_path(F2C_INCLUDE_DIR NAMES f2c.h) -endif() - -if(NOT LAPACK_INCLUDE_DIR) - find_path(LAPACK_INCLUDE_DIR NAMES clapack.h) -endif() - -list(APPEND LAPACK_INCLUDE_DIR ${F2C_INCLUDE_DIR}) -set(LAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) -set(LAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) -set(CLAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) -set(CLAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) -set(F2C_INCLUDE_DIRS "${F2C_INCLUDE_DIR}" CACHE PATH "" FORCE) - -set(LAPACK_DLL_DIR ${LAPACK_INCLUDE_DIR}) -list(TRANSFORM LAPACK_DLL_DIR APPEND "/../bin") -message(STATUS "LAPACK_DLL_DIR: ${LAPACK_DLL_DIR}") - -if(WIN32) - find_file(LAPACK_LIBRARY_RELEASE_DLL NAMES lapack.dll PATHS ${LAPACK_DLL_DIR}) - find_file(LAPACK_LIBRARY_DEBUG_FOLDER NAMES lapackd.dll PATHS ${LAPACK_DLL_DIR}) - find_file(F2C_LIBRARY_RELEASE_DLL NAMES f2c.dll libf2c.dll PATHS ${LAPACK_DLL_DIR}) - find_file(F2C_LIBRARY_DEBUG_DLL NAMES f2cd.dll libf2cd.dll PATHS ${LAPACK_DLL_DIR}) -endif() - -set(LAPACK_BLAS_LIBRARY "${LAPACK_BLAS_LIBRARY}" CACHE STRING "" FORCE) -set(F2C_LIBRARIES "${F2C_LIBRARY}" CACHE STRING "" FORCE) -set(LAPACK_VERSION "${CLAPACK_VERSION}" CACHE STRING "" FORCE) -set(LAPACK_LIBRARIES "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) -set(CLAPACK_LIBRARY "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) -set(CLAPACK_LIBRARIES "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) - -set(LAPACK_LIBRARY "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) -set(F2C_LIBRARY "${F2C_LIBRARY}" CACHE STRING "" FORCE) -set(LAPACK_LIBRARY_RELEASE "${LAPACK_LIBRARY_RELEASE}" CACHE STRING "" FORCE) -set(LAPACK_LIBRARY_DEBUG "${LAPACK_LIBRARY_DEBUG}" CACHE STRING "" FORCE) -set(F2C_LIBRARY_RELEASE "${F2C_LIBRARY_RELEASE}" CACHE STRING "" FORCE) -set(F2C_LIBRARY_DEBUG "${F2C_LIBRARY_DEBUG}" CACHE STRING "" FORCE) - -find_package_handle_standard_args(CLAPACK DEFAULT_MSG CLAPACK_LIBRARY CLAPACK_INCLUDE_DIR) -mark_as_advanced(CLAPACK_INCLUDE_DIR CLAPACK_LIBRARY) - -find_package_handle_standard_args(LAPACK DEFAULT_MSG LAPACK_LIBRARY LAPACK_INCLUDE_DIR) -mark_as_advanced(LAPACK_INCLUDE_DIR LAPACK_LIBRARY) - -find_package_handle_standard_args(F2C DEFAULT_MSG F2C_LIBRARY F2C_INCLUDE_DIR) -mark_as_advanced(F2C_INCLUDE_DIR F2C_LIBRARY) - -#TARGETS -if(CLAPACK_FOUND AND NOT TARGET clapack::clapack) - if(EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}") - add_library(clapack::clapack SHARED IMPORTED) - set_target_properties(clapack::clapack PROPERTIES - IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE_DLL}" - IMPORTED_IMPLIB_RELEASE "${oLAPACK_LIBRARY_RELEASE}" - INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${oF2C_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${oF2C_LIBRARY_DEBUG}>;$<$<NOT:$<CONFIG:DEBUG>>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${LAPACK_BLAS_LIBRARY_DEBUG}>;$<LINK_ONLY:${ADDITIONAL_LAPACK_LIBRARY}>;$<LINK_ONLY:${PTHREAD_LINK_NAME}>" - IMPORTED_CONFIGURATIONS Release - IMPORTED_LINK_INTERFACE_LANGUAGES "C") - if(EXISTS "${LAPACK_LIBRARY_DEBUG_DLL}") - set_property(TARGET clapack::clapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) - set_target_properties(clapack::clapack PROPERTIES - IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG_DLL}" - IMPORTED_IMPLIB_DEBUG "${oLAPACK_LIBRARY_DEBUG}") - endif() - else() - add_library(clapack::clapack UNKNOWN IMPORTED) - set_target_properties(clapack::clapack PROPERTIES - IMPORTED_LOCATION_RELEASE "${oLAPACK_LIBRARY_RELEASE}" - INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${oF2C_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${oF2C_LIBRARY_DEBUG}>;$<$<NOT:$<CONFIG:DEBUG>>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${LAPACK_BLAS_LIBRARY_DEBUG}>;$<LINK_ONLY:${ADDITIONAL_LAPACK_LIBRARY}>;$<LINK_ONLY:${PTHREAD_LINK_NAME}>" - IMPORTED_CONFIGURATIONS Release - IMPORTED_LINK_INTERFACE_LANGUAGES "C") - if(EXISTS "${LAPACK_LIBRARY_DEBUG}") - set_property(TARGET clapack::clapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) - set_target_properties(clapack::clapack PROPERTIES - IMPORTED_LOCATION_DEBUG "${oLAPACK_LIBRARY_DEBUG}") - endif() - endif() -endif() - -if(CLAPACK_FOUND AND NOT TARGET lapack) - if(EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}") - add_library(lapack SHARED IMPORTED) - set_target_properties(lapack PROPERTIES - IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE_DLL}" - IMPORTED_IMPLIB_RELEASE "${oLAPACK_LIBRARY_RELEASE}" - INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${oF2C_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${oF2C_LIBRARY_DEBUG}>;$<$<NOT:$<CONFIG:DEBUG>>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${LAPACK_BLAS_LIBRARY_DEBUG}>;$<LINK_ONLY:${ADDITIONAL_LAPACK_LIBRARY}>;$<LINK_ONLY:${PTHREAD_LINK_NAME}>" - IMPORTED_CONFIGURATIONS Release - IMPORTED_LINK_INTERFACE_LANGUAGES "C") - if(EXISTS "${LAPACK_LIBRARY_DEBUG_DLL}") - set_property(TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) - set_target_properties(lapack PROPERTIES - IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG_DLL}" - IMPORTED_IMPLIB_DEBUG "${oLAPACK_LIBRARY_DEBUG}") - endif() - else() - add_library(lapack UNKNOWN IMPORTED) - set_target_properties(lapack PROPERTIES - IMPORTED_LOCATION_RELEASE "${oLAPACK_LIBRARY_RELEASE}" - INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" - IMPORTED_CONFIGURATIONS Release - INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${oF2C_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${oF2C_LIBRARY_DEBUG}>;$<$<NOT:$<CONFIG:DEBUG>>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$<CONFIG:DEBUG>:${LAPACK_BLAS_LIBRARY_DEBUG}>;$<LINK_ONLY:${ADDITIONAL_LAPACK_LIBRARY}>;$<LINK_ONLY:${PTHREAD_LINK_NAME}>" - IMPORTED_LINK_INTERFACE_LANGUAGES "C") - if(EXISTS "${LAPACK_LIBRARY_DEBUG}") - set_property(TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) - set_target_properties(lapack PROPERTIES - IMPORTED_LOCATION_DEBUG "${oLAPACK_LIBRARY_DEBUG}") - endif() - endif() -endif() +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindLAPACK
+----------
+
+Find LAPACK library
+
+This module finds an installed fortran library that implements the
+LAPACK linear-algebra interface (see http://www.netlib.org/lapack/).
+
+The approach follows that taken for the autoconf macro file,
+acx_lapack.m4 (distributed at
+http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
+
+Input Variables
+^^^^^^^^^^^^^^^
+
+The following variables may be set to influence this module's behavior:
+
+``BLA_STATIC``
+ if ``ON`` use static linkage
+
+``BLA_VENDOR``
+ If set, checks only the specified vendor, if not set checks all the
+ possibilities. List of vendors valid in this module:
+
+ * ``Intel10_32`` (intel mkl v10 32 bit)
+ * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model)
+ * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model)
+ * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model)
+ * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model)
+ * ``Intel`` (obsolete versions of mkl 32 and 64 bit)
+ * ``OpenBLAS``
+ * ``FLAME``
+ * ``ACML``
+ * ``Apple``
+ * ``NAS``
+ * ``Generic``
+
+``BLA_F95``
+ if ``ON`` tries to find BLAS95/LAPACK95
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``LAPACK_FOUND``
+ library implementing the LAPACK interface is found
+``LAPACK_LINKER_FLAGS``
+ uncached list of required linker flags (excluding -l and -L).
+``LAPACK_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use LAPACK
+``LAPACK95_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use LAPACK95
+``LAPACK95_FOUND``
+ library implementing the LAPACK95 interface is found
+
+.. note::
+
+ C or CXX must be enabled to use Intel MKL
+
+ For example, to use Intel MKL libraries and/or Intel compiler:
+
+ .. code-block:: cmake
+
+ set(BLA_VENDOR Intel10_64lp)
+ find_package(LAPACK)
+#]=======================================================================]
+
+set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
+# Check the language being used
+if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
+ if(LAPACK_FIND_REQUIRED)
+ message(FATAL_ERROR "FindLAPACK requires Fortran, C, or C++ to be enabled.")
+ else()
+ message(STATUS "Looking for LAPACK... - NOT found (Unsupported languages)")
+ return()
+ endif()
+endif()
+
+if (CMAKE_Fortran_COMPILER_LOADED)
+include(${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake)
+else ()
+include(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
+endif ()
+include(${CMAKE_ROOT}/Modules/CMakePushCheckState.cmake)
+include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
+
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
+
+set(LAPACK_FOUND FALSE)
+set(LAPACK95_FOUND FALSE)
+
+# TODO: move this stuff to separate module
+
+macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
+# This macro checks for the existence of the combination of fortran libraries
+# given by _list. If the combination is found, this macro checks (using the
+# Check_Fortran_Function_Exists macro) whether can link against that library
+# combination using the name of a routine given by _name using the linker
+# flags given by _flags. If the combination of libraries is found and passes
+# the link test, LIBRARIES is set to the list of complete library paths that
+# have been found. Otherwise, LIBRARIES is set to FALSE.
+
+# N.B. _prefix is the prefix applied to the names of all cached variables that
+# are generated internally and marked advanced by this macro.
+
+set(_libraries_work TRUE)
+set(${LIBRARIES})
+set(${LIBRARIES}_RELEASE)
+set(_combined_name)
+if (NOT _libdir)
+ if (WIN32)
+ set(_libdir ENV LIB)
+ elseif (APPLE)
+ set(_libdir ENV DYLD_LIBRARY_PATH)
+ else ()
+ set(_libdir ENV LD_LIBRARY_PATH)
+ endif ()
+endif ()
+
+list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+
+foreach(_library ${_list})
+ set(_combined_name ${_combined_name}_${_library})
+
+ if(_libraries_work)
+ if (BLA_STATIC)
+ if (WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ()
+ if (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else ()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ()
+ else ()
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # for ubuntu's libblas3gf and liblapack3gf packages
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+ endif ()
+ endif ()
+ find_library(${_prefix}_${_library}_LIBRARY_RELEASE
+ NAMES ${_library}
+ PATHS ${_libdir}
+ )
+ mark_as_advanced(${_prefix}_${_library}_LIBRARY_RELEASE)
+ find_library(${_prefix}_${_library}_LIBRARY_DEBUG
+ NAMES ${_library}d
+ PATHS ${_libdir}
+ )
+ mark_as_advanced(${_prefix}_${_library}_LIBRARY_DEBUG)
+ select_library_configurations(${_prefix}_${_library})
+ if(NOT ${_prefix}_${_library}_LIBRARY_RELEASE MATCHES "NOTFOUND")
+ set(${LIBRARIES}_RELEASE ${${LIBRARIES}_RELEASE} ${${_prefix}_${_library}_LIBRARY_RELEASE})
+ endif()
+ set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
+ set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+ endif()
+endforeach()
+
+if(_libraries_work)
+ # Test this combination of libraries.
+ if(NOT "${_blas}" STREQUAL "")
+ string(GENEX_STRIP "${_blas}" _test_blas)
+ endif()
+ if(UNIX AND BLA_STATIC)
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}_RELEASE} ${_test_blas} "-Wl,--end-group" ${_threads})
+ else()
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}_RELEASE} ${_test_blas} ${_threads})
+ endif()
+ #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
+ #message("DEBUG: _test_blas = ${_test_blas} former ${_blas}")
+ if (NOT CMAKE_Fortran_COMPILER_LOADED)
+ check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
+ else ()
+ check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
+ endif ()
+ set(CMAKE_REQUIRED_LIBRARIES)
+ set(_test_blas)
+ set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
+# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
+endif()
+
+ if(_libraries_work)
+ set(${LIBRARIES} ${${LIBRARIES}} "${_blas}" ${_threads})
+ else()
+ set(${LIBRARIES} FALSE)
+ endif()
+
+endmacro()
+
+
+set(LAPACK_LINKER_FLAGS)
+set(LAPACK_LIBRARIES)
+set(LAPACK95_LIBRARIES)
+
+
+if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_package(BLAS)
+else()
+ find_package(BLAS REQUIRED)
+endif()
+
+
+if(BLAS_FOUND)
+ set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
+ if (NOT $ENV{BLA_VENDOR} STREQUAL "")
+ set(BLA_VENDOR $ENV{BLA_VENDOR})
+ else ()
+ if(NOT BLA_VENDOR)
+ set(BLA_VENDOR "All")
+ endif()
+ endif ()
+
+#intel lapack
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
+ if (NOT WIN32)
+ set(LAPACK_mkl_LM "-lm")
+ set(LAPACK_mkl_LDL "-ldl")
+ endif ()
+ if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
+ if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_PACKAGE(Threads)
+ else()
+ find_package(Threads REQUIRED)
+ endif()
+
+ if (BLA_VENDOR MATCHES "_64ilp")
+ set(LAPACK_mkl_ILP_MODE "ilp64")
+ else ()
+ set(LAPACK_mkl_ILP_MODE "lp64")
+ endif ()
+
+ set(LAPACK_SEARCH_LIBS "")
+
+ if (BLA_F95)
+ set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
+ set(_LIBRARIES LAPACK95_LIBRARIES)
+ set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
+
+ # old
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_lapack95")
+ # new >= 10.3
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_intel_c")
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_lapack95_${LAPACK_mkl_ILP_MODE}")
+ else()
+ set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
+ set(_LIBRARIES LAPACK_LIBRARIES)
+ set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
+
+ # old
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_lapack")
+ endif()
+
+ # First try empty lapack libs
+ if (NOT ${_LIBRARIES})
+ check_lapack_libraries(
+ ${_LIBRARIES}
+ LAPACK
+ ${LAPACK_mkl_SEARCH_SYMBOL}
+ ""
+ ""
+ "${_BLAS_LIBRARIES}"
+ ""
+ )
+ endif ()
+ # Then try the search libs
+ foreach (IT ${LAPACK_SEARCH_LIBS})
+ if (NOT ${_LIBRARIES})
+ check_lapack_libraries(
+ ${_LIBRARIES}
+ LAPACK
+ ${LAPACK_mkl_SEARCH_SYMBOL}
+ ""
+ "${IT}"
+ "${_BLAS_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
+ )
+ endif ()
+ endforeach ()
+
+ unset(LAPACK_mkl_ILP_MODE)
+ unset(LAPACK_mkl_SEARCH_SYMBOL)
+ unset(LAPACK_mkl_LM)
+ unset(LAPACK_mkl_LDL)
+ endif ()
+endif()
+
+if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "goto2"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "openblas"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "flame"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif()
+endif ()
+
+#acml lapack
+ if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
+ if (BLAS_LIBRARIES MATCHES ".+acml.+")
+ set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
+ endif ()
+ endif ()
+
+# Apple LAPACK library?
+if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "Accelerate"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif()
+endif ()
+if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+ if ( NOT LAPACK_LIBRARIES )
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "vecLib"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif ()
+endif ()
+# Generic LAPACK library?
+if (BLA_VENDOR STREQUAL "Generic" OR
+ BLA_VENDOR STREQUAL "ATLAS" OR
+ BLA_VENDOR STREQUAL "All")
+ if ( NOT LAPACK_LIBRARIES )
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "lapack"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif ()
+ if ( NOT LAPACK_LIBRARIES )
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "lapack;libf2c"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif ()
+ if ( NOT LAPACK_LIBRARIES )
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "lapack;f2c"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif ()
+endif ()
+
+else()
+ message(STATUS "LAPACK requires BLAS")
+endif()
+
+if(BLA_F95)
+ if(LAPACK95_LIBRARIES)
+ set(LAPACK95_FOUND TRUE)
+ else()
+ set(LAPACK95_FOUND FALSE)
+ endif()
+ if(NOT LAPACK_FIND_QUIETLY)
+ if(LAPACK95_FOUND)
+ message(STATUS "A library with LAPACK95 API found.")
+ else()
+ if(LAPACK_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "A required library with LAPACK95 API not found. Please specify library location."
+ )
+ else()
+ message(STATUS
+ "A library with LAPACK95 API not found. Please specify library location."
+ )
+ endif()
+ endif()
+ endif()
+ set(LAPACK_FOUND "${LAPACK95_FOUND}")
+ set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
+else()
+ if(LAPACK_LIBRARIES)
+ set(LAPACK_FOUND TRUE)
+ else()
+ set(LAPACK_FOUND FALSE)
+ endif()
+
+ if(NOT LAPACK_FIND_QUIETLY)
+ if(LAPACK_FOUND)
+ message(STATUS "A library with LAPACK API found.")
+ else()
+ if(LAPACK_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "A required library with LAPACK API not found. Please specify library location."
+ )
+ else()
+ message(STATUS
+ "A library with LAPACK API not found. Please specify library location."
+ )
+ endif()
+ endif()
+ endif()
+endif()
+
+cmake_pop_check_state()
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/ports/clapack/enable_openblas_compat.patch b/ports/clapack/enable_openblas_compat.patch deleted file mode 100644 index 319935475..000000000 --- a/ports/clapack/enable_openblas_compat.patch +++ /dev/null @@ -1,112 +0,0 @@ -diff --git a/INCLUDE/blaswrap.h b/INCLUDE/blaswrap.h -index 333a17a..fb6750a 100644 ---- a/INCLUDE/blaswrap.h -+++ b/INCLUDE/blaswrap.h -@@ -155,6 +155,107 @@ - #define ctrsm_ f2c_ctrsm - #define ztrsm_ f2c_ztrsm - -+#else -+ -+#define sswap_ sswap -+#define saxpy_ saxpy -+#define sasum_ sasum -+#define isamax_ isamax -+#define scopy_ scopy -+#define sscal_ sscal -+#define sger_ sger -+#define snrm2_ snrm2 -+#define ssymv_ ssymv -+#define sdot_ sdot -+#define saxpy_ saxpy -+#define ssyr2_ ssyr2 -+#define srot_ srot -+#define sgemv_ sgemv -+#define strsv_ strsv -+#define sgemm_ sgemm -+#define strsm_ strsm -+ -+#define dswap_ dswap -+#define daxpy_ daxpy -+#define dasum_ dasum -+#define idamax_ idamax -+#define dcopy_ dcopy -+#define dscal_ dscal -+#define dger_ dger -+#define dnrm2_ dnrm2 -+#define dsymv_ dsymv -+#define ddot_ ddot -+#define dsyr2_ dsyr2 -+#define drot_ drot -+#define dgemv_ dgemv -+#define dtrsv_ dtrsv -+#define dgemm_ dgemm -+#define dtrsm_ dtrsm -+ -+#define cswap_ cswap -+#define caxpy_ caxpy -+#define scasum_ scasum -+#define icamax_ icamax -+#define ccopy_ ccopy -+#define cscal_ cscal -+#define scnrm2_ scnrm2 -+#define cgemv_ cgemv -+#define ctrsv_ ctrsv -+#define cgemm_ cgemm -+#define ctrsm_ ctrsm -+#define cgerc_ cgerc -+#define chemv_ chemv -+#define cher2_ cher2 -+ -+#define zswap_ zswap -+#define zaxpy_ zaxpy -+#define dzasum_ dzasum -+#define izamax_ izamax -+#define zcopy_ zcopy -+#define zscal_ zscal -+#define dznrm2_ dznrm2 -+#define zgemv_ zgemv -+#define ztrsv_ ztrsv -+#define zgemm_ zgemm -+#define ztrsm_ ztrsm -+#define zgerc_ zgerc -+#define zhemv_ zhemv -+#define zher2_ zher2 -+ -+/* LAPACK */ -+#define dlacon_ dlacon -+#define slacon_ slacon -+#define icmax1_ icmax1 -+#define scsum1_ scsum1 -+#define clacon_ clacon -+#define dzsum1_ dzsum1 -+#define izmax1_ izmax1 -+#define zlacon_ zlacon -+ -+/* Fortran interface */ -+#define c_bridge_dgssv_ c_bridge_dgssv -+#define c_fortran_sgssv_ c_fortran_sgssv -+#define c_fortran_dgssv_ c_fortran_dgssv -+#define c_fortran_cgssv_ c_fortran_cgssv -+#define c_fortran_zgssv_ c_fortran_zgssv -+ -+#define cdotc_ cdotc -+#define cdotu_ cdotu -+#define csscal_ csscal -+#define zdscal_ zdscal -+#define zdotc_ zdotc -+#define zdotu_ zdotu -+#define ctrmm_ ctrmm -+#define dtrmm_ dtrmm -+#define strmm_ strmm -+#define ztrmm_ ztrmm -+#define cgeru_ cgeru -+#define zgeru_ zgeru -+#define xerbla_ xerbla -+#define dtrmv_ dtrmv -+#define dsyrk_ dsyrk -+#define zherk_ zherk -+ - #endif /* NO_BLAS_WRAP */ - - #endif /* __BLASWRAP_H */ diff --git a/ports/clapack/portfile.cmake b/ports/clapack/portfile.cmake index 2845bbdc2..90169d79b 100644 --- a/ports/clapack/portfile.cmake +++ b/ports/clapack/portfile.cmake @@ -1,11 +1,5 @@ include(vcpkg_common_functions) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(VCPKG_POLICY_EMPTY_PACKAGE enabled) - message(WARNING "You do not need this package on macOS, since you already have the Accelerate Framework") - return() -endif() - vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_download_distfile(ARCHIVE @@ -14,16 +8,11 @@ vcpkg_download_distfile(ARCHIVE SHA512 cf19c710291ddff3f6ead7d86bdfdeaebca21291d9df094bf0a8ef599546b007757fb2dbb19b56511bb53ef7456eac0c73973b9627bf4d02982c856124428b49 ) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(ADDITIONAL_PATCH "enable_openblas_compat.patch") -endif() - vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH ARCHIVE ${ARCHIVE} PATCHES remove_internal_blas.patch - ${ADDITIONAL_PATCH} ) vcpkg_configure_cmake( @@ -37,7 +26,7 @@ vcpkg_install_cmake() vcpkg_copy_pdbs() #TODO: fix the official exported targets, since they are broken (luckily it seems that no-one uses them for now) -vcpkg_fixup_cmake_targets() +vcpkg_fixup_cmake_targets(CONFIG_PATH share/clapack) #we install a cmake wrapper since the official FindLAPACK module in cmake does find clapack easily, unfortunately... file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/lapack) diff --git a/ports/clapack/vcpkg-cmake-wrapper.cmake b/ports/clapack/vcpkg-cmake-wrapper.cmake index aee3e1e08..26a0a1624 100644 --- a/ports/clapack/vcpkg-cmake-wrapper.cmake +++ b/ports/clapack/vcpkg-cmake-wrapper.cmake @@ -1,8 +1,2 @@ -set(LAPACK_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) +include(${CMAKE_CURRENT_LIST_DIR}/FindLAPACK.cmake) -if(NOT LAPACK_LIBRARIES) - _find_package(${ARGS}) -endif() - -set(CMAKE_MODULE_PATH ${LAPACK_PREV_MODULE_PATH}) diff --git a/ports/cmcstl2/CONTROL b/ports/cmcstl2/CONTROL new file mode 100644 index 000000000..42b652ce4 --- /dev/null +++ b/ports/cmcstl2/CONTROL @@ -0,0 +1,4 @@ +Source: cmcstl2
+Version: 2019-07-20
+Description: An implementation of C++ Extensions for Ranges
+Homepage: https://github.com/CaseyCarter/cmcstl2
diff --git a/ports/cmcstl2/portfile.cmake b/ports/cmcstl2/portfile.cmake new file mode 100644 index 000000000..e2a0b9a3f --- /dev/null +++ b/ports/cmcstl2/portfile.cmake @@ -0,0 +1,31 @@ +# header-only library
+
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO CaseyCarter/cmcstl2
+ REF cca84b9fd362ea37334ccbe09a66be4121768ac9
+ SHA512 a528dda26964a8c29f2bf7ddb24a861f337246e9ab2bda19f62d4ca107951aa77e37070623db3b5574973404ccf2f201bc2020654b3d53de36d8a22de521e5b9
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DSTL2_BUILD_EXAMPLES=OFF
+ -DSTL2_BUILD_TESTING=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/collada-dom/CONTROL b/ports/collada-dom/CONTROL index 952f4ae50..31ded7253 100644 --- a/ports/collada-dom/CONTROL +++ b/ports/collada-dom/CONTROL @@ -1,4 +1,4 @@ Source: collada-dom
-Version: 2.5.0-1
+Version: 2.5.0-2
Description: The COLLADA Document Object Model (DOM) is an application programming interface (API) that provides a C++ object representation of a COLLADA XML instance document.
Build-Depends: zlib, libxml2, minizip, pcre, uriparser, boost-filesystem, boost-system
diff --git a/ports/collada-dom/portfile.cmake b/ports/collada-dom/portfile.cmake index f36d8e4a9..20ee9fffa 100644 --- a/ports/collada-dom/portfile.cmake +++ b/ports/collada-dom/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_from_github( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
)
vcpkg_install_cmake()
diff --git a/ports/corrade/portfile.cmake b/ports/corrade/portfile.cmake index 336cda6e3..40011f3d0 100644 --- a/ports/corrade/portfile.cmake +++ b/ports/corrade/portfile.cmake @@ -26,13 +26,23 @@ foreach(_feature IN LISTS ALL_FEATURES) endif() endforeach() +if(NOT VCPKG_CMAKE_SYSTEM_NAME) + # building for Windows desktop + if (VCPKG_PLATFORM_TOOLSET STREQUAL "v142" AND NOT VCPKG_USE_HEAD_VERSION) + message("**********") + message("WARNING: Visual Studio 2019 is not official supported by Corrade/Magnum team. Please use --head version if you intend to have upstream support.") + message("**********") + set(_CUSTOM_BUILD_FLAGS "-DCORRADE_MSVC2017_COMPATIBILITY=ON") + endif() +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA # Disable this option if project cannot be built with Ninja OPTIONS - -DDUTILITY_USE_ANSI_COLORS=ON + -DUTILITY_USE_ANSI_COLORS=ON -DBUILD_STATIC=${BUILD_STATIC} - -DCORRADE_MSVC2017_COMPATIBILITY=ON + ${_CUSTOM_BUILD_FLAGS} ${_COMPONENT_FLAGS} ) diff --git a/ports/cpp-taskflow/CONTROL b/ports/cpp-taskflow/CONTROL index 4abf5457f..69b58ea81 100644 --- a/ports/cpp-taskflow/CONTROL +++ b/ports/cpp-taskflow/CONTROL @@ -1,3 +1,3 @@ Source: cpp-taskflow
-Version: 2018-11-30
+Version: 2.2.0
Description: Fast Parallel Tasking Programming Library using Modern C++.
diff --git a/ports/cpp-taskflow/portfile.cmake b/ports/cpp-taskflow/portfile.cmake index 1f596f0d4..5160d02a2 100644 --- a/ports/cpp-taskflow/portfile.cmake +++ b/ports/cpp-taskflow/portfile.cmake @@ -5,8 +5,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO cpp-taskflow/cpp-taskflow
- REF 97252f7d782c6e896122645175c08131ce10e649
- SHA512 df8ae9ea449663cb548f3c37346c2e0c785add2d86b9c618aea2741d81fe88c34b0d3d0e610a4b571973f9bc18631becedfe28e029ecf0c0cc87e4c35a280a29
+ REF v2.2.0
+ SHA512 c075f1b7e4dd6ed6d9561b860b660ee4b28eddb321d8aa8746fbec45b1039ab686700156e4273da5a4ac7af0707975331befd9bf3e51f18925ea3a9a60083549
HEAD_REF master
)
diff --git a/ports/cppgraphqlgen/CONTROL b/ports/cppgraphqlgen/CONTROL index d3f13de82..67b17b7fc 100644 --- a/ports/cppgraphqlgen/CONTROL +++ b/ports/cppgraphqlgen/CONTROL @@ -1,4 +1,4 @@ Source: cppgraphqlgen
-Version: 3.0.0
+Version: 3.0.2
Build-Depends: boost-filesystem (!uwp&!windows), boost-program-options, pegtl, rapidjson
Description: C++ GraphQL schema service generator
diff --git a/ports/cppgraphqlgen/portfile.cmake b/ports/cppgraphqlgen/portfile.cmake index 5c92e1a60..b4f22868e 100644 --- a/ports/cppgraphqlgen/portfile.cmake +++ b/ports/cppgraphqlgen/portfile.cmake @@ -2,9 +2,9 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
- REPO Microsoft/cppgraphqlgen
- REF v3.0.0
- SHA512 26da9b559b7220f44bc1aabd68250a4cf869329a5496ac439f9bc7cea5137e0ef9068dc6e868adf441cd5c212f21dd08f0a21db393eb4c237525961eefd49389
+ REPO microsoft/cppgraphqlgen
+ REF v3.0.2
+ SHA512 ae2e94e7cb8853c88d2dbf226dec52e30fb16d1889f14f94d2a585dd2be1985e58ac8c16765b970c4417c08d519b32514080d90bfab7e34b66dc7c32b9f9caa6
HEAD_REF master
)
diff --git a/ports/cpprestsdk/CONTROL b/ports/cpprestsdk/CONTROL index be8d24045..877164673 100644 --- a/ports/cpprestsdk/CONTROL +++ b/ports/cpprestsdk/CONTROL @@ -1,19 +1,23 @@ Source: cpprestsdk -Version: 2.10.14 -Build-Depends: zlib, openssl (!uwp&!windows), boost-system (!uwp&!windows), boost-date-time (!uwp&!windows), boost-regex (!uwp&!windows), boost-thread (!uwp&!windows), boost-filesystem (!uwp&!windows), boost-random (!uwp&!windows), boost-chrono (!uwp&!windows), boost-asio (!uwp&!windows) +Version: 2.10.14-1 +Build-Depends: openssl (!uwp&!windows), boost-system (!uwp&!windows), boost-date-time (!uwp&!windows), boost-regex (!uwp&!windows), boost-thread (!uwp&!windows), boost-filesystem (!uwp&!windows), boost-random (!uwp&!windows), boost-chrono (!uwp&!windows), boost-asio (!uwp&!windows) Homepage: https://github.com/Microsoft/cpprestsdk Description: C++11 JSON, REST, and OAuth library The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services. Default-Features: default-features Feature: default-features -Build-Depends: cpprestsdk[brotli] (windows), cpprestsdk[websockets] +Build-Depends: cpprestsdk[brotli] (windows), cpprestsdk[core], cpprestsdk[compression], cpprestsdk[websockets] Description: Features installed by default +Feature: compression +Build-Depends: zlib +Description: HTTP Compression support + Feature: websockets -Build-Depends: websocketpp (!uwp), openssl (!uwp), boost-system (!uwp), boost-date-time (!uwp), boost-regex (!uwp) +Build-Depends: cpprestsdk[core], cpprestsdk[compression], websocketpp (!uwp), openssl (!uwp), boost-system (!uwp), boost-date-time (!uwp), boost-regex (!uwp) Description: Websockets support Feature: brotli -Build-Depends: brotli +Build-Depends: cpprestsdk[core], cpprestsdk[compression], brotli Description: Brotli compression support diff --git a/ports/cpprestsdk/portfile.cmake b/ports/cpprestsdk/portfile.cmake index 8add4c1ab..4a6dad142 100644 --- a/ports/cpprestsdk/portfile.cmake +++ b/ports/cpprestsdk/portfile.cmake @@ -16,16 +16,21 @@ if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") -DWEBSOCKETPP_CONFIG_VERSION=${WEBSOCKETPP_PATH}) endif() -set(CPPREST_EXCLUDE_WEBSOCKETS ON) -if("websockets" IN_LIST FEATURES) - set(CPPREST_EXCLUDE_WEBSOCKETS OFF) -endif() - set(CPPREST_EXCLUDE_BROTLI ON) if ("brotli" IN_LIST FEATURES) set(CPPREST_EXCLUDE_BROTLI OFF) endif() +set(CPPREST_EXCLUDE_COMPRESSION ON) +if ("compression" IN_LIST FEATURES) + set(CPPREST_EXCLUDE_COMPRESSION OFF) +endif() + +set(CPPREST_EXCLUDE_WEBSOCKETS ON) +if("websockets" IN_LIST FEATURES) + set(CPPREST_EXCLUDE_WEBSOCKETS OFF) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/Release PREFER_NINJA @@ -33,6 +38,8 @@ vcpkg_configure_cmake( ${OPTIONS} -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF + -DCPPREST_EXCLUDE_BROTLI=${CPPREST_EXCLUDE_BROTLI} + -DCPPREST_EXCLUDE_COMPRESSION=${CPPREST_EXCLUDE_COMPRESSION} -DCPPREST_EXCLUDE_WEBSOCKETS=${CPPREST_EXCLUDE_WEBSOCKETS} -DCPPREST_EXPORT_DIR=share/cpprestsdk -DWERROR=OFF diff --git a/ports/cppzmq/CONTROL b/ports/cppzmq/CONTROL index f50dd4103..c98e464ca 100644 --- a/ports/cppzmq/CONTROL +++ b/ports/cppzmq/CONTROL @@ -1,5 +1,5 @@ Source: cppzmq -Version: 4.3.0-1 +Version: 4.4.1 Build-Depends: zeromq Homepage: https://github.com/zeromq/cppzmq Description: lightweight messaging kernel, C++ bindings diff --git a/ports/cppzmq/portfile.cmake b/ports/cppzmq/portfile.cmake index cd281513a..52c4126c4 100644 --- a/ports/cppzmq/portfile.cmake +++ b/ports/cppzmq/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO zeromq/cppzmq - REF v4.3.0 - SHA512 c9e08e48795b9043c689ffa6953ac59e0fe79d9110d79e06609ab67bf76bea52147b59ecf033f7a06e57d5eb0c3c6bc79634af789966ff22d7d80091d19b135d + REF v4.4.1 + SHA512 5178a24413e44a6d99e57db7c9859c72279304272baa0e1fb810174cdf592cb567cab98428ef3ab611042bdf4bc506867421662409d1f0d82c233cb83ebdb801 HEAD_REF master ) diff --git a/ports/ctbignum/CONTROL b/ports/ctbignum/CONTROL new file mode 100644 index 000000000..977abc21f --- /dev/null +++ b/ports/ctbignum/CONTROL @@ -0,0 +1,6 @@ +Source: ctbignum +Version: 2019-08-02 +Homepage: https://github.com/niekbouman/ctbignum +Description: This is a header-only template library for fixed-width "small big-integer" computations, for use during run-time as well as compile-time. +Build-Depends: boost + diff --git a/ports/ctbignum/portfile.cmake b/ports/ctbignum/portfile.cmake new file mode 100644 index 000000000..6d297117f --- /dev/null +++ b/ports/ctbignum/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO niekbouman/ctbignum + REF cf3233d8b7dcff59f29a7389204959ee2228a4af + SHA512 8cd5e187836f48165a088a171c87ce438393e66f7362af1b67a253ae6ef0b17c41468e21e0dfe337094796f2b2a2fa5062cc9a9231afc377f187baf1ead1257e + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCTBIGNUM_BuildTests=OFF + -DCTBIGNUM_BuildBenchmarks=OFF +) + +vcpkg_install_cmake() + +# Move CMake files to the right place +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) +# Remove empty files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) + diff --git a/ports/ctemplate/CONTROL b/ports/ctemplate/CONTROL index d5fadf3ea..00abc1f96 100644 --- a/ports/ctemplate/CONTROL +++ b/ports/ctemplate/CONTROL @@ -1,4 +1,4 @@ Source: ctemplate -Version: 2017-06-23-44b7c5-3 +Version: 2017-06-23-44b7c5-4 Homepage: https://github.com/OlafvdSpek/ctemplate Description: C++ CTemplate system diff --git a/ports/ctemplate/portfile.cmake b/ports/ctemplate/portfile.cmake index d22c3afa4..d5d8b3960 100644 --- a/ports/ctemplate/portfile.cmake +++ b/ports/ctemplate/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_find_acquire_program(PYTHON3) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DPYTHON_EXECUTABLE=${PYTHON3} OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON ) diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL index 0b2028369..72d5d3e66 100644 --- a/ports/curl/CONTROL +++ b/ports/curl/CONTROL @@ -1,5 +1,5 @@ Source: curl -Version: 7.65.0-3 +Version: 7.65.2-1 Build-Depends: zlib Homepage: https://github.com/curl/curl Description: A library for transferring data with URLs diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index 5c4f94fdf..49d4d12e6 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO curl/curl - REF curl-7_65_0 - SHA512 436b6b42654c1db2b3f69df410a7f28401a50faf18e74f328a93585c147541e697664b0e9e7df03239fd76c797c1bb4f435f4c668a6b0ad28bdd67e17f786491 + REF curl-7_65_2 + SHA512 8e06377a6d8837a4c2cd96f978f0ac848b9472500fd25983bb1f9e5f52d9d6f7ff0c71d443587a979cf80fd19412bb64b9362b774cf91e02479fdfad7e085b16 HEAD_REF master PATCHES 0001_cmake.patch diff --git a/ports/cutelyst2/CONTROL b/ports/cutelyst2/CONTROL index 499e039ce..8d5ce89a0 100644 --- a/ports/cutelyst2/CONTROL +++ b/ports/cutelyst2/CONTROL @@ -1,4 +1,4 @@ Source: cutelyst2 -Version: 2.7.0 +Version: 2.8.0 Description: A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework Build-Depends: qt5-base diff --git a/ports/cutelyst2/fix-static-build.patch b/ports/cutelyst2/fix-static-build.patch new file mode 100644 index 000000000..e40cd1dab --- /dev/null +++ b/ports/cutelyst2/fix-static-build.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9a695fd..0667668 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -129,6 +129,33 @@ add_definitions( + -DQT_DISABLE_DEPRECATED_BEFORE=0x050c00 + ) + ++if (BUILD_WIN_STATIC) ++ add_definitions( ++ -DCutelyst2Qt5_EXPORTS ++ -DActionRenderView_EXPORTS ++ -DActionREST_EXPORTS ++ -DActionRoleACL_EXPORTS ++ -DCutelyst2Qt5Authentication_EXPORTS ++ -DCutelyst2Qt5Session_EXPORTS ++ -DCutelyst2Qt5StaticSimple_EXPORTS ++ -DCutelyst2Qt5StaticCompressed_EXPORTS ++ -DCutelyst2Qt5UtilsPagination_EXPORTS ++ -DCutelyst2Qt5StatusMessage_EXPORTS ++ -DCutelyst2Qt5Memcached_EXPORTS ++ -DCutelyst2Qt5MemcachedSessionStore_EXPORTS ++ -DCutelyst2Qt5CSRFProtection_EXPORTS ++ -DCutelyst2Qt5UtilsSql_EXPORTS ++ -DCutelyst2Qt5UtilsValidator_EXPORTS ++ -DCutelyst2Qt5UtilsLangSelect_EXPORTS ++ -DCutelyst2Qt5ViewClearSilver_EXPORTS ++ -DCutelyst2Qt5ViewEmail_EXPORTS ++ -DCutelyst2Qt5ViewGrantlee_EXPORTS ++ -DCutelyst2Qt5ViewJson_EXPORTS ++ -DCutelyst2Qt5Wsgi_EXPORTS ++ -DCutelyst2Qt5UserAgent_EXPORTS ++ ) ++endif() ++ + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/ports/cutelyst2/portfile.cmake b/ports/cutelyst2/portfile.cmake index 755cc3ed5..320059cd9 100644 --- a/ports/cutelyst2/portfile.cmake +++ b/ports/cutelyst2/portfile.cmake @@ -3,16 +3,23 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO cutelyst/cutelyst - REF v2.7.0 - SHA512 78848d6d4e79149d9e9ae07211875dd212eb046bcdde7cde0bd781ed89d006247b21bc7a37c4e028d0982bb0f69654d469eb37b857dc0d585e9adc79ecd6291d + REF c020f115b392bb8e22bed1e1669724102a31ab0c #v2.8.0 + SHA512 79b440f6dc0a78bc6b3ea83b496a4a9fd7bb016ea2492393c53d82af2c304291ac62a11af96bb05b1fc6422bf2012bec501bb8eb4bd770c54ad166d119891bc1 HEAD_REF master + PATCHES fix-static-build.patch ) +set(BUILD_WIN_STATIC OFF) +if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(BUILD_WIN_STATIC ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DBUILD_TESTS:BOOL=OFF + -DBUILD_WIN_STATIC=${BUILD_WIN_STATIC} ) vcpkg_install_cmake() diff --git a/ports/cxxopts/CONTROL b/ports/cxxopts/CONTROL index 1d5664cec..53da6cd4e 100644 --- a/ports/cxxopts/CONTROL +++ b/ports/cxxopts/CONTROL @@ -1,4 +1,4 @@ Source: cxxopts -Version: 2.1.2-1 +Version: 2.2.0 Homepage: https://github.com/jarro2783/cxxopts Description: This is a lightweight C++ option parser library, supporting the standard GNU style syntax for options diff --git a/ports/cxxopts/portfile.cmake b/ports/cxxopts/portfile.cmake index dd5981e7d..b1c6697ed 100644 --- a/ports/cxxopts/portfile.cmake +++ b/ports/cxxopts/portfile.cmake @@ -2,8 +2,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO jarro2783/cxxopts - REF v2.1.2 - SHA512 7ee3725995d4d0f78b75d1d87f10290f20529ca4aa430eb8dd1c59d98c6e99c54b54fc545926b59f499d02ae4f75f9064b3b5ebbab3f74031d3638e7a2378440 + REF v2.2.0 + SHA512 9f5182b3a86b3d47d1ce5e1e222ab596fce59d3b2dcc0ab2c3802338d5e0f3e6556f2a5ff2accb32cae7e2db41ac5a361c93bf0256f9e44c316eaa4b47c19efa HEAD_REF master ) @@ -12,6 +12,7 @@ vcpkg_configure_cmake( PREFER_NINJA OPTIONS -DCXXOPTS_BUILD_EXAMPLES=OFF + -DCXXOPTS_BUILD_TESTS=OFF ) vcpkg_install_cmake() diff --git a/ports/czmq/CONTROL b/ports/czmq/CONTROL index 55cba0bd4..4d68f15b1 100644 --- a/ports/czmq/CONTROL +++ b/ports/czmq/CONTROL @@ -1,5 +1,5 @@ Source: czmq -Version: 2019-06-10-1 +Version: 2019-06-10-3 Build-Depends: zeromq Description: High-level C binding for ZeroMQ Homepage: https://github.com/zeromq/czmq diff --git a/ports/czmq/portfile.cmake b/ports/czmq/portfile.cmake index bba5e6e22..2545feea5 100644 --- a/ports/czmq/portfile.cmake +++ b/ports/czmq/portfile.cmake @@ -27,13 +27,13 @@ endforeach() string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) -vcpkg_check_features( - draft ENABLE_DRAFTS - tool BUILD_TOOLS - curl CZMQ_WITH_LIBCURL - httpd CZMQ_WITH_LIBMICROHTTPD - lz4 CZMQ_WITH_LZ4 - uuid CZMQ_WITH_UUID +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + draft ENABLE_DRAFTS + tool BUILD_TOOLS + curl CZMQ_WITH_LIBCURL + httpd CZMQ_WITH_LIBMICROHTTPD + lz4 CZMQ_WITH_LZ4 + uuid CZMQ_WITH_UUID ) vcpkg_configure_cmake( @@ -69,7 +69,7 @@ else() set(EXECUTABLE_SUFFIX "") endif() -if (BUILD_TOOLS) +if ("tool" IN_LIST FEATURES) file(COPY ${CURRENT_PACKAGES_DIR}/bin/zmakecert${EXECUTABLE_SUFFIX} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) diff --git a/ports/darknet/CONTROL b/ports/darknet/CONTROL index d31d4ef1d..6979c310c 100644 --- a/ports/darknet/CONTROL +++ b/ports/darknet/CONTROL @@ -1,5 +1,5 @@ Source: darknet -Version: 0.2.5-4 +Version: 0.2.5-6 Description: Darknet is an open source neural network framework written in C and CUDA. You only look once (YOLO) is a state-of-the-art, real-time object detection system, best example of darknet functionalities. Build-Depends: pthreads (windows), stb Default-Features: weights @@ -13,8 +13,11 @@ Build-Depends: cuda Description: Build darknet with support for CUDA Feature: weights -Description: Download common weights from official websites, using vcpkg proxy-enabled functions +Description: Download pre-built weights for test + +Feature: weights-train +Description: Download pre-built weights for training Feature: opencv-cuda -Build-Depends: opencv[ffmpeg], opencv[cuda] +Build-Depends: darknet[opencv], darknet[cuda] Description: Build darknet with support for a CUDA-enabled OpenCV diff --git a/ports/darknet/portfile.cmake b/ports/darknet/portfile.cmake index 3fb49e687..a18c97a91 100644 --- a/ports/darknet/portfile.cmake +++ b/ports/darknet/portfile.cmake @@ -11,22 +11,17 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO AlexeyAB/darknet - REF a1abd07e23fc5b143a6197de9908fe4f33791c6a - SHA512 df91bf595666a4db5beb5cc55f6c60be19667ab987a784faef04cf2215317c9a340cfc0a200640741fcc88c29cff077d5153b86ff497c31ad5ad132f05987516 + REF b2d795e34e1d734d0f451ce9847a0e6b68c32351 + SHA512 1964aa0d768d37fc614983718aede8b29e562fd8120116b7cd7a1331bb8a3256e28c01cdff6f19bbe7b9d6289b3292188205f362bae38393cee33d8a2e6a5273 HEAD_REF master ) -vcpkg_check_features( - "cuda" ENABLE_CUDA - "opencv" ENABLE_OPENCV +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + "cuda" ENABLE_CUDA + "opencv" ENABLE_OPENCV ) -if("opencv-cuda" IN_LIST FEATURES) - set(ENABLE_OPENCV ON) - set(ENABLE_CUDA ON) -endif() - -if (ENABLE_CUDA) +if ("cuda" IN_LIST FEATURES) if (NOT VCPKG_CMAKE_SYSTEM_NAME AND NOT ENV{CUDACXX}) #CMake looks for nvcc only in PATH and CUDACXX env vars for the Ninja generator. Since we filter path on vcpkg and CUDACXX env var is not set by CUDA installer on Windows, CMake cannot find CUDA when using Ninja generator, so we need to manually enlight it if necessary (https://gitlab.kitware.com/cmake/cmake/issues/19173). Otherwise we could just disable Ninja and use MSBuild, but unfortunately CUDA installer does not integrate with some distributions of MSBuild (like the ones inside Build Tools), making CUDA unavailable otherwise in those cases, which we want to avoid set(ENV{CUDACXX} "$ENV{CUDA_PATH}/bin/nvcc.exe") @@ -56,8 +51,22 @@ if("weights" IN_LIST FEATURES) ) endif() -#make sure we don't use any integrated pre-built library +if("weights-train" IN_LIST FEATURES) + vcpkg_download_distfile(IMAGENET_CONV_WEIGHTS_V3 + URLS "https://pjreddie.com/media/files/darknet53.conv.74" + FILENAME "darknet-cache/darknet53.conv.74" + SHA512 8983e1c129e2d6e8e3da0cc0781ecb7a07813830ef5a87c24b53100df6a5f23db6c6e6a402aec78025a93fe060b75d1958f1b8f7439a04b54a3f19c81e2ae99b + ) + vcpkg_download_distfile(IMAGENET_CONV_WEIGHTS_V2 + URLS "https://pjreddie.com/media/files/darknet19_448.conv.23" + FILENAME "darknet-cache/darknet19_448.conv.23" + SHA512 8016f5b7ddc15c5d7dad231592f5351eea65f608ebdb204f545034dde904e11962f693080dfeb5a4510e7b71bdda151a9121ba0f8a243018d680f01b1efdbd31 + ) +endif() + +#make sure we don't use any integrated pre-built library nor any unnecessary CMake module file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty) +file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindPThreads_windows.cmake) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} @@ -66,13 +75,11 @@ vcpkg_configure_cmake( OPTIONS -DINSTALL_BIN_DIR:STRING=bin -DINSTALL_LIB_DIR:STRING=lib - -DENABLE_CUDA=${ENABLE_CUDA} - -DENABLE_OPENCV=${ENABLE_OPENCV} + ${FEATURE_OPTIONS} ) vcpkg_install_cmake() -#somehow the native CMAKE_EXECUTABLE_SUFFIX does not work, so here we emulate it if(CMAKE_HOST_WIN32) set(EXECUTABLE_SUFFIX ".exe") else() @@ -101,8 +108,6 @@ endif() vcpkg_fixup_cmake_targets() file(COPY ${SOURCE_PATH}/cmake/Modules/FindCUDNN.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/darknet) -file(COPY ${SOURCE_PATH}/cmake/Modules/FindPThreads_windows.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/darknet) -file(COPY ${SOURCE_PATH}/cmake/Modules/FindStb.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/darknet) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) @@ -115,3 +120,8 @@ if("weights" IN_LIST FEATURES) file(COPY ${VCPKG_ROOT_DIR}/downloads/darknet-cache/yolov3-tiny.weights DESTINATION ${CURRENT_PACKAGES_DIR}/tools/darknet) file(COPY ${VCPKG_ROOT_DIR}/downloads/darknet-cache/yolov2-tiny.weights DESTINATION ${CURRENT_PACKAGES_DIR}/tools/darknet) endif() + +if("weights-train" IN_LIST FEATURES) + file(COPY ${VCPKG_ROOT_DIR}/downloads/darknet-cache/darknet53.conv.74 DESTINATION ${CURRENT_PACKAGES_DIR}/tools/darknet) + file(COPY ${VCPKG_ROOT_DIR}/downloads/darknet-cache/darknet19_448.conv.23 DESTINATION ${CURRENT_PACKAGES_DIR}/tools/darknet) +endif() diff --git a/ports/date/CMakeLists.txt b/ports/date/CMakeLists.txt index 292c1758a..bacbf2716 100644 --- a/ports/date/CMakeLists.txt +++ b/ports/date/CMakeLists.txt @@ -18,8 +18,8 @@ target_include_directories(tz PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DI if(HAS_REMOTE_API) find_package(CURL REQUIRED) - target_link_libraries(tz PUBLIC $<BUILD_INTERFACE:${CURL_LIBRARIES}>) target_include_directories(tz PUBLIC $<BUILD_INTERFACE:${CURL_INCLUDE_DIRS}>) + target_link_libraries(tz PUBLIC ${CURL_LIBRARIES}) endif() if(BUILD_SHARED_LIBS) diff --git a/ports/date/CONTROL b/ports/date/CONTROL index 93f4b37cd..03cd721cb 100644 --- a/ports/date/CONTROL +++ b/ports/date/CONTROL @@ -1,5 +1,5 @@ Source: date -Version: ed0368f +Version: 2019-05-18-1 Homepage: https://github.com/HowardHinnant/date Description: A date and time library based on the C++11/14/17 <chrono> header diff --git a/ports/dbg-macro/CONTROL b/ports/dbg-macro/CONTROL new file mode 100644 index 000000000..80a2e3165 --- /dev/null +++ b/ports/dbg-macro/CONTROL @@ -0,0 +1,4 @@ +Source: dbg-macro +Version: 2019-07-11 +Description: A dbg(...) macro for C++ +Homepage: https://github.com/sharkdp/dbg-macro diff --git a/ports/dbg-macro/portfile.cmake b/ports/dbg-macro/portfile.cmake new file mode 100644 index 000000000..3aee7268d --- /dev/null +++ b/ports/dbg-macro/portfile.cmake @@ -0,0 +1,16 @@ +# single header file library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO sharkdp/dbg-macro + REF 4409d8428baf700873bcfee42e63bbca6700b97e + SHA512 f9f936707631bee112566a24c92cbf171e54362099df689253ab38d0489400f65c284df81749376f18cb3ebcefea3cc18844554016798c2542ec73dc2afcc931 + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/dbg.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/dbow2/CONTROL b/ports/dbow2/CONTROL new file mode 100644 index 000000000..4b5c4c1e0 --- /dev/null +++ b/ports/dbow2/CONTROL @@ -0,0 +1,5 @@ +Source: dbow2 +Version: 2019-08-05 +Homepage: https://github.com/dorian3d/DBoW2 +Description: DBoW2 is an improved version of the DBow library, an open source C++ library for indexing and converting images into a bag-of-word representation. +Build-Depends: opencv diff --git a/ports/dbow2/portfile.cmake b/ports/dbow2/portfile.cmake new file mode 100644 index 000000000..c569e89ac --- /dev/null +++ b/ports/dbow2/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO dorian3d/DBoW2 + REF 4d08e9fc751fac9063874d85a43c1ccdcda8b401 + SHA512 0a4ad8506c731395cb23d96d0e8afe4131576af88468723b9496cdbc95a031089ecdeb61dbb7205cb3a7599acb60a39887fa9852e7d7a690b8152a1bd26d9bd0 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS -DBUILD_Demo=OFF +) + +vcpkg_install_cmake() + +# Move CMake files to the right place +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/DBoW2) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/DBoW2/DBoW2Config.cmake) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) + diff --git a/ports/dimcli/CONTROL b/ports/dimcli/CONTROL index e98f11565..12078257a 100644 --- a/ports/dimcli/CONTROL +++ b/ports/dimcli/CONTROL @@ -1,4 +1,4 @@ Source: dimcli -Version: 4.1.0 +Version: 4.1.0-1 Homepage: https://github.com/gknowles/dimcli Description: C++ command line parser toolkit diff --git a/ports/dimcli/fix-NameBoolean.patch b/ports/dimcli/fix-NameBoolean.patch new file mode 100644 index 000000000..35eb64d68 --- /dev/null +++ b/ports/dimcli/fix-NameBoolean.patch @@ -0,0 +1,63 @@ +diff --git a/libs/dimcli/cli.cpp b/libs/dimcli/cli.cpp +index 9e67c12..c96bd24 100644 +--- a/libs/dimcli/cli.cpp ++++ b/libs/dimcli/cli.cpp +@@ -388,8 +388,8 @@ GroupConfig const & Cli::Config::findGrpOrDie(Cli const & cli) { + ***/ + + //=========================================================================== +-Cli::OptBase::OptBase(string const & names, bool boolean) +- : m_bool{boolean} ++Cli::OptBase::OptBase(string const & names, bool in_boolean) ++ : m_bool{in_boolean} + , m_names{names} + { + // set m_fromName and assert if names is malformed +@@ -486,12 +486,12 @@ static bool includeName( + OptName const & name, + NameListType type, + Cli::OptBase const & opt, +- bool boolean, ++ bool in_boolean, + bool inverted + ) { + if (name.opt != &opt) + return false; +- if (boolean) { ++ if (in_boolean) { + if (type == kNameEnable) + return !name.invert; + if (type == kNameDisable) +diff --git a/libs/dimcli/cli.h b/libs/dimcli/cli.h +index 2c1615c..3e4f405 100644 +--- a/libs/dimcli/cli.h ++++ b/libs/dimcli/cli.h +@@ -818,7 +818,7 @@ public: + }; + + public: +- OptBase(std::string const & keys, bool boolean); ++ OptBase(std::string const & keys, bool in_boolean); + virtual ~OptBase() {} + + //----------------------------------------------------------------------- +@@ -952,7 +952,7 @@ inline void Cli::OptBase::setValueDesc<DIMCLI_LIB_FILESYSTEM_PATH>() { + template <typename A, typename T> + class Cli::OptShim : public OptBase { + public: +- OptShim(std::string const & keys, bool boolean); ++ OptShim(std::string const & keys, bool in_boolean); + OptShim(OptShim const &) = delete; + OptShim & operator=(OptShim const &) = delete; + +@@ -1100,8 +1100,8 @@ protected: + + //=========================================================================== + template <typename A, typename T> +-Cli::OptShim<A, T>::OptShim(std::string const & keys, bool boolean) +- : OptBase(keys, boolean) ++Cli::OptShim<A, T>::OptShim(std::string const & keys, bool in_boolean) ++ : OptBase(keys, in_boolean) + { + setValueDesc<T>(); + } diff --git a/ports/dimcli/portfile.cmake b/ports/dimcli/portfile.cmake index 6362aa987..2d231117c 100644 --- a/ports/dimcli/portfile.cmake +++ b/ports/dimcli/portfile.cmake @@ -6,6 +6,8 @@ vcpkg_from_github( REF v4.1.0 SHA512 5de010b5abfda9e6996bba8c621e03ae0cf81dbc2f69cd859e2ebf7b1706c451f7f8e142299784646d89ca3c3e5803e8711215680b8bdb8eb663158bff3b4f3d HEAD_REF master + PATCHES + fix-NameBoolean.patch ) set(staticCrt OFF) if(VCPKG_CRT_LINKAGE STREQUAL "static") diff --git a/ports/directxmesh/CONTROL b/ports/directxmesh/CONTROL index 700756964..331466f53 100644 --- a/ports/directxmesh/CONTROL +++ b/ports/directxmesh/CONTROL @@ -1,4 +1,4 @@ Source: directxmesh -Version: apr2019 +Version: jun2019-1 Homepage: https://github.com/Microsoft/DirectXMesh Description: DirectXMesh geometry processing library
\ No newline at end of file diff --git a/ports/directxmesh/portfile.cmake b/ports/directxmesh/portfile.cmake index 53cd44b0c..3cf718727 100644 --- a/ports/directxmesh/portfile.cmake +++ b/ports/directxmesh/portfile.cmake @@ -3,14 +3,14 @@ include(vcpkg_common_functions) vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
if(NOT VCPKG_CRT_LINKAGE STREQUAL "dynamic")
- message(FATAL_ERROR "DirectXMesh only supports dynamic CRT linkage")
+ message(FATAL_ERROR "DirectXMesh only supports dynamic CRT linkage")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/DirectXMesh
- REF apr2019 - SHA512 a9e0dbf6483633a1727592de7e2fa733de993daff848d9ec2241ce54b67c7d24ed0419058f2f6ce256021dcf7e16d178b62ed9b8c7a1756504ab044f8740be1d
+ REF jun2019
+ SHA512 6d42cd4d3e34e7f3bd5cee1a9ad90c9f89eafa55951a0a8d776034a05caa06b0fd17629547d14c8f2b4d0c5fafdbd24ae05c2a6582b5d069093d6b4dadac09a0
HEAD_REF master
)
@@ -20,8 +20,24 @@ ELSE() SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
ENDIF()
+if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
+ set(VS_VERSION "2015")
+elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
+ set(VS_VERSION "2017")
+elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
+ set(VS_VERSION "2019")
+else()
+ message(FATAL_ERROR "Unsupported platform toolset.")
+endif()
+
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(SLN_NAME "Windows10_${VS_VERSION}")
+else()
+ set(SLN_NAME "Desktop_${VS_VERSION}")
+endif()
+
vcpkg_build_msbuild(
- PROJECT_PATH ${SOURCE_PATH}/DirectXMesh_Desktop_2017.sln
+ PROJECT_PATH ${SOURCE_PATH}/DirectXMesh_${SLN_NAME}.sln
PLATFORM ${BUILD_ARCH}
)
@@ -30,17 +46,21 @@ file(INSTALL ${SOURCE_PATH}/DirectXMesh/DirectXMesh.inl
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
+
file(INSTALL
- ${SOURCE_PATH}/DirectXMesh/Bin/Desktop_2017/${BUILD_ARCH}/Debug/DirectXMesh.lib
+ ${SOURCE_PATH}/DirectXMesh/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXMesh.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL
- ${SOURCE_PATH}/DirectXMesh/Bin/Desktop_2017/${BUILD_ARCH}/Release/DirectXMesh.lib
+ ${SOURCE_PATH}/DirectXMesh/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXMesh.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
-set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools)
-file(INSTALL
- ${SOURCE_PATH}/Meshconvert/Bin/Desktop_2017/${BUILD_ARCH}/Release/Meshconvert.exe
- DESTINATION ${TOOL_PATH})
+if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/directxmesh)
+ file(MAKE_DIRECTORY ${TOOL_PATH})
+ file(INSTALL
+ ${SOURCE_PATH}/Meshconvert/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/Meshconvert.exe
+ DESTINATION ${TOOL_PATH})
+endif()
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxmesh)
diff --git a/ports/directxtex/CONTROL b/ports/directxtex/CONTROL index 69b6d2ee2..4eb03bb01 100644 --- a/ports/directxtex/CONTROL +++ b/ports/directxtex/CONTROL @@ -1,4 +1,4 @@ Source: directxtex
-Version: apr2019
+Version: jun2019-1
Homepage: https://github.com/Microsoft/DirectXTex
Description: DirectXTex texture processing library
\ No newline at end of file diff --git a/ports/directxtex/portfile.cmake b/ports/directxtex/portfile.cmake index 94f9b69cb..a58d53169 100644 --- a/ports/directxtex/portfile.cmake +++ b/ports/directxtex/portfile.cmake @@ -9,8 +9,8 @@ endif() vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/DirectXTex
- REF apr2019 - SHA512 3e50c5beb25416a0720614321bb2b712b5677b50989909ca703801080023f8f8ad168bbe4e5dc522500325989a8f6982026d7dc5029ee28d9dcfe35efdd002de
+ REF jun2019
+ SHA512 036a4593f8117e622cd6f609aea5bad734f9c3fc239984ec4f970cb6634ac3097cdb5ed2e467d3b1549e2340bcfe10ee4925b4e3691cf7f729ca538d3724c26e
HEAD_REF master
)
@@ -20,8 +20,24 @@ ELSE() SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
ENDIF()
+if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
+ set(VS_VERSION "2015")
+elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
+ set(VS_VERSION "2017")
+elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
+ set(VS_VERSION "2019")
+else()
+ message(FATAL_ERROR "Unsupported platform toolset.")
+endif()
+
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(SLN_NAME "Windows10_${VS_VERSION}")
+else()
+ set(SLN_NAME "Desktop_${VS_VERSION}")
+endif()
+
vcpkg_build_msbuild(
- PROJECT_PATH ${SOURCE_PATH}/DirectXTex_Desktop_2017.sln
+ PROJECT_PATH ${SOURCE_PATH}/DirectXTex_${SLN_NAME}.sln
PLATFORM ${BUILD_ARCH}
)
@@ -31,23 +47,25 @@ file(INSTALL DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
file(INSTALL
- ${SOURCE_PATH}/DirectXTex/Bin/Desktop_2017/${BUILD_ARCH}/Debug/DirectXTex.lib
+ ${SOURCE_PATH}/DirectXTex/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXTex.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL
- ${SOURCE_PATH}/DirectXTex/Bin/Desktop_2017/${BUILD_ARCH}/Release/DirectXTex.lib
+ ${SOURCE_PATH}/DirectXTex/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXTex.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
-set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools)
-file(MAKE_DIRECTORY ${TOOL_PATH})
-file(INSTALL
- ${SOURCE_PATH}/Texdiag/Bin/Desktop_2017/${BUILD_ARCH}/Release/texdiag.exe
- DESTINATION ${TOOL_PATH})
-file(INSTALL
- ${SOURCE_PATH}/Texconv/Bin/Desktop_2017/${BUILD_ARCH}/Release/Texconv.exe
- DESTINATION ${TOOL_PATH})
-file(INSTALL
- ${SOURCE_PATH}/Texassemble/Bin/Desktop_2017/${BUILD_ARCH}/Release/Texassemble.exe
- DESTINATION ${TOOL_PATH})
+if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/directxtex)
+ file(MAKE_DIRECTORY ${TOOL_PATH})
+ file(INSTALL
+ ${SOURCE_PATH}/Texdiag/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/texdiag.exe
+ DESTINATION ${TOOL_PATH})
+ file(INSTALL
+ ${SOURCE_PATH}/Texconv/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/Texconv.exe
+ DESTINATION ${TOOL_PATH})
+ file(INSTALL
+ ${SOURCE_PATH}/Texassemble/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/Texassemble.exe
+ DESTINATION ${TOOL_PATH})
+endif()
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/DirectXTex)
diff --git a/ports/directxtk/CONTROL b/ports/directxtk/CONTROL index 469788934..cbe291a8f 100644 --- a/ports/directxtk/CONTROL +++ b/ports/directxtk/CONTROL @@ -1,4 +1,4 @@ Source: directxtk -Version: apr2019 +Version: jun2019-1 Homepage: https://github.com/Microsoft/DirectXTK Description: A collection of helper classes for writing DirectX 11.x code in C++. diff --git a/ports/directxtk/fix-invalid-configuration.patch b/ports/directxtk/fix-invalid-configuration.patch new file mode 100644 index 000000000..785fd009a --- /dev/null +++ b/ports/directxtk/fix-invalid-configuration.patch @@ -0,0 +1,39 @@ +diff --git a/DirectXTK_Windows10.sln b/DirectXTK_Windows10.sln
+index 8962307..9e3b8a7 100644
+--- a/DirectXTK_Windows10.sln
++++ b/DirectXTK_Windows10.sln
+@@ -15,11 +15,11 @@ Global
+ Debug|ARM = Debug|ARM
+ Debug|ARM64 = Debug|ARM64
+ Debug|x64 = Debug|x64
+- Debug|x86 = Debug|x86
++ Debug|Win32 = Debug|Win32
+ Release|ARM = Release|ARM
+ Release|ARM64 = Release|ARM64
+ Release|x64 = Release|x64
+- Release|x86 = Release|x86
++ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM.ActiveCfg = Debug|ARM
+@@ -28,16 +28,16 @@ Global
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM64.Build.0 = Debug|ARM64
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.ActiveCfg = Debug|x64
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.Build.0 = Debug|x64
+- {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.ActiveCfg = Debug|Win32
+- {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.Build.0 = Debug|Win32
++ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|Win32.ActiveCfg = Debug|Win32
++ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|Win32.Build.0 = Debug|Win32
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.ActiveCfg = Release|ARM
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.Build.0 = Release|ARM
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM64.ActiveCfg = Release|ARM64
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM64.Build.0 = Release|ARM64
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.ActiveCfg = Release|x64
+ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.Build.0 = Release|x64
+- {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.ActiveCfg = Release|Win32
+- {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.Build.0 = Release|Win32
++ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|Win32.ActiveCfg = Release|Win32
++ {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
diff --git a/ports/directxtk/portfile.cmake b/ports/directxtk/portfile.cmake index 245c8a4af..df5e7a02b 100644 --- a/ports/directxtk/portfile.cmake +++ b/ports/directxtk/portfile.cmake @@ -3,14 +3,14 @@ include(vcpkg_common_functions) vcpkg_check_linkage(ONLY_STATIC_LIBRARY) if(NOT VCPKG_CRT_LINKAGE STREQUAL "dynamic") - message(FATAL_ERROR "DirectXTK only supports dynamic CRT linkage") + message(FATAL_ERROR "DirectXTK only supports dynamic CRT linkage") endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Microsoft/DirectXTK - REF apr2019 - SHA512 811ed222c1650d34a8475e44719cca8972a85d96f9ccb10548e1501eb9d28fd8685de90832b517cdcbf21ae8c9160dea69000e8dca06fab745a15a7acc14ba98 + REF jun2019 + SHA512 211b18ee0755802a5d44b58da2485276cabdee222d2f5fd7b42bad0bf75810e3ac1bd319b90891d9cc0345b124631ad37588422af9120cece9fa0ed769033e77 HEAD_REF master ) @@ -20,34 +20,50 @@ ELSE() SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) ENDIF() +if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140") + set(VS_VERSION "2015") +elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v141") + set(VS_VERSION "2017") +elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v142") + set(VS_VERSION "2019") +else() + message(FATAL_ERROR "Unsupported platform toolset.") +endif() + +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(SLN_NAME "Windows10_${VS_VERSION}") +else() + set(SLN_NAME "Desktop_${VS_VERSION}") +endif() + vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/DirectXTK_Desktop_2017.sln + PROJECT_PATH ${SOURCE_PATH}/DirectXTK_${SLN_NAME}.sln PLATFORM ${BUILD_ARCH} ) file(INSTALL - ${SOURCE_PATH}/Bin/Desktop_2017/${BUILD_ARCH}/Release/DirectXTK.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib) - -file(INSTALL - ${SOURCE_PATH}/Bin/Desktop_2017/${BUILD_ARCH}/Debug/DirectXTK.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) - -set(DXTK_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/directxtk) -file(MAKE_DIRECTORY ${DXTK_TOOL_PATH}) + ${SOURCE_PATH}/Inc/ + DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK +) file(INSTALL - ${SOURCE_PATH}/MakeSpriteFont/bin/Release/MakeSpriteFont.exe - DESTINATION ${DXTK_TOOL_PATH}) + ${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXTK.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(INSTALL - ${SOURCE_PATH}/XWBTool/Bin/Desktop_2017/${BUILD_ARCH}/Release/XWBTool.exe - DESTINATION ${DXTK_TOOL_PATH}) + ${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXTK.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) -file(INSTALL - ${SOURCE_PATH}/Inc/ - DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK -) +if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(DXTK_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/directxtk) + file(MAKE_DIRECTORY ${DXTK_TOOL_PATH}) + file(INSTALL + ${SOURCE_PATH}/MakeSpriteFont/bin/Release/MakeSpriteFont.exe + DESTINATION ${DXTK_TOOL_PATH}) + file(INSTALL + ${SOURCE_PATH}/XWBTool/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/XWBTool.exe + DESTINATION ${DXTK_TOOL_PATH}) +endif() # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxtk RENAME copyright) diff --git a/ports/directxtk12/CONTROL b/ports/directxtk12/CONTROL index 466acece6..2d7c849c2 100644 --- a/ports/directxtk12/CONTROL +++ b/ports/directxtk12/CONTROL @@ -1,4 +1,4 @@ Source: directxtk12
-Version: dec2016-1
+Version: jun2019-1
Homepage: https://github.com/Microsoft/DirectXTK12
Description: A collection of helper classes for writing DirectX 12 code in C++.
diff --git a/ports/directxtk12/portfile.cmake b/ports/directxtk12/portfile.cmake index d51a82b81..114165fb4 100644 --- a/ports/directxtk12/portfile.cmake +++ b/ports/directxtk12/portfile.cmake @@ -3,19 +3,15 @@ include(vcpkg_common_functions) vcpkg_check_linkage(ONLY_STATIC_LIBRARY) if(NOT VCPKG_CRT_LINKAGE STREQUAL "dynamic") - message(FATAL_ERROR "DirectXTk12 only supports dynamic CRT linkage") + message(FATAL_ERROR "DirectXTK12 only supports dynamic CRT linkage") endif() -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK12-dec2016) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Microsoft/DirectXTK12/archive/dec2016.tar.gz" - FILENAME "DirectXTK12-dec2016.tar.gz" - SHA512 7c98fbf1d7ef96807a38d396a87dacdc60fdcd7e461210d246cc424789c4c5c5fb1390db958c1bd1f77da8af756a9eae36813e5da6bbb0ea1432ff4004f1d010 -) -vcpkg_extract_source_archive(${ARCHIVE}) - -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/DirectXTK_Desktop_2015_Win10.sln +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Microsoft/DirectXTK12 + REF jun2019 + SHA512 f635746ff92cf3b60b96f74f5ada5fb8409d1ac6e2729d24ebf0ebb275e26d373ec0ccdfbb66a3cb967267da86de4d70304d1f3326b738f94f5a8fc0d43a8c97 + HEAD_REF master ) IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") @@ -24,17 +20,38 @@ ELSE() SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) ENDIF() -file(INSTALL - ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Release/DirectXTK12.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib) -file(INSTALL - ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Debug/DirectXTK12.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140") + set(VS_VERSION "2015") +elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v141") + set(VS_VERSION "2017") +elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v142") + set(VS_VERSION "2019") +else() + message(FATAL_ERROR "Unsupported platform toolset.") +endif() + +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(SLN_NAME "Windows10_${VS_VERSION}") +else() + set(SLN_NAME "Desktop_${VS_VERSION}_Win10") +endif() + +vcpkg_build_msbuild( + PROJECT_PATH ${SOURCE_PATH}/DirectXTK_${SLN_NAME}.sln +) file(INSTALL ${SOURCE_PATH}/Inc/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK12 ) +file(INSTALL + ${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXTK12.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + +file(INSTALL + ${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXTK12.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxtk12 RENAME copyright) diff --git a/ports/discount/CONTROL b/ports/discount/CONTROL new file mode 100644 index 000000000..51c8b5e90 --- /dev/null +++ b/ports/discount/CONTROL @@ -0,0 +1,4 @@ +Source: discount
+Version: 2.2.6
+Homepage: https://github.com/Orc/discount
+Description: DISCOUNT is a implementation of John Gruber & Aaron Swartz's Markdown markup language.
diff --git a/ports/discount/blocktags b/ports/discount/blocktags new file mode 100644 index 000000000..dfd3957c3 --- /dev/null +++ b/ports/discount/blocktags @@ -0,0 +1,34 @@ +static struct kw blocktags[] = {
+ { "P", 1, 0 },
+ { "DL", 2, 0 },
+ { "H1", 2, 0 },
+ { "H2", 2, 0 },
+ { "H3", 2, 0 },
+ { "H4", 2, 0 },
+ { "H5", 2, 0 },
+ { "H6", 2, 0 },
+ { "HR", 2, 1 },
+ { "OL", 2, 0 },
+ { "UL", 2, 0 },
+ { "BDO", 3, 0 },
+ { "DFN", 3, 0 },
+ { "DIV", 3, 0 },
+ { "MAP", 3, 0 },
+ { "PRE", 3, 0 },
+ { "WBR", 3, 0 },
+ { "XMP", 3, 0 },
+ { "FORM", 4, 0 },
+ { "NOBR", 4, 0 },
+ { "STYLE", 5, 0 },
+ { "TABLE", 5, 0 },
+ { "CENTER", 6, 0 },
+ { "IFRAME", 6, 0 },
+ { "OBJECT", 6, 0 },
+ { "SCRIPT", 6, 0 },
+ { "ADDRESS", 7, 0 },
+ { "LISTING", 7, 0 },
+ { "PLAINTEXT", 9, 0 },
+ { "BLOCKQUOTE", 10, 0 },
+};
+
+#define NR_blocktags 30
diff --git a/ports/discount/cmake.patch b/ports/discount/cmake.patch new file mode 100644 index 000000000..8a2278cf7 --- /dev/null +++ b/ports/discount/cmake.patch @@ -0,0 +1,27 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 3895fdb..a183836 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -182,7 +182,10 @@ if(${PROJECT_NAME}_MAKE_INSTALL) + target_include_directories(libmarkdown INTERFACE + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> + ) +- set(_TARGETS libmarkdown markdown) ++ set(_TARGETS libmarkdown) ++ if(NOT ${PROJECT_NAME}_ONLY_LIBRARY) ++ set(_TARGETS ${_TARGETS} markdown) ++ endif() + if(${PROJECT_NAME}_INSTALL_SAMPLES) + list(APPEND _TARGETS mkd2html makepage) + endif() +diff --git a/cmake/config.h.in b/cmake/config.h.in +index e08220d..e630934 100644 +--- a/cmake/config.h.in ++++ b/cmake/config.h.in +@@ -74,4 +74,6 @@ + + #define TABSTOP @TABSTOP@ + ++#define DESTRUCTOR ++ + #endif /* _CONFIG_D */ diff --git a/ports/discount/disable-deprecated-warnings.patch b/ports/discount/disable-deprecated-warnings.patch new file mode 100644 index 000000000..e8f4f0fb7 --- /dev/null +++ b/ports/discount/disable-deprecated-warnings.patch @@ -0,0 +1,16 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 11fa675..34cc9ed 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -20,6 +20,11 @@ set(${PROJECT_NAME}_INSTALL_SAMPLES OFF CACHE BOOL + set(${PROJECT_NAME}_ONLY_LIBRARY OFF CACHE BOOL + "Set to ON to only build markdown library (default is OFF)") + ++# MSVC deprecated warnings (C4996,strdup, ...) ++if(MSVC) ++ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) ++endif() ++ + # Check headers + include(CheckIncludeFile) + check_include_file(libgen.h HAVE_LIBGEN_H) diff --git a/ports/discount/generate-blocktags-command.patch b/ports/discount/generate-blocktags-command.patch new file mode 100644 index 000000000..13d63a25d --- /dev/null +++ b/ports/discount/generate-blocktags-command.patch @@ -0,0 +1,29 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index a183836..e9deef5 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -113,12 +115,19 @@ configure_file("${_ROOT}/mkdio.h.in" + + include_directories("${_ROOT}") + +-add_executable(mktags +- "${_ROOT}/mktags.c") + +-add_custom_command(OUTPUT "${_ROOT}/blocktags" +- COMMAND mktags > blocktags +- WORKING_DIRECTORY "${_ROOT}") ++if(NOT GENERATE_BLOCKTAGS) ++ message(STATUS "Not generating blocktags") ++else() ++ message(STATUS "Using mktags to generate blocktags") ++ ++ add_executable(mktags ++ "${_ROOT}/mktags.c") ++ ++ add_custom_command(OUTPUT "${_ROOT}/blocktags" ++ COMMAND mktags > blocktags ++ WORKING_DIRECTORY "${_ROOT}") ++endif() + + add_library(libmarkdown + "${_ROOT}/mkdio.c" diff --git a/ports/discount/portfile.cmake b/ports/discount/portfile.cmake new file mode 100644 index 000000000..6a40d5105 --- /dev/null +++ b/ports/discount/portfile.cmake @@ -0,0 +1,45 @@ +include(vcpkg_common_functions)
+
+# No dynamic link for MSVC
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Orc/discount
+ REF v2.2.6
+ SHA512 4c5956dea78aacd3a105ddac13f1671d811a5b2b04990cdf8485c36190c8872c4b1b9432a7236f669c34b07564ecd0096632dced54d67de9eaf4f23641417ecc
+ HEAD_REF master
+ PATCHES
+ cmake.patch
+ generate-blocktags-command.patch
+ disable-deprecated-warnings.patch
+)
+
+set(GENERATE_BLOCKTAGS ON)
+if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" OR VCPKG_TARGET_ARCHITECTURE MATCHES "arm64" OR VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
+ set(GENERATE_BLOCKTAGS OFF)
+endif()
+
+if(NOT GENERATE_BLOCKTAGS)
+ configure_file("${CURRENT_PORT_DIR}/blocktags" "${SOURCE_PATH}/blocktags" COPYONLY)
+ message(STATUS "Copied blocktags")
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH "${SOURCE_PATH}/cmake"
+ PREFER_NINJA
+ DISABLE_PARALLEL_CONFIGURE
+ OPTIONS
+ -DDISCOUNT_ONLY_LIBRARY=ON
+ -DGENERATE_BLOCKTAGS=${GENERATE_BLOCKTAGS}
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/discount)
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/discount" RENAME copyright)
+
diff --git a/ports/dlfcn-win32/CONTROL b/ports/dlfcn-win32/CONTROL index 24af3631f..453ecf9e4 100644 --- a/ports/dlfcn-win32/CONTROL +++ b/ports/dlfcn-win32/CONTROL @@ -1,4 +1,4 @@ Source: dlfcn-win32 -Version: 1.1.1-1 +Version: 1.1.1-2 Homepage: https://github.com/dlfcn-win32/dlfcn-win32 Description: dlfcn-win32 is an implementation of dlfcn for Windows. diff --git a/ports/dlfcn-win32/portfile.cmake b/ports/dlfcn-win32/portfile.cmake index 77fd87b12..d67fb00fe 100644 --- a/ports/dlfcn-win32/portfile.cmake +++ b/ports/dlfcn-win32/portfile.cmake @@ -22,6 +22,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/drlibs/CONTROL b/ports/drlibs/CONTROL new file mode 100644 index 000000000..284f99c35 --- /dev/null +++ b/ports/drlibs/CONTROL @@ -0,0 +1,4 @@ +Source: drlibs +Version: 2019-08-12 +Homepage: https://github.com/mackron/dr_libs +Description: A collection of public domain single-file libraries for C/C++. diff --git a/ports/drlibs/portfile.cmake b/ports/drlibs/portfile.cmake new file mode 100644 index 000000000..3c50aff94 --- /dev/null +++ b/ports/drlibs/portfile.cmake @@ -0,0 +1,17 @@ +#header-only library +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mackron/dr_libs + REF b777360d73c10a367d268a8bb51bc0d1f36020b5 + SHA512 65d2c01ea72868e1212dc5af6b8bad7603a40e030a6c6ee59ae4e723de9c974ed31385475e2bcf0f22d424666fc70c7851c3998d0c51afc845785e71ed267a8f + HEAD_REF master +) + +# Put the licence file where vcpkg expects it +file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/drlibs) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/drlibs/README.md ${CURRENT_PACKAGES_DIR}/share/drlibs/copyright) + +# Copy the header files +file(GLOB HEADER_FILES ${SOURCE_PATH}/*.h) +file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include) diff --git a/ports/duckx/CONTROL b/ports/duckx/CONTROL new file mode 100644 index 000000000..59dda99b7 --- /dev/null +++ b/ports/duckx/CONTROL @@ -0,0 +1,4 @@ +Source: duckx
+Version: 2019-08-06
+Homepage: https://github.com/amiremohamadi/DuckX
+Description: DuckX is a library for creation of Office docx files.
diff --git a/ports/duckx/portfile.cmake b/ports/duckx/portfile.cmake new file mode 100644 index 000000000..66bcdff25 --- /dev/null +++ b/ports/duckx/portfile.cmake @@ -0,0 +1,20 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO amiremohamadi/DuckX + REF 98c946ad13559c03e9c7f2b050b9f70d5caf509e + SHA512 20e8970a1faff6e2ff5bc106bd038396d05ace3517ac83583712263870c4b007ebc407b5d69c482f7117ac155aa85f9928d5ee524f75897e8e12eb3659d16c15 +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) + +file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/duckx) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/duckx RENAME copyright) diff --git a/ports/duktape/CONTROL b/ports/duktape/CONTROL index 5f212d705..08c822fad 100644 --- a/ports/duktape/CONTROL +++ b/ports/duktape/CONTROL @@ -1,5 +1,5 @@ Source: duktape
-Version: 2.3.0-1
+Version: 2.3.0-2
Homepage: https://github.com/svaarala/duktape
Description: Embeddable Javascript engine with a focus on portability and compact footprint.
Build-Depends:
diff --git a/ports/duktape/portfile.cmake b/ports/duktape/portfile.cmake index e15ca137b..fe2c9a494 100644 --- a/ports/duktape/portfile.cmake +++ b/ports/duktape/portfile.cmake @@ -48,6 +48,7 @@ vcpkg_apply_patches( ) vcpkg_configure_cmake( + PREFER_NINJA SOURCE_PATH ${SOURCE_PATH} ) diff --git a/ports/easycl/CONTROL b/ports/easycl/CONTROL new file mode 100644 index 000000000..ad61f2260 --- /dev/null +++ b/ports/easycl/CONTROL @@ -0,0 +1,5 @@ +Source: easycl +Version: 0.3 +Homepage: https://github.com/architector1324/EasyCL +Build-Depends: opencl +Description: OpenCL based lightweight c++ computing library diff --git a/ports/easycl/portfile.cmake b/ports/easycl/portfile.cmake new file mode 100644 index 000000000..694a853bb --- /dev/null +++ b/ports/easycl/portfile.cmake @@ -0,0 +1,15 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO architector1324/EasyCL + REF 0.3 + SHA512 c0e9aa03c9039e9ffe4794ccc4e85654f8267924e577cf96fd8d5e141fab9e8f6dc4668ee4475d6df3ba77572e52a181493acd3dfdb0abf7bd83b7e3d4d08a29 + HEAD_REF master +) + +# Handle headers +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp") + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/easycl RENAME copyright) diff --git a/ports/easyhook/CONTROL b/ports/easyhook/CONTROL new file mode 100644 index 000000000..a47eb803d --- /dev/null +++ b/ports/easyhook/CONTROL @@ -0,0 +1,4 @@ +Source: easyhook
+Version: 2.7.6789.0
+Homepage: https://github.com/EasyHook/EasyHook
+Description: This project supports extending (hooking) unmanaged code (APIs) with pure managed ones, from within a fully managed environment on 32- or 64-bit Windows Vista x64, Windows Server 2008 x64, Windows 7, Windows 8.1, and Windows 10.
\ No newline at end of file diff --git a/ports/easyhook/fix-build.patch b/ports/easyhook/fix-build.patch new file mode 100644 index 000000000..230faf65d --- /dev/null +++ b/ports/easyhook/fix-build.patch @@ -0,0 +1,128 @@ +diff --git a/EasyHookDll/EasyHookDll.vcxproj b/EasyHookDll/EasyHookDll.vcxproj +index ec66f91..5773555 100644 +--- a/EasyHookDll/EasyHookDll.vcxproj ++++ b/EasyHookDll/EasyHookDll.vcxproj +@@ -188,7 +188,7 @@ + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> +- <SmallerTypeCheck>true</SmallerTypeCheck> ++ <SmallerTypeCheck>false</SmallerTypeCheck> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> +@@ -207,10 +207,6 @@ + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll" +-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> +- </PostBuildEvent> + <MASM> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> + </MASM> +@@ -223,7 +219,7 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> +- <SmallerTypeCheck>true</SmallerTypeCheck> ++ <SmallerTypeCheck>false</SmallerTypeCheck> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> +@@ -242,10 +238,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll" +-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> +- </PostBuildEvent> + <MASM> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> + </MASM> +@@ -261,7 +253,7 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> +- <SmallerTypeCheck>true</SmallerTypeCheck> ++ <SmallerTypeCheck>false</SmallerTypeCheck> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> +@@ -278,10 +270,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll" +-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> +- </PostBuildEvent> + <MASM> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> + </MASM> +@@ -297,7 +285,7 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> +- <SmallerTypeCheck>true</SmallerTypeCheck> ++ <SmallerTypeCheck>false</SmallerTypeCheck> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> +@@ -314,10 +302,6 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll" +-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> +- </PostBuildEvent> + <MASM> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> + </MASM> +@@ -355,10 +339,6 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll" +-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> +- </PostBuildEvent> + <MASM> + <GenerateDebugInformation>false</GenerateDebugInformation> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> +@@ -397,10 +377,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll" +-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> +- </PostBuildEvent> + <MASM> + <GenerateDebugInformation>false</GenerateDebugInformation> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> +@@ -439,10 +415,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll" +-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> +- </PostBuildEvent> + <MASM> + <GenerateDebugInformation>false</GenerateDebugInformation> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> +@@ -481,10 +453,6 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> +- <PostBuildEvent> +- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll" +-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command> +- </PostBuildEvent> + <MASM> + <GenerateDebugInformation>false</GenerateDebugInformation> + <UseSafeExceptionHandlers>false</UseSafeExceptionHandlers> diff --git a/ports/easyhook/portfile.cmake b/ports/easyhook/portfile.cmake new file mode 100644 index 000000000..d74457880 --- /dev/null +++ b/ports/easyhook/portfile.cmake @@ -0,0 +1,38 @@ +include(vcpkg_common_functions)
+
+if (NOT VCPKG_TARGET_IS_WINDOWS)
+ message(FATAL_ERROR "easyhook only support windows.")
+endif()
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ message(FATAL_ERROR "easyhook can only be built as dynamic library.")
+endif()
+
+message(".Net framework 4.0 is required, please install it before install easyhook.")
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO EasyHook/EasyHook
+ REF v2.7.6789.0
+ SHA512 a48b4fe6dd2e55a2d515bc917c0f3ff5b73f08d1778e671df802347c3b8e1d4638005582a494acdf891ffe3fa6eae3eab0096083a8af2352e3f0883eb83421d6
+ HEAD_REF master
+ PATCHES fix-build.patch
+)
+
+vcpkg_install_msbuild(
+ SOURCE_PATH ${SOURCE_PATH}
+ PROJECT_SUBPATH EasyHook.sln
+ TARGET EasyHookDll
+ RELEASE_CONFIGURATION "netfx4-Release"
+ DEBUG_CONFIGURATION "netfx4-Debug"
+)
+
+# These libraries are useless, so remove.
+file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/EasyHook.dll ${CURRENT_PACKAGES_DIR}/bin/EasyHook.pdb)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/EasyHook.dll ${CURRENT_PACKAGES_DIR}/debug/bin/EasyHook.pdb)
+
+# Install includes
+file(INSTALL ${SOURCE_PATH}/Public/easyhook.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/easyhook)
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/easyhook RENAME copyright)
diff --git a/ports/easyloggingpp/CONTROL b/ports/easyloggingpp/CONTROL index 9e2427ff9..a10dbb2d6 100644 --- a/ports/easyloggingpp/CONTROL +++ b/ports/easyloggingpp/CONTROL @@ -1,3 +1,3 @@ Source: easyloggingpp
-Version: 9.96.7
+Version: 9.96.7-1
Description: Easylogging++ is a single header efficient logging library for C++ applications.
\ No newline at end of file diff --git a/ports/easyloggingpp/portfile.cmake b/ports/easyloggingpp/portfile.cmake index 8294e0a81..56ba406b7 100644 --- a/ports/easyloggingpp/portfile.cmake +++ b/ports/easyloggingpp/portfile.cmake @@ -12,6 +12,7 @@ vcpkg_from_github( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-Dbuild_static_lib=ON
)
diff --git a/ports/ecm/CONTROL b/ports/ecm/CONTROL index 075cf894f..4f98c2290 100644 --- a/ports/ecm/CONTROL +++ b/ports/ecm/CONTROL @@ -1,4 +1,4 @@ Source: ecm -Version: 5.58.0 +Version: 5.60.0-1 Homepage: https://github.com/KDE/extra-cmake-modules Description: Extra CMake Modules (ECM), extra modules and scripts for CMake diff --git a/ports/ecm/portfile.cmake b/ports/ecm/portfile.cmake index 8211fb97a..ab92b3086 100644 --- a/ports/ecm/portfile.cmake +++ b/ports/ecm/portfile.cmake @@ -4,13 +4,14 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO KDE/extra-cmake-modules - REF v5.58.0 - SHA512 c08408c5842789ce61d17642025edca022bcc0b78aba3d7dc0af5a6973f5f26ebe6f65e6d97e516e64eaf778d4a70397c76a96c45a6ee8bda3f2a9d9fff5966e + REF v5.60.0 + SHA512 98c7cbb0a84fbd4806cdf84538cb16717cbbb13fa5cce5c4bf9a507a699c579fa6f88af5091b3d311bdd504a119d6147114b2fad5de2dfd5f18448bca60cdc92 HEAD_REF master ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF diff --git a/ports/ecsutil/CONTROL b/ports/ecsutil/CONTROL index f008311f2..9621f8781 100644 --- a/ports/ecsutil/CONTROL +++ b/ports/ecsutil/CONTROL @@ -1,4 +1,4 @@ -Source: ecsutil
-Version: 1.0.6.1-1
-Description: Native Windows SDK for accessing ECS via the S3 HTTP protocol.
-Build-Depends: atlmfc (windows)
+Source: ecsutil +Version: 1.0.7.2 +Description: Native Windows SDK for accessing ECS via the S3 HTTP protocol. +Build-Depends: atlmfc (windows) diff --git a/ports/ecsutil/portfile.cmake b/ports/ecsutil/portfile.cmake index 966281a4f..eeb9eca53 100644 --- a/ports/ecsutil/portfile.cmake +++ b/ports/ecsutil/portfile.cmake @@ -28,8 +28,8 @@ endif() vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO EMCECS/ecs-object-client-windows-cpp
- REF v1.0.6.1
- SHA512 4b16b9ce1dbc9f541fe95a40c10678cd2b0192acc94bc3d57e58fbdf37964af84cdc901686555aad1f58d133632b1ad6f57976a5ac71aed1fce2fb44a2d0f8d3
+ REF v1.0.7.2
+ SHA512 2505db74b370271bd9ad8e73248e3d29384ad9a6f1c8246203abe82f99ea8f75419482031024127361358c339955fd2a029a5c77f5ce6e7a35c18f1fc0635c88
HEAD_REF master
PATCHES NoLibSyms.patch
)
diff --git a/ports/expat/CONTROL b/ports/expat/CONTROL index f01b5b9e1..68629eb2d 100644 --- a/ports/expat/CONTROL +++ b/ports/expat/CONTROL @@ -1,4 +1,4 @@ Source: expat -Version: 2.2.6 +Version: 2.2.7 Homepage: https://github.com/libexpat/libexpat Description: XML parser library written in C diff --git a/ports/expat/portfile.cmake b/ports/expat/portfile.cmake index 7e2c322db..7b97fb3de 100644 --- a/ports/expat/portfile.cmake +++ b/ports/expat/portfile.cmake @@ -6,8 +6,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libexpat/libexpat - REF R_2_2_6 - SHA512 727fbd24041c9af71b32353448583a6d8b38ddf93b10c97510e847939c2ad2be9b40ff6e6e27b725bff277982c2fc96c75f19c4a3ac4a246133eb62870c963d8 + REF R_2_2_7 + SHA512 11b1f9a135c4501ef0112e17da8381e956366165a11a384daedd4cdef9a00c3112c8f6ff8c8f6d3b5e7b71b9a73041f23beac0f27e9cfafe1ec0266d95870408 HEAD_REF master) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) diff --git a/ports/fast-cpp-csv-parser/CONTROL b/ports/fast-cpp-csv-parser/CONTROL new file mode 100644 index 000000000..a9766a66a --- /dev/null +++ b/ports/fast-cpp-csv-parser/CONTROL @@ -0,0 +1,4 @@ +Source: fast-cpp-csv-parser +Version: 2019-08-14 +Description: A small, easy-to-use and fast header-only library for reading comma separated value (CSV) files +Homepage: https://github.com/ben-strasser/fast-cpp-csv-parser diff --git a/ports/fast-cpp-csv-parser/portfile.cmake b/ports/fast-cpp-csv-parser/portfile.cmake new file mode 100644 index 000000000..be3ef7e88 --- /dev/null +++ b/ports/fast-cpp-csv-parser/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ben-strasser/fast-cpp-csv-parser + REF 78f413248fdeea27368481c4a1d48c059ac36680 + SHA512 f8eb477e0b5e82f5b5d7bdf045094dcc59433e7b6305a1e16e45c2c24f4bbb7f6e9540e17a8ffafce29ea2ebe3a2647174824abe80da5f2054f7df3d7da8c28d + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/csv.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/fastfeat/CONTROL b/ports/fastfeat/CONTROL index ff76128fc..934993034 100644 --- a/ports/fastfeat/CONTROL +++ b/ports/fastfeat/CONTROL @@ -1,3 +1,3 @@ Source: fastfeat
-Version: 391d5e9
+Version: 391d5e9-1
Description: FAST feature detectors in C
diff --git a/ports/fastfeat/portfile.cmake b/ports/fastfeat/portfile.cmake index 95d178ea4..7fd35b9f8 100644 --- a/ports/fastfeat/portfile.cmake +++ b/ports/fastfeat/portfile.cmake @@ -17,6 +17,7 @@ DESTINATION ${SOURCE_PATH} vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=ON
)
diff --git a/ports/fastlz/CONTROL b/ports/fastlz/CONTROL index 4154ea953..98b53557e 100644 --- a/ports/fastlz/CONTROL +++ b/ports/fastlz/CONTROL @@ -1,4 +1,4 @@ Source: fastlz -Version: 1.0-2 +Version: 1.0-3 Homepage: https://github.com/ariya/FastLZ Description: A lightning-fast lossless compression library diff --git a/ports/fastlz/portfile.cmake b/ports/fastlz/portfile.cmake index 857dd7d0b..38c71aade 100644 --- a/ports/fastlz/portfile.cmake +++ b/ports/fastlz/portfile.cmake @@ -14,6 +14,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL index 4c1565679..abf59b857 100644 --- a/ports/ffmpeg/CONTROL +++ b/ports/ffmpeg/CONTROL @@ -1,5 +1,5 @@ Source: ffmpeg -Version: 4.1-8 +Version: 4.1-10 Homepage: https://ffmpeg.org Description: a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations. @@ -45,3 +45,6 @@ Description: allow nonfree and unredistributable libraries Feature: gpl Description: allow GPL licensed libraries + +Feature: avresample +Description: Libav audio resampling library support in ffmpeg diff --git a/ports/ffmpeg/FindFFMPEG.cmake b/ports/ffmpeg/FindFFMPEG.cmake index 65ab59e90..b3c187340 100644 --- a/ports/ffmpeg/FindFFMPEG.cmake +++ b/ports/ffmpeg/FindFFMPEG.cmake @@ -35,6 +35,8 @@ include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) include(${CMAKE_ROOT}/Modules/CMakeFindDependencyMacro.cmake) +set(FFMPEG_VERSION "4.1") + find_dependency(Threads) #list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS Threads::Threads) if(UNIX) @@ -83,7 +85,7 @@ macro(FFMPEG_FIND_GENEX varname shortname headername) set(FFMPEG_${varname}_FOUND 1) list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR}) endif() -endmacro(FFMPEG_FIND) +endmacro(FFMPEG_FIND_GENEX) if(WIN32) if(NOT FFMPEG_${varname}_INCLUDE_DIRS) @@ -92,8 +94,39 @@ if(WIN32) if (FFMPEG_stdint_INCLUDE_DIRS) set(STDINT_OK TRUE) endif() + FFMPEG_FIND_GENEX(libzlib zlib zlib.h) else() set(STDINT_OK TRUE) + FFMPEG_FIND_GENEX(libzlib z zlib.h) +endif() + +if(APPLE) + find_library(VT_UNIT VideoToolbox) + if (NOT VT_UNIT) + message(FATAL_ERROR "VideoToolbox not found") + endif() + find_library(AT_UNIT AudioToolbox) + if (NOT AT_UNIT) + message(FATAL_ERROR "AudioToolbox not found") + endif() + find_library(SEC_UNIT Security) + if (NOT SEC_UNIT) + message(FATAL_ERROR "Security not found") + endif() + find_library(CF_UNIT CoreFoundation) + if (NOT CF_UNIT) + message(FATAL_ERROR "CoreFoundation not found") + endif() + find_library(CM_UNIT CoreMedia) + if (NOT CM_UNIT) + message(FATAL_ERROR "CoreMedia not found") + endif() + find_library(CV_UNIT CoreVideo) + if (NOT CV_UNIT) + message(FATAL_ERROR "CoreVideo not found") + endif() + find_package(Iconv QUIET) + list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${VT_UNIT} ${AT_UNIT} ${SEC_UNIT} ${CF_UNIT} ${CM_UNIT} ${CV_UNIT} ${Iconv_LIBRARIES}) endif() FFMPEG_FIND(libavcodec avcodec avcodec.h) @@ -103,13 +136,20 @@ FFMPEG_FIND(libavformat avformat avformat.h) FFMPEG_FIND(libavutil avutil avutil.h) FFMPEG_FIND(libswresample swresample swresample.h) FFMPEG_FIND(libswscale swscale swscale.h) -FFMPEG_FIND_GENEX(libzlib zlib zlib.h) if (FFMPEG_libavcodec_FOUND AND FFMPEG_libavdevice_FOUND AND FFMPEG_libavfilter_FOUND AND FFMPEG_libavformat_FOUND AND FFMPEG_libavutil_FOUND AND FFMPEG_libswresample_FOUND AND FFMPEG_libswscale_FOUND AND FFMPEG_libzlib_FOUND AND STDINT_OK) list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_libavformat_INCLUDE_DIRS} ${FFMPEG_libavdevice_INCLUDE_DIRS} ${FFMPEG_libavcodec_INCLUDE_DIRS} ${FFMPEG_libavutil_INCLUDE_DIRS} ${FFMPEG_libswscale_INCLUDE_DIRS} ${FFMPEG_stdint_INCLUDE_DIRS}) list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS) + set(FFMPEG_libavformat_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libavdevice_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libavcodec_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libavutil_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libswscale_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libavfilter_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libswresample_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + list(APPEND FFMPEG_LIBRARIES ${FFMPEG_libavformat_LIBRARY} ${FFMPEG_libavdevice_LIBRARY} diff --git a/ports/ffmpeg/configure_opencv.patch b/ports/ffmpeg/configure_opencv.patch deleted file mode 100644 index ac5c82797..000000000 --- a/ports/ffmpeg/configure_opencv.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/configure
-+++ b/configure
-@@ -6110,7 +6110,7 @@ enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec
- enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
- enabled libopencv && { check_headers opencv2/core/core_c.h &&
- { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
-- require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
-+ require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core341 -lopencv_imgproc341; } ||
- require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
- enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
- enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
diff --git a/ports/ffmpeg/fix-debug-build.patch b/ports/ffmpeg/fix-debug-build.patch new file mode 100644 index 000000000..324eb79f9 --- /dev/null +++ b/ports/ffmpeg/fix-debug-build.patch @@ -0,0 +1,30 @@ +diff --git a/configure b/configure +index 7c5b8a1..181fc47 100644 +--- a/configure ++++ b/configure +@@ -3906,6 +3906,9 @@ for opt do + --libfuzzer=*) + libfuzzer_path="$optval" + ;; ++ --debug) ++ enable debug_configure ++ ;; + *) + optname="${opt%%=*}" + optname="${optname#--}" +@@ -6037,8 +6040,13 @@ fi + + enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion || + check_lib zlib zlib.h zlibVersion -lz; } +-enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 +-enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma ++if enabled debug_configure; then ++ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2d ++ enabled lzma && check_lib lzma lzma.h lzma_version_number -llzmad ++else ++ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 ++ enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma ++fi + + # On some systems dynamic loading requires no extra linker flags + check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index 15be7468b..079880ab3 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -12,10 +12,10 @@ vcpkg_extract_source_archive_ex( PATCHES create-lib-libraries.patch detect-openssl.patch - configure_opencv.patch fix_windowsinclude-in-ffmpegexe-1.patch fix_windowsinclude-in-ffmpegexe-2.patch fix_libvpx_windows_linking.patch + fix-debug-build.patch ) if (${SOURCE_PATH} MATCHES " ") @@ -25,7 +25,7 @@ endif() vcpkg_find_acquire_program(YASM) get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) set(SEP ";") #We're assuming that if we're building for Windows we're using MSVC set(INCLUDE_VAR "INCLUDE") @@ -36,7 +36,7 @@ else() set(LIB_PATH_VAR "LIBRARY_PATH") endif() -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") set(BUILD_SCRIPT ${CMAKE_CURRENT_LIST_DIR}\\build.sh) @@ -125,6 +125,10 @@ else() set(OPTIONS "${OPTIONS} --disable-bzlib") endif() +if("avresample" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-avresample") +endif() + set(OPTIONS_CROSS "") if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") @@ -162,44 +166,51 @@ endif() message(STATUS "Building Options: ${OPTIONS}") -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") - set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MDd --extra-cxxflags=-MDd") + set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MDd --extra-cxxflags=-MDd --debug") set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-cflags=-MD --extra-cxxflags=-MD") else() - set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MTd --extra-cxxflags=-MTd") + set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MTd --extra-cxxflags=-MTd --debug") set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-cflags=-MT --extra-cxxflags=-MT") endif() endif() set(ENV_LIB_PATH "$ENV{${LIB_PATH_VAR}}") -set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/lib${SEP}${ENV_LIB_PATH}") - -message(STATUS "Building ${_csc_PROJECT_PATH} for Release") -file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) -vcpkg_execute_required_process( - COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" - "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" # BUILD DIR - "${SOURCE_PATH}" # SOURCE DIR - "${CURRENT_PACKAGES_DIR}" # PACKAGE DIR - "${OPTIONS} ${OPTIONS_RELEASE}" - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME build-${TARGET_TRIPLET}-rel -) -set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/debug/lib${SEP}${ENV_LIB_PATH}") - -message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") -file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) -vcpkg_execute_required_process( - COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" - "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" # BUILD DIR - "${SOURCE_PATH}" # SOURCE DIR - "${CURRENT_PACKAGES_DIR}/debug" # PACKAGE DIR - "${OPTIONS} ${OPTIONS_DEBUG}" - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME build-${TARGET_TRIPLET}-dbg -) +# Relase build +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) + message(STATUS "Building Relase Options: ${OPTIONS_RELEASE}") + set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/lib${SEP}${ENV_LIB_PATH}") + message(STATUS "Building ${_csc_PROJECT_PATH} for Release") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" # BUILD DIR + "${SOURCE_PATH}" # SOURCE DIR + "${CURRENT_PACKAGES_DIR}" # PACKAGE DIR + "${OPTIONS} ${OPTIONS_RELEASE}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME build-${TARGET_TRIPLET}-rel + ) +endif() + +# Debug build +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) + message(STATUS "Building Debug Options: ${OPTIONS_DEBUG}") + set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/debug/lib${SEP}${ENV_LIB_PATH}") + message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" # BUILD DIR + "${SOURCE_PATH}" # SOURCE DIR + "${CURRENT_PACKAGES_DIR}/debug" # PACKAGE DIR + "${OPTIONS} ${OPTIONS_DEBUG}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME build-${TARGET_TRIPLET}-dbg + ) +endif() file(GLOB DEF_FILES ${CURRENT_PACKAGES_DIR}/lib/*.def ${CURRENT_PACKAGES_DIR}/debug/lib/*.def) diff --git a/ports/forest/CONTROL b/ports/forest/CONTROL index 39fda4672..82de142c1 100644 --- a/ports/forest/CONTROL +++ b/ports/forest/CONTROL @@ -1,4 +1,4 @@ Source: forest -Version: 12.0.0 +Version: 12.0.3 Homepage: https://github.com/xorz57/forest -Description: Template library of tree data structures +Description: Template Library of Tree Data Structures in C++17 diff --git a/ports/forest/portfile.cmake b/ports/forest/portfile.cmake index b142d181e..b32febeae 100644 --- a/ports/forest/portfile.cmake +++ b/ports/forest/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO xorz57/forest - REF 12.0.0 - SHA512 c6f7a7ca098755bc6ac2f02048962d9f1d619c2d76671e9bb558524f760c3e28604db21991c2d9ebc90ffdb12ea00708d9a4fee1f4416ee216f3ef1dea0a1b97 + REF 12.0.3 + SHA512 9a693569c1d169e0c87d88150ae223d71d9491c9ed8774fdfdeee3b6a10f25d74b0653766d04095711bc76c7a4ecbec6f98dfad6846323f5f3bd701574843f53 HEAD_REF master ) diff --git a/ports/freeglut/CONTROL b/ports/freeglut/CONTROL index 1ee44b7f3..7489109c4 100644 --- a/ports/freeglut/CONTROL +++ b/ports/freeglut/CONTROL @@ -1,4 +1,4 @@ Source: freeglut -Version: 3.0.0-6 +Version: 3.0.0-7 Homepage: https://sourceforge.net/projects/freeglut/ Description: Open source implementation of GLUT with source and binary backwards compatibility. diff --git a/ports/freeglut/portfile.cmake b/ports/freeglut/portfile.cmake index 86d691593..ab95e3165 100644 --- a/ports/freeglut/portfile.cmake +++ b/ports/freeglut/portfile.cmake @@ -36,6 +36,7 @@ file(WRITE ${SOURCE_PATH}/include/GL/freeglut_std.h "${FREEGLUT_STDH}") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DFREEGLUT_BUILD_STATIC_LIBS=${FREEGLUT_STATIC} -DFREEGLUT_BUILD_SHARED_LIBS=${FREEGLUT_DYNAMIC} diff --git a/ports/freeimage/CONTROL b/ports/freeimage/CONTROL index 9d9a006c6..c911df6c7 100644 --- a/ports/freeimage/CONTROL +++ b/ports/freeimage/CONTROL @@ -1,5 +1,5 @@ Source: freeimage -Version: 3.18.0-6 -Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp[all], libraw, jxrlib, openexr +Version: 3.18.0-7 +Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp[all] (!uwp), libraw, jxrlib, openexr Homepage: https://sourceforge.net/projects/freeimage/ Description: Support library for graphics image formats diff --git a/ports/freetype/CONTROL b/ports/freetype/CONTROL index 3a52d3222..20d4bb93c 100644 --- a/ports/freetype/CONTROL +++ b/ports/freetype/CONTROL @@ -1,5 +1,5 @@ Source: freetype -Version: 2.10.0-1 +Version: 2.10.1-1 Build-Depends: zlib, bzip2, libpng Homepage: https://www.freetype.org/ Description: A library to render fonts. diff --git a/ports/freetype/portfile.cmake b/ports/freetype/portfile.cmake index a5c2fde79..d1822481f 100644 --- a/ports/freetype/portfile.cmake +++ b/ports/freetype/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions) -set(FT_VERSION 2.10.0) +set(FT_VERSION 2.10.1) vcpkg_download_distfile(ARCHIVE - URLS "https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${FT_VERSION}.tar.bz2" "https://downloads.sourceforge.net/project/freetype/freetype2/${FT_VERSION}/freetype-${FT_VERSION}.tar.bz2" - FILENAME "freetype-${FT_VERSION}.tar.bz2" - SHA512 dfad66f419ea9577f09932e0730c0c887bdcbdbc8152fa7477a0c39d69a5b68476761deed6864ddcc5cf18d100a7a3f728049768e24afcb04b1a74b25b6acf7e + URLS "https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${FT_VERSION}.tar.xz" "https://downloads.sourceforge.net/project/freetype/freetype2/${FT_VERSION}/freetype-${FT_VERSION}.tar.xz" + FILENAME "freetype-${FT_VERSION}.tar.xz" + SHA512 c7a565b0ab3dce81927008a6965d5c7540f0dc973fcefdc1677c2e65add8668b4701c2958d25593cb41f706f4488765365d40b93da71dbfa72907394f28b2650 ) vcpkg_extract_source_archive_ex( diff --git a/ports/g3log/CONTROL b/ports/g3log/CONTROL index 717166079..aeeee688c 100644 --- a/ports/g3log/CONTROL +++ b/ports/g3log/CONTROL @@ -1,3 +1,4 @@ Source: g3log
-Version: 2019-05-14-1
+Version: 2019-07-29
Description: Asynchronous logger with Dynamic Sinks
+Homepage: https://github.com/KjellKod/g3log
diff --git a/ports/g3log/portfile.cmake b/ports/g3log/portfile.cmake index f07ae0b1c..f0ae8a23a 100644 --- a/ports/g3log/portfile.cmake +++ b/ports/g3log/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KjellKod/g3log
- REF 376c417ad170228fa6d1b9994a6e07a2ac143a51
- SHA512 fd442b895f0be2489d2be099b1faca5c964f1a3880e3867726efb5f5a17192fbf2c2d60cf118e1b68bea73cf328f0b16c0265ec0f0c0fbbb1f62f68a994f5b86
+ REF f1491791785101d4ae948f8ecee7e9cc3e6b0be8
+ SHA512 852ed7c9eb2345f02414be7fb7dfbd4be340dcbf8abc4e6ba6327d181cf10e33969279166151b4eeab78b290d3fecbf4a5094696c412f7b2ab815df415652bd8
HEAD_REF master
)
@@ -12,7 +12,7 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" G3_SHARED_LIB) string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" G3_SHARED_RUNTIME)
# https://github.com/KjellKod/g3log#prerequisites
-set(VERSION "1.3.2-95")
+set(VERSION "1.3.2-80")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
diff --git a/ports/gaussianlib/CONTROL b/ports/gaussianlib/CONTROL new file mode 100644 index 000000000..7f0be1d5a --- /dev/null +++ b/ports/gaussianlib/CONTROL @@ -0,0 +1,4 @@ +Source: gaussianlib
+Version: 2019-08-04
+Description: Basic linear algebra C++ library for 2D and 3D applications
+Homepage: https://github.com/LukasBanana/GaussianLib
diff --git a/ports/gaussianlib/portfile.cmake b/ports/gaussianlib/portfile.cmake new file mode 100644 index 000000000..219196738 --- /dev/null +++ b/ports/gaussianlib/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library
+
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO LukasBanana/GaussianLib
+ REF 8630d4ac14a37f01c71bdf0c1c653e3746aa08da
+ SHA512 70de394496f20fe7037782d16cfa4bcd85beefdb25094247b8b572e6bb55866be6e2c82722d705141919b91f24428dde7b32f3d8a39670e7ef324c81b1ebe7e2
+ HEAD_REF master
+)
+
+file(COPY ${SOURCE_PATH}/include/Gauss DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
diff --git a/ports/gdal/CONTROL b/ports/gdal/CONTROL index 5df9a7fa2..bf5acc08d 100644 --- a/ports/gdal/CONTROL +++ b/ports/gdal/CONTROL @@ -1,5 +1,5 @@ Source: gdal -Version: 2.4.1-5 +Version: 2.4.1-7 Homepage: https://gdal.org/ Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data. Build-Depends: proj, libpng, geos, sqlite3, curl, expat, libpq, openjpeg, libwebp, libxml2, liblzma, netcdf-c, hdf5, zlib diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake index 61609d3d3..e212a42ed 100644 --- a/ports/gdal/portfile.cmake +++ b/ports/gdal/portfile.cmake @@ -324,6 +324,10 @@ if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStor # Copy over PDBs vcpkg_copy_pdbs() + + if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/gdal204.pdb) + endif() elseif (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") # Build in UNIX # Check build system first diff --git a/ports/gdcm/CONTROL b/ports/gdcm/CONTROL index 32a962eb4..3b49ddec4 100644 --- a/ports/gdcm/CONTROL +++ b/ports/gdcm/CONTROL @@ -1,4 +1,4 @@ Source: gdcm -Version: 3.0.0-3 +Version: 3.0.0-4 Description: Grassroots DICOM library Build-Depends: zlib, expat, openjpeg diff --git a/ports/gdcm/portfile.cmake b/ports/gdcm/portfile.cmake index 36a3e0e1f..b5e825a37 100644 --- a/ports/gdcm/portfile.cmake +++ b/ports/gdcm/portfile.cmake @@ -43,6 +43,12 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share ) +file(READ ${CURRENT_PACKAGES_DIR}/share/gdcm/GDCMTargets.cmake GDCM_TARGETS) +string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" + "set(CMAKE_IMPORT_FILE_VERSION 1) +find_package(OpenJPEG QUIET)" GDCM_TARGETS "${GDCM_TARGETS}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/gdcm/GDCMTargets.cmake "${GDCM_TARGETS}") + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() diff --git a/ports/geogram/CONTROL b/ports/geogram/CONTROL index 8fd66be95..4eb40eee0 100644 --- a/ports/geogram/CONTROL +++ b/ports/geogram/CONTROL @@ -1,5 +1,5 @@ Source: geogram -Version: 1.6.9-6 +Version: 1.6.9-7 Homepage: https://gforge.inria.fr/projects/geogram/ Description: Geogram is a programming library of geometric algorithms. Build-Depends: openblas (!osx), clapack (!osx) diff --git a/ports/geogram/enable_openblas_compatibility.patch b/ports/geogram/enable_openblas_compatibility.patch deleted file mode 100644 index e6ab75a4c..000000000 --- a/ports/geogram/enable_openblas_compatibility.patch +++ /dev/null @@ -1,1008 +0,0 @@ -diff --git a/src/lib/third_party/numerics/ARPACK/arpack_cnames.h b/src/lib/third_party/numerics/ARPACK/arpack_cnames.h -new file mode 100644 -index 0000000..e6f2c48 ---- /dev/null -+++ b/src/lib/third_party/numerics/ARPACK/arpack_cnames.h -@@ -0,0 +1,105 @@ -+#ifndef __ARPACK_CNAMES -+#define __ARPACK_CNAMES -+ -+/* -+ * These defines set up the naming scheme required to have a fortran 77 -+ * routine call a C routine -+ * for following Fortran to C interface: -+ * FORTRAN CALL C DECLARATION -+ * call dgemm(...) void dgemm(...) -+ */ -+/* BLAS */ -+#define sswap_ sswap -+#define saxpy_ saxpy -+#define sasum_ sasum -+#define isamax_ isamax -+#define scopy_ scopy -+#define sscal_ sscal -+#define sger_ sger -+#define snrm2_ snrm2 -+#define ssymv_ ssymv -+#define sdot_ sdot -+#define saxpy_ saxpy -+#define ssyr2_ ssyr2 -+#define srot_ srot -+#define sgemv_ sgemv -+#define strsv_ strsv -+#define sgemm_ sgemm -+#define strsm_ strsm -+ -+#define dswap_ dswap -+#define daxpy_ daxpy -+#define dasum_ dasum -+#define idamax_ idamax -+#define dcopy_ dcopy -+#define dscal_ dscal -+#define dger_ dger -+#define dnrm2_ dnrm2 -+#define dsymv_ dsymv -+#define ddot_ ddot -+#define dsyr2_ dsyr2 -+#define drot_ drot -+#define dgemv_ dgemv -+#define dtrsv_ dtrsv -+#define dgemm_ dgemm -+#define dtrsm_ dtrsm -+ -+#define cswap_ cswap -+#define caxpy_ caxpy -+#define scasum_ scasum -+#define icamax_ icamax -+#define ccopy_ ccopy -+#define cscal_ cscal -+#define scnrm2_ scnrm2 -+#define cgemv_ cgemv -+#define ctrsv_ ctrsv -+#define cgemm_ cgemm -+#define ctrsm_ ctrsm -+#define cgerc_ cgerc -+#define chemv_ chemv -+#define cher2_ cher2 -+ -+#define zswap_ zswap -+#define zaxpy_ zaxpy -+#define dzasum_ dzasum -+#define izamax_ izamax -+#define zcopy_ zcopy -+#define zscal_ zscal -+#define dznrm2_ dznrm2 -+#define zgemv_ zgemv -+#define ztrsv_ ztrsv -+#define zgemm_ zgemm -+#define ztrsm_ ztrsm -+#define zgerc_ zgerc -+#define zhemv_ zhemv -+#define zher2_ zher2 -+ -+/* LAPACK */ -+#define dlacon_ dlacon -+#define slacon_ slacon -+#define icmax1_ icmax1 -+#define scsum1_ scsum1 -+#define clacon_ clacon -+#define dzsum1_ dzsum1 -+#define izmax1_ izmax1 -+#define zlacon_ zlacon -+ -+/* Fortran interface */ -+#define c_bridge_dgssv_ c_bridge_dgssv -+#define c_fortran_sgssv_ c_fortran_sgssv -+#define c_fortran_dgssv_ c_fortran_dgssv -+#define c_fortran_cgssv_ c_fortran_cgssv -+#define c_fortran_zgssv_ c_fortran_zgssv -+ -+#define cdotc_ cdotc -+#define csscal_ csscal -+#define zdscal_ zdscal -+#define zdotc_ zdotc -+#define ctrmm_ ctrmm -+#define dtrmm_ dtrmm -+#define strmm_ strmm -+#define ztrmm_ ztrmm -+#define cgeru_ cgeru -+#define zgeru_ zgeru -+ -+#endif /* __ARPACK_CNAMES */ -diff --git a/src/lib/third_party/numerics/ARPACK/cgetv0.c b/src/lib/third_party/numerics/ARPACK/cgetv0.c -index 48e8677..871d7b0 100755 ---- a/src/lib/third_party/numerics/ARPACK/cgetv0.c -+++ b/src/lib/third_party/numerics/ARPACK/cgetv0.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/cnaitr.c b/src/lib/third_party/numerics/ARPACK/cnaitr.c -index ee9318b..693f399 100755 ---- a/src/lib/third_party/numerics/ARPACK/cnaitr.c -+++ b/src/lib/third_party/numerics/ARPACK/cnaitr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/cnapps.c b/src/lib/third_party/numerics/ARPACK/cnapps.c -index 0c4a6a2..4929fc1 100755 ---- a/src/lib/third_party/numerics/ARPACK/cnapps.c -+++ b/src/lib/third_party/numerics/ARPACK/cnapps.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/cnaup2.c b/src/lib/third_party/numerics/ARPACK/cnaup2.c -index 8322446..2d98e4b 100755 ---- a/src/lib/third_party/numerics/ARPACK/cnaup2.c -+++ b/src/lib/third_party/numerics/ARPACK/cnaup2.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/cnaupd.c b/src/lib/third_party/numerics/ARPACK/cnaupd.c -index e51f72e..4fe5dca 100755 ---- a/src/lib/third_party/numerics/ARPACK/cnaupd.c -+++ b/src/lib/third_party/numerics/ARPACK/cnaupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/cneigh.c b/src/lib/third_party/numerics/ARPACK/cneigh.c -index d96bebd..adfa279 100755 ---- a/src/lib/third_party/numerics/ARPACK/cneigh.c -+++ b/src/lib/third_party/numerics/ARPACK/cneigh.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/cneupd.c b/src/lib/third_party/numerics/ARPACK/cneupd.c -index 6a839e7..35fc426 100755 ---- a/src/lib/third_party/numerics/ARPACK/cneupd.c -+++ b/src/lib/third_party/numerics/ARPACK/cneupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/cngets.c b/src/lib/third_party/numerics/ARPACK/cngets.c -index 9788d00..663406f 100755 ---- a/src/lib/third_party/numerics/ARPACK/cngets.c -+++ b/src/lib/third_party/numerics/ARPACK/cngets.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/csortc.c b/src/lib/third_party/numerics/ARPACK/csortc.c -index 8c6cedb..0d330fe 100755 ---- a/src/lib/third_party/numerics/ARPACK/csortc.c -+++ b/src/lib/third_party/numerics/ARPACK/csortc.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* \BeginDoc */ - - /* \Name: csortc */ -diff --git a/src/lib/third_party/numerics/ARPACK/cstatn.c b/src/lib/third_party/numerics/ARPACK/cstatn.c -index 6fcde6d..4eb47dc 100755 ---- a/src/lib/third_party/numerics/ARPACK/cstatn.c -+++ b/src/lib/third_party/numerics/ARPACK/cstatn.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dgetv0.c b/src/lib/third_party/numerics/ARPACK/dgetv0.c -index 0f4c2bb..2206708 100755 ---- a/src/lib/third_party/numerics/ARPACK/dgetv0.c -+++ b/src/lib/third_party/numerics/ARPACK/dgetv0.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dlaqrb.c b/src/lib/third_party/numerics/ARPACK/dlaqrb.c -index baa4f12..d4275a7 100755 ---- a/src/lib/third_party/numerics/ARPACK/dlaqrb.c -+++ b/src/lib/third_party/numerics/ARPACK/dlaqrb.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Table of constant values */ - - static integer c__1 = 1; -diff --git a/src/lib/third_party/numerics/ARPACK/dnaitr.c b/src/lib/third_party/numerics/ARPACK/dnaitr.c -index 8fffe7f..74eca38 100755 ---- a/src/lib/third_party/numerics/ARPACK/dnaitr.c -+++ b/src/lib/third_party/numerics/ARPACK/dnaitr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dnapps.c b/src/lib/third_party/numerics/ARPACK/dnapps.c -index 67dac36..b0083a1 100755 ---- a/src/lib/third_party/numerics/ARPACK/dnapps.c -+++ b/src/lib/third_party/numerics/ARPACK/dnapps.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dnaup2.c b/src/lib/third_party/numerics/ARPACK/dnaup2.c -index 28dabb6..8b48f33 100755 ---- a/src/lib/third_party/numerics/ARPACK/dnaup2.c -+++ b/src/lib/third_party/numerics/ARPACK/dnaup2.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dnaupd.c b/src/lib/third_party/numerics/ARPACK/dnaupd.c -index e20298c..dcfaf47 100755 ---- a/src/lib/third_party/numerics/ARPACK/dnaupd.c -+++ b/src/lib/third_party/numerics/ARPACK/dnaupd.c -@@ -11,7 +11,7 @@ - */ - - #include "protos.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dnconv.c b/src/lib/third_party/numerics/ARPACK/dnconv.c -index e2324b7..aa0bf91 100755 ---- a/src/lib/third_party/numerics/ARPACK/dnconv.c -+++ b/src/lib/third_party/numerics/ARPACK/dnconv.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dneigh.c b/src/lib/third_party/numerics/ARPACK/dneigh.c -index b7057eb..94e3680 100755 ---- a/src/lib/third_party/numerics/ARPACK/dneigh.c -+++ b/src/lib/third_party/numerics/ARPACK/dneigh.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dneupd.c b/src/lib/third_party/numerics/ARPACK/dneupd.c -index 141255d..067041b 100755 ---- a/src/lib/third_party/numerics/ARPACK/dneupd.c -+++ b/src/lib/third_party/numerics/ARPACK/dneupd.c -@@ -11,7 +11,7 @@ - */ - - #include "protos.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dngets.c b/src/lib/third_party/numerics/ARPACK/dngets.c -index 9b0ee73..e39848f 100755 ---- a/src/lib/third_party/numerics/ARPACK/dngets.c -+++ b/src/lib/third_party/numerics/ARPACK/dngets.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsaitr.c b/src/lib/third_party/numerics/ARPACK/dsaitr.c -index 2f3df52..89a597a 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsaitr.c -+++ b/src/lib/third_party/numerics/ARPACK/dsaitr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsapps.c b/src/lib/third_party/numerics/ARPACK/dsapps.c -index e87b27d..4a320c9 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsapps.c -+++ b/src/lib/third_party/numerics/ARPACK/dsapps.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsaup2.c b/src/lib/third_party/numerics/ARPACK/dsaup2.c -index e5f224f..b93e80b 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsaup2.c -+++ b/src/lib/third_party/numerics/ARPACK/dsaup2.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsaupd.c b/src/lib/third_party/numerics/ARPACK/dsaupd.c -index a9e456f..d20ebe2 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsaupd.c -+++ b/src/lib/third_party/numerics/ARPACK/dsaupd.c -@@ -11,7 +11,7 @@ - */ - - #include "protos.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsconv.c b/src/lib/third_party/numerics/ARPACK/dsconv.c -index 843ac29..25e3b8f 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsconv.c -+++ b/src/lib/third_party/numerics/ARPACK/dsconv.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dseigt.c b/src/lib/third_party/numerics/ARPACK/dseigt.c -index c7e975b..ba74d2f 100755 ---- a/src/lib/third_party/numerics/ARPACK/dseigt.c -+++ b/src/lib/third_party/numerics/ARPACK/dseigt.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsesrt.c b/src/lib/third_party/numerics/ARPACK/dsesrt.c -index 1bf99ee..8a2030f 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsesrt.c -+++ b/src/lib/third_party/numerics/ARPACK/dsesrt.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Table of constant values */ - - static integer c__1 = 1; -diff --git a/src/lib/third_party/numerics/ARPACK/dseupd.c b/src/lib/third_party/numerics/ARPACK/dseupd.c -index 9b81477..065e4d8 100755 ---- a/src/lib/third_party/numerics/ARPACK/dseupd.c -+++ b/src/lib/third_party/numerics/ARPACK/dseupd.c -@@ -11,7 +11,7 @@ - */ - - #include "protos.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsgets.c b/src/lib/third_party/numerics/ARPACK/dsgets.c -index 7983ec8..19a33d9 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsgets.c -+++ b/src/lib/third_party/numerics/ARPACK/dsgets.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dsortc.c b/src/lib/third_party/numerics/ARPACK/dsortc.c -index 2170fcc..131ae2f 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsortc.c -+++ b/src/lib/third_party/numerics/ARPACK/dsortc.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* ----------------------------------------------------------------------- */ - /* \BeginDoc */ - -diff --git a/src/lib/third_party/numerics/ARPACK/dsortr.c b/src/lib/third_party/numerics/ARPACK/dsortr.c -index 5f8dca8..335d9a9 100755 ---- a/src/lib/third_party/numerics/ARPACK/dsortr.c -+++ b/src/lib/third_party/numerics/ARPACK/dsortr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* ----------------------------------------------------------------------- */ - /* \BeginDoc */ - -diff --git a/src/lib/third_party/numerics/ARPACK/dstatn.c b/src/lib/third_party/numerics/ARPACK/dstatn.c -index 50c15f2..1909d6d 100755 ---- a/src/lib/third_party/numerics/ARPACK/dstatn.c -+++ b/src/lib/third_party/numerics/ARPACK/dstatn.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dstats.c b/src/lib/third_party/numerics/ARPACK/dstats.c -index 4341eea..02f4024 100755 ---- a/src/lib/third_party/numerics/ARPACK/dstats.c -+++ b/src/lib/third_party/numerics/ARPACK/dstats.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/dstqrb.c b/src/lib/third_party/numerics/ARPACK/dstqrb.c -index 2a10880..c25f44d 100755 ---- a/src/lib/third_party/numerics/ARPACK/dstqrb.c -+++ b/src/lib/third_party/numerics/ARPACK/dstqrb.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Table of constant values */ - - static integer c__0 = 0; -diff --git a/src/lib/third_party/numerics/ARPACK/protos.h b/src/lib/third_party/numerics/ARPACK/protos.h -index 2e87fe7..09a89fc 100755 ---- a/src/lib/third_party/numerics/ARPACK/protos.h -+++ b/src/lib/third_party/numerics/ARPACK/protos.h -@@ -8,7 +8,7 @@ - - #include <third_party/numerics/linkage.h> - #include "f2c.h" -- -+#include "arpack_cnames.h" - int NUMERICS_API dnaupd_( - integer *ido, char *bmat, integer *n, char * - which, integer *nev, doublereal *tol, doublereal *resid, integer *ncv, -diff --git a/src/lib/third_party/numerics/ARPACK/sgetv0.c b/src/lib/third_party/numerics/ARPACK/sgetv0.c -index 206122a..314252f 100755 ---- a/src/lib/third_party/numerics/ARPACK/sgetv0.c -+++ b/src/lib/third_party/numerics/ARPACK/sgetv0.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/slaqrb.c b/src/lib/third_party/numerics/ARPACK/slaqrb.c -index 335faa2..12cc92a 100755 ---- a/src/lib/third_party/numerics/ARPACK/slaqrb.c -+++ b/src/lib/third_party/numerics/ARPACK/slaqrb.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Table of constant values */ - - static integer c__1 = 1; -diff --git a/src/lib/third_party/numerics/ARPACK/snaitr.c b/src/lib/third_party/numerics/ARPACK/snaitr.c -index 5e24f6c..f3bc2fa 100755 ---- a/src/lib/third_party/numerics/ARPACK/snaitr.c -+++ b/src/lib/third_party/numerics/ARPACK/snaitr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/snapps.c b/src/lib/third_party/numerics/ARPACK/snapps.c -index 37470fc..9ae03e4 100755 ---- a/src/lib/third_party/numerics/ARPACK/snapps.c -+++ b/src/lib/third_party/numerics/ARPACK/snapps.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/snaup2.c b/src/lib/third_party/numerics/ARPACK/snaup2.c -index 4028150..f893a8e 100755 ---- a/src/lib/third_party/numerics/ARPACK/snaup2.c -+++ b/src/lib/third_party/numerics/ARPACK/snaup2.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/snaupd.c b/src/lib/third_party/numerics/ARPACK/snaupd.c -index 88118f0..66fac19 100755 ---- a/src/lib/third_party/numerics/ARPACK/snaupd.c -+++ b/src/lib/third_party/numerics/ARPACK/snaupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/snconv.c b/src/lib/third_party/numerics/ARPACK/snconv.c -index 4984455..cb42561 100755 ---- a/src/lib/third_party/numerics/ARPACK/snconv.c -+++ b/src/lib/third_party/numerics/ARPACK/snconv.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/sneigh.c b/src/lib/third_party/numerics/ARPACK/sneigh.c -index 4ff7d7a..a8b3ffc 100755 ---- a/src/lib/third_party/numerics/ARPACK/sneigh.c -+++ b/src/lib/third_party/numerics/ARPACK/sneigh.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/sneupd.c b/src/lib/third_party/numerics/ARPACK/sneupd.c -index e2a7205..430f033 100755 ---- a/src/lib/third_party/numerics/ARPACK/sneupd.c -+++ b/src/lib/third_party/numerics/ARPACK/sneupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/sngets.c b/src/lib/third_party/numerics/ARPACK/sngets.c -index 5a13f94..1c34e92 100755 ---- a/src/lib/third_party/numerics/ARPACK/sngets.c -+++ b/src/lib/third_party/numerics/ARPACK/sngets.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssaitr.c b/src/lib/third_party/numerics/ARPACK/ssaitr.c -index 65a61f6..98fbb1c 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssaitr.c -+++ b/src/lib/third_party/numerics/ARPACK/ssaitr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssapps.c b/src/lib/third_party/numerics/ARPACK/ssapps.c -index 9537c2f..b979fb1 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssapps.c -+++ b/src/lib/third_party/numerics/ARPACK/ssapps.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssaup2.c b/src/lib/third_party/numerics/ARPACK/ssaup2.c -index a5123dc..59e08aa 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssaup2.c -+++ b/src/lib/third_party/numerics/ARPACK/ssaup2.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssaupd.c b/src/lib/third_party/numerics/ARPACK/ssaupd.c -index 5898148..32ba0b0 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssaupd.c -+++ b/src/lib/third_party/numerics/ARPACK/ssaupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssconv.c b/src/lib/third_party/numerics/ARPACK/ssconv.c -index 0e1c9c2..90faa50 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssconv.c -+++ b/src/lib/third_party/numerics/ARPACK/ssconv.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/sseigt.c b/src/lib/third_party/numerics/ARPACK/sseigt.c -index 6b9e407..6652b74 100755 ---- a/src/lib/third_party/numerics/ARPACK/sseigt.c -+++ b/src/lib/third_party/numerics/ARPACK/sseigt.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssesrt.c b/src/lib/third_party/numerics/ARPACK/ssesrt.c -index 9287d6a..d6bcd6d 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssesrt.c -+++ b/src/lib/third_party/numerics/ARPACK/ssesrt.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Table of constant values */ - - static integer c__1 = 1; -diff --git a/src/lib/third_party/numerics/ARPACK/sseupd.c b/src/lib/third_party/numerics/ARPACK/sseupd.c -index 163df3a..b0e825f 100755 ---- a/src/lib/third_party/numerics/ARPACK/sseupd.c -+++ b/src/lib/third_party/numerics/ARPACK/sseupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssgets.c b/src/lib/third_party/numerics/ARPACK/ssgets.c -index 244f2ab..52127c2 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssgets.c -+++ b/src/lib/third_party/numerics/ARPACK/ssgets.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/ssortc.c b/src/lib/third_party/numerics/ARPACK/ssortc.c -index aa836f7..38b5fbd 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssortc.c -+++ b/src/lib/third_party/numerics/ARPACK/ssortc.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* ----------------------------------------------------------------------- */ - /* \BeginDoc */ - -diff --git a/src/lib/third_party/numerics/ARPACK/ssortr.c b/src/lib/third_party/numerics/ARPACK/ssortr.c -index e48fb1c..88db423 100755 ---- a/src/lib/third_party/numerics/ARPACK/ssortr.c -+++ b/src/lib/third_party/numerics/ARPACK/ssortr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* ----------------------------------------------------------------------- */ - /* \BeginDoc */ - -diff --git a/src/lib/third_party/numerics/ARPACK/sstatn.c b/src/lib/third_party/numerics/ARPACK/sstatn.c -index fc899df..26d49b9 100755 ---- a/src/lib/third_party/numerics/ARPACK/sstatn.c -+++ b/src/lib/third_party/numerics/ARPACK/sstatn.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/sstats.c b/src/lib/third_party/numerics/ARPACK/sstats.c -index 6601d2e..61577e2 100755 ---- a/src/lib/third_party/numerics/ARPACK/sstats.c -+++ b/src/lib/third_party/numerics/ARPACK/sstats.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/sstqrb.c b/src/lib/third_party/numerics/ARPACK/sstqrb.c -index 4c7bf91..2a416e2 100755 ---- a/src/lib/third_party/numerics/ARPACK/sstqrb.c -+++ b/src/lib/third_party/numerics/ARPACK/sstqrb.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Table of constant values */ - - static integer c__0 = 0; -diff --git a/src/lib/third_party/numerics/ARPACK/zgetv0.c b/src/lib/third_party/numerics/ARPACK/zgetv0.c -index 96d3c48..d868c1f 100755 ---- a/src/lib/third_party/numerics/ARPACK/zgetv0.c -+++ b/src/lib/third_party/numerics/ARPACK/zgetv0.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/znaitr.c b/src/lib/third_party/numerics/ARPACK/znaitr.c -index 2ce6b9c..c8cf0f6 100755 ---- a/src/lib/third_party/numerics/ARPACK/znaitr.c -+++ b/src/lib/third_party/numerics/ARPACK/znaitr.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/znapps.c b/src/lib/third_party/numerics/ARPACK/znapps.c -index 732aed0..30f46e6 100755 ---- a/src/lib/third_party/numerics/ARPACK/znapps.c -+++ b/src/lib/third_party/numerics/ARPACK/znapps.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/znaup2.c b/src/lib/third_party/numerics/ARPACK/znaup2.c -index b7caa42..7164775 100755 ---- a/src/lib/third_party/numerics/ARPACK/znaup2.c -+++ b/src/lib/third_party/numerics/ARPACK/znaup2.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/znaupd.c b/src/lib/third_party/numerics/ARPACK/znaupd.c -index ed251ee..f960959 100755 ---- a/src/lib/third_party/numerics/ARPACK/znaupd.c -+++ b/src/lib/third_party/numerics/ARPACK/znaupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/zneigh.c b/src/lib/third_party/numerics/ARPACK/zneigh.c -index 4157ab3..4ee3c1e 100755 ---- a/src/lib/third_party/numerics/ARPACK/zneigh.c -+++ b/src/lib/third_party/numerics/ARPACK/zneigh.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/zneupd.c b/src/lib/third_party/numerics/ARPACK/zneupd.c -index 3f684f4..3ef32c1 100755 ---- a/src/lib/third_party/numerics/ARPACK/zneupd.c -+++ b/src/lib/third_party/numerics/ARPACK/zneupd.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/zngets.c b/src/lib/third_party/numerics/ARPACK/zngets.c -index a2e461b..97bbebd 100755 ---- a/src/lib/third_party/numerics/ARPACK/zngets.c -+++ b/src/lib/third_party/numerics/ARPACK/zngets.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { -diff --git a/src/lib/third_party/numerics/ARPACK/zsortc.c b/src/lib/third_party/numerics/ARPACK/zsortc.c -index a35748c..38dbc42 100755 ---- a/src/lib/third_party/numerics/ARPACK/zsortc.c -+++ b/src/lib/third_party/numerics/ARPACK/zsortc.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* \BeginDoc */ - - /* \Name: zsortc */ -diff --git a/src/lib/third_party/numerics/ARPACK/zstatn.c b/src/lib/third_party/numerics/ARPACK/zstatn.c -index d433e97..5a8bd1e 100755 ---- a/src/lib/third_party/numerics/ARPACK/zstatn.c -+++ b/src/lib/third_party/numerics/ARPACK/zstatn.c -@@ -11,7 +11,7 @@ - */ - - #include "f2c.h" -- -+#include "arpack_cnames.h" - /* Common Block Declarations */ - - struct { diff --git a/ports/geogram/fix_underscore.patch b/ports/geogram/fix_underscore.patch deleted file mode 100644 index eeb5a30cb..000000000 --- a/ports/geogram/fix_underscore.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff --git a/src/lib/third_party/numerics/SUPERLU/slu_Cnames.h b/src/lib/third_party/numerics/SUPERLU/slu_Cnames.h -index 68b3afe..0369a68 100755 ---- a/src/lib/third_party/numerics/SUPERLU/slu_Cnames.h -+++ b/src/lib/third_party/numerics/SUPERLU/slu_Cnames.h -@@ -1,4 +1,4 @@ --#define Add_ /* Bruno */ -+#define NoChange - - /*! \file - Copyright (c) 2003, The Regents of the University of California, through diff --git a/ports/geogram/portfile.cmake b/ports/geogram/portfile.cmake index 9584e6619..5da48ff89 100644 --- a/ports/geogram/portfile.cmake +++ b/ports/geogram/portfile.cmake @@ -8,17 +8,12 @@ vcpkg_download_distfile(ARCHIVE SHA512 1b5c7540bef734c1908f213f26780aba63b4911a8022d5eb3f7c90eabe2cb69efd1f298b30cdc8e2c636a5b37c8c25832dd4aad0b7c2ff5f0a5b5caa17970136 ) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(ADDITIONAL_PATCHES "fix_underscore.patch" "enable_openblas_compatibility.patch") -endif() - vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH ARCHIVE ${ARCHIVE} REF ${GEOGRAM_VERSION} PATCHES fix-cmake-config-and-install.patch - ${ADDITIONAL_PATCHES} ) file(COPY ${CURRENT_PORT_DIR}/Config.cmake.in DESTINATION ${SOURCE_PATH}/cmake) diff --git a/ports/gherkin-c/CONTROL b/ports/gherkin-c/CONTROL index 3ded48444..e1533180f 100644 --- a/ports/gherkin-c/CONTROL +++ b/ports/gherkin-c/CONTROL @@ -1,3 +1,3 @@ Source: gherkin-c
-Version: 2019-10-07 +Version: 2019-10-07-1 Description: Gherkin parser/compiler in C
diff --git a/ports/gherkin-c/portfile.cmake b/ports/gherkin-c/portfile.cmake index 04e104235..adb13076d 100644 --- a/ports/gherkin-c/portfile.cmake +++ b/ports/gherkin-c/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_from_github( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DBUILD_GHERKIN_TESTS=OFF
)
diff --git a/ports/gl2ps/CONTROL b/ports/gl2ps/CONTROL index ae8aab8fa..deb9483aa 100644 --- a/ports/gl2ps/CONTROL +++ b/ports/gl2ps/CONTROL @@ -1,5 +1,5 @@ Source: gl2ps -Version: 1.4.0-1 +Version: 1.4.0-3 Homepage: https://gitlab.onelab.info/gl2ps/gl2ps Description: OpenGL to PostScript Printing Library Build-Depends: freeglut, zlib, libpng diff --git a/ports/gl2ps/portfile.cmake b/ports/gl2ps/portfile.cmake index 7f08f8de4..eaee56270 100644 --- a/ports/gl2ps/portfile.cmake +++ b/ports/gl2ps/portfile.cmake @@ -1,19 +1,18 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gl2ps-gl2ps_1_4_0-e7b16f8f80382e45b681651e6381de09250243a6) -vcpkg_download_distfile(ARCHIVE - URLS "http://gitlab.onelab.info/gl2ps/gl2ps/repository/archive.tar.gz?ref=gl2ps_1_4_0" - FILENAME "gl2ps_1_4_0.tar.gz" - SHA512 6ec18debdf94e8de22ca7084fe6fef72fb858fc6295a35fa3c98c3c45211f9f72e23a14224a85877f64031077da4978b8d5d81f24dfe18de8c2ec32a680eba60 -) -vcpkg_extract_source_archive(${ARCHIVE}) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/separate-static-dynamic-build.patch" +vcpkg_from_gitlab( + GITLAB_URL http://gitlab.onelab.info + OUT_SOURCE_PATH SOURCE_PATH + REPO gl2ps/gl2ps + REF gl2ps_1_4_0 + SHA512 ee10e3fd312eae896934c39b8d115f28017874f918e4dd3350ca8f7cbf47dfc44101a5c6eb8826707620fcc336ca51ddc4eb7bf653af4b27651277625bac3cce + HEAD_REF master + PATCHES separate-static-dynamic-build.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON ) diff --git a/ports/glbinding/CONTROL b/ports/glbinding/CONTROL index 016283ca9..5bef7210a 100644 --- a/ports/glbinding/CONTROL +++ b/ports/glbinding/CONTROL @@ -1,5 +1,5 @@ Source: glbinding -Version: 3.1.0-1 +Version: 3.1.0-2 Description: glbinding is an MIT licensed, cross-platform C++ binding for the OpenGL API Homepage: https://github.com/cginternals/glbinding Build-Depends: egl-registry diff --git a/ports/glbinding/portfile.cmake b/ports/glbinding/portfile.cmake index d9fb5c0b2..863426282 100644 --- a/ports/glbinding/portfile.cmake +++ b/ports/glbinding/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DOPTION_BUILD_TESTS=OFF -DOPTION_BUILD_GPU_TESTS=OFF diff --git a/ports/glew/CONTROL b/ports/glew/CONTROL index 8d336de5a..41df4d08c 100644 --- a/ports/glew/CONTROL +++ b/ports/glew/CONTROL @@ -1,4 +1,4 @@ Source: glew -Version: 2.1.0-4 +Version: 2.1.0-5 Description: The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. Homepage: https://github.com/nigels-com/glew diff --git a/ports/glew/portfile.cmake b/ports/glew/portfile.cmake index 2637b2091..818ee52ea 100644 --- a/ports/glew/portfile.cmake +++ b/ports/glew/portfile.cmake @@ -18,6 +18,7 @@ vcpkg_extract_source_archive_ex( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/build/cmake + PREFER_NINJA DISABLE_PARALLEL_CONFIGURE OPTIONS -DBUILD_UTILS=OFF diff --git a/ports/glfw3/CONTROL b/ports/glfw3/CONTROL index 361820820..6cbc41564 100644 --- a/ports/glfw3/CONTROL +++ b/ports/glfw3/CONTROL @@ -1,4 +1,4 @@ Source: glfw3 -Version: 3.3 +Version: 3.3-1 Homepage: https://github.com/glfw/glfw Description: GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc. diff --git a/ports/glfw3/portfile.cmake b/ports/glfw3/portfile.cmake index ea3e4eaec..c8948628f 100644 --- a/ports/glfw3/portfile.cmake +++ b/ports/glfw3/portfile.cmake @@ -20,6 +20,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF diff --git a/ports/google-cloud-cpp/CONTROL b/ports/google-cloud-cpp/CONTROL index 0adc8a16b..a844f9749 100644 --- a/ports/google-cloud-cpp/CONTROL +++ b/ports/google-cloud-cpp/CONTROL @@ -1,4 +1,5 @@ Source: google-cloud-cpp
-Version: 0.11.0
-Build-Depends: grpc, curl[ssl], crc32c
+Version: 0.12.0
+Build-Depends: grpc, curl[ssl], crc32c, googleapis
Description: C++ Client Libraries for Google Cloud Platform APIs.
+Homepage: https://github.com/googleapis/google-cloud-cpp
diff --git a/ports/google-cloud-cpp/portfile.cmake b/ports/google-cloud-cpp/portfile.cmake index 0ae85412a..e9ffdd014 100644 --- a/ports/google-cloud-cpp/portfile.cmake +++ b/ports/google-cloud-cpp/portfile.cmake @@ -5,18 +5,19 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO googleapis/google-cloud-cpp - REF v0.11.0 - SHA512 059322c73a9632644faec7dc33fc9e390cd5aeb1576a2e6ddeeb6e4078040c47f71fe687702f04173ee86638886872046ea22e60fae3f6a8bf16f6bfb9478962 + REF v0.12.0 + SHA512 14d83e099b9d425475b963b6b4fe11c1881988afc90d87a63b2a0d17cd18f3000f725fa230b6b7487e14e383e7f3c5803122dbadd9dacdeeadc541b55074a805 HEAD_REF master ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + DISABLE_PARALLEL_CONFIGURE OPTIONS -DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package -DGOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK=OFF - -DBUILD_TESTING=OFF + -DBUILD_TESTING=OFF ) vcpkg_install_cmake(ADD_BIN_TO_PATH) diff --git a/ports/googleapis/CONTROL b/ports/googleapis/CONTROL new file mode 100644 index 000000000..194cd39f5 --- /dev/null +++ b/ports/googleapis/CONTROL @@ -0,0 +1,5 @@ +Source: googleapis +Version: 0.1.3 +Build-Depends: grpc, protobuf +Description: C++ Proto Libraries for Google APIs. +Homepage: https://github.com/googleapis/cpp-cmakefiles diff --git a/ports/googleapis/portfile.cmake b/ports/googleapis/portfile.cmake new file mode 100644 index 000000000..969ec95fb --- /dev/null +++ b/ports/googleapis/portfile.cmake @@ -0,0 +1,32 @@ +include(vcpkg_common_functions) + +if (VCPKG_TARGET_IS_UWP) + message(FATAL_ERROR "Package `googleapis` doesn't support UWP") +endif() + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO googleapis/cpp-cmakefiles + REF v0.1.3 + SHA512 5c6be5af731d97dcf754b1f643c35a1c806e6b976a3dd027dd80ee15f86c6d70f772dcecbf2da5597a4e8d8d9639813c2d2f66dd7112b8039c14c3a49ec6c4db + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake(ADD_BIN_TO_PATH) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/googleapis RENAME copyright) + +vcpkg_copy_pdbs() + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) diff --git a/ports/googleapis/usage b/ports/googleapis/usage new file mode 100644 index 000000000..00ca628e5 --- /dev/null +++ b/ports/googleapis/usage @@ -0,0 +1,6 @@ +The package googleapis is compatible with built-in CMake targets: + + find_package(googleapis CONFIG REQUIRED) + + # Then link against the proto libraries that you want to use, for example: + target_link_libraries(main PRIVATE googleapis-c++::bigtable_protos gRPC::grpc gRPC::grpc++) diff --git a/ports/graphicsmagick/CONTROL b/ports/graphicsmagick/CONTROL index 631fd52f3..350ccd178 100644 --- a/ports/graphicsmagick/CONTROL +++ b/ports/graphicsmagick/CONTROL @@ -1,6 +1,6 @@ Source: graphicsmagick Maintainer: josuegomes@gmail.com -Version: 1.3.32 +Version: 1.3.32-1 Build-Depends: zlib, bzip2, freetype, libjpeg-turbo, libpng, tiff Homepage: https://sourceforge.net/projects/graphicsmagick/ Description: Image processing library diff --git a/ports/graphicsmagick/portfile.cmake b/ports/graphicsmagick/portfile.cmake index b976bfbee..1764b30e7 100644 --- a/ports/graphicsmagick/portfile.cmake +++ b/ports/graphicsmagick/portfile.cmake @@ -28,6 +28,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/magick_types.h DESTINATION ${SOURCE_PATH}/ma vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DINSTALL_HEADERS=OFF ) diff --git a/ports/gtest/CONTROL b/ports/gtest/CONTROL index a03fc9ec9..203c90aca 100644 --- a/ports/gtest/CONTROL +++ b/ports/gtest/CONTROL @@ -1,4 +1,4 @@ Source: gtest -Version: 2019-01-04-3 +Version: 2019-08-14-1 Homepage: https://github.com/google/googletest Description: GoogleTest and GoogleMock testing frameworks. diff --git a/ports/gtest/portfile.cmake b/ports/gtest/portfile.cmake index be1cce4ed..776c67f97 100644 --- a/ports/gtest/portfile.cmake +++ b/ports/gtest/portfile.cmake @@ -7,8 +7,8 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO google/googletest - REF b6cd405286ed8635ece71c72f118e659f4ade3fb - SHA512 1642a9cf1923d00c52c346399941517787431dad3e6d3a5da07bc02243a231a95e30e0a9568ffd29bb9b9757f15c1c47d2d811c2bedb301f2d27cf912be0a534 + REF 90a443f9c2437ca8a682a1ac625eba64e1d74a8a + SHA512 fc874a7977f11be58dc63993b520b4ae6ca43654fb5250c8b56df62a21f4dca8fcbdc81dfa106374b2bb7c59bc88952fbfc0e3ae4c7d63fdb502afbaeb39c822 HEAD_REF master PATCHES 0002-Fix-z7-override.patch diff --git a/ports/harfbuzz/CONTROL b/ports/harfbuzz/CONTROL index 39bce8010..8952d04d4 100644 --- a/ports/harfbuzz/CONTROL +++ b/ports/harfbuzz/CONTROL @@ -1,5 +1,5 @@ Source: harfbuzz -Version: 2.5.1-1 +Version: 2.5.3 Description: HarfBuzz OpenType text shaping engine Homepage: https://github.com/behdad/harfbuzz Build-Depends: freetype, ragel, gettext (osx) diff --git a/ports/harfbuzz/portfile.cmake b/ports/harfbuzz/portfile.cmake index d7fbd9a0d..98e6b15af 100644 --- a/ports/harfbuzz/portfile.cmake +++ b/ports/harfbuzz/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO harfbuzz/harfbuzz - REF 2.5.1 - SHA512 e8b4b98e65d809579456551e4dd70bdd847d02cbfa80df479f6f544eff2bdbfaa7502f22e5f4e5217f063badc8874f6e568d49e9c40ab752b233fafa9e74aeab + REF 2.5.3 + SHA512 d541463b3647fc2c7ddaa29aedcea1c3bde5e26e0d529384d66d630af3aaf2a4befb3c4d47c93833f099339a0f951fb132011a02c57fc00ba543bd1b17026ffa HEAD_REF master PATCHES 0001-fix-cmake-export.patch diff --git a/ports/hayai/CONTROL b/ports/hayai/CONTROL new file mode 100644 index 000000000..7943d301b --- /dev/null +++ b/ports/hayai/CONTROL @@ -0,0 +1,4 @@ +Source: hayai
+Version: 2019-08-10
+Description: C++ benchmarking framework
+Homepage: https://github.com/nickbruun/hayai
diff --git a/ports/hayai/portfile.cmake b/ports/hayai/portfile.cmake new file mode 100644 index 000000000..c175d6633 --- /dev/null +++ b/ports/hayai/portfile.cmake @@ -0,0 +1,70 @@ +include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO nickbruun/hayai
+ REF 0234860c7a851362ab33efc6c018203cded3eb48
+ SHA512 e4c65d834eddaeb77e73a3bc24645a531b93d26e32ff1daffbe71c579b76b4b8b4865f6c7ea07b378cafbe2da3a698414d4135f28fc9821eef995ed78d0987f2
+ HEAD_REF master
+)
+
+if(VCPKG_TARGET_IS_UWP)
+ set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
+ set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DINSTALL_HAYAI=ON
+ -DBUILD_HAYAI_TESTS=OFF
+ -DBUILD_HAYAI_SAMPLES=OFF
+)
+
+vcpkg_install_cmake()
+
+if(EXISTS ${CURRENT_PACKAGES_DIR}/CMake)
+ vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
+elseif(EXISTS ${CURRENT_PACKAGES_DIR}/lib/CMake/${PORT})
+ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/CMake/${PORT})
+endif()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle manual-link libraries
+if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/hayai_main.lib)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/debug/lib/hayai_main.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/hayai_main.lib
+ )
+
+ vcpkg_replace_string(
+ ${CURRENT_PACKAGES_DIR}/share/${PORT}/hayai-targets-debug.cmake
+ "\${CMAKE_CURRENT_LIST_DIR}/../../debug/lib/hayai_main.lib"
+ "\${CMAKE_CURRENT_LIST_DIR}/../../debug/lib/manual-link/hayai_main.lib"
+ )
+endif()
+
+if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/hayai_main.lib)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/lib/hayai_main.lib
+ ${CURRENT_PACKAGES_DIR}/lib/manual-link/hayai_main.lib
+ )
+
+ vcpkg_replace_string(
+ ${CURRENT_PACKAGES_DIR}/share/${PORT}/hayai-targets-release.cmake
+ "\${CMAKE_CURRENT_LIST_DIR}/../../lib/hayai_main.lib"
+ "\${CMAKE_CURRENT_LIST_DIR}/../../lib/manual-link/hayai_main.lib"
+ )
+endif()
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/hdf5/CONTROL b/ports/hdf5/CONTROL index 18f03e487..542062c50 100644 --- a/ports/hdf5/CONTROL +++ b/ports/hdf5/CONTROL @@ -1,12 +1,12 @@ Source: hdf5 -Version: 1.10.5-7 +Version: 1.10.5-8 Homepage: https://www.hdfgroup.org/downloads/hdf5/ Description: HDF5 is a data model, library, and file format for storing and managing data Build-Depends: zlib, szip Feature: parallel Description: parallel support for HDF5 -Build-Depends: msmpi +Build-Depends: mpi Feature: cpp Description: Builds cpp lib diff --git a/ports/hfsm2/CONTROL b/ports/hfsm2/CONTROL new file mode 100644 index 000000000..4677f8b08 --- /dev/null +++ b/ports/hfsm2/CONTROL @@ -0,0 +1,5 @@ +Source: hfsm2 +Version: beta7 +Homepage: https://github.com/andrew-gresyk/HFSM2 +Description: Header-only heriarchical FSM framework in C++14, with fully statically-defined structure (no dynamic allocations), built with variadic templates. +Build-Depends: catch2 diff --git a/ports/hfsm2/portfile.cmake b/ports/hfsm2/portfile.cmake new file mode 100644 index 000000000..0970d0111 --- /dev/null +++ b/ports/hfsm2/portfile.cmake @@ -0,0 +1,15 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO andrew-gresyk/HFSM2 + REF Beta7 + SHA512 f3365c0823fa63f7e6b82bd2dc84f8871eb58ffd9485753a60ea8f956856cbec7c5da3929ab8fe8b5902a7c840334a1d421417984124adf109f96756490ac437 + HEAD_REF master +) + +# Install include directory +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) diff --git a/ports/hypre/CONTROL b/ports/hypre/CONTROL index 907e64b87..91d281589 100644 --- a/ports/hypre/CONTROL +++ b/ports/hypre/CONTROL @@ -1,5 +1,5 @@ Source: hypre -Version: 2.11.2-1 +Version: 2.11.2-2 Homepage: https://computation.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods Description: SCALABLE LINEAR SOLVERS AND MULTIGRID METHODS -Build-Depends: msmpi +Build-Depends: mpi diff --git a/ports/hypre/portfile.cmake b/ports/hypre/portfile.cmake index a0b38216e..f8ab07b9d 100644 --- a/ports/hypre/portfile.cmake +++ b/ports/hypre/portfile.cmake @@ -25,6 +25,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS ${OPTIONS} OPTIONS_RELEASE diff --git a/ports/imgui/CONTROL b/ports/imgui/CONTROL index 6de881a9a..203556f6f 100644 --- a/ports/imgui/CONTROL +++ b/ports/imgui/CONTROL @@ -1,4 +1,4 @@ Source: imgui -Version: 1.70-1 +Version: 1.72b Homepage: https://github.com/ocornut/imgui Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies. diff --git a/ports/imgui/portfile.cmake b/ports/imgui/portfile.cmake index 2acebc0c8..79c2bb318 100644 --- a/ports/imgui/portfile.cmake +++ b/ports/imgui/portfile.cmake @@ -5,8 +5,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ocornut/imgui - REF v1.70 - SHA512 b1a0fba339a9b19a49316494e58eabacd250e85e8ee17552c03ed99f50886072c882979039f18139e504c4406cf31aea3e9ce391d4641318f0022fa9b51bb9c4 + REF v1.72b + SHA512 ed40f2647a2256e61b6c754d091df364f23c93d7c008a838f7816e2924e16bea3d1251b675e1bd69256697d77f17372e5b29d986720ed5fb63ede94f9e813ede HEAD_REF master ) diff --git a/ports/inja/CONTROL b/ports/inja/CONTROL index ec53d0748..ae7291bfb 100644 --- a/ports/inja/CONTROL +++ b/ports/inja/CONTROL @@ -1,4 +1,4 @@ Source: inja -Version: 2.1.0 +Version: 2.1.0-1 Build-Depends: nlohmann-json Description: Inja - A Template Engine for Modern C++ diff --git a/ports/inja/cmake-version.patch b/ports/inja/cmake-version.patch new file mode 100644 index 000000000..37b048870 --- /dev/null +++ b/ports/inja/cmake-version.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 115c898..176bf2d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,7 @@ + cmake_minimum_required(VERSION 3.5) + + +-project(inja LANGUAGES CXX VERSION 2.0.0) ++project(inja LANGUAGES CXX VERSION 2.1.0) + + + option(INJA_USE_EMBEDDED_JSON "Use the shipped json header if not available on the system" ON) diff --git a/ports/inja/portfile.cmake b/ports/inja/portfile.cmake index 17bde913a..4fb028a1e 100644 --- a/ports/inja/portfile.cmake +++ b/ports/inja/portfile.cmake @@ -5,7 +5,27 @@ vcpkg_from_github( REF v2.1.0 SHA512 6b3a3a6a9e2adff14083a8e83c95fdc5ccf0c930acff40c4cf6c11d67b0df18fd941307e5d1f0c45dcfcb4c4afd0026b718ca510a2b297b9c6be048f5b144d42 HEAD_REF master + PATCHES + cmake-version.patch ) -file(INSTALL ${SOURCE_PATH}/single_include/inja/inja.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include) -file(INSTALL ${SOURCE_PATH}/single_include/inja/inja.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/share/inja RENAME copyright) + +vcpkg_configure_cmake( + SOURCE_PATH "${SOURCE_PATH}" + PREFER_NINJA + OPTIONS + -DINJA_USE_EMBEDDED_JSON=OFF + -DBUILD_TESTING=OFF + -DBUILD_BENCHMARK=OFF +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/inja) vcpkg_copy_pdbs() + +# Inja is a header-only library +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib") +# Don't need built-in nlohmann-json as this package depends on nlohmann-json +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/inja/json") + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/inja RENAME copyright) diff --git a/ports/irrlicht/CMakeLists.txt b/ports/irrlicht/CMakeLists.txt index b58739836..e61a1d270 100644 --- a/ports/irrlicht/CMakeLists.txt +++ b/ports/irrlicht/CMakeLists.txt @@ -85,6 +85,13 @@ target_link_libraries(Irrlicht PRIVATE ${BZIP2_LIBRARY}
)
+target_compile_definitions(Irrlicht PRIVATE
+ NO_IRR_USE_NON_SYSTEM_ZLIB_
+ NO_IRR_USE_NON_SYSTEM_LIB_PNG_
+ NO_IRR_USE_NON_SYSTEM_JPEG_LIB_
+ NO_IRR_USE_NON_SYSTEM_BZLIB_
+ )
+
if(IRR_BUILD_TOOLS)
add_executable(FileToHeader ${IRR_TOOL_FILES_FILE_TO_HEADER})
@@ -144,6 +151,9 @@ endif() target_compile_definitions(Irrlicht PRIVATE IRRLICHT_EXPORTS)
if(WIN32)
+ # Unicode
+ target_compile_definitions(Irrlicht PRIVATE UNICODE _UNICODE)
+
# Import the symbols of bzip2
target_compile_definitions(Irrlicht PRIVATE BZ_IMPORT)
diff --git a/ports/irrlicht/CONTROL b/ports/irrlicht/CONTROL index 7cc3e4223..89c782b46 100644 --- a/ports/irrlicht/CONTROL +++ b/ports/irrlicht/CONTROL @@ -1,5 +1,5 @@ Source: irrlicht
-Version: 1.8.4-1
+Version: 1.8.4-2
Description: Irrlicht lightning fast 3d engine
Build-Depends: zlib, libpng, bzip2, libjpeg-turbo
diff --git a/ports/irrlicht/portfile.cmake b/ports/irrlicht/portfile.cmake index f4eaf5fc8..5bee54b42 100644 --- a/ports/irrlicht/portfile.cmake +++ b/ports/irrlicht/portfile.cmake @@ -22,6 +22,8 @@ vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF "1.8.4"
+ PATCHES
+ "support-unicode-on-windows.patch"
# [NO_REMOVE_ONE_LEVEL]
# [WORKING_DIRECTORY <${CURRENT_BUILDTREES_DIR}/src>]
# [PATCHES <a.patch>...]
diff --git a/ports/irrlicht/support-unicode-on-windows.patch b/ports/irrlicht/support-unicode-on-windows.patch new file mode 100644 index 000000000..609824401 --- /dev/null +++ b/ports/irrlicht/support-unicode-on-windows.patch @@ -0,0 +1,28 @@ +diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h +index c2c5d12..7c44f0c 100644 +--- a/include/IrrCompileConfig.h ++++ b/include/IrrCompileConfig.h +@@ -233,7 +233,9 @@ you will not be able to use anything provided by the GUI Environment, including + disable this feature, the engine behave as before (ansi). This is currently only supported + for Windows based systems. You also have to set #define UNICODE for this to compile. + */ +-//#define _IRR_WCHAR_FILESYSTEM ++#if defined(_IRR_WINDOWS_) && (defined(_UNICODE) || defined(UNICODE)) ++#define _IRR_WCHAR_FILESYSTEM ++#endif + #ifdef NO_IRR_WCHAR_FILESYSTEM + #undef _IRR_WCHAR_FILESYSTEM + #endif +diff --git a/include/Keycodes.h b/include/Keycodes.h +index e56eca1..57ab312 100644 +--- a/include/Keycodes.h ++++ b/include/Keycodes.h +@@ -89,7 +89,7 @@ namespace irr + KEY_KEY_X = 0x58, // X key + KEY_KEY_Y = 0x59, // Y key + KEY_KEY_Z = 0x5A, // Z key +- KEY_LWIN = 0x5B, // Left Windows key (Microsoft Natural keyboard) ++ KEY_LWIN = 0x5B, // Left Windows key (Microsoft® Natural® keyboard) + KEY_RWIN = 0x5C, // Right Windows key (Natural keyboard) + KEY_APPS = 0x5D, // Applications key (Natural keyboard) + KEY_SLEEP = 0x5F, // Computer Sleep key diff --git a/ports/itk/CONTROL b/ports/itk/CONTROL index b77968554..d9e0bde62 100644 --- a/ports/itk/CONTROL +++ b/ports/itk/CONTROL @@ -1,5 +1,5 @@ Source: itk -Version: 5.0.0-2 +Version: 5.0.1 Description: Insight Segmentation and Registration Toolkit (ITK) is used for image processing and analysis. Homepage: https://github.com/InsightSoftwareConsortium/ITK Build-Depends: double-conversion, libjpeg-turbo, zlib, libpng, tiff, expat, eigen3, hdf5[cpp], openjpeg diff --git a/ports/itk/portfile.cmake b/ports/itk/portfile.cmake index a83527a51..e0ebaaecf 100644 --- a/ports/itk/portfile.cmake +++ b/ports/itk/portfile.cmake @@ -10,8 +10,8 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO InsightSoftwareConsortium/ITK - REF v5.0.0 - SHA512 7eecd62ab3124147f0abce482699dfdc43610703959d4a3f667c8ce12a6ecacf836a863d146f3cc7d5220b4aa05adf70a0d4dc6fa8e87bac215565badc96acff + REF v5.0.1 + SHA512 242ce66cf83f82d26f20d2099108295e28c8875e7679126ba023834bf0e94454460ba86452a94c8ddaea93d2314befc399f2b151d7294370d4b47f0e9798e77f HEAD_REF master PATCHES fix_openjpeg_search.patch @@ -35,8 +35,6 @@ vcpkg_configure_cmake( -DITK_INSTALL_DATA_DIR=share/itk/data -DITK_INSTALL_DOC_DIR=share/itk/doc -DITK_INSTALL_PACKAGE_DIR=share/itk - -DITK_LEGACY_REMOVE=ON - -DITK_FUTURE_LEGACY_REMOVE=ON -DITK_USE_64BITS_IDS=ON -DITK_USE_CONCEPT_CHECKING=ON #-DITK_USE_SYSTEM_LIBRARIES=ON # enables USE_SYSTEM for all third party libraries, some of which do not have vcpkg ports such as CastXML, SWIG, MINC etc diff --git a/ports/itpp/CONTROL b/ports/itpp/CONTROL index 623b2fc6b..95a49293b 100644 --- a/ports/itpp/CONTROL +++ b/ports/itpp/CONTROL @@ -1,3 +1,3 @@ Source: itpp
-Version: 4.3.1
+Version: 4.3.1-1
Description: IT++ is a C++ library of mathematical, signal processing and communication classes and functions. Its main use is in simulation of communication systems and for performing research in the area of communications.
\ No newline at end of file diff --git a/ports/itpp/fix-linux.patch b/ports/itpp/fix-linux.patch index 5e7bb64c0..18b66af5f 100644 --- a/ports/itpp/fix-linux.patch +++ b/ports/itpp/fix-linux.patch @@ -1,13 +1,17 @@ diff --git a/itpp/base/random_dsfmt.h b/itpp/base/random_dsfmt.h -index ccbf182..a3d5472 100644 +index ccbf182..de819fb 100644 --- a/itpp/base/random_dsfmt.h +++ b/itpp/base/random_dsfmt.h -@@ -299,7 +299,7 @@ private: +@@ -299,7 +299,12 @@ private: */ static void do_recursion(typename Context::w128_t *r, typename Context::w128_t *a, typename Context::w128_t *b, typename Context::w128_t *lung) { #if defined(__SSE2__) -- const unsigned int SSE2_SHUFF = 0x1bU; ++ ++#ifdef __linux__ +#define SSE2_SHUFF 0x1bU ++#else + const unsigned int SSE2_SHUFF = 0x1bU; ++#endif __m128i x = a->si; __m128i z = _mm_slli_epi64(x, SL1); diff --git a/ports/itpp/fix-uwp.patch b/ports/itpp/fix-uwp.patch index 18e5fe4eb..69805922a 100644 --- a/ports/itpp/fix-uwp.patch +++ b/ports/itpp/fix-uwp.patch @@ -1,12 +1,15 @@ diff --git a/itpp/base/timing.cpp b/itpp/base/timing.cpp -index 58178e4..47d662e 100644 +index 58178e4..6b173d0 100644 --- a/itpp/base/timing.cpp +++ b/itpp/base/timing.cpp -@@ -51,6 +51,7 @@ - +@@ -52,6 +52,10 @@ #if defined(_WIN32) && !defined(__CYGWIN__) #include <windows.h> -+#include <Winsock2.h> ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) ++#include <Winsock2.h> ++#endif ++ int gettimeofday(struct timeval* p, void*) { + union { diff --git a/ports/itpp/portfile.cmake b/ports/itpp/portfile.cmake index 10faf4882..84fc651e4 100644 --- a/ports/itpp/portfile.cmake +++ b/ports/itpp/portfile.cmake @@ -13,20 +13,10 @@ vcpkg_extract_source_archive_ex( REF ${ITPP_VERSION}
PATCHES
msvc2013.patch
+ fix-uwp.patch
+ fix-linux.patch
)
-if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
- vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES fix-uwp.patch
- )
-elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
- vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES fix-linux.patch
- )
-endif()
-
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
diff --git a/ports/jack2/CONTROL b/ports/jack2/CONTROL index d665dbe24..fb3fed91f 100644 --- a/ports/jack2/CONTROL +++ b/ports/jack2/CONTROL @@ -1,5 +1,5 @@ Source: jack2
-Version: 1.9.12-1
+Version: 1.9.12-2
Homepage: https://github.com/jackaudio/jack2
Description: Cross-platform API that enables device sharing and inter-application audio routing
diff --git a/ports/jack2/portfile.cmake b/ports/jack2/portfile.cmake index f7109aafd..3cb59189e 100644 --- a/ports/jack2/portfile.cmake +++ b/ports/jack2/portfile.cmake @@ -15,6 +15,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/jsoncons/CONTROL b/ports/jsoncons/CONTROL index 8b01549ef..7158ab580 100644 --- a/ports/jsoncons/CONTROL +++ b/ports/jsoncons/CONTROL @@ -1,3 +1,4 @@ -Source: jsoncons
-Version: 0.125.0 -Description: A C++, header-only library for constructing JSON and JSON-like text and binary data formats, with JSON Pointer, JSON Patch, JSONPath, CSV, MessagePack, CBOR, BSON, UBJSON
+Source: jsoncons +Version: 0.131.2 +Description: A C++, header-only library for constructing JSON and JSON-like text and binary data formats, with JSON Pointer, JSON Patch, JSONPath, CSV, MessagePack, CBOR, BSON, UBJSON +Homepage: https://github.com/danielaparker/jsoncons diff --git a/ports/jsoncons/portfile.cmake b/ports/jsoncons/portfile.cmake index fb00be0ad..7c6af87b5 100644 --- a/ports/jsoncons/portfile.cmake +++ b/ports/jsoncons/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO danielaparker/jsoncons - REF v0.125.0 - SHA512 60969fa9bb47c8ee2e01c9333322940c7e9063e4c7761fa54f9d2bba8e49815145e2b48f2bc528a5b3b5316aded2930cdf410a29ce608df09a561a4650d20e15 + REF v0.131.2 + SHA512 7053a971cbc6e12623b65f98323c0d330c903f2b5eae9191369a9a04ae87654e8fa435139e9a72829a1ef9a957e3d4837362c90668f42ba8a0eedc80207e6eef HEAD_REF master ) diff --git a/ports/jsonnet/CONTROL b/ports/jsonnet/CONTROL index 35c870658..508f1e7af 100644 --- a/ports/jsonnet/CONTROL +++ b/ports/jsonnet/CONTROL @@ -1,4 +1,4 @@ Source: jsonnet -Version: 2019-05-08 +Version: 2019-05-08-1 Homepage: https://github.com/google/jsonnet Description: Jsonnet - The data templating language diff --git a/ports/jsonnet/portfile.cmake b/ports/jsonnet/portfile.cmake index 5472445da..ffa2973fb 100644 --- a/ports/jsonnet/portfile.cmake +++ b/ports/jsonnet/portfile.cmake @@ -11,12 +11,12 @@ vcpkg_from_github( SHA512 d9f84c39929e9e80272e2b834f68a13b48c1cb4d64b70f5b6fa16e677555d947f7cf57372453e23066a330faa6a429b9aa750271b46f763581977a223d238785 HEAD_REF master PATCHES - 001-enable-msvc.patch + 001-enable-msvc.patch ) if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") vcpkg_execute_required_process( - COMMAND Powershell -Command "((Get-Content -Encoding Byte \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' > \"${SOURCE_PATH}/core/std.jsonnet.h\"" + COMMAND Powershell -Command "((Get-Content -AsByteStream \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' | Out-File -Encoding Ascii \"${SOURCE_PATH}/core/std.jsonnet.h\"" WORKING_DIRECTORY "${SOURCE_PATH}" LOGNAME "std.jsonnet" ) @@ -31,7 +31,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS -DBUILD_JSONNET=OFF -DBUILD_TESTS=OFF + OPTIONS -DBUILD_JSONNET=OFF -DBUILD_JSONNETFMT=OFF -DBUILD_TESTS=OFF ) vcpkg_install_cmake() diff --git a/ports/jxrlib/CONTROL b/ports/jxrlib/CONTROL index f104c4c84..8ed2805a4 100644 --- a/ports/jxrlib/CONTROL +++ b/ports/jxrlib/CONTROL @@ -1,4 +1,4 @@ Source: jxrlib
-Version: 1.1-7
+Version: 1.1-8
Homepage: https://github.com/4creators/jxrlib
Description: Open source implementation of the jpegxr image format standard.
diff --git a/ports/jxrlib/portfile.cmake b/ports/jxrlib/portfile.cmake index 43358fa15..76b0f61fa 100644 --- a/ports/jxrlib/portfile.cmake +++ b/ports/jxrlib/portfile.cmake @@ -22,6 +22,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/kangaru/CONTROL b/ports/kangaru/CONTROL index 6990d5190..9f7e93f1b 100644 --- a/ports/kangaru/CONTROL +++ b/ports/kangaru/CONTROL @@ -1,3 +1,3 @@ Source: kangaru -Version: 4.1.3-1 +Version: 4.2.0 Description: A dependency injection container for C++11, C++14 and later diff --git a/ports/kangaru/portfile.cmake b/ports/kangaru/portfile.cmake index 15af5ded0..c4ede7a3d 100644 --- a/ports/kangaru/portfile.cmake +++ b/ports/kangaru/portfile.cmake @@ -3,14 +3,15 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO gracicot/kangaru - REF v4.1.3 - SHA512 7cfec493dff475c8fe88e336638897096359d3781ab8944aa6bb8f5b68a4dbc993f769142d0143ae5db751159cee1b125ea2728e8b73747950572c84ea354090 + REF v4.2.0 + SHA512 8495add3074370edaef397fa298d6e5305165c3d8e2d5abfa18b0853418cd47a75a38753d33bc58f1d038f1a8d0c8812b9763a822d580641e98c331495946b50 HEAD_REF master ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS -DKANGARU_EXPORT=Off -DKANGARU_TEST=Off + PREFER_NINJA + OPTIONS -DKANGARU_EXPORT=Off -DKANGARU_TEST=Off -DKANGARU_REVERSE_DESTRUCTION=On ) vcpkg_install_cmake() diff --git a/ports/kealib/CONTROL b/ports/kealib/CONTROL index 9e2b6549c..bb2b4cd48 100644 --- a/ports/kealib/CONTROL +++ b/ports/kealib/CONTROL @@ -1,9 +1,9 @@ Source: kealib -Version: 1.4.11 +Version: 1.4.11-1 Build-Depends: hdf5[cpp], zlib, szip Homepage: https://bitbucket.org/chchrsc/kealib Description: kealib is gdal model using HDF5 standard. Feature: parallel Description: Use parallel support for HDF5 -Build-Depends: hdf5[parallel], msmpi +Build-Depends: hdf5[parallel], mpi diff --git a/ports/lastools/CONTROL b/ports/lastools/CONTROL new file mode 100644 index 000000000..cb908a8d4 --- /dev/null +++ b/ports/lastools/CONTROL @@ -0,0 +1,4 @@ +Source: lastools
+Version: 2019-07-10
+Homepage: https://github.com/LAStools/LAStools
+Description: LAStools: award-winning software for efficient LiDAR processing (with LASzip)
\ No newline at end of file diff --git a/ports/lastools/portfile.cmake b/ports/lastools/portfile.cmake new file mode 100644 index 000000000..5f6e40397 --- /dev/null +++ b/ports/lastools/portfile.cmake @@ -0,0 +1,35 @@ +if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ message(FATAL_ERROR "${PORT} doesn't currently support UWP.")
+endif()
+
+include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO LAStools/LAStools
+ REF f15a702530e098b46c2eb3923f89a68ffa81e668
+ SHA512 df5763b7c69721ba2a24fde2b4092e53136020b88ff4cc0d533279d709c55d7d16d8a4300f0b68829294d9311ed674af5b15306c4ded7a6310e55404737702e0
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+endif()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
+
diff --git a/ports/lazy-importer/CONTROL b/ports/lazy-importer/CONTROL new file mode 100644 index 000000000..c46a768b0 --- /dev/null +++ b/ports/lazy-importer/CONTROL @@ -0,0 +1,4 @@ +Source: lazy-importer +Version: 2019-08-10 +Description: Library for importing functions from dlls in a hidden, reverse engineer unfriendly way +Homepage: https://github.com/JustasMasiulis/lazy_importer diff --git a/ports/lazy-importer/portfile.cmake b/ports/lazy-importer/portfile.cmake new file mode 100644 index 000000000..076bb7c34 --- /dev/null +++ b/ports/lazy-importer/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO JustasMasiulis/lazy_importer + REF 88186bfce98845eba9050f7597332754f621c0fc + SHA512 04789501ea9c9cf600326b3f8292c441f54d0915452eb29b063fe0a8d56a31157cf338a4ec44aa658e397d754b6593ece51af2736d5980e72d67359a1abc2625 + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/include/lazy_importer.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/leaf/CONTROL b/ports/leaf/CONTROL new file mode 100644 index 000000000..d85d93d9a --- /dev/null +++ b/ports/leaf/CONTROL @@ -0,0 +1,3 @@ +Source: leaf
+Version: 0.2.1-2
+Description: Lightweight error augmentation framework
\ No newline at end of file diff --git a/ports/leaf/portfile.cmake b/ports/leaf/portfile.cmake new file mode 100644 index 000000000..1ff5e1e53 --- /dev/null +++ b/ports/leaf/portfile.cmake @@ -0,0 +1,21 @@ +include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO zajo/leaf
+ REF 5fd08ee095c92b2bf4623b7237393e81f995ca7a
+ SHA512 92b86dbba55d31808f442d27dd873dce1162b28213533e124df448ae4f7b4442733501b6539ab15f67a85e184e458a66df4e4e020a3a213b44578ebbde281a42
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/leaf RENAME copyright)
diff --git a/ports/leptonica/CONTROL b/ports/leptonica/CONTROL index 39a0a5e5c..0d65a10d5 100644 --- a/ports/leptonica/CONTROL +++ b/ports/leptonica/CONTROL @@ -1,5 +1,5 @@ Source: leptonica -Version: 1.76.0-1 +Version: 1.78.0 Homepage: https://github.com/DanBloomberg/leptonica Description: An open source library containing software that is broadly useful for image processing and image analysis applications Build-Depends: libjpeg-turbo, zlib, libpng, tiff, giflib diff --git a/ports/leptonica/portfile.cmake b/ports/leptonica/portfile.cmake index 34a1c379e..7b8479698 100644 --- a/ports/leptonica/portfile.cmake +++ b/ports/leptonica/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO DanBloomberg/leptonica - REF 1.76.0 - SHA512 0d7575dc38d1e656a228ef30412a2cbb908b9c7c8636e4e96f4a7dc0429c04709316b8ad04893285ab430c1b2063d71537fc5b989a0f9dbdbec488713e1bab1f + REF 87b8219360bca3c9929a5705c3d9c50c42c34bca + SHA512 b7bfa9437be7e3d9276acacf8f62ccda1cd8f88741ada5106ef0232d4965617be2c5d0b8a6b4462896a1a0b6b44d9ecefd6e6b8d0e50d4fb881bdf5e821703a4 HEAD_REF master PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-cmakelists.patch diff --git a/ports/leptonica/use-tiff-libraries.patch b/ports/leptonica/use-tiff-libraries.patch index f994be552..4db86ef7b 100644 --- a/ports/leptonica/use-tiff-libraries.patch +++ b/ports/leptonica/use-tiff-libraries.patch @@ -1,13 +1,13 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 3af7e30..55e17da 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -44,7 +44,7 @@ if (PNG_LIBRARY) - endif() - if (TIFF_LIBRARY) - target_include_directories (leptonica PUBLIC ${TIFF_INCLUDE_DIR}) -- target_link_libraries (leptonica ${TIFF_LIBRARY}) -+ target_link_libraries (leptonica ${TIFF_LIBRARIES}) - endif() - if (WEBP_FOUND) - target_include_directories (leptonica PUBLIC ${WEBP_INCLUDE_DIR}) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 6daad98..5119895 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -48,7 +48,7 @@ if (PNG_LIBRARY)
+ endif()
+ if (TIFF_LIBRARY)
+ target_include_directories (leptonica PUBLIC ${TIFF_INCLUDE_DIR})
+- target_link_libraries (leptonica ${TIFF_LIBRARY})
++ target_link_libraries (leptonica ${TIFF_LIBRARIES})
+ endif()
+ if (WEBP_FOUND)
+ target_include_directories (leptonica PUBLIC ${WEBP_INCLUDE_DIRS})
diff --git a/ports/libcerf/001-fix-static-build.patch b/ports/libcerf/001-fix-static-build.patch new file mode 100644 index 000000000..ffaeaedfb --- /dev/null +++ b/ports/libcerf/001-fix-static-build.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f79581f..4fc9457 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -56,6 +56,8 @@ if(MSVC)
+ # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/$<CONFIG>)
+ if(BUILD_SHARED_LIBS)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
++ else()
++ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
+ endif()
+ else()
+ add_compile_options(-O2 -Wno-sign-compare -fno-omit-frame-pointer)
diff --git a/ports/libcerf/CONTROL b/ports/libcerf/CONTROL new file mode 100644 index 000000000..72b1324d3 --- /dev/null +++ b/ports/libcerf/CONTROL @@ -0,0 +1,4 @@ +Source: libcerf
+Version: 1.13
+Description: A self-contained numeric library that provides an efficient and accurate implementation of complex error functions, along with Dawson, Faddeeva, and Voigt functions.
+Homepage: https://jugit.fz-juelich.de/mlz/libcerf
diff --git a/ports/libcerf/portfile.cmake b/ports/libcerf/portfile.cmake new file mode 100644 index 000000000..20e3c7c70 --- /dev/null +++ b/ports/libcerf/portfile.cmake @@ -0,0 +1,35 @@ +include(vcpkg_common_functions)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(BUILD_SHARED_LIBS ON)
+else()
+ set(BUILD_SHARED_LIBS OFF)
+endif()
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://jugit.fz-juelich.de/mlz/libcerf/uploads/924b8d245ad3461107ec630734dfc781/libcerf-1.13.tgz"
+ FILENAME "libcerf-1.13.tgz"
+ SHA512 4df711d3e9fd00de99959c3253a9565d1dc2c41f75a5800ced9c52f89cbd13185fbdca3ad75de788fd16c044082738ab345b7fb6a8820ac588edafe1812944aa
+)
+
+vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE ${ARCHIVE}
+ PATCHES 001-fix-static-build.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DCERF_CPP=ON
+ -DLIB_MAN=OFF
+ -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libcerf RENAME copyright)
+
+vcpkg_test_cmake(PACKAGE_NAME libcerf)
diff --git a/ports/libconfig/CONTROL b/ports/libconfig/CONTROL index 8b64a280e..3cbedcf5c 100644 --- a/ports/libconfig/CONTROL +++ b/ports/libconfig/CONTROL @@ -1,4 +1,4 @@ Source: libconfig -Version: 1.7.2 +Version: 1.7.2-1 Homepage: https://github.com/hyperrealm/libconfig Description: C/C++ library for processing configuration files diff --git a/ports/libconfig/portfile.cmake b/ports/libconfig/portfile.cmake index 9456636a9..a3958d342 100644 --- a/ports/libconfig/portfile.cmake +++ b/ports/libconfig/portfile.cmake @@ -13,6 +13,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON ) diff --git a/ports/libconfuse/CMakeLists.txt b/ports/libconfuse/CMakeLists.txt new file mode 100644 index 000000000..651dab2f0 --- /dev/null +++ b/ports/libconfuse/CMakeLists.txt @@ -0,0 +1,139 @@ +cmake_minimum_required(VERSION 3.14)
+
+set(ac_init_line_re "AC_INIT\\(([^,]+), ([^,]+), ([^,]+), ([^)]+)\\)")
+file(STRINGS
+ ${CMAKE_CURRENT_LIST_DIR}/configure.ac
+ ac_init_line
+ REGEX ${ac_init_line_re}
+)
+
+string(REGEX REPLACE "${ac_init_line_re}" "\\1" PACKAGE_NAME ${ac_init_line})
+string(REGEX REPLACE "${ac_init_line_re}" "\\2" PACKAGE_VERSION ${ac_init_line})
+string(REGEX REPLACE "${ac_init_line_re}" "\\3" PACKAGE_BUGREPORT ${ac_init_line})
+string(REGEX REPLACE "${ac_init_line_re}" "\\4" PACKAGE ${ac_init_line})
+
+set(PACKAGE_TARNAME ${PACKAGE})
+set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+
+string(REGEX REPLACE "([0-9]+.[0-9]+.[0-9]+).*" "\\1" SEMANTIC_VERSION ${PACKAGE_VERSION})
+
+project(libconfuse VERSION ${SEMANTIC_VERSION} LANGUAGES C)
+
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+include(GNUInstallDirs)
+
+find_package(FLEX REQUIRED)
+find_package(Gettext QUIET)
+find_package(Intl QUIET)
+
+set(CMAKE_DISABLE_SOURCE_CHANGES ON)
+set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
+
+if (GETTEXT_FOUND)
+ set(ENABLE_NLS 1)
+endif ()
+
+# libconfig.pc.in
+set(prefix ${CMAKE_INSTALL_PREFIX})
+set(exec_prefix ${prefix})
+set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR})
+set(includedir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
+set(VERSION ${PROJECT_VERSION})
+
+if (Intl_FOUND AND Intl_LIBRARIES)
+ set(LTLIBINTL ${Intl_LIBRARIES})
+endif ()
+
+configure_file(libconfuse.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libconfuse.pc @ONLY)
+
+check_function_exists(dcgettext HAVE_DCGETTEXT)
+check_function_exists(fmemopen HAVE_FMEMOPEN)
+check_function_exists(funopen HAVE_FUNOPEN)
+check_function_exists(gettext HAVE_GETTEXT)
+check_function_exists(iconv HAVE_ICONV)
+check_function_exists(strcasecmp HAVE_STRCASECMP)
+check_function_exists(strdup HAVE_STRDUP)
+check_function_exists(_strdup HAVE__STRDUP)
+check_function_exists(strndup HAVE_STRNDUP)
+check_function_exists(setenv HAVE_SETENV)
+check_function_exists(unsetenv HAVE_UNSETENV)
+check_function_exists(_putenv HAVE__PUTENV)
+
+if (MSVC)
+ check_function_exists(_fileno HAVE__FILENO)
+ check_function_exists(_isatty HAVE__ISATTY)
+ check_function_exists(_stricmp HAVE_STRCASECMP)
+endif ()
+
+check_include_file(stdlib.h HAVE_STDLIB_H)
+check_include_file(string.h HAVE_STRING_H)
+
+check_include_file(strings.h HAVE_STRINGS_H)
+check_include_file(sys/stat.h HAVE_SYS_STAT_H)
+check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+check_include_file(unistd.h HAVE_UNISTD_H)
+check_include_file(windows.h HAVE_WINDOWS_H)
+
+configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+flex_target(
+ CONFUSE
+ src/lexer.l
+ ${CMAKE_CURRENT_BINARY_DIR}/lexer.c
+ COMPILE_FLAGS -Pcfg_yy
+)
+
+set(libconfuse_sources
+ src/confuse.c
+ ${FLEX_CONFUSE_OUTPUTS}
+)
+
+if (NOT HAVE_FMEMOPEN)
+ list(APPEND libconfuse_sources src/fmemopen.c)
+endif ()
+
+add_library(libconfuse ${libconfuse_sources})
+
+if (BUILD_SHARED_LIBS)
+ if (WIN32)
+ target_compile_definitions(libconfuse PRIVATE BUILDING_DLL)
+ endif ()
+else ()
+ target_compile_definitions(libconfuse PUBLIC BUILDING_STATIC)
+endif ()
+
+string(COMPARE EQUAL "${CMAKE_C_COMPILER_ID}" "GNU" USING_GNUC)
+
+target_compile_definitions(libconfuse
+ PUBLIC
+ $<BUILD_INTERFACE:HAVE_CONFIG_H>
+ PRIVATE
+ $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
+ $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
+ $<$<BOOL:${MSVC}>:strcasecmp=_stricmp>
+ $<$<BOOL:${USING_GNUC}>:_GNU_SOURCE>
+)
+
+target_include_directories(libconfuse
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+set_target_properties(libconfuse PROPERTIES PUBLIC_HEADER src/confuse.h)
+
+install(TARGETS libconfuse EXPORT unofficial-libconfuse-config)
+
+install(
+ EXPORT unofficial-libconfuse-config
+ NAMESPACE unofficial::libconfuse::
+ DESTINATION share/unofficial-libconfuse
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/libconfuse.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+)
diff --git a/ports/libconfuse/CONTROL b/ports/libconfuse/CONTROL new file mode 100644 index 000000000..15044cce3 --- /dev/null +++ b/ports/libconfuse/CONTROL @@ -0,0 +1,4 @@ +Source: libconfuse
+Version: 2019-07-14
+Description: Small configuration file parser library for C
+Homepage: https://github.com/martinh/libconfuse
diff --git a/ports/libconfuse/config.h.in b/ports/libconfuse/config.h.in new file mode 100644 index 000000000..3a43264bd --- /dev/null +++ b/ports/libconfuse/config.h.in @@ -0,0 +1,99 @@ +/* Define if translation of program messages to the user's native
+ language is requested. */
+#cmakedefine ENABLE_NLS
+
+/* Define if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H
+
+/* Define if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H
+
+/* Define if you have the <windows.h> header file. */
+#cmakedefine HAVE_WINDOWS_H
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you have the `_fileno' function. */
+#cmakedefine HAVE__FILENO
+
+/* Define if you have the `_isatty' function. */
+#cmakedefine HAVE__ISATTY
+
+/* Define if the GNU dcgettext() function is already present or preinstalled. */
+#cmakedefine HAVE_DCGETTEXT
+
+/* Define if you have the `fmemopen' function. */
+#cmakedefine HAVE_FMEMOPEN
+
+/* Define if you have the `funopen' function. */
+#cmakedefine HAVE_FUNOPEN
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#cmakedefine HAVE_GETTEXT
+
+/* Define if you have the iconv() function. */
+#cmakedefine HAVE_ICONV
+
+/* Define if you have the `strcasecmp' function. */
+#cmakedefine HAVE_STRCASECMP
+
+/* Define if you have the `strdup' function. */
+#cmakedefine HAVE_STRDUP
+
+/* Define if you have the `_strdup' function. */
+#cmakedefine HAVE__STRDUP
+
+/* Define if you have the strndup function */
+#cmakedefine HAVE_STRNDUP
+
+/* Define if you have the `setenv' function. */
+#cmakedefine HAVE_SETENV
+
+/* Define if you have the `unsetenv' function. */
+#cmakedefine HAVE_UNSETENV
+
+/* Define if you have the `_putenv' function. */
+#cmakedefine HAVE__PUTENV
+
+/* Define if `lex' declares `yytext' as a `char *' by default, not a
+ `char[]'. */
+/*#undef YYTEXT_POINTER*/
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/*#undef const*/
+
+/* Name of package */
+#define PACKAGE "@PACKAGE@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "@PACKAGE_NAME@"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "@PACKAGE_STRING@"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+
+/* Version number of package */
+#define VERSION "@PACKAGE_VERSION@"
+
+#define LOCALEDIR "@CMAKE_INSTALL_LOCALEDIR@"
diff --git a/ports/libconfuse/portfile.cmake b/ports/libconfuse/portfile.cmake new file mode 100644 index 000000000..01c6290cd --- /dev/null +++ b/ports/libconfuse/portfile.cmake @@ -0,0 +1,43 @@ +include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO martinh/libconfuse
+ REF 67e1207c8de440525a3fdde1448a586791ebc052
+ SHA512 15d4eb0640fe74cc90910820715a70b2f944d2ed9753cca3be90f0ac6840beeda6a370b0624588d81ed2def2f8463e404473721351a685af711cf1d59efb870a
+ HEAD_REF master
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h.in DESTINATION ${SOURCE_PATH})
+
+vcpkg_find_acquire_program(FLEX)
+get_filename_component(FLEX_DIR ${FLEX} DIRECTORY)
+vcpkg_add_to_path(${FLEX_DIR})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_replace_string(
+ ${CURRENT_PACKAGES_DIR}/include/confuse.h
+ "ifdef BUILDING_STATIC"
+ "if 1 // ifdef BUILDING_STATIC"
+ )
+endif()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME unofficial-${PORT})
diff --git a/ports/libevent/CONTROL b/ports/libevent/CONTROL index 95a4c37da..a05a77edd 100644 --- a/ports/libevent/CONTROL +++ b/ports/libevent/CONTROL @@ -1,5 +1,5 @@ Source: libevent
-Version: 2.1.10
+Version: 2.1.11
Build-Depends: openssl
Homepage: https://github.com/libevent/libevent
Description: An event notification library
diff --git a/ports/libevent/fix-arm_build.patch b/ports/libevent/fix-arm_build.patch deleted file mode 100644 index 7bfad0449..000000000 --- a/ports/libevent/fix-arm_build.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 44b6e18..19c024f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -322,7 +322,7 @@ endif() - # Winsock. - if(WIN32) - set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h ws2tcpip.h) -- set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib) -+ set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib advapi32.lib shell32.lib) - set(CMAKE_REQUIRED_DEFINITIONS -FIwinsock2.h -FIws2tcpip.h) - endif() - if (SOLARIS) -diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake -index 411ca9d..869735e 100644 ---- a/cmake/AddEventLibrary.cmake -+++ b/cmake/AddEventLibrary.cmake -@@ -73,6 +73,8 @@ macro(add_event_library LIB_NAME) - list(APPEND ADD_EVENT_LIBRARY_TARGETS "${LIB_NAME}_static") - - set(ADD_EVENT_LIBRARY_INTERFACE "${LIB_NAME}_static") -+ -+ target_link_libraries("${LIB_NAME}_static" PRIVATE ${CMAKE_REQUIRED_LIBRARIES}) - endif() - - if (${EVENT_LIBRARY_SHARED}) -@@ -81,7 +83,8 @@ macro(add_event_library LIB_NAME) - target_link_libraries("${LIB_NAME}_shared" - ${CMAKE_THREAD_LIBS_INIT} - ${LIB_PLATFORM} -- ${LIB_LIBRARIES}) -+ ${LIB_LIBRARIES} -+ ${CMAKE_REQUIRED_LIBRARIES}) - - if (EVENT_SHARED_FLAGS) - set_event_shared_lib_flags("${LIB_NAME}" "${EVENT_SHARED_FLAGS}") diff --git a/ports/libevent/portfile.cmake b/ports/libevent/portfile.cmake index ee3fdd3b6..91c915b92 100644 --- a/ports/libevent/portfile.cmake +++ b/ports/libevent/portfile.cmake @@ -7,11 +7,10 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libevent/libevent - REF release-2.1.10-stable - SHA512 8c336df258f7a12164da739b0ea68bebcc8b2ea4f4a839300aa1c5edfb673ac5d6517f882ba04ab35d406489ddd682a319e39fa6784ac0cab73227d42e503a55 + REF release-2.1.11-stable + SHA512 a34ca4ad4d55a989a4f485f929d0ed2438d070d0e12a19d90c2b12783a562419c64db6a2603b093d958a75246d14ffefc8730c69c90b1b2f48339bde947f0e02 PATCHES fix-file_path.patch - fix-arm_build.patch ) if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") @@ -34,16 +33,20 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "windows" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if (VCPKG_TARGET_IS_WINDOWS) vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/libevent) -elseif (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) -elseif (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") +else () vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) endif() +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/libevent/) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/event_rpcgen.py ${CURRENT_PACKAGES_DIR}/tools/libevent/event_rpcgen.py) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + vcpkg_copy_pdbs() file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libevent) diff --git a/ports/libexif/CONTROL b/ports/libexif/CONTROL index d99eb31b9..e37d0960e 100644 --- a/ports/libexif/CONTROL +++ b/ports/libexif/CONTROL @@ -1,4 +1,4 @@ Source: libexif -Version: 0.6.21-1 -Homepage: https://sourceforge.net/projects/libexif/ +Version: 0.6.21-2 +Homepage: https://libexif.github.io/ Description: a library for parsing, editing, and saving EXIF data diff --git a/ports/libexif/add-missing-_stdint-h.patch b/ports/libexif/add-missing-_stdint-h.patch new file mode 100644 index 000000000..1c4c95d1c --- /dev/null +++ b/ports/libexif/add-missing-_stdint-h.patch @@ -0,0 +1,7 @@ +diff --git a/libexif/_stdint.h b/libexif/_stdint.h +new file mode 100644 +index 0000000..9a6118b +--- /dev/null ++++ b/libexif/_stdint.h +@@ -0,0 +1 @@ ++#include <stdint.h> diff --git a/ports/libexif/portfile.cmake b/ports/libexif/portfile.cmake index 0442d8c15..11f7080d1 100644 --- a/ports/libexif/portfile.cmake +++ b/ports/libexif/portfile.cmake @@ -4,15 +4,14 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") message(FATAL_ERROR "libexif currently only supports being built for desktop") endif() -set(LIBEXIF_VERSION 0.6.21) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libexif-${LIBEXIF_VERSION}) - -vcpkg_download_distfile(ARCHIVE - URLS "https://freefr.dl.sourceforge.net/project/libexif/libexif/${LIBEXIF_VERSION}/libexif-${LIBEXIF_VERSION}.tar.bz2" - FILENAME "libexif-${LIBEXIF_VERSION}.tar.bz2" - SHA512 4e0fe2abe85d1c95b41cb3abe1f6333dc3a9eb69dba106a674a78d74a4d5b9c5a19647118fa1cc2d72b98a29853394f1519eda9e2889eb28d3be26b21c7cfc35 +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libexif/libexif + REF libexif-0_6_21-release + SHA512 aecba54eb9c8b4ce29d11985a547074b381d72027b563c7aef865852b661a6f18a258c748fca6b16198344f4a86568b658071ac95cc1d332f576c6160e1f257d + HEAD_REF master + PATCHES add-missing-_stdint-h.patch ) -vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h.cmake DESTINATION ${SOURCE_PATH}) diff --git a/ports/libfreenect2/CONTROL b/ports/libfreenect2/CONTROL index bb0b63871..6734e25cc 100644 --- a/ports/libfreenect2/CONTROL +++ b/ports/libfreenect2/CONTROL @@ -1,5 +1,5 @@ Source: libfreenect2 -Version: 0.2.0-2 +Version: 0.2.0-3 Build-Depends: libusb, libjpeg-turbo Homepage: https://github.com/OpenKinect/libfreenect2 Description: Open source drivers for the Kinect for Windows v2 device diff --git a/ports/libfreenect2/portfile.cmake b/ports/libfreenect2/portfile.cmake index 839c7073e..9ca8867fb 100644 --- a/ports/libfreenect2/portfile.cmake +++ b/ports/libfreenect2/portfile.cmake @@ -20,6 +20,7 @@ file(WRITE ${SOURCE_PATH}/examples/CMakeLists.txt "${EXAMPLECMAKE}") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DENABLE_CUDA=OFF ) diff --git a/ports/libgit2/CONTROL b/ports/libgit2/CONTROL index 5c396d473..5569f18ff 100644 --- a/ports/libgit2/CONTROL +++ b/ports/libgit2/CONTROL @@ -1,5 +1,5 @@ Source: libgit2
-Version: 0.28.2
+Version: 0.28.3
Homepage: https://github.com/libgit2/libgit2
Build-Depends: openssl (!windows&&!uwp)
Description: Git linkable library
diff --git a/ports/libgit2/portfile.cmake b/ports/libgit2/portfile.cmake index 711da201e..d2b70483d 100644 --- a/ports/libgit2/portfile.cmake +++ b/ports/libgit2/portfile.cmake @@ -8,8 +8,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libgit2/libgit2
- REF b3e1a56ebb2b9291e82dc027ba9cbcfc3ead54d3 - SHA512 2a992759c0892300eff6d4e823367e2cfc5bcaa6e37a0e87de45a16393c53ccd286f47f37d38c104e79eed8688b9834ada00000b2d6894f89773f75c83e23022
+ REF v0.28.3 + SHA512 15444823b7d4885f7b8c3982f8905efc4a75913de016a9b2e0a24d5ce9746e6a549dffd5469036529557feff2ce7ece9328266eb312c80b96091ce0f65ee97ee
HEAD_REF master
)
diff --git a/ports/libidn2/CONTROL b/ports/libidn2/CONTROL index 01d89d69b..3ed7546ba 100644 --- a/ports/libidn2/CONTROL +++ b/ports/libidn2/CONTROL @@ -1,5 +1,5 @@ Source: libidn2 -Version: 2.1.1-1 +Version: 2.2.0 Build-Depends: libiconv Homepage: https://www.gnu.org/software/libidn/ Description: GNU Libidn is an implementation of the Stringprep, Punycode and IDNA 2003 specifications. Libidn's purpose is to encode and decode internationalized domain names. diff --git a/ports/libidn2/portfile.cmake b/ports/libidn2/portfile.cmake index d7de30f41..2b5be4692 100644 --- a/ports/libidn2/portfile.cmake +++ b/ports/libidn2/portfile.cmake @@ -1,12 +1,12 @@ include(vcpkg_common_functions) -set(IDN2_VERSION 2.1.1) -set(IDN2_FILENAME libidn2-${IDN2_VERSION}a.tar.gz) +set(IDN2_VERSION 2.2.0) +set(IDN2_FILENAME libidn2-${IDN2_VERSION}.tar.gz) vcpkg_download_distfile(ARCHIVE URLS "http://ftp.gnu.org/gnu/libidn/${IDN2_FILENAME}" FILENAME "${IDN2_FILENAME}" - SHA512 404a739e33d324f700ac8e8119de3feef0de778bbb11be09049cb64eab447cd101883f6d489cca1e88c230f58bcaf9758fe102e571b6501450aa750ec2a4a9c6 + SHA512 ccf56056a378d49a28ff67a2a23cd3d32ce51f86a78f84839b98dad709a1d0d03ac8d7c1496f0e4d3536bca00e3d09d34d76a37317b2ce87e3aa66bdf4e877b8 ) vcpkg_extract_source_archive_ex( diff --git a/ports/libkml/CONTROL b/ports/libkml/CONTROL index 34a3a3440..d52ca4c01 100644 --- a/ports/libkml/CONTROL +++ b/ports/libkml/CONTROL @@ -2,4 +2,4 @@ Source: libkml Version: 1.3.0-3 Homepage: https://github.com/libkml/libkml Description: Reference implementation of OGC KML 2.2 -Build-Depends: zlib, expat, minizip, uriparser, boost-smart-ptr +Build-Depends: zlib, expat, minizip[bzip2], uriparser, boost-smart-ptr diff --git a/ports/liblas/CONTROL b/ports/liblas/CONTROL new file mode 100644 index 000000000..4b983c937 --- /dev/null +++ b/ports/liblas/CONTROL @@ -0,0 +1,12 @@ +Source: liblas +Version: 1.8.1 +Build-Depends: boost, boost-thread, boost-system, boost-iostreams, boost-filesystem, libgeotiff +Description: A C/C++ library for reading and writing the very common LAS LiDAR format. + +Feature: jpeg +Description: Support for jpeg +Build-Depends: libjpeg-turbo + +Feature: zlib +Build-Depends: zlib +Description: Support zlib for compression
\ No newline at end of file diff --git a/ports/liblas/fix-BuildError.patch b/ports/liblas/fix-BuildError.patch new file mode 100644 index 000000000..277e81ef7 --- /dev/null +++ b/ports/liblas/fix-BuildError.patch @@ -0,0 +1,47 @@ +diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt +index beb83e2..6f216bd 100644 +--- a/apps/CMakeLists.txt ++++ b/apps/CMakeLists.txt +@@ -155,7 +152,7 @@ endif() + # Targets installation + + install(TARGETS ${LIBLAS_UTILITIES} +- RUNTIME DESTINATION ${LIBLAS_BIN_DIR} ++ RUNTIME DESTINATION tools + LIBRARY DESTINATION ${LIBLAS_LIB_DIR} + ARCHIVE DESTINATION ${LIBLAS_LIB_DIR}) + +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index c7f583d..ca9e602 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -5,13 +5,8 @@ + # Set where cmake will install liblas-config.cmake. It's installed in + # ${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR} and ${PROJECT_ROOT_DIR} + # is the relative path to the root from there. +-if (NOT WIN32) +- set(INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}") +- set (PROJECT_ROOT_DIR "../../..") +-else () +- set(INSTALL_CMAKE_DIR "cmake") +- set (PROJECT_ROOT_DIR "..") +-endif () ++set(INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}") ++set (PROJECT_ROOT_DIR "../../..") + + # Now create the liblas-config files using the .in templates + configure_file (liblas-config.cmake.in +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index e35de06..f7c25d2 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -226,7 +226,8 @@ target_link_libraries(${LIBLAS_LIB_NAME} + ${GEOTIFF_LIBRARY} + ${GDAL_LIBRARY} + ${LASZIP_LIBRARY} +- ${Boost_LIBRARIES}) ++ ${Boost_LIBRARIES} ++ proj) + + target_link_libraries(${LIBLAS_C_LIB_NAME} + ${LIBLAS_LIB_NAME} ) diff --git a/ports/liblas/portfile.cmake b/ports/liblas/portfile.cmake new file mode 100644 index 000000000..0ad91aa0d --- /dev/null +++ b/ports/liblas/portfile.cmake @@ -0,0 +1,48 @@ +include(vcpkg_common_functions) + +set(VERSION 1.8.1) + +vcpkg_download_distfile(ARCHIVE + URLS "http://download.osgeo.org/liblas/libLAS-${VERSION}.tar.bz2" + FILENAME "libLAS-${VERSION}-src.tar.bz2" + SHA512 1cb39c557af0006c54f1100d0d409977fcc1886abd155c1b144d806c47f8675a9f2125d3a9aca16bae65d2aabba84d5e5e322b42085e7db312f3d53f92342acf + HEAD_REF master +) + +vcpkg_extract_source_archive_ex( + ARCHIVE ${ARCHIVE} + OUT_SOURCE_PATH SOURCE_PATH + PATCHES fix-BuildError.patch +) + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_OSGEO4W=OFF # Disable osgeo4w + -DWITH_TESTS=OFF + -DWITH_UTILITIES=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=${CMAKE_DISABLE_FIND_PACKAGE_ZLIB} + -DCMAKE_DISABLE_FIND_PACKAGE_JPEG=${CMAKE_DISABLE_FIND_PACKAGE_JPEG} +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/doc) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/doc) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/share/cmake/liblas/liblas-depends.cmake) + +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/share/cmake/liblas) + vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/liblas) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/liblas RENAME copyright) diff --git a/ports/libmad/CONTROL b/ports/libmad/CONTROL index ae26eebab..e3adc42be 100644 --- a/ports/libmad/CONTROL +++ b/ports/libmad/CONTROL @@ -1,3 +1,3 @@ Source: libmad
-Version: 0.15.1-2
+Version: 0.15.1-3
Description: high-quality MPEG audio decoder
diff --git a/ports/libmad/portfile.cmake b/ports/libmad/portfile.cmake index cc5027963..9c1f43b56 100644 --- a/ports/libmad/portfile.cmake +++ b/ports/libmad/portfile.cmake @@ -24,6 +24,7 @@ file(COPY ${SOURCE_PATH}/msvc++/mad.h DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/libmariadb/CONTROL b/ports/libmariadb/CONTROL index 986eb5d23..0e3327bb4 100644 --- a/ports/libmariadb/CONTROL +++ b/ports/libmariadb/CONTROL @@ -1,4 +1,4 @@ Source: libmariadb
-Version: 3.0.10-1
+Version: 3.0.10-3
Homepage: https://github.com/MariaDB/mariadb-connector-c
Description: MariaDB Connector/C is used to connect C/C++ applications to MariaDB and MySQL databases
diff --git a/ports/libmariadb/fix-InstallPath.patch b/ports/libmariadb/fix-InstallPath.patch new file mode 100644 index 000000000..1a317aa2d --- /dev/null +++ b/ports/libmariadb/fix-InstallPath.patch @@ -0,0 +1,146 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 02757a9..b2715dd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,6 +15,11 @@ IF(COMMAND CMAKE_POLICY) + ENDFOREACH() + ENDIF() + ++if (BUILD_SHARED_LIBS) ++ set(DEFAULT_LINKAGE DYNAMIC) ++else() ++ set(DEFAULT_LINKAGE STATIC) ++endif() + + PROJECT(mariadb-connector-c C) + +diff --git a/cmake/install_plugins.cmake b/cmake/install_plugins.cmake +index cd5616c..d058a5c 100644 +--- a/cmake/install_plugins.cmake ++++ b/cmake/install_plugins.cmake +@@ -8,7 +8,7 @@ + # plugin installation + + MACRO(INSTALL_PLUGIN name binary_dir) +- INSTALL(TARGETS ${name} COMPONENT ClientPlugins DESTINATION ${INSTALL_PLUGINDIR}) ++ INSTALL(TARGETS ${name} COMPONENT ClientPlugins DESTINATION ${INSTALL_PLUGINDIR}/../../../bin/plugin) + IF(WIN32) + FILE(APPEND ${CC_BINARY_DIR}/win/packaging/plugin.conf "<File Id=\"${name}.dll\" Name=\"${name}.dll\" DiskId=\"1\" Source=\"${binary_dir}/${CMAKE_BUILD_TYPE}/${name}.dll\"/>\n") + FILE(APPEND ${CC_BINARY_DIR}/win/packaging/plugin.conf "<File Id=\"${name}.pdb\" Name=\"${name}.pdb\" DiskId=\"1\" Source=\"${binary_dir}/${CMAKE_BUILD_TYPE}/${name}.pdb\"/>\n") +diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt +index a1f039e..03a3a6f 100644 +--- a/libmariadb/CMakeLists.txt ++++ b/libmariadb/CMakeLists.txt +@@ -386,10 +386,10 @@ ADD_LIBRARY(mariadbclient STATIC ${MARIADB_OBJECTS} ${EMPTY_FILE}) + TARGET_LINK_LIBRARIES(mariadbclient ${SYSTEM_LIBS}) + + IF(UNIX) +- ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE}) ++ ADD_LIBRARY(libmariadb ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE}) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") + ELSE() +- ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} mariadbclient.def) ++ ADD_LIBRARY(libmariadb ${libmariadb_RC} mariadbclient.def) + TARGET_LINK_LIBRARIES(libmariadb mariadbclient) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINKER_LANGUAGE C) + ENDIF() +@@ -441,13 +441,14 @@ ENDIF() + + INSTALL(TARGETS mariadbclient + COMPONENT Development +- DESTINATION ${INSTALL_LIBDIR}) ++ LIBRARY DESTINATION lib) + INSTALL(TARGETS libmariadb + COMPONENT SharedLibraries +- DESTINATION ${INSTALL_LIBDIR}) ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + +- +-IF(WIN32) ++IF(0) + # On Windows, install PDB + INSTALL(FILES $<TARGET_PDB_FILE:libmariadb> DESTINATION "${INSTALL_LIBDIR}" + CONFIGURATIONS Debug RelWithDebInfo +diff --git a/plugins/auth/CMakeLists.txt b/plugins/auth/CMakeLists.txt +index 42f6f05..9a57146 100644 +--- a/plugins/auth/CMakeLists.txt ++++ b/plugins/auth/CMakeLists.txt +@@ -14,7 +14,7 @@ REGISTER_PLUGIN(TARGET mysql_native_password + REGISTER_PLUGIN(TARGET dialog + TYPE MARIADB_CLIENT_PLUGIN_AUTH + CONFIGURATIONS DYNAMIC STATIC OFF +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${CC_SOURCE_DIR}/plugins/auth/dialog.c + ${CC_SOURCE_DIR}/libmariadb/get_password.c) + +@@ -33,7 +33,7 @@ IF(WITH_SSL) + REGISTER_PLUGIN(TARGET caching_sha2_password + TYPE MARIADB_CLIENT_PLUGIN_AUTH + CONFIGURATIONS DYNAMIC STATIC OFF +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${CC_SOURCE_DIR}/plugins/auth/caching_sha2_pw.c + ${CRYPT_SOURCE} + LIBRARIES ${CACHING_SHA2_LIBS}) +@@ -53,7 +53,7 @@ IF(GSSAPI_SOURCES) + REGISTER_PLUGIN(TARGET auth_gssapi_client + TYPE MARIADB_CLIENT_PLUGIN_AUTH + CONFIGURATIONS DYNAMIC STATIC OFF +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${GSSAPI_SOURCES} + INCLUDES ${CC_SOURCE_DIR}/plugins/auth ${GSSAPI_INCS} + LIBRARIES ${GSSAPI_LIBS}) +@@ -68,7 +68,7 @@ IF(${WITH_SSL} STREQUAL "OPENSSL" OR ${WITH_SSL} STREQUAL "SCHANNEL") + REGISTER_PLUGIN(TARGET sha256_password + TYPE MARIADB_CLIENT_PLUGIN_AUTH + CONFIGURATIONS DYNAMIC STATIC OFF +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${AUTH_DIR}/sha256_pw.c + LIBRARIES ${SHA256_LIBS}) + ENDIF() +@@ -85,6 +85,6 @@ REGISTER_PLUGIN(TARGET mysql_old_password + REGISTER_PLUGIN(TARGET mysql_clear_password + TYPE MARIADB_CLIENT_PLUGIN_AUTH + CONFIGURATIONS DYNAMIC STATIC OFF +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${AUTH_DIR}/mariadb_cleartext.c) + +diff --git a/plugins/io/CMakeLists.txt b/plugins/io/CMakeLists.txt +index 8c304c9..3547107 100644 +--- a/plugins/io/CMakeLists.txt ++++ b/plugins/io/CMakeLists.txt +@@ -7,7 +7,7 @@ IF (WITH_CURL) + REGISTER_PLUGIN(TARGET remote_io + TYPE MARIADB_CLIENT_PLUGIN_IO + CONFIGURATIONS DYNAMIC STATIC OFF +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${CC_SOURCE_DIR}/plugins/io/remote_io.c + INCLUDES ${CURL_INCLUDE_DIR} + LIBRARIES ${CURL_LIBRARIES}) +diff --git a/plugins/pvio/CMakeLists.txt b/plugins/pvio/CMakeLists.txt +index 76eb3ef..3601622 100644 +--- a/plugins/pvio/CMakeLists.txt ++++ b/plugins/pvio/CMakeLists.txt +@@ -15,13 +15,13 @@ IF(WIN32) + REGISTER_PLUGIN(TARGET pvio_npipe + TYPE MARIADB_CLIENT_PLUGIN_PVIO + CONFIGURATIONS STATIC DYNAMIC DEFAULT +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${CC_SOURCE_DIR}/plugins/pvio/pvio_npipe.c) + + # shared memory + REGISTER_PLUGIN(TARGET pvio_shmem + TYPE MARIADB_CLIENT_PLUGIN_PVIO + CONFIGURATIONS STATIC DYNAMIC DEFAULT +- DEFAULT DYNAMIC ++ DEFAULT ${DEFAULT_LINKAGE} + SOURCES ${CC_SOURCE_DIR}/plugins/pvio/pvio_shmem.c) + ENDIF() diff --git a/ports/libmariadb/portfile.cmake b/ports/libmariadb/portfile.cmake index 0089ec0a3..ebf8b9f24 100644 --- a/ports/libmariadb/portfile.cmake +++ b/ports/libmariadb/portfile.cmake @@ -14,10 +14,12 @@ vcpkg_from_github( PATCHES
md.patch
disable-test-build.patch
+ fix-InstallPath.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DWITH_UNITTEST=OFF
-DWITH_SSL=OFF
@@ -38,45 +40,8 @@ if(VCPKG_BUILD_TYPE STREQUAL "debug") ${CURRENT_PACKAGES_DIR}/include)
endif()
-# fix libmariadb lib & dll directory.
-if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
- file(RENAME
- ${CURRENT_PACKAGES_DIR}/lib/mariadb/mariadbclient.lib
- ${CURRENT_PACKAGES_DIR}/lib/mariadbclient.lib)
- endif()
-
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
- file(RENAME
- ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/mariadbclient.lib
- ${CURRENT_PACKAGES_DIR}/debug/lib/mariadbclient.lib)
- endif()
-else()
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
- file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
- file(RENAME
- ${CURRENT_PACKAGES_DIR}/lib/mariadb/libmariadb.dll
- ${CURRENT_PACKAGES_DIR}/bin/libmariadb.dll)
- file(RENAME
- ${CURRENT_PACKAGES_DIR}/lib/mariadb/libmariadb.lib
- ${CURRENT_PACKAGES_DIR}/lib/libmariadb.lib)
- endif()
-
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
- file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(RENAME
- ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/libmariadb.dll
- ${CURRENT_PACKAGES_DIR}/debug/bin/libmariadb.dll)
- file(RENAME
- ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/libmariadb.lib
- ${CURRENT_PACKAGES_DIR}/debug/lib/libmariadb.lib)
- endif()
-endif()
-
# remove plugin folder
file(REMOVE_RECURSE
- ${CURRENT_PACKAGES_DIR}/lib/plugin
- ${CURRENT_PACKAGES_DIR}/debug/lib/plugin
${CURRENT_PACKAGES_DIR}/lib/mariadb
${CURRENT_PACKAGES_DIR}/debug/lib/mariadb)
diff --git a/ports/libmspack/CONTROL b/ports/libmspack/CONTROL index de476a430..c81f19005 100644 --- a/ports/libmspack/CONTROL +++ b/ports/libmspack/CONTROL @@ -1,5 +1,5 @@ Source: libmspack -Version: 0.10.1 +Version: 0.10.1-1 Build-Depends: Homepage: https://www.cabextract.org.uk/libmspack Description: libmspack is a portable library for some loosely related Microsoft compression formats. diff --git a/ports/libmspack/portfile.cmake b/ports/libmspack/portfile.cmake index 759f01724..b476ad9a6 100644 --- a/ports/libmspack/portfile.cmake +++ b/ports/libmspack/portfile.cmake @@ -18,6 +18,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/libmspack.def DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/libnice/CONTROL b/ports/libnice/CONTROL index 2d542c41d..8f79f6b0a 100644 --- a/ports/libnice/CONTROL +++ b/ports/libnice/CONTROL @@ -1,5 +1,5 @@ Source: libnice -Version: 0.1.15 +Version: 0.1.15-1 Homepage: https://nice.freedesktop.org Description: Libnice is an implementation of the IETF's Interactive Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal Utilities for NAT (STUN) standard (RFC 5389). Build-Depends: glib, openssl diff --git a/ports/libnice/portfile.cmake b/ports/libnice/portfile.cmake index 2c0f87afe..14fb0d646 100644 --- a/ports/libnice/portfile.cmake +++ b/ports/libnice/portfile.cmake @@ -15,6 +15,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_RELEASE -DOPTIMIZE=1 OPTIONS_DEBUG -DDEBUGGABLE=1 ) diff --git a/ports/libodb-boost/CONTROL b/ports/libodb-boost/CONTROL index 24f7d18b9..3dec84103 100644 --- a/ports/libodb-boost/CONTROL +++ b/ports/libodb-boost/CONTROL @@ -1,4 +1,4 @@ Source: libodb-boost -Version: 2.4.0-2 +Version: 2.4.0-3 Description: Description: Boost support for the ODB ORM library Build-Depends: libodb diff --git a/ports/libodb-boost/portfile.cmake b/ports/libodb-boost/portfile.cmake index 212e6b01a..dc94a232f 100644 --- a/ports/libodb-boost/portfile.cmake +++ b/ports/libodb-boost/portfile.cmake @@ -14,6 +14,7 @@ file(COPY vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DLIBODB_INSTALL_HEADERS=OFF ) diff --git a/ports/libodb-mysql/CONTROL b/ports/libodb-mysql/CONTROL index fe5a28e8a..7d2ee12f1 100644 --- a/ports/libodb-mysql/CONTROL +++ b/ports/libodb-mysql/CONTROL @@ -1,5 +1,5 @@ Source: libodb-mysql -Version: 2.4.0-2 +Version: 2.4.0-3 Homepage: https://www.codesynthesis.com/products/odb/ Description: MySQL support for the ODB ORM library Build-Depends: libodb, libmysql
\ No newline at end of file diff --git a/ports/libodb-mysql/portfile.cmake b/ports/libodb-mysql/portfile.cmake index 88684bd35..cf2d8b8c7 100644 --- a/ports/libodb-mysql/portfile.cmake +++ b/ports/libodb-mysql/portfile.cmake @@ -35,6 +35,7 @@ set(MYSQL_LIB "${CURRENT_INSTALLED_DIR}/lib/libmysql.lib") set(MYSQL_LIB_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib/libmysql.lib") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DMYSQL_INCLUDE_DIR=${MYSQL_INCLUDE_DIR} OPTIONS_RELEASE diff --git a/ports/libodb-pgsql/CONTROL b/ports/libodb-pgsql/CONTROL index d35291135..a6988eeb0 100644 --- a/ports/libodb-pgsql/CONTROL +++ b/ports/libodb-pgsql/CONTROL @@ -1,5 +1,5 @@ Source: libodb-pgsql -Version: 2.4.0-2 +Version: 2.4.0-3 Homepage: https://www.codesynthesis.com/products/odb/ Description: Description: PostgreSQL support for the ODB ORM library Build-Depends: libodb, libpq diff --git a/ports/libodb-pgsql/portfile.cmake b/ports/libodb-pgsql/portfile.cmake index 3e31f2aa7..ed9f35034 100644 --- a/ports/libodb-pgsql/portfile.cmake +++ b/ports/libodb-pgsql/portfile.cmake @@ -14,6 +14,7 @@ file(COPY vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DLIBODB_INSTALL_HEADERS=OFF ) diff --git a/ports/libodb-sqlite/CONTROL b/ports/libodb-sqlite/CONTROL index a8d9ef41f..ed02fa815 100644 --- a/ports/libodb-sqlite/CONTROL +++ b/ports/libodb-sqlite/CONTROL @@ -1,5 +1,5 @@ Source: libodb-sqlite -Version: 2.4.0-3 +Version: 2.4.0-4 Homepage: https://www.codesynthesis.com/products/odb/ Description: Sqlite support for the ODB ORM library Build-Depends: libodb, sqlite3 diff --git a/ports/libodb-sqlite/portfile.cmake b/ports/libodb-sqlite/portfile.cmake index b301169a7..67e4ffb37 100644 --- a/ports/libodb-sqlite/portfile.cmake +++ b/ports/libodb-sqlite/portfile.cmake @@ -22,6 +22,7 @@ file(COPY vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DLIBODB_INSTALL_HEADERS=OFF ) diff --git a/ports/libodb/CONTROL b/ports/libodb/CONTROL index 049a1bd12..129db70ab 100644 --- a/ports/libodb/CONTROL +++ b/ports/libodb/CONTROL @@ -1,4 +1,4 @@ Source: libodb -Version: 2.4.0-4 +Version: 2.4.0-5 Homepage: https://www.codesynthesis.com/products/odb/ Description: ODB library, base runtime for the ODB ORM solution diff --git a/ports/libodb/portfile.cmake b/ports/libodb/portfile.cmake index 1ca5d4a1a..7e48f43e5 100644 --- a/ports/libodb/portfile.cmake +++ b/ports/libodb/portfile.cmake @@ -22,6 +22,7 @@ file(COPY vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DLIBODB_INSTALL_HEADERS=OFF ) diff --git a/ports/libpmemobj-cpp/CONTROL b/ports/libpmemobj-cpp/CONTROL index ec1eb3628..1c692e8eb 100644 --- a/ports/libpmemobj-cpp/CONTROL +++ b/ports/libpmemobj-cpp/CONTROL @@ -1,4 +1,4 @@ Source: libpmemobj-cpp
-Version: 1.6-1
+Version: 1.7
#Build-Depends: pmdk
Description: C++ bindings for libpmemobj (https://github.com/pmem/pmdk).
\ No newline at end of file diff --git a/ports/libpmemobj-cpp/portfile.cmake b/ports/libpmemobj-cpp/portfile.cmake index 457711404..d60ee3376 100644 --- a/ports/libpmemobj-cpp/portfile.cmake +++ b/ports/libpmemobj-cpp/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pmem/libpmemobj-cpp
- REF 1.6
- SHA512 c9a90ebc6e3231b9fcc86c9c55cc8dc219b663b39828680fb58ad7229dba1d60428c34824445f627350013bf32b83e5f0f9c2d4c17054f2321d5200832e6fea0
+ REF 1.7
+ SHA512 1caea1227baa0f36190a108cbf7150fd7022175a138d81167bb25d4b1c5dba14a5c16c37477f8895b5c4f9fd460c7c43560ceeccc4ad088f94b50de18637173b
HEAD_REF master
)
diff --git a/ports/librabbitmq/CONTROL b/ports/librabbitmq/CONTROL index 38287971d..9f2d0fae6 100644 --- a/ports/librabbitmq/CONTROL +++ b/ports/librabbitmq/CONTROL @@ -1,5 +1,5 @@ Source: librabbitmq -Version: 0.9.0 +Version: 0.9.0-1 Build-Depends: openssl Homepage: https://github.com/alanxz/rabbitmq-c Description: A C-language AMQP client library for use with v2.0+ of the RabbitMQ broker. diff --git a/ports/librabbitmq/portfile.cmake b/ports/librabbitmq/portfile.cmake index 79463c26c..3bf4d25cc 100644 --- a/ports/librabbitmq/portfile.cmake +++ b/ports/librabbitmq/portfile.cmake @@ -15,6 +15,7 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF diff --git a/ports/librdkafka/CONTROL b/ports/librdkafka/CONTROL index f4030ff08..9b520bbe3 100644 --- a/ports/librdkafka/CONTROL +++ b/ports/librdkafka/CONTROL @@ -1,5 +1,5 @@ Source: librdkafka
-Version: 1.1.0
+Version: 1.1.0-1
Description: The Apache Kafka C/C++ library
Homepage: https://github.com/edenhill/librdkafka
@@ -18,3 +18,6 @@ Build-Depends: zlib Feature: zstd
Description: Build with zstd
Build-Depends: zstd
+
+Feature: snappy
+Description: Build with snappy
diff --git a/ports/librdkafka/portfile.cmake b/ports/librdkafka/portfile.cmake index 5bc66fdfa..c441c3c07 100644 --- a/ports/librdkafka/portfile.cmake +++ b/ports/librdkafka/portfile.cmake @@ -12,11 +12,12 @@ vcpkg_from_github( string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" RDKAFKA_BUILD_STATIC)
-vcpkg_check_features(
- lz4 ENABLE_LZ4_EXT
- ssl WITH_SSL
- zlib WITH_ZLIB
- zstd WITH_ZSTD
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ lz4 ENABLE_LZ4_EXT
+ ssl WITH_SSL
+ zlib WITH_ZLIB
+ zstd WITH_ZSTD
+ snappy WITH_SNAPPY
)
vcpkg_configure_cmake(
@@ -49,7 +50,7 @@ vcpkg_fixup_cmake_targets( TARGET_PATH share/rdkafka
)
-if(ENABLE_LZ4_EXT)
+if("lz4" IN_LIST FEATURES)
vcpkg_replace_string(
${CURRENT_PACKAGES_DIR}/share/rdkafka/RdKafkaConfig.cmake
"find_dependency(LZ4)"
diff --git a/ports/libsamplerate/CONTROL b/ports/libsamplerate/CONTROL index dc0bf20dc..36e5df98c 100644 --- a/ports/libsamplerate/CONTROL +++ b/ports/libsamplerate/CONTROL @@ -1,4 +1,4 @@ Source: libsamplerate -Version: 0.1.9.0 +Version: 0.1.9.0-1 Homepage: https://www.mega-nerd.com/SRC Description: Sample Rate Converter for audio diff --git a/ports/libsamplerate/portfile.cmake b/ports/libsamplerate/portfile.cmake index 87712f6d2..9cd648a6d 100644 --- a/ports/libsamplerate/portfile.cmake +++ b/ports/libsamplerate/portfile.cmake @@ -15,6 +15,7 @@ file(COPY ${SOURCE_PATH}/Win32/config.h DESTINATION ${SOURCE_PATH}/src) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/src + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/libtorrent/CONTROL b/ports/libtorrent/CONTROL index 2fe8e85ed..ef6da1321 100644 --- a/ports/libtorrent/CONTROL +++ b/ports/libtorrent/CONTROL @@ -1,5 +1,5 @@ Source: libtorrent -Version: 2019-04-19 +Version: 1.2.1-bcb26fd6 Homepage: https://github.com/arvidn/libtorrent Description: An efficient feature complete C++ BitTorrent implementation Build-Depends: openssl, boost-system, boost-date-time, boost-chrono, boost-random, boost-asio, boost-crc, boost-config, boost-iterator, boost-scope-exit, boost-multiprecision diff --git a/ports/libtorrent/portfile.cmake b/ports/libtorrent/portfile.cmake index bc05d14c7..df31dbe93 100644 --- a/ports/libtorrent/portfile.cmake +++ b/ports/libtorrent/portfile.cmake @@ -3,12 +3,11 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO arvidn/libtorrent - REF 76c2794923c4c101ff715be11d794f7fefc6c524 - SHA512 3e154857bb56318ebe725326e1832aa387dc85840be80ebe76c0265e8fded43bc3006d528784c8805e30c3fba41b4108ccf81170870d1686dc499048367563ea + REF bcb26fd638bd8c543cd3cc42837b120ff86d44b1 + SHA512 af897d2daca6e67efe777724147b1047624df9df938222fe967d380263d88ccb3c081e1a24a6c790bf1b35f46385ef08b46d8e46d0922f945cd28c59dd0d35a7 HEAD_REF master PATCHES add-datetime-to-boost-libs.patch - windows-boost-1.70.patch ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBTORRENT_SHARED) diff --git a/ports/libtorrent/windows-boost-1.70.patch b/ports/libtorrent/windows-boost-1.70.patch deleted file mode 100644 index b0bf1f642..000000000 --- a/ports/libtorrent/windows-boost-1.70.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/ip_notifier.cpp b/src/ip_notifier.cpp
-index 37e5623..daa25f8 100644
---- a/src/ip_notifier.cpp
-+++ b/src/ip_notifier.cpp
-@@ -380,7 +380,7 @@ struct ip_change_notifier_impl final : ip_change_notifier
- }
- else
- {
-- m_hnd.get_io_service().post([cb, err]()
-+ lt::get_io_service(m_hnd).post([cb, err]()
- { cb(error_code(err, system_category())); });
- }
- }
diff --git a/ports/libusb/CONTROL b/ports/libusb/CONTROL index e4229daed..d8b7d7042 100644 --- a/ports/libusb/CONTROL +++ b/ports/libusb/CONTROL @@ -1,4 +1,4 @@ Source: libusb -Version: 1.0.22-3 +Version: 1.0.22-4 Homepage: https://github.com/libusb/libusb Description: a cross-platform library to access USB devices diff --git a/ports/libusb/portfile.cmake b/ports/libusb/portfile.cmake index d5047841f..9ab38c869 100644 --- a/ports/libusb/portfile.cmake +++ b/ports/libusb/portfile.cmake @@ -18,7 +18,7 @@ vcpkg_from_github( fix_c2001.patch ) -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) if(VCPKG_PLATFORM_TOOLSET MATCHES "v142") set(MSVS_VERSION 2017) #they are abi compatible, so it should work elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v141") @@ -29,8 +29,20 @@ if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") set(LIBUSB_PROJECT_TYPE dll) + if (VCPKG_CRT_LINKAGE STREQUAL static) + file(READ "${SOURCE_PATH}/msvc/libusb_${LIBUSB_PROJECT_TYPE}_${MSVS_VERSION}.vcxproj" PROJ_FILE) + string(REPLACE "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>" "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>" PROJ_FILE "${PROJ_FILE}") + string(REPLACE "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>" "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>" PROJ_FILE "${PROJ_FILE}") + file(WRITE "${SOURCE_PATH}/msvc/libusb_${LIBUSB_PROJECT_TYPE}_${MSVS_VERSION}.vcxproj" "${PROJ_FILE}") + endif() else() set(LIBUSB_PROJECT_TYPE static) + if (VCPKG_CRT_LINKAGE STREQUAL dynamic) + file(READ "${SOURCE_PATH}/msvc/libusb_${LIBUSB_PROJECT_TYPE}_${MSVS_VERSION}.vcxproj" PROJ_FILE) + string(REPLACE "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>" "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>" PROJ_FILE "${PROJ_FILE}") + string(REPLACE "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>" "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>" PROJ_FILE "${PROJ_FILE}") + file(WRITE "${SOURCE_PATH}/msvc/libusb_${LIBUSB_PROJECT_TYPE}_${MSVS_VERSION}.vcxproj" "${PROJ_FILE}") + endif() endif() vcpkg_install_msbuild( diff --git a/ports/libwebsockets/CONTROL b/ports/libwebsockets/CONTROL index 1b091480a..a180ec420 100644 --- a/ports/libwebsockets/CONTROL +++ b/ports/libwebsockets/CONTROL @@ -1,5 +1,5 @@ Source: libwebsockets -Version: 3.1.0-2 +Version: 3.1.0-3 Build-Depends: zlib, openssl Homepage: https://github.com/warmcat/libwebsockets Description: Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources, and provide fast throughput in both directions as client or server. diff --git a/ports/libwebsockets/portfile.cmake b/ports/libwebsockets/portfile.cmake index b2b90cccf..06793dd8e 100644 --- a/ports/libwebsockets/portfile.cmake +++ b/ports/libwebsockets/portfile.cmake @@ -13,6 +13,7 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LWS_WITH_SHARED) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DLWS_WITH_STATIC=${LWS_WITH_STATIC} -DLWS_WITH_SHARED=${LWS_WITH_SHARED} diff --git a/ports/libzippp/CONTROL b/ports/libzippp/CONTROL new file mode 100644 index 000000000..f2a6b24d6 --- /dev/null +++ b/ports/libzippp/CONTROL @@ -0,0 +1,4 @@ +Source: libzippp
+Version: 2019-07-22
+Description: Simple basic C++ wrapper around the libzip library. It is meant to be a portable and easy-to-use library for ZIP handling
+Build-Depends: zlib, libzip[bzip2]
diff --git a/ports/libzippp/portfile.cmake b/ports/libzippp/portfile.cmake new file mode 100644 index 000000000..3c3a22ffa --- /dev/null +++ b/ports/libzippp/portfile.cmake @@ -0,0 +1,27 @@ +include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ctabin/libzippp
+ REF be75a3413b648a3264e94a2c1921c83081dec1e0
+ SHA512 86c6040bbaea0817486218e96c4d230a328e3560ada41861fbd18d78faa085b158199318d633085e616509084082bf29d6f97afdd2d2dfbc6b843dfbf6a20c85
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DBUILD_TESTS=OFF
+ OPTIONS_DEBUG
+ -DINSTALL_HEADERS=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH "share/libzippp")
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENCE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libzippp RENAME copyright)
diff --git a/ports/lmdb/CONTROL b/ports/lmdb/CONTROL index eea847401..eac4b017f 100644 --- a/ports/lmdb/CONTROL +++ b/ports/lmdb/CONTROL @@ -1,4 +1,4 @@ Source: lmdb -Version: 0.9.23-1 +Version: 0.9.23-2 Homepage: https://github.com/LMDB/lmdb Description: LMDB is an extraordinarily fast, memory-efficient database diff --git a/ports/lmdb/portfile.cmake b/ports/lmdb/portfile.cmake index 9dc1aeeb2..064f7cff6 100644 --- a/ports/lmdb/portfile.cmake +++ b/ports/lmdb/portfile.cmake @@ -13,6 +13,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake/ DESTINATION ${SOURCE_PATH}/libraries/ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/libraries/liblmdb + PREFER_NINJA OPTIONS_DEBUG -DLMDB_INSTALL_HEADERS=OFF ) diff --git a/ports/mbedtls/CONTROL b/ports/mbedtls/CONTROL index ac4a4a131..787d15652 100644 --- a/ports/mbedtls/CONTROL +++ b/ports/mbedtls/CONTROL @@ -1,4 +1,4 @@ Source: mbedtls -Version: 2.15.1 +Version: 2.16.2 Homepage: https://github.com/ARMmbed/mbedtls Description: An open source, portable, easy to use, readable and flexible SSL library diff --git a/ports/mbedtls/portfile.cmake b/ports/mbedtls/portfile.cmake index fa87630a4..d1a937243 100644 --- a/ports/mbedtls/portfile.cmake +++ b/ports/mbedtls/portfile.cmake @@ -5,8 +5,8 @@ set(VCPKG_LIBRARY_LINKAGE static) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ARMmbed/mbedtls - REF mbedtls-2.15.1 - SHA512 361bac49bc179c020855a59140a3e9e31ec9e89ebde9d630e9f3491cdfdf466c8dc2313276d6b257a7728784f5478bdcfd14d26e81f90d432bad2e9a94151fc2 + REF mbedtls-2.16.2 + SHA512 55af897ea3a1455ec4c16980a504a542333e8465bdf89d77b756e6d9893c394166ec880734ecdb10ec0643ddc828bf21e2dd8891b1b4a431e9c57e63a07915aa HEAD_REF master ) diff --git a/ports/metis/CONTROL b/ports/metis/CONTROL index 02f5eb9e1..3ddfbb788 100644 --- a/ports/metis/CONTROL +++ b/ports/metis/CONTROL @@ -1,4 +1,4 @@ Source: metis
-Version: 5.1.0-4
+Version: 5.1.0-5
Homepage: https://glaros.dtc.umn.edu/gkhome/metis/metis/overview
Description: Serial Graph Partitioning and Fill-reducing Matrix Ordering
diff --git a/ports/metis/portfile.cmake b/ports/metis/portfile.cmake index 7a7f575a6..ec17f0dc3 100644 --- a/ports/metis/portfile.cmake +++ b/ports/metis/portfile.cmake @@ -26,6 +26,7 @@ vcpkg_extract_source_archive_ex( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS ${OPTIONS}
)
diff --git a/ports/mimalloc/CONTROL b/ports/mimalloc/CONTROL new file mode 100644 index 000000000..daf48d8ce --- /dev/null +++ b/ports/mimalloc/CONTROL @@ -0,0 +1,13 @@ +Source: mimalloc
+Version: 2019-06-25-1
+Description: Compact general purpose allocator with excellent performance
+Homepage: https://github.com/microsoft/mimalloc
+
+Feature: asm
+Description: Generate assembly files
+
+Feature: override
+Description: Override the standard malloc interface
+
+Feature: secure
+Description: Use security mitigations (like guard pages and randomization)
diff --git a/ports/mimalloc/fix-cmake.patch b/ports/mimalloc/fix-cmake.patch new file mode 100644 index 000000000..3fd5f3050 --- /dev/null +++ b/ports/mimalloc/fix-cmake.patch @@ -0,0 +1,52 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a35e885..76b6f60 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -105,7 +105,7 @@ else() + list(APPEND mi_libraries pthread) + endif() + +- ++if(BUILD_SHARED_LIBS) + # shared library + add_library(mimalloc SHARED ${mi_sources}) + set_target_properties(mimalloc PROPERTIES VERSION ${mi_version} NO_SONAME "YES" OUTPUT_NAME ${mi_basename} ) +@@ -116,7 +116,7 @@ endif() + target_compile_options(mimalloc PRIVATE ${mi_cflags}) + target_include_directories(mimalloc PRIVATE include PUBLIC $<INSTALL_INTERFACE:${mi_install_dir}/include>) + target_link_libraries(mimalloc PUBLIC ${mi_libraries}) +- ++else() + # static library + add_library(mimalloc-static STATIC ${mi_sources}) + if(WIN32) +@@ -135,15 +135,18 @@ endif() + target_compile_options(mimalloc-static PRIVATE ${mi_cflags}) + target_include_directories(mimalloc-static PRIVATE include PUBLIC $<INSTALL_INTERFACE:${mi_install_dir}/include>) + target_link_libraries(mimalloc-static PUBLIC ${mi_libraries}) ++endif() + + # install static and shared library, and the include files +-install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_dir} LIBRARY NAMELINK_SKIP) +-install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_dir}) ++if(BUILD_SHARED_LIBS) ++install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP) ++else() ++install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION lib) ++endif() + install(FILES include/mimalloc.h DESTINATION ${mi_install_dir}/include) + install(FILES cmake/mimalloc-config.cmake DESTINATION ${mi_install_dir}/cmake) + install(FILES cmake/mimalloc-config-version.cmake DESTINATION ${mi_install_dir}/cmake) + install(EXPORT mimalloc DESTINATION ${mi_install_dir}/cmake) +-install(FILES "$<TARGET_FILE:mimalloc>" DESTINATION lib) # duplicate the .so in the lib directory (unversioned) + + # single object file for more predictable static overriding + add_library(mimalloc-obj OBJECT src/static.c) +@@ -154,7 +157,3 @@ if(NOT WIN32 AND MI_OVERRIDE MATCHES "ON") + endif() + target_compile_options(mimalloc-obj PRIVATE ${mi_cflags}) + target_include_directories(mimalloc-obj PRIVATE include PUBLIC $<INSTALL_INTERFACE:include>) +- +-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/mimalloc-obj.dir/src/static.c${CMAKE_C_OUTPUT_EXTENSION} +- DESTINATION ${mi_install_dir} +- RENAME ${mi_basename}${CMAKE_C_OUTPUT_EXTENSION} ) diff --git a/ports/mimalloc/portfile.cmake b/ports/mimalloc/portfile.cmake new file mode 100644 index 000000000..1a11284f5 --- /dev/null +++ b/ports/mimalloc/portfile.cmake @@ -0,0 +1,71 @@ +include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO microsoft/mimalloc
+ REF c6c1d5fffd0cf8dcb2ab969cde8fd170af44fdef
+ SHA512 3b9ce5d7dd70dd5ea56b70833c842068312a739e6131d956fd733e9893441e7e3340b6734bea0b799ac292533b0082975c08facd963961062dac821ccc44f9a9
+ HEAD_REF master
+ PATCHES
+ fix-cmake.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ asm MI_SEE_ASM
+ secure MI_SECURE
+ override MI_OVERRIDE
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS_DEBUG
+ -DMI_CHECK_FULL=ON
+ OPTIONS_RELEASE
+ -DMI_CHECK_FULL=OFF
+ OPTIONS
+ -DMI_INTERPOSE=ON
+ -DMI_USE_CXX=OFF
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+file(GLOB lib_directories RELATIVE ${CURRENT_PACKAGES_DIR}/lib "${CURRENT_PACKAGES_DIR}/lib/${PORT}-*")
+list(GET lib_directories 0 lib_install_dir)
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/${lib_install_dir}/cmake)
+
+vcpkg_replace_string(
+ ${CURRENT_PACKAGES_DIR}/share/${PORT}/mimalloc.cmake
+ "lib/${lib_install_dir}/"
+ ""
+)
+
+file(COPY
+ ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
+)
+
+file(COPY ${CURRENT_PACKAGES_DIR}/lib/${lib_install_dir}/include DESTINATION ${CURRENT_PACKAGES_DIR})
+
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/lib/${lib_install_dir}
+ ${CURRENT_PACKAGES_DIR}/debug/share
+ ${CURRENT_PACKAGES_DIR}/lib/${lib_install_dir}
+)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ vcpkg_replace_string(
+ ${CURRENT_PACKAGES_DIR}/include/mimalloc.h
+ "!defined(MI_SHARED_LIB)"
+ "0 // !defined(MI_SHARED_LIB)"
+ )
+endif()
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/mimalloc/vcpkg-cmake-wrapper.cmake b/ports/mimalloc/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..4e2a70c4b --- /dev/null +++ b/ports/mimalloc/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,9 @@ +_find_package(${ARGS})
+
+if(TARGET mimalloc AND NOT TARGET mimalloc-static)
+ add_library(mimalloc-static INTERFACE IMPORTED)
+ set_target_properties(mimalloc-static PROPERTIES INTERFACE_LINK_LIBRARIES mimalloc)
+elseif(TARGET mimalloc-static AND NOT TARGET mimalloc)
+ add_library(mimalloc INTERFACE IMPORTED)
+ set_target_properties(mimalloc PROPERTIES INTERFACE_LINK_LIBRARIES mimalloc-static)
+endif()
diff --git a/ports/minizip/CMakeLists.txt b/ports/minizip/CMakeLists.txt index edb9b3c7b..b5c5d5dbc 100644 --- a/ports/minizip/CMakeLists.txt +++ b/ports/minizip/CMakeLists.txt @@ -6,12 +6,20 @@ if(MSVC) endif() find_package(ZLIB REQUIRED) +set(MIN_SRC contrib/minizip) -find_package(BZip2 REQUIRED) +include_directories(${MIN_SRC} ${ZLIB_INCLUDE_DIRS}) -set(MIN_SRC contrib/minizip) +set(MINIZIP_LIBRARIES ZLIB::ZLIB) +if(ENABLE_BZIP2) + message(STATUS "Building with bzip2 support") + find_package(BZip2) -include_directories(${MIN_SRC} ${ZLIB_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR}) + include_directories(${BZIP2_INCLUDE_DIR}) + set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARIES} ${BZIP2_LIBRARIES}) +else() + message(STATUS "Building without bzip2 support") +endif() set(SRC ${MIN_SRC}/ioapi.c @@ -41,14 +49,16 @@ add_library(minizip ${SRC}) target_link_libraries(minizip PRIVATE ZLIB::ZLIB) target_compile_definitions(minizip PRIVATE -D_ZLIB_H) -target_link_libraries(minizip PRIVATE ${BZIP2_LIBRARIES}) -target_compile_definitions(minizip PRIVATE -DHAVE_BZIP2=1) +if(ENABLE_BZIP2) + target_link_libraries(minizip PRIVATE ${BZIP2_LIBRARIES}) + target_compile_definitions(minizip PRIVATE -DHAVE_BZIP2=1) +endif() -add_executable(minizip_bin ${MIN_SRC}/minizip.c) -add_executable(miniunz_bin ${MIN_SRC}/miniunz.c) +add_executable(minizip_bin ${MIN_SRC}/minizip.c) +add_executable(miniunz_bin ${MIN_SRC}/miniunz.c) -target_link_libraries(minizip_bin minizip ${BZIP2_LIBRARIES} ZLIB::ZLIB) -target_link_libraries(miniunz_bin minizip ${BZIP2_LIBRARIES} ZLIB::ZLIB) +target_link_libraries(minizip_bin minizip ${MINIZIP_LIBRARIES}) +target_link_libraries(miniunz_bin minizip ${MINIZIP_LIBRARIES}) set_target_properties(minizip_bin PROPERTIES OUTPUT_NAME minizip) set_target_properties(miniunz_bin PROPERTIES OUTPUT_NAME miniunz) diff --git a/ports/minizip/CONTROL b/ports/minizip/CONTROL index 93d453ca2..9570e945e 100644 --- a/ports/minizip/CONTROL +++ b/ports/minizip/CONTROL @@ -1,5 +1,9 @@ Source: minizip
-Version: 1.2.11-4
+Version: 1.2.11-5
+Build-Depends: zlib
Homepage: https://github.com/madler/zlib
Description: Zip compression library
-Build-Depends: bzip2, zlib
+
+Feature: bzip2
+Build-Depends: bzip2
+Description: Support compression using bzip2 library
diff --git a/ports/minizip/portfile.cmake b/ports/minizip/portfile.cmake index 15289b767..86cfe9b9d 100644 --- a/ports/minizip/portfile.cmake +++ b/ports/minizip/portfile.cmake @@ -1,37 +1,48 @@ include(vcpkg_common_functions) if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore) - message(FATAL_ERROR "WindowsStore not supported") + message(FATAL_ERROR "WindowsStore not supported") endif() vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO madler/zlib - REF v1.2.11 - SHA512 104c62ed1228b5f1199bc037081861576900eb0697a226cafa62a35c4c890b5cb46622e399f9aad82ee5dfb475bae26ae75e2bd6da3d261361b1c8b996970faf - HEAD_REF master - PATCHES minizip.patch # enable decrypt support for password-encrypted ZIP files + OUT_SOURCE_PATH SOURCE_PATH + REPO madler/zlib + REF v1.2.11 + SHA512 104c62ed1228b5f1199bc037081861576900eb0697a226cafa62a35c4c890b5cb46622e399f9aad82ee5dfb475bae26ae75e2bd6da3d261361b1c8b996970faf + HEAD_REF master + PATCHES minizip.patch # enable decrypt support for password-encrypted ZIP files ) +set(BUILD_minizip_bzip2 OFF) +if ("bzip2" IN_LIST FEATURES) + set(BUILD_minizip_bzip2 ON) +endif() + file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON -DDISABLE_INSTALL_TOOLS=ON + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DENABLE_BZIP2=${BUILD_minizip_bzip2} + OPTIONS_DEBUG + -DDISABLE_INSTALL_HEADERS=ON -DDISABLE_INSTALL_TOOLS=ON ) vcpkg_install_cmake() vcpkg_copy_pdbs() vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/minizip) -file(GLOB HEADERS "${CURRENT_PACKAGES_DIR}/include/minizip/*.h") -foreach(HEADER ${HEADERS}) - file(READ "${HEADER}" _contents) - string(REPLACE "#ifdef HAVE_BZIP2" "#if 1" _contents "${_contents}") - file(WRITE "${HEADER}" "${_contents}") -endforeach() + +if ("bzip2" IN_LIST FEATURES) + file(GLOB HEADERS "${CURRENT_PACKAGES_DIR}/include/minizip/*.h") + foreach(HEADER ${HEADERS}) + file(READ "${HEADER}" _contents) + string(REPLACE "#ifdef HAVE_BZIP2" "#if 1" _contents "${_contents}") + file(WRITE "${HEADER}" "${_contents}") + endforeach() +endif() file(INSTALL ${SOURCE_PATH}/contrib/minizip/MiniZip64_info.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/minizip RENAME copyright) diff --git a/ports/mlpack/CONTROL b/ports/mlpack/CONTROL index 0902ce894..e76327ca5 100644 --- a/ports/mlpack/CONTROL +++ b/ports/mlpack/CONTROL @@ -1,5 +1,5 @@ Source: mlpack -Version: 3.1.1 +Version: 3.1.1-1 Description: mlpack is a fast, flexible machine learning library, written in C++, that aims to provide fast, extensible implementations of cutting-edge machine learning algorithms. Build-Depends: openblas (!osx), clapack (!osx), boost, armadillo, ensmallen diff --git a/ports/mlpack/blas_lapack.patch b/ports/mlpack/blas_lapack.patch new file mode 100644 index 000000000..2b9e44597 --- /dev/null +++ b/ports/mlpack/blas_lapack.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b158498..50f1def 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -286,7 +286,7 @@ if (WIN32)
+ find_package(LAPACK)
+ find_package(BLAS)
+ set(ARMADILLO_LIBRARIES
+- ${ARMADILLO_LIBRARIES} ${BLAS_LIBRARY} ${LAPACK_LIBRARY})
++ ${ARMADILLO_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+ endif ()
+
+ # Include directories for the previous dependencies.
diff --git a/ports/mlpack/portfile.cmake b/ports/mlpack/portfile.cmake index 0a5bcb6d1..6bde064f4 100644 --- a/ports/mlpack/portfile.cmake +++ b/ports/mlpack/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( HEAD_REF master PATCHES cmakelists.patch + blas_lapack.patch ) file(REMOVE ${SOURCE_PATH}/CMake/ARMA_FindACML.cmake) diff --git a/ports/mongo-c-driver/CONTROL b/ports/mongo-c-driver/CONTROL index 5d3b3a5f0..eb52dacc8 100644 --- a/ports/mongo-c-driver/CONTROL +++ b/ports/mongo-c-driver/CONTROL @@ -1,5 +1,9 @@ Source: mongo-c-driver -Version: 1.14.0-3 +Version: 1.14.0-3-1 Build-Depends: libbson, openssl (!windows), zlib Description: Client library written in C for MongoDB. Homepage: https://github.com/mongodb/mongo-c-driver + +Feature: snappy +Description: Enables snappy compressor support +Build-Depends: snappy diff --git a/ports/mongo-c-driver/portfile.cmake b/ports/mongo-c-driver/portfile.cmake index f2b72fc08..9106fecb9 100644 --- a/ports/mongo-c-driver/portfile.cmake +++ b/ports/mongo-c-driver/portfile.cmake @@ -10,6 +10,10 @@ vcpkg_from_github( PATCHES fix-uwp.patch
)
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ "snappy" ENABLE_SNAPPY
+)
+
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(ENABLE_STATIC ON)
else()
@@ -35,6 +39,7 @@ vcpkg_configure_cmake( -DENABLE_ZLIB=SYSTEM
-DENABLE_STATIC=${ENABLE_STATIC}
-DBUILD_VERSION=${BUILD_VERSION}
+ ${FEATURE_OPTIONS}
)
vcpkg_install_cmake()
diff --git a/ports/monkeys-audio/CONTROL b/ports/monkeys-audio/CONTROL index 2b6447dbe..fdd72f340 100644 --- a/ports/monkeys-audio/CONTROL +++ b/ports/monkeys-audio/CONTROL @@ -1,5 +1,5 @@ Source: monkeys-audio -Version: 4.3.3-1 +Version: 4.8.3 Homepage: https://monkeysaudio.com Description: Monkey's Audio is an excellent audio compression tool which has multiple advantages over traditional methods. Audio files compressed with it ends with .ape extension. diff --git a/ports/monkeys-audio/portfile.cmake b/ports/monkeys-audio/portfile.cmake index fbde63a4a..719db6e29 100644 --- a/ports/monkeys-audio/portfile.cmake +++ b/ports/monkeys-audio/portfile.cmake @@ -6,17 +6,17 @@ endif() vcpkg_check_linkage(ONLY_STATIC_LIBRARY ONLY_STATIC_CRT) -if(EXISTS ${CURRENT_BUILDTREES_DIR}/src/MAC_SDK_433.zip.extracted) +if(EXISTS ${CURRENT_BUILDTREES_DIR}/src/MAC_SDK_483.zip.extracted) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src) endif() set(VERSION 4.7) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/433) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/483) vcpkg_download_distfile(ARCHIVE - URLS "http://monkeysaudio.com/files/MAC_SDK_433.zip" - FILENAME "MAC_SDK_433.zip" - SHA512 957ba262da29a8542ab82dc828328b19bf80ecf0d09165db935924b390cb6a3a2d9303a2e07b86b28ecf4210a66dd5c4be840205a9f09518189101033f1a13c8 + URLS "http://monkeysaudio.com/files/MAC_SDK_483.zip" + FILENAME "MAC_SDK_483.zip" + SHA512 c080aa87997def3b970050f6bd334b6908884cc521f192abc02d774a8b3067207781dcab30f052015d4ae891fc6390c6f0b33ed319d9d7fd0850dab6fcded8f0 ) vcpkg_extract_source_archive(${ARCHIVE} ${SOURCE_PATH}) @@ -29,7 +29,7 @@ file(REMOVE vcpkg_install_msbuild( SOURCE_PATH ${SOURCE_PATH} - PROJECT_SUBPATH Source/Projects/VS2017/Console/Console.vcxproj + PROJECT_SUBPATH Source/Projects/VS2019/Console/Console.vcxproj ) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include) diff --git a/ports/mozjpeg/CONTROL b/ports/mozjpeg/CONTROL index c5180d140..2f786a1c2 100644 --- a/ports/mozjpeg/CONTROL +++ b/ports/mozjpeg/CONTROL @@ -1,4 +1,4 @@ Source: mozjpeg -Version: 3.2-2 +Version: 3.2-3 Homepage: https://github.com/mozilla/mozjpeg Description: MozJPEG reduces file sizes of JPEG images while retaining quality and compatibility with the vast majority of the world's deployed decoders. It's compatible with libjpeg API and ABI, and can be used as a drop-in replacement for libjpeg. diff --git a/ports/mozjpeg/portfile.cmake b/ports/mozjpeg/portfile.cmake index 70fc58dc4..d771fd205 100644 --- a/ports/mozjpeg/portfile.cmake +++ b/ports/mozjpeg/portfile.cmake @@ -26,6 +26,7 @@ string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" WITH_CRT_DLL) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DDENABLE_SHARED=${ENABLE_SHARED_BUILD} -DENABLE_STATIC=${ENABLE_STATIC_BUILD} diff --git a/ports/mpg123/CONTROL b/ports/mpg123/CONTROL index ad360039c..47692364e 100644 --- a/ports/mpg123/CONTROL +++ b/ports/mpg123/CONTROL @@ -1,4 +1,4 @@ Source: mpg123 -Version: 1.25.8-5 +Version: 1.25.8-6 Homepage: https://sourceforge.net/projects/mpg123/ Description: mpg123 is a real time MPEG 1.0/2.0/2.5 audio player/decoder for layers 1, 2 and 3 (MPEG 1.0 layer 3 also known as MP3).
\ No newline at end of file diff --git a/ports/mpg123/portfile.cmake b/ports/mpg123/portfile.cmake index ff7645390..8523c6cb7 100644 --- a/ports/mpg123/portfile.cmake +++ b/ports/mpg123/portfile.cmake @@ -2,7 +2,6 @@ include(vcpkg_common_functions) set(MPG123_VERSION 1.25.8) set(MPG123_HASH f226317dddb07841a13753603fa13c0a867605a5a051626cb30d45cfba266d3d4296f5b8254f65b403bb5eef6addce1784ae8829b671a746854785cda1bad203) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpg123-${MPG123_VERSION}) #architecture detection if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") @@ -23,19 +22,20 @@ vcpkg_download_distfile(ARCHIVE FILENAME "mpg123-${MPG123_VERSION}.tar.bz2" SHA512 ${MPG123_HASH} ) -vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_extract_source_archive_ex( + ARCHIVE ${ARCHIVE} + OUT_SOURCE_PATH SOURCE_PATH + PATCHES + 0001-fix-crt-linking.patch + 0002-fix-x86-build.patch +) vcpkg_find_acquire_program(YASM) get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - "${CURRENT_PORT_DIR}/0001-fix-crt-linking.patch" - "${CURRENT_PORT_DIR}/0002-fix-x86-build.patch") - +if(VCPKG_TARGET_IS_WINDOWS) vcpkg_build_msbuild( PROJECT_PATH ${SOURCE_PATH}/ports/MSVC++/2015/win32/libmpg123/libmpg123.vcxproj RELEASE_CONFIGURATION Release_x86${MPG123_CONFIGURATION_SUFFIX} diff --git a/ports/mpi/CONTROL b/ports/mpi/CONTROL new file mode 100644 index 000000000..b5db97f13 --- /dev/null +++ b/ports/mpi/CONTROL @@ -0,0 +1,4 @@ +Source: mpi +Version: 1 +Description: Message Passing Interface (MPI) is a standardized and portable message-passing standard designed by a group of researchers from academia and industry to function on a wide variety of parallel computing architectures. The standard defines the syntax and semantics of a core of library routines useful to a wide range of users writing portable message-passing programs in C, C++, and Fortran. There are several well-tested and efficient implementations of MPI, many of which are open-source or in the public domain. +Build-Depends: msmpi (windows), openmpi (!windows) diff --git a/ports/mpi/portfile.cmake b/ports/mpi/portfile.cmake new file mode 100644 index 000000000..e46edeb43 --- /dev/null +++ b/ports/mpi/portfile.cmake @@ -0,0 +1,3 @@ +include(vcpkg_common_functions) + +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/ports/mpmcqueue/CONTROL b/ports/mpmcqueue/CONTROL new file mode 100644 index 000000000..3da89f6a5 --- /dev/null +++ b/ports/mpmcqueue/CONTROL @@ -0,0 +1,4 @@ +Source: mpmcqueue +Version: 2019-07-26 +Description: A bounded multi-producer multi-consumer lock-free queue written in C++11 +Homepage: https://github.com/rigtorp/MPMCQueue diff --git a/ports/mpmcqueue/portfile.cmake b/ports/mpmcqueue/portfile.cmake new file mode 100644 index 000000000..be2f03064 --- /dev/null +++ b/ports/mpmcqueue/portfile.cmake @@ -0,0 +1,19 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO rigtorp/MPMCQueue + REF 5883e32b07e8a60c22d532d9120ea5c11348aea9 + SHA512 4adbbe5e014e0ef5c7030aaa9faa4e07e2c65753cd89c770da250811c13776576c4f1caf4144542318c41ebc7433b106e802c482a5d44572963a5ab59047257e + HEAD_REF master +) + +file(COPY + ${SOURCE_PATH}/include/rigtorp/MPMCQueue.h + DESTINATION ${CURRENT_PACKAGES_DIR}/include/rigtorp +) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/msgpack/CONTROL b/ports/msgpack/CONTROL index 0b22d5c69..dab3515b9 100644 --- a/ports/msgpack/CONTROL +++ b/ports/msgpack/CONTROL @@ -1,4 +1,4 @@ Source: msgpack -Version: 3.1.1 +Version: 3.2.0 Homepage: https://github.com/msgpack/msgpack-c Description: MessagePack is an efficient binary serialization format, which lets you exchange data among multiple languages like JSON, except that it's faster and smaller. diff --git a/ports/msgpack/portfile.cmake b/ports/msgpack/portfile.cmake index 33873e990..c9249a2bc 100644 --- a/ports/msgpack/portfile.cmake +++ b/ports/msgpack/portfile.cmake @@ -2,8 +2,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO msgpack/msgpack-c - REF cpp-3.1.1 - SHA512 2d1607f482160d8860b07d7597af760bfefcb3afa4e82602df43487d15950ab235e7efeabd7e08996807935de71d4dcdab424c91bff806279419db2ec9500227 + REF cpp-3.2.0 + SHA512 698fcdd5b427373997d0c89ff2cd09c44cf3b165defd381ff3cd9e14ecb83841064754a42aab99441a3b17aa26e3daec8f83e40d6d482c4b443b21b313278d14 HEAD_REF master) vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index c55a49412..10482cb0a 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -1,5 +1,9 @@ include(vcpkg_common_functions) +if(VCPKG_CMAKE_SYSTEM_NAME) + message(FATAL_ERROR "This port is only for building msmpi on Windows Desktop") +endif() + set(MSMPI_VERSION "10.0.12498") set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msmpi-${MSMPI_VERSION}) diff --git a/ports/nameof/CONTROL b/ports/nameof/CONTROL new file mode 100644 index 000000000..35df482a0 --- /dev/null +++ b/ports/nameof/CONTROL @@ -0,0 +1,4 @@ +Source: nameof
+Version: 2019-07-13
+Description: Nameof operator for modern C++
+Homepage: https://github.com/Neargye/nameof
diff --git a/ports/nameof/portfile.cmake b/ports/nameof/portfile.cmake new file mode 100644 index 000000000..21dcf1b97 --- /dev/null +++ b/ports/nameof/portfile.cmake @@ -0,0 +1,31 @@ +# header-only library
+
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Neargye/nameof
+ REF 9d335128265e443acf4e12ed40327e166cd8e3da
+ SHA512 3d4af0069fc3dbf9a4a79ae1bea282cafb69606936a66bf43b5a13ae2f0cbc88e98dbb02a12e9c211afd73d9807b36a6f09635a1922ce5faaeb2a148672a0b13
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DNAMEOF_OPT_BUILD_EXAMPLES=OFF
+ -DNAMEOF_OPT_BUILD_TESTS=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/nanodbc/CONTROL b/ports/nanodbc/CONTROL index bf1aaa69e..20c7c28b5 100644 --- a/ports/nanodbc/CONTROL +++ b/ports/nanodbc/CONTROL @@ -1,4 +1,4 @@ Source: nanodbc -Version: 2.12.4-3 +Version: 2.12.4-4 Homepage: https://github.com/lexicalunit/nanodbc Description: A small C++ wrapper for the native C ODBC API. diff --git a/ports/nanodbc/portfile.cmake b/ports/nanodbc/portfile.cmake index 7014c7eac..0b31d6f6f 100644 --- a/ports/nanodbc/portfile.cmake +++ b/ports/nanodbc/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS # Legacy, remove at release of v2.13 -DNANODBC_EXAMPLES=OFF diff --git a/ports/netcdf-c/CONTROL b/ports/netcdf-c/CONTROL index 684c54ba6..f69dc61ad 100644 --- a/ports/netcdf-c/CONTROL +++ b/ports/netcdf-c/CONTROL @@ -1,5 +1,5 @@ Source: netcdf-c -Version: 4.7.0-3 +Version: 4.7.0-4 Build-Depends: hdf5, curl Homepage: https://github.com/Unidata/netcdf-c Description: a set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. diff --git a/ports/netcdf-c/hdf5_3.patch b/ports/netcdf-c/hdf5_3.patch index ba9a168c8..502a8ea99 100644 --- a/ports/netcdf-c/hdf5_3.patch +++ b/ports/netcdf-c/hdf5_3.patch @@ -2,11 +2,13 @@ diff --git a/libhdf5/CMakeLists.txt b/libhdf5/CMakeLists.txt index f3c7bbc..34fc2ab 100644
--- a/libhdf5/CMakeLists.txt
+++ b/libhdf5/CMakeLists.txt
-@@ -20,3 +20,7 @@ add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES})
+@@ -20,3 +20,9 @@ add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES})
# Remember to package this file for CMake builds.
ADD_EXTRA_DIST(${libnchdf5_SOURCES} CMakeLists.txt)
+
-+if(BUILD_SHARED_LIBS)
-+target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-shared hdf5::hdf5-static hdf5::hdf5_hl-shared hdf5::hdf5_hl-static)
++if(HDF5_BUILD_SHARED_LIBS)
++ target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-shared hdf5::hdf5_hl-shared)
++else()
++ target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-static hdf5::hdf5_hl-static)
+endif()
diff --git a/ports/nghttp2/CONTROL b/ports/nghttp2/CONTROL index 176a1c30a..2e8489e0a 100644 --- a/ports/nghttp2/CONTROL +++ b/ports/nghttp2/CONTROL @@ -1,4 +1,4 @@ Source: nghttp2 -Version: 1.35.0 +Version: 1.39.2 Homepage: https://github.com/nghttp2/nghttp2 Description: Implementation of the Hypertext Transfer Protocol version 2 in C diff --git a/ports/nghttp2/enable-static.patch b/ports/nghttp2/enable-static.patch deleted file mode 100644 index 18e58daeb..000000000 --- a/ports/nghttp2/enable-static.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt -index 17e422b..b2e7a6e 100644 ---- a/lib/CMakeLists.txt -+++ b/lib/CMakeLists.txt -@@ -37,8 +37,8 @@ if(WIN32) - set(NGHTTP2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - endif() - --# Public shared library --add_library(nghttp2 SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) -+# Public library -+add_library(nghttp2 ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) - set_target_properties(nghttp2 PROPERTIES - COMPILE_FLAGS "${WARNCFLAGS}" - VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} -@@ -49,6 +49,10 @@ target_include_directories(nghttp2 INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/includes" - ) - -+if(NOT BUILD_SHARED_LIBS) -+ target_compile_definitions(nghttp2 PUBLIC "-DNGHTTP2_STATICLIB") -+endif() -+ - if(HAVE_CUNIT OR ENABLE_STATIC_LIB) - # Static library (for unittests because of symbol visibility) - add_library(nghttp2_static STATIC ${NGHTTP2_SOURCES}) - diff --git a/ports/nghttp2/portfile.cmake b/ports/nghttp2/portfile.cmake index 52f754afb..05a639d06 100644 --- a/ports/nghttp2/portfile.cmake +++ b/ports/nghttp2/portfile.cmake @@ -1,7 +1,7 @@ include(vcpkg_common_functions) set(LIB_NAME nghttp2) -set(LIB_VERSION 1.35.0) +set(LIB_VERSION 1.39.2) set(LIB_FILENAME ${LIB_NAME}-${LIB_VERSION}.tar.gz) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIB_NAME}-${LIB_VERSION}) @@ -9,16 +9,10 @@ set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIB_NAME}-${LIB_VERSION}) vcpkg_download_distfile(ARCHIVE URLS "https://github.com/nghttp2/nghttp2/releases/download/v${LIB_VERSION}/${LIB_FILENAME}" FILENAME "${LIB_FILENAME}" - SHA512 65889545684e2c8b4aeeb7084ca36e3f78927fa2b6d1df906af3970d8ce6c7c6093b56a5e0713f7bb54a98f06ad52d6e2b323e760297610702afe526b0fdd577 + SHA512 1623a6bd9de1ca4d0742919b973eaefd570b250eb109697e5cf2240d2062789d1ca58632fdff32bb17f524b102fade0e30ab3f400dc2c128bfb91a75277f13e0 ) vcpkg_extract_source_archive(${ARCHIVE}) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - "${CMAKE_CURRENT_LIST_DIR}/enable-static.patch" -) - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -35,13 +29,8 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/man) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc) -# Move dll files from /lib to /bin where vcpkg expects them -if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/${LIB_NAME}.dll ${CURRENT_PACKAGES_DIR}/bin/${LIB_NAME}.dll) - - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/${LIB_NAME}.dll ${CURRENT_PACKAGES_DIR}/debug/bin/${LIB_NAME}.dll) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() # License and man diff --git a/ports/nlohmann-json/CONTROL b/ports/nlohmann-json/CONTROL index 275914a94..168535699 100644 --- a/ports/nlohmann-json/CONTROL +++ b/ports/nlohmann-json/CONTROL @@ -1,4 +1,4 @@ Source: nlohmann-json -Version: 3.6.1 +Version: 3.7.0 Homepage: https://github.com/nlohmann/json Description: JSON for Modern C++ diff --git a/ports/nlohmann-json/portfile.cmake b/ports/nlohmann-json/portfile.cmake index fb492c08c..5d105d4f4 100644 --- a/ports/nlohmann-json/portfile.cmake +++ b/ports/nlohmann-json/portfile.cmake @@ -1,6 +1,6 @@ include(vcpkg_common_functions) -set(SOURCE_VERSION 3.6.1) +set(SOURCE_VERSION 3.7.0) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/nlohmann-json-v${SOURCE_VERSION}) file(MAKE_DIRECTORY ${SOURCE_PATH}) @@ -15,11 +15,11 @@ function(download_src SUBPATH SHA512) file(COPY ${FILE} DESTINATION ${SUBPATH_DIR}) endfunction() -download_src(CMakeLists.txt ea5775c8eca3f387d152e6adadeb5e5454b7bce2bb45b305019248def2714b85b959196cb97f25b175ebebd044f179bcffa5ec62b0373bee3a8ca135f2988054) +download_src(CMakeLists.txt f397536b06a2adaf717067f6bcbc4b23836d28bb7471143848259ef90f84bb5aadbd21bb387f80603fca791c9806b846e110e97a10de5b276f03a7fe6a97f2eb) download_src(LICENSE.MIT 44e6d9510dd66195211aa8ce3e6eef55be524e82c5864f3bfb85f2ac1215529c8ca370c8746de61ad5739e5af1633a5985085dacd1ffe220cd21d06433936801) download_src(nlohmann_json.natvis 9bce6758db0e54777394a4e718e60a281952b15f0c6dc6a6ad4a6d023c958b5515b2d39b7d4c66c03f0d3fdfdc1d6c23afb8b8419f1345c9d44d7b9a9ee2582b) download_src(cmake/config.cmake.in 7caab6166baa891f77f5b632ac4a920e548610ec41777b885ec51fe68d3665ffe91984dd2881caf22298b5392dfbd84b526fda252467bb66de9eb90e6e6ade5a) -download_src(single_include/nlohmann/json.hpp 17ad2911f054235002e273a34087f91122586de475792e9a41b8fa5cd0df3341867a976d702e2bb99459583d393afaabb481823700260bc19fb64eae544fc0bd) +download_src(single_include/nlohmann/json.hpp 1a12ea9e54a19e398a4d7aa3be1759ce3666a1b479bd553fe11bc63897a8055f11f42871eee6c801756dde038d860c48043cc50df753835c9a9691a1876a159e) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/nmslib/CONTROL b/ports/nmslib/CONTROL index 262c40682..5f61fa1f9 100644 --- a/ports/nmslib/CONTROL +++ b/ports/nmslib/CONTROL @@ -1,5 +1,5 @@ Source: nmslib
-Version: 1.7.3.6
+Version: 1.7.3.6-1
Homepage: https://github.com/searchivarius/nmslib
Description: Non-Metric Space Library (NMSLIB) is an efficient similarity search library and a toolkit for evaluation of k-NN methods for generic non-metric spaces.
#
diff --git a/ports/nmslib/portfile.cmake b/ports/nmslib/portfile.cmake index ffea74d75..ed5d902ba 100644 --- a/ports/nmslib/portfile.cmake +++ b/ports/nmslib/portfile.cmake @@ -25,6 +25,7 @@ endif() # TODO: check SSE and AVX avability and set corresponding tags vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/similarity_search + PREFER_NINJA OPTIONS -DWITH_EXTRAS=${WITH_EXTRAS} ) diff --git a/ports/nngpp/CONTROL b/ports/nngpp/CONTROL new file mode 100644 index 000000000..7cc9d7afe --- /dev/null +++ b/ports/nngpp/CONTROL @@ -0,0 +1,6 @@ +Source: nngpp +Version: 2019-07-25 +Homepage:https://github.com/cwzx/nngpp +Description: C++ wrapper around the nanomsg NNG API. +Build-Depends: nng + diff --git a/ports/nngpp/portfile.cmake b/ports/nngpp/portfile.cmake new file mode 100644 index 000000000..18646951c --- /dev/null +++ b/ports/nngpp/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cwzx/nngpp + REF 3351f54e6e774505d8d8b88064d04eb98e0b1cda + SHA512 6f72d1085b58ee7a8941294e7479661d8fc2c22cc8af2cee9c2cef11d508032a860c0061851bda07cf995ec8f57e5a25e241a15114a91c487d8aad6def2d4ce5 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DNNGPP_BUILD_DEMOS=OFF + -DNNGPP_BUILD_TESTS=OFF +) + +vcpkg_install_cmake() + +# Move CMake config files to the right place +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib) + +# Handle copyright +file(COPY ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/license.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) + diff --git a/ports/nt-wrapper/CONTROL b/ports/nt-wrapper/CONTROL new file mode 100644 index 000000000..cd16e9541 --- /dev/null +++ b/ports/nt-wrapper/CONTROL @@ -0,0 +1,4 @@ +Source: nt-wrapper +Version: 2019-08-10 +Description: A header only wrapper library around native windows system APIs +Homepage: https://github.com/JustasMasiulis/nt_wrapper diff --git a/ports/nt-wrapper/portfile.cmake b/ports/nt-wrapper/portfile.cmake new file mode 100644 index 000000000..7ed8146ff --- /dev/null +++ b/ports/nt-wrapper/portfile.cmake @@ -0,0 +1,25 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO JustasMasiulis/nt_wrapper + REF 6a150292a43f6aea35918a5c5e93a66c334ea301 + SHA512 fb8a1c4c934d3cb48a76a935ba69fd51ec2e6b66f5c265a8da9456691f933c6080057fec9a714f252c39d02525603b993cecd905452598058254ac9318655c4f + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_TESTING=OFF +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/ogre/CONTROL b/ports/ogre/CONTROL index d7a4dd3f5..2d870641e 100644 --- a/ports/ogre/CONTROL +++ b/ports/ogre/CONTROL @@ -1,5 +1,5 @@ Source: ogre -Version: 1.12.0-1 +Version: 1.12.0-2 Build-Depends: freeimage, freetype, zlib, zziplib Homepage: https://github.com/OGRECave/ogre Description: 3D Object-Oriented Graphics Rendering Engine @@ -7,6 +7,9 @@ Description: 3D Object-Oriented Graphics Rendering Engine Feature: d3d9 Description: Build Direct3D9 RenderSystem +Feature: csharp +Description: Build csharp bindings + Feature: java Description: Build Java (JNI) bindings diff --git a/ports/ogre/portfile.cmake b/ports/ogre/portfile.cmake index 04b4fe608..9f21e1f53 100644 --- a/ports/ogre/portfile.cmake +++ b/ports/ogre/portfile.cmake @@ -1,5 +1,9 @@ include(vcpkg_common_functions) +if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message("${PORT} currently requires the following library from the system package manager:\n Xaw\n\nIt can be installed on Ubuntu systems via apt-get install libxaw7-dev") +endif() + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO OGRECave/ogre @@ -38,6 +42,12 @@ else() set(WITH_PYTHON OFF) endif() +if("csharp" IN_LIST FEATURES) + set(WITH_CSHARP ON) +else() + set(WITH_CSHARP OFF) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -65,6 +75,7 @@ vcpkg_configure_cmake( # Optional stuff -DOGRE_BUILD_COMPONENT_JAVA=${WITH_JAVA} -DOGRE_BUILD_COMPONENT_PYTHON=${WITH_PYTHON} + -DOGRE_BUILD_COMPONENT_CSHARP=${WITH_CSHARP} -DOGRE_BUILD_RENDERSYSTEM_D3D9=${WITH_D3D9} # vcpkg specific stuff -DOGRE_CMAKE_DIR=share/ogre @@ -92,7 +103,9 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() -if(NOT VCPKG_CMAKE_SYSTEM_NAME) +#Remove OgreMain*.lib from lib/ folder, because autolink would complain, since it defines a main symbol +#manual-link subfolder is here to the rescue! +if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "Release") file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") diff --git a/ports/ogre/toolchain_fixes.patch b/ports/ogre/toolchain_fixes.patch index 1af384bdf..22b2e69c7 100644 --- a/ports/ogre/toolchain_fixes.patch +++ b/ports/ogre/toolchain_fixes.patch @@ -1,45 +1,88 @@ diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt -index a7a3796..2e21403 100755 +index a7a3796..7e41f57 100755 --- a/CMake/CMakeLists.txt +++ b/CMake/CMakeLists.txt -@@ -13,10 +13,12 @@ +@@ -13,13 +13,15 @@ # directory, but can also be used for custom projects. ############################################################# --if(WIN32 OR APPLE) -- set(OGRE_CMAKE_DIR "CMake") --else() -- set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake") +if(NOT DEFINED OGRE_CMAKE_DIR) -+ if(WIN32 OR APPLE) -+ set(OGRE_CMAKE_DIR "CMake") -+ else() -+ set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake") -+ endif() + if(WIN32 OR APPLE) + set(OGRE_CMAKE_DIR "CMake") + else() + set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake") endif() ++endif() + +-set(INST_FILES Utils/FindPkgMacros.cmake) ++set(INST_FILES Utils/FindPkgMacros.cmake) - set(INST_FILES Utils/FindPkgMacros.cmake) + if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "poco") + set(INST_FILES ${INST_FILES} Packages/FindPOCO.cmake) +diff --git a/CMake/ConfigureBuild.cmake b/CMake/ConfigureBuild.cmake +index 26c384f..131e238 100644 +--- a/CMake/ConfigureBuild.cmake ++++ b/CMake/ConfigureBuild.cmake +@@ -68,7 +68,7 @@ if (OGRE_CONFIG_THREADS) + + endif() + +-set(OGRE_ASSERT_MODE 1 CACHE STRING ++set(OGRE_ASSERT_MODE 1 CACHE STRING + "Enable Ogre asserts and exceptions. Possible values: + 0 - Standard asserts in debug builds, nothing in release builds. + 1 - Standard asserts in debug builds, exceptions in release builds. +@@ -197,7 +197,7 @@ if (UNIX) + configure_file(${OGRE_TEMPLATES_DIR}/OGRE-MeshLodGenerator.pc.in ${PROJECT_BINARY_DIR}/pkgconfig/OGRE-MeshLodGenerator.pc @ONLY) + install(FILES ${PROJECT_BINARY_DIR}/pkgconfig/OGRE-MeshLodGenerator.pc DESTINATION ${OGRE_LIB_DIRECTORY}/pkgconfig) + endif () +- ++ + if (OGRE_BUILD_COMPONENT_TERRAIN) + if (OGRE_BUILD_COMPONENT_PAGING) + set(OGRE_PAGING_ADDITIONAL_PACKAGES ", OGRE-Paging = ${OGRE_VERSION}") diff --git a/CMake/InstallResources.cmake b/CMake/InstallResources.cmake -index 783755e..79f7514 100644 +index 783755e..bd7fd3d 100644 --- a/CMake/InstallResources.cmake +++ b/CMake/InstallResources.cmake -@@ -208,10 +208,12 @@ endif () +@@ -131,7 +131,7 @@ configure_file(${OGRE_TEMPLATES_DIR}/tests.cfg.in ${PROJECT_BINARY_DIR}/inst/bin + + + # install resource files +-install(FILES ++install(FILES + ${PROJECT_BINARY_DIR}/inst/bin/resources.cfg + ${PROJECT_BINARY_DIR}/inst/bin/plugins.cfg + ${PROJECT_BINARY_DIR}/inst/bin/samples.cfg +@@ -208,17 +208,19 @@ endif () # Create the CMake package files include(CMakePackageConfigHelpers) --if(WIN32 OR APPLE) -- set(OGRE_CMAKE_DIR "CMake") --else() -- set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake") +if(NOT DEFINED OGRE_CMAKE_DIR) -+ if(WIN32 OR APPLE) -+ set(OGRE_CMAKE_DIR "CMake") -+ else() -+ set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake") -+ endif() + if(WIN32 OR APPLE) + set(OGRE_CMAKE_DIR "CMake") + else() + set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake") endif() ++endif() configure_package_config_file(${OGRE_TEMPLATES_DIR}/OGREConfig.cmake.in ${PROJECT_BINARY_DIR}/cmake/OGREConfig.cmake INSTALL_DESTINATION ${OGRE_CMAKE_DIR} + PATH_VARS CMAKE_INSTALL_PREFIX) + write_basic_package_version_file( +- ${PROJECT_BINARY_DIR}/cmake/OGREConfigVersion.cmake +- VERSION ${OGRE_VERSION} ++ ${PROJECT_BINARY_DIR}/cmake/OGREConfigVersion.cmake ++ VERSION ${OGRE_VERSION} + COMPATIBILITY SameMajorVersion) + install(FILES + ${PROJECT_BINARY_DIR}/cmake/OGREConfig.cmake +@@ -228,4 +230,4 @@ install(FILES + install(EXPORT OgreTargetsRelease CONFIGURATIONS Release None "" DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake) + install(EXPORT OgreTargetsRelWithDebInfo CONFIGURATIONS RelWithDebInfo DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake) + install(EXPORT OgreTargetsMinSizeRel CONFIGURATIONS MinSizeRel DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake) +-install(EXPORT OgreTargetsDebug CONFIGURATIONS Debug DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake) +\ No newline at end of file ++install(EXPORT OgreTargetsDebug CONFIGURATIONS Debug DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake) diff --git a/CMake/Packages/FindCg.cmake b/CMake/Packages/FindCg.cmake index 4501cf9..e91bfd0 100644 --- a/CMake/Packages/FindCg.cmake @@ -131,29 +174,29 @@ index 7125895..f73c928 100644 add_parent_dir(HLSL2GLSL_INCLUDE_DIRS HLSL2GLSL_INCLUDE_DIR) - diff --git a/CMake/Packages/FindNVAPI.cmake b/CMake/Packages/FindNVAPI.cmake -index 95c70cd..17dabb8 100644 +index 2b9deba..6d8fb37 100644 --- a/CMake/Packages/FindNVAPI.cmake +++ b/CMake/Packages/FindNVAPI.cmake @@ -11,7 +11,7 @@ - # Once done, this will define - # - # NVAPI_FOUND - system has NVAPI --# NVAPI_INCLUDE_DIRS - the NVAPI include directories -+# NVAPI_INCLUDE_DIRS - the NVAPI include directories - # NVAPI_LIBRARIES - link these to use NVAPI - - include(FindPkgMacros) + # Once done, this will define
+ #
+ # NVAPI_FOUND - system has NVAPI
+-# NVAPI_INCLUDE_DIRS - the NVAPI include directories
++# NVAPI_INCLUDE_DIRS - the NVAPI include directories
+ # NVAPI_LIBRARIES - link these to use NVAPI
+
+ include(FindPkgMacros)
@@ -44,7 +44,7 @@ findpkg_framework(NVAPI) - find_path(NVAPI_INCLUDE_DIR NAMES nvapi.h HINTS ${NVAPI_FRAMEWORK_INCLUDES} ${NVAPI_INC_SEARCH_PATH} ${NVAPI_PKGC_INCLUDE_DIRS} PATH_SUFFIXES NVAPI) - find_library(NVAPI_LIBRARY_REL NAMES ${NVAPI_LIBRARY_NAMES} HINTS ${NVAPI_LIB_SEARCH_PATH} ${NVAPI_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) - find_library(NVAPI_LIBRARY_DBG NAMES ${NVAPI_LIBRARY_NAMES_DBG} HINTS ${NVAPI_LIB_SEARCH_PATH} ${NVAPI_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) --make_library_set(NVAPI_LIBRARY) -+make_library_set(NVAPI) - - findpkg_finish(NVAPI) + find_path(NVAPI_INCLUDE_DIR NAMES nvapi.h HINTS ${NVAPI_FRAMEWORK_INCLUDES} ${NVAPI_INC_SEARCH_PATH} ${NVAPI_PKGC_INCLUDE_DIRS} PATH_SUFFIXES NVAPI)
+ find_library(NVAPI_LIBRARY_REL NAMES ${NVAPI_LIBRARY_NAMES} HINTS ${NVAPI_LIB_SEARCH_PATH} ${NVAPI_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel)
+ find_library(NVAPI_LIBRARY_DBG NAMES ${NVAPI_LIBRARY_NAMES_DBG} HINTS ${NVAPI_LIB_SEARCH_PATH} ${NVAPI_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug)
+-make_library_set(NVAPI_LIBRARY)
++make_library_set(NVAPI)
+
+ findpkg_finish(NVAPI)
-add_parent_dir(NVAPI_INCLUDE_DIRS NVAPI_INCLUDE_DIR) \ No newline at end of file -+add_parent_dir(NVAPI_INCLUDE_DIRS NVAPI_INCLUDE_DIR) ++add_parent_dir(NVAPI_INCLUDE_DIRS NVAPI_INCLUDE_DIR)
diff --git a/CMake/Packages/FindPOCO.cmake b/CMake/Packages/FindPOCO.cmake index 6b6d7fa..c2cb80e 100644 --- a/CMake/Packages/FindPOCO.cmake @@ -313,6 +356,66 @@ index e97951e..1c7cf00 100644 findpkg_finish(ZZip) - +diff --git a/CMake/Templates/OGREConfig.cmake.in b/CMake/Templates/OGREConfig.cmake.in +index 79c5394..7b22a0d 100644 +--- a/CMake/Templates/OGREConfig.cmake.in ++++ b/CMake/Templates/OGREConfig.cmake.in +@@ -10,12 +10,12 @@ + # Find OGRE includes and library + # + # This module defines +-# OGRE_INCLUDE_DIRS - the OGRE include directories ++# OGRE_INCLUDE_DIRS - the OGRE include directories + # OGRE_LIBRARIES - link these to use the OGRE + # OGRE_LIBRARY_DIRS, the location of the libraries + # OGRE_STATIC - whther ogre was build as static lib + # OGRE_${COMPONENT}_FOUND - ${COMPONENT} is available +-# OGRE_${COMPONENT}_LIBRARIES - link these to only use ${COMPONENT} ++# OGRE_${COMPONENT}_LIBRARIES - link these to only use ${COMPONENT} + # OGRE_PLUGIN_DIR - The directory where the OGRE plugins are located + # OGRE_MEDIA_DIR - The directory where the OGRE sample media is located + # OGRE_CONFIG_DIR - The directory where the OGRE config files are located +@@ -25,7 +25,7 @@ + set(OGRE_STATIC @OGRE_STATIC@) + set(OGRE_MEDIA_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/@OGRE_MEDIA_PATH@") + set(OGRE_PLUGIN_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/lib/OGRE") +-set(OGRE_CONFIG_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/@OGRE_CFG_INSTALL_PATH@") ++set(OGRE_CONFIG_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/@OGRE_CFG_INSTALL_PATH@") + + set(OGRE_PREFIX_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@") + get_filename_component(OGRE_LIBRARY_DIRS "${OGRE_PREFIX_DIR}/lib" ABSOLUTE) +@@ -47,7 +47,7 @@ set(OGRE_PLUGINS) + macro(ogre_declare_component COMPONENT) + set(OGRE_${COMPONENT}_FOUND TRUE) + set(OGRE_${COMPONENT}_LIBRARIES Ogre${COMPONENT}) # backwards compatibility +- ++ + list(APPEND OGRE_COMPONENTS ${COMPONENT}) + list(APPEND OGRE_LIBRARIES Ogre${COMPONENT}) + endmacro() +@@ -55,11 +55,11 @@ endmacro() + macro(ogre_declare_plugin TYPE COMPONENT) + set(OGRE_${TYPE}_${COMPONENT}_FOUND TRUE) + set(OGRE_${TYPE}_${COMPONENT}_LIBRARIES ${TYPE}_${COMPONENT}) +- ++ + if(@OGRE_STATIC@) + list(APPEND OGRE_LIBRARIES ${TYPE}_${COMPONENT}) + endif() +- ++ + list(APPEND OGRE_PLUGINS ${TYPE}_${COMPONENT}) + endmacro() + +@@ -149,7 +149,7 @@ endif() + cmake_policy(POP) + + if(@OGRE_STATIC@) +- list(APPEND OGRE_LIBRARIES OgreGLSupport@OGRE_LIB_SUFFIX@ @CMAKE_DL_LIBS@) # glXXw uses dlopen ++ list(APPEND OGRE_LIBRARIES OgreGLSupport @CMAKE_DL_LIBS@) # glXXw uses dlopen + list(APPEND OGRE_LIBRARY_DIRS "${OGRE_LIBRARY_DIRS}/OGRE") # plugins folder + endif() + diff --git a/CMake/Utils/FindPkgMacros.cmake b/CMake/Utils/FindPkgMacros.cmake index 374f84b..dc7066d 100644 --- a/CMake/Utils/FindPkgMacros.cmake @@ -349,7 +452,7 @@ index 374f84b..dc7066d 100644 # Generate debug names from given release names diff --git a/CMakeLists.txt b/CMakeLists.txt -index d2819f0..8b54b38 100644 +index d2819f0..f40239f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,7 @@ if (MSVC) @@ -361,7 +464,7 @@ index d2819f0..8b54b38 100644 # Turn on the ability to create folders to organize projects (.vcproj) # It creates "CMakePredefinedTargets" folder by default and adds CMake # defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj -@@ -274,14 +274,9 @@ elseif(EMSCRIPTEN) +@@ -274,12 +274,8 @@ elseif(EMSCRIPTEN) elseif (APPLE AND NOT APPLE_IOS) set(XCODE_ATTRIBUTE_SDKROOT macosx) @@ -372,11 +475,9 @@ index d2819f0..8b54b38 100644 - set(CMAKE_OSX_SYSROOT macosx) - endif() -- # Make sure that the OpenGL render system is selected for non-iOS Apple builds + # Make sure that the OpenGL render system is selected for non-iOS Apple builds set(OGRE_BUILD_RENDERSYSTEM_GLES2 FALSE) - endif () - -@@ -310,7 +305,7 @@ include(Dependencies) +@@ -310,7 +306,7 @@ include(Dependencies) # Customise what to build option(OGRE_STATIC "Static build" FALSE) option(OGRE_ENABLE_PRECOMPILED_HEADERS "Use precompiled headers to speed up build" TRUE) @@ -385,7 +486,7 @@ index d2819f0..8b54b38 100644 "Make ResourceManager strict for faster operation. Possible values: 0 - OFF search in all groups twice - for case sensitive and insensitive lookup [DEPRECATED] 1 - PEDANTIC require an explicit resource group. Case sensitive lookup. -@@ -352,7 +347,7 @@ cmake_dependent_option(OGRE_BUILD_LIBS_AS_FRAMEWORKS "Build frameworks for libra +@@ -352,7 +348,7 @@ cmake_dependent_option(OGRE_BUILD_LIBS_AS_FRAMEWORKS "Build frameworks for libra option(OGRE_BUILD_TESTS "Build the unit tests & PlayPen" FALSE) option(OGRE_CONFIG_DOUBLE "Use doubles instead of floats in Ogre" FALSE) option(OGRE_CONFIG_NODE_INHERIT_TRANSFORM "Tells the node whether it should inherit full transform from it's parent node or derived position, orientation and scale" FALSE) @@ -437,7 +538,7 @@ index bdb303d..e8031d1 100644 \ No newline at end of file +) diff --git a/OgreMain/CMakeLists.txt b/OgreMain/CMakeLists.txt -index 6ec4e34..666a736 100644 +index 6ec4e34..2803a8a 100644 --- a/OgreMain/CMakeLists.txt +++ b/OgreMain/CMakeLists.txt @@ -188,21 +188,21 @@ if (WINDOWS_STORE OR WINDOWS_PHONE) @@ -475,12 +576,13 @@ index 6ec4e34..666a736 100644 list(APPEND LIBRARIES "atomic") else() list(APPEND LIBRARIES "-latomic") -@@ -226,8 +226,6 @@ if (APPLE) +@@ -226,8 +226,7 @@ if (APPLE) LINK_FLAGS "-framework IOKit -framework Cocoa -framework Carbon -framework OpenGL -framework CoreVideo" ) - set(OGRE_OSX_BUILD_CONFIGURATION "$(PLATFORM_NAME)/$(CONFIGURATION)") - ++ if(OGRE_BUILD_LIBS_AS_FRAMEWORKS) add_custom_command(TARGET OgreMain POST_BUILD COMMAND mkdir ARGS -p ${PROJECT_BINARY_DIR}/lib/${OGRE_OSX_BUILD_CONFIGURATION}/Ogre.framework/Headers/Threading diff --git a/ports/oniguruma/CONTROL b/ports/oniguruma/CONTROL index 768083b4e..6fe3ee2d0 100644 --- a/ports/oniguruma/CONTROL +++ b/ports/oniguruma/CONTROL @@ -1,5 +1,5 @@ Source: oniguruma
-Version: 6.9.2-2
+Version: 6.9.2-3
Description: Modern and flexible regular expressions library
Homepage: https://github.com/kkos/oniguruma
diff --git a/ports/oniguruma/portfile.cmake b/ports/oniguruma/portfile.cmake index 586bfbe07..5b2fe2adf 100644 --- a/ports/oniguruma/portfile.cmake +++ b/ports/oniguruma/portfile.cmake @@ -8,17 +8,16 @@ vcpkg_from_github( HEAD_REF master
)
-if("non-posix" IN_LIST FEATURES)
- set(ENABLE_POSIX_API OFF)
-else()
- set(ENABLE_POSIX_API ON)
-endif()
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ INVERTED_FEATURES
+ "non-posix" ENABLE_POSIX_API
+)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
- -DENABLE_POSIX_API=${ENABLE_POSIX_API}
+ ${FEATURE_OPTIONS}
)
vcpkg_install_cmake()
diff --git a/ports/open62541/CONTROL b/ports/open62541/CONTROL index 28bfd2c0b..bff3217bb 100644 --- a/ports/open62541/CONTROL +++ b/ports/open62541/CONTROL @@ -1,3 +1,3 @@ Source: open62541 -Version: 0.3.0-2 +Version: 0.3.0-3 Description: open62541 is an open source C (C99) implementation of OPC UA licensed under the Mozilla Public License v2.0. diff --git a/ports/open62541/portfile.cmake b/ports/open62541/portfile.cmake index 5132fa7f0..d0e26df3f 100644 --- a/ports/open62541/portfile.cmake +++ b/ports/open62541/portfile.cmake @@ -1,6 +1,6 @@ include(vcpkg_common_functions) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") +if(NOT CMAKE_HOST_WIN32) message("${PORT} currently requires the following tools from the system package manager:\n python-six\n\nThis can be installed on Ubuntu systems via apt-get install python-six python3-six (depending on your current python default interpreter)") endif() @@ -31,21 +31,24 @@ endif() vcpkg_find_acquire_program(PYTHON3) get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) -get_filename_component(PYTHON3_DIR_NAME "${PYTHON3_DIR}" NAME) vcpkg_add_to_path("${PYTHON3_DIR}") -if(NOT EXISTS ${PYTHON3_DIR}/easy_install${EXECUTABLE_SUFFIX}) - if(NOT EXISTS ${PYTHON3_DIR}/Scripts/pip${EXECUTABLE_SUFFIX}) - vcpkg_download_distfile(GET_PIP - URLS "https://bootstrap.pypa.io/get-pip.py" - FILENAME "tools/python/${PYTHON3_DIR_NAME}/get-pip.py" - SHA512 99520d223819708b8f6e4b839d1fa215e4e8adc7fcd0db6c25a0399cf2fa10034b35673cf450609303646d12497f301ef53b7e7cc65c78e7bce4af0c673555ad - ) - execute_process(COMMAND ${PYTHON3_DIR}/python${EXECUTABLE_SUFFIX} ${PYTHON3_DIR}/get-pip.py) +if(CMAKE_HOST_WIN32) + # Must not modify system copy of python3 -- on CMAKE_HOST_WIN32, we have our own private copy + if(NOT EXISTS ${PYTHON3_DIR}/easy_install.exe) + if(NOT EXISTS ${PYTHON3_DIR}/Scripts/pip.exe) + get_filename_component(PYTHON3_DIR_NAME "${PYTHON3_DIR}" NAME) + vcpkg_download_distfile(GET_PIP + URLS "https://bootstrap.pypa.io/3.3/get-pip.py" + FILENAME "tools/python/${PYTHON3_DIR_NAME}/get-pip.py" + SHA512 92e68525830bb23955a31cb19ebc3021ef16b6337eab83d5db2961b791283d2867207545faf83635f6027f2f7b7f8fee2c85f2cfd8e8267df25406474571c741 + ) + execute_process(COMMAND ${PYTHON3_DIR}/python.exe ${GET_PIP}) + endif() + execute_process(COMMAND ${PYTHON3_DIR}/Scripts/pip.exe install six) + else() + execute_process(COMMAND ${PYTHON3_DIR}/easy_install.exe six) endif() - execute_process(COMMAND ${PYTHON3_DIR}/Scripts/pip${EXECUTABLE_SUFFIX} install six) -else() - execute_process(COMMAND ${PYTHON3_DIR}/easy_install${EXECUTABLE_SUFFIX} six) endif() vcpkg_configure_cmake( diff --git a/ports/openblas/CONTROL b/ports/openblas/CONTROL index 1c01d8363..47b9430a9 100644 --- a/ports/openblas/CONTROL +++ b/ports/openblas/CONTROL @@ -1,4 +1,5 @@ Source: openblas -Version: 0.3.6-4 +Version: 0.3.6-5 Homepage: https://github.com/xianyi/OpenBLAS +Build-Depends: pthread (linux) Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. diff --git a/ports/openblas/FindBLAS.cmake b/ports/openblas/FindBLAS.cmake new file mode 100644 index 000000000..164e79f3b --- /dev/null +++ b/ports/openblas/FindBLAS.cmake @@ -0,0 +1,816 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindBLAS
+--------
+
+Find Basic Linear Algebra Subprograms (BLAS) library
+
+This module finds an installed Fortran library that implements the
+BLAS linear-algebra interface (see http://www.netlib.org/blas/). The
+list of libraries searched for is taken from the ``autoconf`` macro file,
+``acx_blas.m4`` (distributed at
+http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
+
+Input Variables
+^^^^^^^^^^^^^^^
+
+The following variables may be set to influence this module's behavior:
+
+``BLA_STATIC``
+ if ``ON`` use static linkage
+
+``BLA_VENDOR``
+ If set, checks only the specified vendor, if not set checks all the
+ possibilities. List of vendors valid in this module:
+
+ * Goto
+ * OpenBLAS
+ * FLAME
+ * ATLAS PhiPACK
+ * CXML
+ * DXML
+ * SunPerf
+ * SCSL
+ * SGIMATH
+ * IBMESSL
+ * Intel10_32 (intel mkl v10 32 bit)
+ * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model)
+ * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model)
+ * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model)
+ * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model)
+ * Intel (obsolete versions of mkl 32 and 64 bit)
+ * ACML
+ * ACML_MP
+ * ACML_GPU
+ * Apple
+ * NAS
+ * Generic
+
+``BLA_F95``
+ if ``ON`` tries to find the BLAS95 interfaces
+
+``BLA_PREFER_PKGCONFIG``
+ if set ``pkg-config`` will be used to search for a BLAS library first
+ and if one is found that is preferred
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``BLAS_FOUND``
+ library implementing the BLAS interface is found
+``BLAS_LINKER_FLAGS``
+ uncached list of required linker flags (excluding ``-l`` and ``-L``).
+``BLAS_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use BLAS (may be empty if compiler implicitly links BLAS)
+``BLAS95_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use BLAS95 interface
+``BLAS95_FOUND``
+ library implementing the BLAS95 interface is found
+
+.. note::
+
+ C or CXX must be enabled to use Intel Math Kernel Library (MKL)
+
+ For example, to use Intel MKL libraries and/or Intel compiler:
+
+ .. code-block:: cmake
+
+ set(BLA_VENDOR Intel10_64lp)
+ find_package(BLAS)
+
+Hints
+^^^^^
+
+Set ``MKLROOT`` environment variable to a directory that contains an MKL
+installation.
+
+#]=======================================================================]
+
+include(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
+include(${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake)
+include(${CMAKE_ROOT}/Modules/CMakePushCheckState.cmake)
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
+
+set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
+# Check the language being used
+if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
+ if(BLAS_FIND_REQUIRED)
+ message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
+ else()
+ message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
+ return()
+ endif()
+endif()
+
+if(BLA_PREFER_PKGCONFIG)
+ find_package(PkgConfig)
+ pkg_check_modules(PKGC_BLAS blas)
+ if(PKGC_BLAS_FOUND)
+ set(BLAS_FOUND ${PKGC_BLAS_FOUND})
+ set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}")
+ return()
+ endif()
+endif()
+
+macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
+ # This macro checks for the existence of the combination of fortran libraries
+ # given by _list. If the combination is found, this macro checks (using the
+ # Check_Fortran_Function_Exists macro) whether can link against that library
+ # combination using the name of a routine given by _name using the linker
+ # flags given by _flags. If the combination of libraries is found and passes
+ # the link test, LIBRARIES is set to the list of complete library paths that
+ # have been found. Otherwise, LIBRARIES is set to FALSE.
+
+ # N.B. _prefix is the prefix applied to the names of all cached variables that
+ # are generated internally and marked advanced by this macro.
+
+ set(_libdir ${ARGN})
+
+ set(_libraries_work TRUE)
+ set(${LIBRARIES})
+ set(_combined_name)
+ if (NOT _libdir)
+ if (WIN32)
+ set(_libdir ENV LIB)
+ elseif (APPLE)
+ set(_libdir ENV DYLD_LIBRARY_PATH)
+ else ()
+ set(_libdir ENV LD_LIBRARY_PATH)
+ endif ()
+ endif ()
+
+ list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+
+ foreach(_library ${_list})
+ set(_combined_name ${_combined_name}_${_library})
+ if(NOT "${_thread}" STREQUAL "")
+ set(_combined_name ${_combined_name}_thread)
+ endif()
+ if(_libraries_work)
+ if (BLA_STATIC)
+ if (WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ()
+ if (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else ()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ()
+ else ()
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # for ubuntu's libblas3gf and liblapack3gf packages
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+ endif ()
+ endif ()
+ find_library(${_prefix}_${_library}_LIBRARY
+ NAMES ${_library}
+ PATHS ${_libdir}
+ )
+ mark_as_advanced(${_prefix}_${_library}_LIBRARY)
+ set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
+ set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+ endif()
+ endforeach()
+ if(_libraries_work)
+ # Test this combination of libraries.
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
+ # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
+ if (CMAKE_Fortran_COMPILER_LOADED)
+ check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
+ else()
+ check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
+ endif()
+ set(CMAKE_REQUIRED_LIBRARIES)
+ set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
+ endif()
+ if(_libraries_work)
+ if("${_list}" STREQUAL "")
+ set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+ else()
+ set(${LIBRARIES} ${${LIBRARIES}} ${_thread}) # for static link
+ endif()
+ else()
+ set(${LIBRARIES} FALSE)
+ endif()
+ #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
+endmacro()
+
+set(BLAS_LINKER_FLAGS)
+set(BLAS_LIBRARIES)
+set(BLAS95_LIBRARIES)
+if (NOT $ENV{BLA_VENDOR} STREQUAL "")
+ set(BLA_VENDOR $ENV{BLA_VENDOR})
+else ()
+ if(NOT BLA_VENDOR)
+ set(BLA_VENDOR "All")
+ endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # Implicitly linked BLAS libraries
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ ""
+ ""
+ )
+ endif()
+endif ()
+
+#BLAS in intel mkl 10+ library? (em64t 64bit)
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
+ if (NOT BLAS_LIBRARIES)
+
+ # System-specific settings
+ if (WIN32)
+ if (BLA_STATIC)
+ set(BLAS_mkl_DLL_SUFFIX "")
+ else()
+ set(BLAS_mkl_DLL_SUFFIX "_dll")
+ endif()
+ else()
+ # Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it)
+ if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
+ set(BLAS_mkl_INTFACE "gf")
+ set(BLAS_mkl_THREADING "gnu")
+ set(BLAS_mkl_OMP "gomp")
+ else()
+ set(BLAS_mkl_INTFACE "intel")
+ set(BLAS_mkl_THREADING "intel")
+ set(BLAS_mkl_OMP "iomp5")
+ endif()
+ set(BLAS_mkl_LM "-lm")
+ set(BLAS_mkl_LDL "-ldl")
+ endif()
+
+ if (BLA_VENDOR MATCHES "_64ilp")
+ set(BLAS_mkl_ILP_MODE "ilp64")
+ else ()
+ set(BLAS_mkl_ILP_MODE "lp64")
+ endif ()
+
+ if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
+ if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+ find_package(Threads)
+ else()
+ find_package(Threads REQUIRED)
+ endif()
+
+ set(BLAS_SEARCH_LIBS "")
+
+ if(BLA_F95)
+ set(BLAS_mkl_SEARCH_SYMBOL sgemm_f95)
+ set(_LIBRARIES BLAS95_LIBRARIES)
+ if (WIN32)
+ # Find the main file (32-bit or 64-bit)
+ set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_blas95_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX} mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}")
+ endif ()
+
+ # Add threading/sequential libs
+ set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+ if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+
+ # Cartesian product of the above
+ foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+ foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+ list(APPEND BLAS_SEARCH_LIBS
+ "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+ endforeach()
+ endforeach()
+ else ()
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+ endif ()
+ if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+ endif ()
+ if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
+ endif ()
+ endif ()
+ else ()
+ set(BLAS_mkl_SEARCH_SYMBOL sgemm)
+ set(_LIBRARIES BLAS_LIBRARIES)
+ if (WIN32)
+ # Find the main file (32-bit or 64-bit)
+ set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}")
+ endif ()
+
+ # Add threading/sequential libs
+ set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+ if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+
+ # Cartesian product of the above
+ foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+ foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+ list(APPEND BLAS_SEARCH_LIBS
+ "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+ endforeach()
+ endforeach()
+ else ()
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+ endif ()
+ if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+ endif ()
+ if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
+ endif ()
+
+ #older vesions of intel mkl libs
+ if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_ia32")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_em64t")
+ endif ()
+ endif ()
+ endif ()
+
+ if (DEFINED ENV{MKLROOT})
+ if (BLA_VENDOR STREQUAL "Intel10_32")
+ set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/ia32")
+ elseif (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$")
+ set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/intel64")
+ endif ()
+ endif ()
+ if (_BLAS_MKLROOT_LIB_DIR)
+ if (WIN32)
+ string(APPEND _BLAS_MKLROOT_LIB_DIR "_win")
+ elseif (APPLE)
+ string(APPEND _BLAS_MKLROOT_LIB_DIR "_mac")
+ else ()
+ string(APPEND _BLAS_MKLROOT_LIB_DIR "_lin")
+ endif ()
+ endif ()
+
+ foreach (IT ${BLAS_SEARCH_LIBS})
+ string(REPLACE " " ";" SEARCH_LIBS ${IT})
+ if (NOT ${_LIBRARIES})
+ check_fortran_libraries(
+ ${_LIBRARIES}
+ BLAS
+ ${BLAS_mkl_SEARCH_SYMBOL}
+ ""
+ "${SEARCH_LIBS}"
+ "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
+ "${_BLAS_MKLROOT_LIB_DIR}"
+ )
+ endif ()
+ endforeach ()
+
+ endif ()
+ unset(BLAS_mkl_ILP_MODE)
+ unset(BLAS_mkl_INTFACE)
+ unset(BLAS_mkl_THREADING)
+ unset(BLAS_mkl_OMP)
+ unset(BLAS_mkl_DLL_SUFFIX)
+ unset(BLAS_mkl_LM)
+ unset(BLAS_mkl_LDL)
+ endif ()
+endif ()
+
+if(BLA_F95)
+ find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES)
+ set(BLAS95_FOUND ${BLAS_FOUND})
+ if(BLAS_FOUND)
+ set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
+ endif()
+endif()
+
+if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "goto2"
+ ""
+ )
+ endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # OpenBLAS (http://www.openblas.net)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "openblas"
+ ""
+ )
+ endif()
+ if(NOT BLAS_LIBRARIES)
+ find_package(Threads)
+ # OpenBLAS (http://www.openblas.net)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "openblas"
+ "${CMAKE_THREAD_LIBS_INIT}"
+ )
+ endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # FLAME's blis library (https://github.com/flame/blis)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "blis"
+ ""
+ )
+ endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "f77blas;atlas"
+ ""
+ )
+ endif()
+endif ()
+
+# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
+if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "sgemm;dgemm;blas"
+ ""
+ )
+ endif()
+endif ()
+
+# BLAS in Alpha CXML library?
+if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "cxml"
+ ""
+ )
+ endif()
+endif ()
+
+# BLAS in Alpha DXML library? (now called CXML, see above)
+if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "dxml"
+ ""
+ )
+ endif()
+endif ()
+
+# BLAS in Sun Performance library?
+if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "-xlic_lib=sunperf"
+ "sunperf;sunmath"
+ ""
+ )
+ if(BLAS_LIBRARIES)
+ set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
+ endif()
+ endif()
+endif ()
+
+# BLAS in SCSL library? (SGI/Cray Scientific Library)
+if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "scsl"
+ ""
+ )
+ endif()
+endif ()
+
+# BLAS in SGIMATH library?
+if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "complib.sgimath"
+ ""
+ )
+ endif()
+endif ()
+
+# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
+if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "essl;blas"
+ ""
+ )
+ endif()
+endif ()
+
+#BLAS in acml library?
+if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
+ if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
+ ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
+ ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
+ )
+ # try to find acml in "standard" paths
+ if( WIN32 )
+ file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
+ else()
+ file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
+ endif()
+ if( WIN32 )
+ file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
+ else()
+ file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
+ endif()
+ list(GET _ACML_ROOT 0 _ACML_ROOT)
+ list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
+ if( _ACML_ROOT )
+ get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
+ if( SIZEOF_INTEGER EQUAL 8 )
+ set( _ACML_PATH_SUFFIX "_int64" )
+ else()
+ set( _ACML_PATH_SUFFIX "" )
+ endif()
+ if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
+ set( _ACML_COMPILER32 "ifort32" )
+ set( _ACML_COMPILER64 "ifort64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
+ set( _ACML_COMPILER32 "sun32" )
+ set( _ACML_COMPILER64 "sun64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
+ set( _ACML_COMPILER32 "pgi32" )
+ if( WIN32 )
+ set( _ACML_COMPILER64 "win64" )
+ else()
+ set( _ACML_COMPILER64 "pgi64" )
+ endif()
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
+ # 32 bit builds not supported on Open64 but for code simplicity
+ # We'll just use the same directory twice
+ set( _ACML_COMPILER32 "open64_64" )
+ set( _ACML_COMPILER64 "open64_64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
+ set( _ACML_COMPILER32 "nag32" )
+ set( _ACML_COMPILER64 "nag64" )
+ else()
+ set( _ACML_COMPILER32 "gfortran32" )
+ set( _ACML_COMPILER64 "gfortran64" )
+ endif()
+
+ if( BLA_VENDOR STREQUAL "ACML_MP" )
+ set(_ACML_MP_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
+ else()
+ set(_ACML_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
+ endif()
+ endif()
+elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
+ set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
+endif()
+
+if( BLA_VENDOR STREQUAL "ACML_MP" )
+ foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
+ endforeach()
+elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
+ foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
+ endforeach()
+else()
+ foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
+ endforeach()
+endif()
+
+# Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
+if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml;acml_mv"
+ ""
+ )
+endif()
+if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml_mp;acml_mv"
+ ""
+ )
+endif()
+if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml;acml_mv;CALBLAS"
+ ""
+ )
+endif()
+endif () # ACML
+
+# Apple BLAS library?
+if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "Accelerate"
+ ""
+ )
+ endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+ if ( NOT BLAS_LIBRARIES )
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "vecLib"
+ ""
+ )
+ endif ()
+endif ()
+
+# Generic BLAS library?
+if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "blas"
+ ""
+ )
+ endif()
+endif ()
+
+if(NOT BLA_F95)
+ find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES)
+endif()
+
+# On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines)
+# we used a placeholder for empty BLAS_LIBRARIES to get through our logic above.
+if (BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+ set(BLAS_LIBRARIES "")
+endif()
+
+cmake_pop_check_state()
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/ports/openblas/enable_underscore.patch b/ports/openblas/enable_underscore.patch deleted file mode 100644 index d2eb3ff22..000000000 --- a/ports/openblas/enable_underscore.patch +++ /dev/null @@ -1,70 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9696961..47ef712 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -29,7 +29,7 @@ option(BUILD_RELAPACK "Build with ReLAPACK (recursive implementation of several - # 64 bit integer interfaces in OpenBLAS. - - set(SYMBOLPREFIX "" CACHE STRING "Add a prefix to all exported symbol names in the shared library to avoid conflicts with other BLAS libraries" ) --set(SYMBOLSUFFIX "" CACHE STRING "Add a suffix to all exported symbol names in the shared library, e.g. _64 for INTERFACE64 builds" ) -+set(SYMBOLSUFFIX "_" CACHE STRING "Add a suffix to all exported symbol names in the shared library, e.g. _64 for INTERFACE64 builds" ) - ####### - if(BUILD_WITHOUT_LAPACK) - set(NO_LAPACK 1) -@@ -232,7 +232,7 @@ if (BUILD_SHARED_LIBS AND BUILD_RELAPACK) - endif() - endif() - --if (BUILD_SHARED_LIBS AND NOT ${SYMBOLPREFIX}${SYMBOLSUFIX} STREQUAL "") -+if (NOT ${SYMBOLPREFIX}${SYMBOLSUFFIX} STREQUAL "") - if (NOT DEFINED ARCH) - set(ARCH_IN "x86_64") - else() -@@ -289,12 +289,14 @@ endif() - if (NOT ${SYMBOLSUFFIX} STREQUAL "") - message(STATUS "adding suffix ${SYMBOLSUFFIX} to names of exported symbols in ${OpenBLAS_LIBNAME}") - endif() -+if(BUILD_SHARED_LIBS) - add_custom_command(TARGET ${OpenBLAS_LIBNAME} POST_BUILD - COMMAND perl ${PROJECT_SOURCE_DIR}/exports/gensymbol "objcopy" "${ARCH}" "${BU}" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" \"${SYMBOLPREFIX}\" \"${SYMBOLSUFFIX}\" "${BUILD_LAPACK_DEPRECATED}" > ${PROJECT_BINARY_DIR}/objcopy.def - COMMAND objcopy -v --redefine-syms ${PROJECT_BINARY_DIR}/objcopy.def ${PROJECT_BINARY_DIR}/lib/lib${OpenBLAS_LIBNAME}.so - COMMENT "renaming symbols" - ) - endif() -+endif() - - - # Install project -@@ -385,4 +387,3 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake - install(EXPORT "${PN}${SUFFIX64}Targets" - NAMESPACE "${PN}${SUFFIX64}::" - DESTINATION ${CMAKECONFIG_INSTALL_DIR}) -- -diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake -index 259ef16..936fbf7 100644 ---- a/cmake/prebuild.cmake -+++ b/cmake/prebuild.cmake -@@ -58,10 +58,8 @@ endif () - set(TARGET_CONF_TEMP "${PROJECT_BINARY_DIR}/${TARGET_CONF}.tmp") - - # c_check --set(FU "") --if (APPLE OR (MSVC AND NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang")) -- set(FU "_") --endif() -+set(FU "") -+set(BU "") - - set(COMPILER_ID ${CMAKE_C_COMPILER_ID}) - if (${COMPILER_ID} STREQUAL "GNU") -@@ -75,7 +73,9 @@ file(WRITE ${TARGET_CONF_TEMP} - "#define ARCH_${UC_ARCH}\t1\n" - "#define C_${COMPILER_ID}\t1\n" - "#define __${BINARY}BIT__\t1\n" -- "#define FUNDERSCORE\t${FU}\n") -+ "#define FUNDERSCORE\t${FU}\n" -+ "#define BUNDERSCORE\t${BU}\n" -+ "//#define NEEDBUNDERSCORE 1\n") - - if (${HOST_OS} STREQUAL "WINDOWSSTORE") - file(APPEND ${TARGET_CONF_TEMP} diff --git a/ports/openblas/fix_space_path.patch b/ports/openblas/fix-space-path.patch index 1ceacd90a..1ceacd90a 100644 --- a/ports/openblas/fix_space_path.patch +++ b/ports/openblas/fix-space-path.patch diff --git a/ports/openblas/openblas_common.h b/ports/openblas/openblas_common.h new file mode 100644 index 000000000..10b25d4c7 --- /dev/null +++ b/ports/openblas/openblas_common.h @@ -0,0 +1,72 @@ +#pragma once +#include "openblas_config.h" + +#if defined(OPENBLAS_OS_WINNT) || defined(OPENBLAS_OS_CYGWIN_NT) || defined(OPENBLAS_OS_INTERIX) +#define OPENBLAS_WINDOWS_ABI +#define OPENBLAS_OS_WINDOWS + +#ifdef DOUBLE +#define DOUBLE_DEFINED DOUBLE +#undef DOUBLE +#endif +#endif + +#ifdef NEEDBUNDERSCORE +#define BLASFUNC(FUNC) FUNC##_ +#else +#define BLASFUNC(FUNC) FUNC +#endif + + +#ifdef OPENBLAS_QUAD_PRECISION +typedef struct { + unsigned long x[2]; +} xdouble; +#elif defined OPENBLAS_EXPRECISION +#define xdouble long double +#else +#define xdouble double +#endif + +#if defined(OS_WINNT) && defined(__64BIT__) +typedef long long BLASLONG; +typedef unsigned long long BLASULONG; +#else +typedef long BLASLONG; +typedef unsigned long BLASULONG; +#endif + +#ifdef OPENBLAS_USE64BITINT +typedef BLASLONG blasint; +#else +typedef int blasint; +#endif + +#if defined(XDOUBLE) || defined(DOUBLE) +#define FLOATRET FLOAT +#else +#ifdef NEED_F2CCONV +#define FLOATRET double +#else +#define FLOATRET float +#endif +#endif + + +/* Inclusion of a standard header file is needed for definition of __STDC_* + predefined macros with some compilers (e.g. GCC 4.7 on Linux). This occurs + as a side effect of including either <features.h> or <stdc-predef.h>. */ +#include <stdio.h> +#define OPENBLAS_COMPLEX_STRUCT +typedef struct { float real, imag; } openblas_complex_float; +typedef struct { double real, imag; } openblas_complex_double; +typedef struct { xdouble real, imag; } openblas_complex_xdouble; +#define openblas_make_complex_float(real, imag) {(real), (imag)} +#define openblas_make_complex_double(real, imag) {(real), (imag)} +#define openblas_make_complex_xdouble(real, imag) {(real), (imag)} +#define openblas_complex_float_real(z) ((z).real) +#define openblas_complex_float_imag(z) ((z).imag) +#define openblas_complex_double_real(z) ((z).real) +#define openblas_complex_double_imag(z) ((z).imag) +#define openblas_complex_xdouble_real(z) ((z).real) +#define openblas_complex_xdouble_imag(z) ((z).imag) diff --git a/ports/openblas/portfile.cmake b/ports/openblas/portfile.cmake index 45260c78a..179491cc4 100644 --- a/ports/openblas/portfile.cmake +++ b/ports/openblas/portfile.cmake @@ -1,26 +1,9 @@ include(vcpkg_common_functions) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(VCPKG_POLICY_EMPTY_PACKAGE enabled) - message(WARNING "You do not need this package on macOS, since you already have the Accelerate Framework") - return() -endif() - if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") message(FATAL_ERROR "openblas can only be built for x64 currently") endif() -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(ADDITIONAL_PATCH "enable_underscore.patch") -endif() - -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - set(NO_SHARED 1) -endif() -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(NO_STATIC 1) -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO xianyi/OpenBLAS @@ -29,8 +12,7 @@ vcpkg_from_github( HEAD_REF develop PATCHES uwp.patch - fix_space_path.patch - ${ADDITIONAL_PATCH} + fix-space-path.patch ) find_program(GIT NAMES git git.cmd) @@ -77,7 +59,7 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS + OPTIONS ${COMMON_OPTIONS} -DCMAKE_SYSTEM_PROCESSOR=AMD64 -DVS_WINRT_COMPONENT=TRUE @@ -85,29 +67,44 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") elseif(NOT VCPKG_CMAKE_SYSTEM_NAME) vcpkg_configure_cmake( + PREFER_NINJA SOURCE_PATH ${SOURCE_PATH} OPTIONS ${COMMON_OPTIONS}) else() + list(APPEND VCPKG_C_FLAGS "-DNEEDBUNDERSCORE") # Required to get common BLASFUNC to append extra _ + list(APPEND VCPKG_CXX_FLAGS "-DNEEDBUNDERSCORE") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS ${COMMON_OPTIONS} - -DTARGET=SANDYBRIDGE -DCMAKE_SYSTEM_PROCESSOR=AMD64 - -DBINARY=64 - -DNO_SHARED=${NO_SHARED} - -DNO_STATIC=${NO_STATIC} - -DNOFORTRAN=ON) + -DNOFORTRAN=ON + -DBU=_ #required for all blas functions to append extra _ using NAME + ) endif() vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/OpenBLAS) -#we install a cmake wrapper since the official FindBLAS thinks that OpenBLAS can solve also LAPACK libraries, while it cannot because we disabled it and we use CLAPACK... maybe we have to trigger finding one package when requesting the other and vice-versa. Wrappers should be ready also to avoid an infinite loop -file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/blas) +vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/OpenBLAS TARGET_PATH share/openblas) +#maybe we need also to write a wrapper inside share/blas to search implicitly for openblas, whenever we feel it's ready for its own -config.cmake file + +# openblas do not make the config file , so I manually made this +# but I think in most case, libraries will not include these files, they define their own used function prototypes +# this is only to quite vcpkg +file(COPY ${CMAKE_CURRENT_LIST_DIR}/openblas_common.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +file(READ ${SOURCE_PATH}/cblas.h CBLAS_H) +string(REPLACE "#include \"common.h\"" "#include \"openblas_common.h\"" CBLAS_H "${CBLAS_H}") +file(WRITE ${CURRENT_PACKAGES_DIR}/include/cblas.h "${CBLAS_H}") + +# openblas is BSD +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openblas) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/openblas/LICENSE ${CURRENT_PACKAGES_DIR}/share/openblas/copyright) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/blas) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindBLAS.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/blas) + vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) - -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openblas RENAME copyright) diff --git a/ports/openblas/vcpkg-cmake-wrapper.cmake b/ports/openblas/vcpkg-cmake-wrapper.cmake index e0791bde8..fc074f33c 100644 --- a/ports/openblas/vcpkg-cmake-wrapper.cmake +++ b/ports/openblas/vcpkg-cmake-wrapper.cmake @@ -1,49 +1,2 @@ -list(REMOVE_ITEM ARGS "BLAS") -list(REMOVE_ITEM ARGS "blas") -list(REMOVE_ITEM ARGS "Blas") -list(REMOVE_ITEM ARGS "NO_MODULE") -list(REMOVE_ITEM ARGS "CONFIG") -list(REMOVE_ITEM ARGS "MODULE") -if(NOT BLAS_LIBRARY OR BLAS_LIBRARIES OR OpenBLAS_LIBRARY OR OpenBLAS_LIBRARIES OR BLAS_LIB OR BLAS_LIBS) - include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) - include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) - - _find_package(OpenBLAS CONFIG ${ARGS}) - - set(CMAKE_THREAD_PREFER_PTHREAD TRUE) - _find_package(Threads) - - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - set(BLAS_INCLUDE_DIR ${_loc}) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_RELEASE) - if(NOT _loc) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_RELEASE) - endif() - set(BLAS_LIBRARY_RELEASE ${_loc}) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_DEBUG) - if(NOT _loc) - get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_DEBUG) - endif() - set(BLAS_LIBRARY_DEBUG ${_loc}) - list(APPEND BLAS_LIBRARY_RELEASE Threads::Threads) - list(APPEND BLAS_LIBRARY_DEBUG Threads::Threads) - select_library_configurations(BLAS) - - set(BLAS_LIBRARY "${BLAS_LIBRARY}" CACHE STRING "" FORCE) - set(BLAS_LIBRARIES "${BLAS_LIBRARY}" CACHE STRING "" FORCE) - set(OpenBLAS_LIBRARY "${BLAS_LIBRARY}" CACHE STRING "" FORCE) - set(OpenBLAS_LIBRARIES "${BLAS_LIBRARY}" CACHE STRING "" FORCE) - set(BLAS_LIB "${BLAS_LIBRARY}" CACHE STRING "" FORCE) - set(BLAS_LIBS "${BLAS_LIBRARY}" CACHE STRING "" FORCE) - - set(BLAS_INCLUDE_DIR "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE) - set(BLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE) - set(OpenBLAS_INCLUDE_DIR "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE) - set(OpenBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE) - set(BLAS_INC "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE) - - find_package_handle_standard_args(BLAS DEFAULT_MSG BLAS_LIBRARY BLAS_INCLUDE_DIR) - mark_as_advanced(BLAS_INCLUDE_DIR BLAS_LIBRARY) - find_package_handle_standard_args(OpenBLAS DEFAULT_MSG OpenBLAS_LIBRARY OpenBLAS_INCLUDE_DIR) - mark_as_advanced(OpenBLAS_INCLUDE_DIR OpenBLAS_LIBRARY) -endif() +message(STATUS "Using VCPKG FindBLAS. Remove if CMake has been updated to account for Threads in OpenBLAS!") +include(${CMAKE_CURRENT_LIST_DIR}/FindBLAS.cmake) diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index 42f5c1c47..7b5ba5af9 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,89 +1,102 @@ -Source: opencv -Version: 3.4.3-9 -Build-Depends: zlib -Homepage: https://github.com/opencv/opencv -Description: computer vision library -Default-Features: opengl, jpeg, png, tiff, eigen, flann - -Feature: opengl -Build-Depends: opengl -Description: opengl support for opencv - -Feature: dnn -Build-Depends: protobuf -Description: opencv_dnn module - -Feature: ovis -Build-Depends: ogre -Description: opencv_ovis module - -Feature: flann -Description: opencv_flann module - -Feature: sfm -Build-Depends: eigen3, glog, gflags, ceres -Description: opencv_sfm module - -Feature: contrib -Build-Depends: opencv[flann] -Description: opencv_contrib module - -Feature: cuda -Build-Depends: cuda -Description: CUDA support for opencv - -Feature: ffmpeg -Description: prebuilt ffmpeg support for opencv - -Feature: ipp -Description: Enable Intel Integrated Performance Primitives - -Feature: tbb -Build-Depends: tbb -Description: Enable Intel Threading Building Blocks - -Feature: qt -Build-Depends: qt5 -Description: Qt GUI support for opencv - -Feature: vtk -Build-Depends: vtk -Description: vtk support for opencv - -Feature: gdcm -Build-Depends: gdcm -Description: GDCM support for opencv - -Feature: webp -Build-Depends: libwebp -Description: WebP support for opencv - -Feature: openexr -Build-Depends: openexr -Description: OpenEXR support for opencv - -Feature: tiff -Build-Depends: tiff -Description: TIFF support for opencv - -Feature: png -Build-Depends: libpng -Description: PNG support for opencv - -Feature: jpeg -Build-Depends: libjpeg-turbo -Description: JPEG support for opencv - -Feature: jasper -Build-Depends: jasper -Description: JPEG 2000 support for opencv - -Feature: eigen -Build-Depends: eigen3 -Description: Eigen support for opencv - -Feature: world -Description: Compile to a single package support for opencv - -Feature: nonfree -Description: allow nonfree and unredistributable libraries +Source: opencv
+Version: 4.1.1-1
+Homepage: https://github.com/opencv/opencv
+Description: Computer vision library
+Build-Depends: opencv4[core]
+Default-Features: dnn, jpeg, opengl, png, tiff, webp
+
+Feature: nonfree
+Build-Depends: opencv4[nonfree]
+Description: opencv nonfree module
+
+Feature: ade
+Build-Depends: opencv4[ade]
+Description: graph api
+
+Feature: contrib
+Build-Depends: opencv4[contrib]
+Description: opencv_contrib module
+
+Feature: cuda
+Build-Depends: opencv4[cuda]
+Description: CUDA support for opencv
+
+Feature: dnn
+Build-Depends: opencv4[dnn]
+Description: Enable dnn module
+
+Feature: eigen
+Build-Depends: opencv4[eigen]
+Description: Eigen support for opencv
+
+Feature: ffmpeg
+Build-Depends: opencv4[ffmpeg]
+Description: ffmpeg support for opencv
+
+Feature: gdcm
+Build-Depends: opencv4[gdcm]
+Description: GDCM support for opencv
+
+Feature: ipp
+Build-Depends: opencv4[ipp]
+Description: Enable Intel Integrated Performance Primitives
+
+Feature: jasper
+Build-Depends: opencv4[jasper]
+Description: JPEG 2000 support for opencv
+
+Feature: jpeg
+Build-Depends: opencv4[jpeg]
+Description: JPEG support for opencv
+
+Feature: openexr
+Build-Depends: opencv4[openexr]
+Description: OpenEXR support for opencv
+
+Feature: opengl
+Build-Depends: opencv4[opengl]
+Description: opengl support for opencv
+
+Feature: openmp
+Build-Depends: opencv4[openmp]
+Description: Enable openmp support for opencv
+
+Feature: ovis
+Build-Depends: opencv4[ovis]
+Description: opencv_ovis module
+
+Feature: png
+Build-Depends: opencv4[png]
+Description: PNG support for opencv
+
+Feature: qt
+Build-Depends: opencv4[qt]
+Description: Qt GUI support for opencv
+
+Feature: sfm
+Build-Depends: opencv4[sfm]
+Description: opencv_sfm module
+
+Feature: tbb
+Build-Depends: opencv4[tbb]
+Description: Enable Intel Threading Building Blocks
+
+Feature: tiff
+Build-Depends: opencv4[tiff]
+Description: TIFF support for opencv
+
+Feature: vtk
+Build-Depends: opencv4[vtk]
+Description: vtk support for opencv
+
+Feature: webp
+Build-Depends: opencv4[webp]
+Description: WebP support for opencv
+
+Feature: halide
+Build-Depends: opencv4[halide]
+Description: Halide support for opencv
+
+Feature: world
+Build-Depends: opencv4[world]
+Description: Compile to a single package support for opencv
diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 55fd6a680..cc6e26fcb 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -1,417 +1 @@ -include(vcpkg_common_functions) - -set(OPENCV_PORT_VERSION "3.4.3") - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO opencv/opencv - REF ${OPENCV_PORT_VERSION} - SHA512 d653a58eb5e3939b9fdb7438ac35f77cf4385cf72d5d22bfd21722a109e1b3283dbb9407985061b7548114f0d05c9395aac9bb62b4d2bc1f68da770a49987fef - HEAD_REF master - PATCHES - 0001-winrt-fixes.patch - 0002-install-options.patch - 0003-disable-downloading.patch - 0004-use-find-package-required.patch - 0005-remove-custom-protobuf-find-package.patch - 0006-fix-missing-openjp2.patch -) - -string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) - -set(CMAKE_MODULE_PATH) - -set(BUILD_opencv_world OFF) -if("world" IN_LIST FEATURES) - set(BUILD_opencv_world ON) -endif() - -set(BUILD_opencv_dnn OFF) -set(WITH_PROTOBUF OFF) -if("dnn" IN_LIST FEATURES) - set(BUILD_opencv_dnn ON) - set(WITH_PROTOBUF ON) - set(PROTOBUF_UPDATE_FILES ON) - set(UPDATE_PROTO_FILES ON) - vcpkg_download_distfile(TINYDNN_ARCHIVE - URLS "https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz" - FILENAME "opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz" - SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b - ) -endif() - -set(BUILD_opencv_flann OFF) -if("flann" IN_LIST FEATURES) - set(BUILD_opencv_flann ON) -endif() - -set(BUILD_opencv_ovis OFF) -if("ovis" IN_LIST FEATURES) - set(BUILD_opencv_ovis ON) -endif() - -set(BUILD_opencv_sfm OFF) -if("sfm" IN_LIST FEATURES) - set(BUILD_opencv_sfm ON) -endif() - -set(BUILD_opencv_contrib OFF) -if("contrib" IN_LIST FEATURES) - set(BUILD_opencv_contrib ON) - - # Used for opencv's face module - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat" - FILENAME "opencv-cache/data/7505c44ca4eb54b4ab1e4777cb96ac05-face_landmark_model.dat" - SHA512 c16e60a6c4bb4de3ab39b876ae3c3f320ea56f69c93e9303bd2dff8760841dcd71be4161fff8bc71e8fe4fe8747fa8465d49d6bd8f5ebcdaea161f4bc2da7c93 - ) - - vcpkg_download_distfile(TINYDNN_ARCHIVE - URLS "https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz" - FILENAME "opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz" - SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b - ) - - function(download_opencv_3rdparty ID COMMIT HASH) - if(NOT EXISTS "${DOWNLOADS}/opencv-cache/${ID}/${COMMIT}.stamp") - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://github.com/opencv/opencv_3rdparty/archive/${COMMIT}.zip" - FILENAME "opencv_3rdparty-${COMMIT}.zip" - SHA512 ${HASH} - ) - vcpkg_extract_source_archive(${OCV_DOWNLOAD}) - file(MAKE_DIRECTORY "${DOWNLOADS}/opencv-cache/${ID}") - file(GLOB XFEATURES2D_I ${CURRENT_BUILDTREES_DIR}/src/opencv_3rdparty-${COMMIT}/*) - foreach(FILE ${XFEATURES2D_I}) - file(COPY ${FILE} DESTINATION "${DOWNLOADS}/opencv-cache/${ID}") - get_filename_component(XFEATURES2D_I_NAME "${FILE}" NAME) - file(MD5 "${FILE}" FILE_HASH) - file(RENAME "${DOWNLOADS}/opencv-cache/${ID}/${XFEATURES2D_I_NAME}" "${DOWNLOADS}/opencv-cache/${ID}/${FILE_HASH}-${XFEATURES2D_I_NAME}") - endforeach() - file(WRITE "${DOWNLOADS}/opencv-cache/${ID}/${COMMIT}.stamp") - endif() - endfunction() - - # Used for opencv's xfeature2d module - download_opencv_3rdparty( - xfeatures2d/boostdesc - 34e4206aef44d50e6bbcd0ab06354b52e7466d26 - 2ccdc8fb59da55eabc73309a80a4d3b1e73e2341027cdcdd2d714e0f519e60f243f38f79b13ed3de32f595aa23e4f86418eed42e741f32a81b1e6e0879190601 - ) - - # Used for opencv's xfeature2d module - download_opencv_3rdparty( - xfeatures2d/vgg - fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d - 7051f5d6ccb938d296b919dd6d5dcddc5afb527aed456639c9984276a8f64565c084d96a72499a7756f127f8d2b1ce9ab70e4cbb3f89c4e16f82296c2a15daed - ) -endif() - -set(WITH_CUDA OFF) -if("cuda" IN_LIST FEATURES) - set(WITH_CUDA ON) -endif() - -set(WITH_FFMPEG OFF) -if("ffmpeg" IN_LIST FEATURES) - set(WITH_FFMPEG ON) - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8041bd6f5ad37045c258904ba3030bb3442e3911/ffmpeg/opencv_ffmpeg.dll" - FILENAME "opencv-cache/ffmpeg/fa5a2a4e2f37defcb95bde8ed145c2b3-opencv_ffmpeg.dll" - SHA512 875f922e1d9fc2fe7c8e879ede35b1001b6ad8b3c4d71feb3823421ce861f580df3418c791315b23870fcb0378d297b01e0761d3f65277ff11ec2fef8c0b08b7 - ) - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8041bd6f5ad37045c258904ba3030bb3442e3911/ffmpeg/opencv_ffmpeg_64.dll" - FILENAME "opencv-cache/ffmpeg/2cc08fc4fef8199fe80e0f126684834f-opencv_ffmpeg_64.dll" - SHA512 4e74aa4cb115f103b929f93bbc8dcf675de7d0c7916f8f0a80ac46761134b088634be95f959ce5827753ae9ecb2365ca40440dfbb9a9bf89f22ee11b6c8342b3 - ) - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8041bd6f5ad37045c258904ba3030bb3442e3911/ffmpeg/ffmpeg_version.cmake" - FILENAME "opencv-cache/ffmpeg/3b90f67f4b429e77d3da36698cef700c-ffmpeg_version.cmake" - SHA512 7d0142c30ac6f6260c1bcabc22753030fd25a708477fa28053e8df847c366967d3b93a8ac14af19a2b7b73d9f8241749a431458faf21a0c8efc7d6d99eecfdcf - ) -endif() - -set(WITH_IPP OFF) -if("ipp" IN_LIST FEATURES) - set(WITH_IPP ON) - - if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/bdb7bb85f34a8cb0d35e40a81f58da431aa1557a/ippicv/ippicv_2017u3_win_intel64_general_20180518.zip" - FILENAME "opencv-cache/ippicv/915ff92958089ede8ea532d3c4fe7187-ippicv_2017u3_win_intel64_general_20180518.zip" - SHA512 8aa08292d542d521c042864446e47a7a6bdbf3896d86fc7b43255459c24a2e9f34a4e9b177023d178fed7a2e82a9db410f89d81375a542d049785d263f46c64d - ) - else() - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/bdb7bb85f34a8cb0d35e40a81f58da431aa1557a/ippicv/ippicv_2017u3_win_ia32_general_20180518.zip" - FILENAME "opencv-cache/ippicv/928168c2d99ab284047dfcfb7a821d91-ippicv_2017u3_win_ia32_general_20180518.zip" - SHA512 b89b0fb739152303cafc9fb064fa8b24fd94850697137ccbb5c1e344e0f5094115603a5e3be3a25f85d0faefc5c53429a7d65da0142d012ada41e8db2bcdd6b7 - ) - endif() -endif() - -set(WITH_TBB OFF) -if("tbb" IN_LIST FEATURES) - set(WITH_TBB ON) -endif() - -set(WITH_QT OFF) -if("qt" IN_LIST FEATURES) - set(WITH_QT ON) -endif() - -set(WITH_VTK OFF) -if("vtk" IN_LIST FEATURES) - set(WITH_VTK ON) -endif() - -set(WITH_WEBP OFF) -if("webp" IN_LIST FEATURES) - set(WITH_WEBP ON) - list(APPEND CMAKE_MODULE_PATH ${CURRENT_INSTALLED_DIR}/share/libwebp) -endif() - -set(WITH_GDCM OFF) -if("gdcm" IN_LIST FEATURES) - set(WITH_GDCM ON) -endif() - -set(WITH_OPENGL OFF) -if("opengl" IN_LIST FEATURES) - set(WITH_OPENGL ON) -endif() - -set(WITH_OPENEXR OFF) -if("openexr" IN_LIST FEATURES) - set(WITH_OPENEXR ON) - list(APPEND CMAKE_MODULE_PATH ${CURRENT_INSTALLED_DIR}/share/openexr) -endif() - -set(WITH_MSMF ON) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - set(WITH_MSMF OFF) -endif() - -set(WITH_TIFF OFF) -if("tiff" IN_LIST FEATURES) - set(WITH_TIFF ON) -endif() - -set(WITH_JPEG OFF) -if("jpeg" IN_LIST FEATURES) - set(WITH_JPEG ON) -endif() - -set(WITH_JASPER OFF) -if("jasper" IN_LIST FEATURES) - set(WITH_JASPER ON) -endif() - -set(WITH_PNG OFF) -if("png" IN_LIST FEATURES) - set(WITH_PNG ON) -endif() - -set(WITH_EIGEN OFF) -if("eigen" IN_LIST FEATURES) - set(WITH_EIGEN ON) -endif() - -set(OPENCV_ENABLE_NONFREE OFF) -if("nonfree" IN_LIST FEATURES) - set(OPENCV_ENABLE_NONFREE ON) -endif() - -if(BUILD_opencv_contrib) - vcpkg_from_github( - OUT_SOURCE_PATH CONTRIB_SOURCE_PATH - REPO opencv/opencv_contrib - REF ${OPENCV_PORT_VERSION} - SHA512 456c6f878fb3bd5459f6430405cf05c609431f8d7db743aa699fc75c305d019682ee3a804bf0cf5107597dd1dbbb69b08be3535a0e6c717e4773ed7c05d08e59 - HEAD_REF master - ) - set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") -endif() - -set(WITH_ZLIB ON) -set(BUILD_opencv_line_descriptor ON) -set(BUILD_opencv_saliency ON) -set(BUILD_opencv_bgsegm ON) -if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") - set(BUILD_opencv_line_descriptor OFF) - set(BUILD_opencv_saliency OFF) - set(BUILD_opencv_bgsegm OFF) -endif() - -string(REPLACE ";" "\\\\\;" CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") - -vcpkg_configure_cmake( - PREFER_NINJA - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - # Ungrouped Entries - -DOpenCV_DISABLE_ARCH_PATH=ON - # Do not build docs/examples - -DBUILD_DOCS=OFF - -DBUILD_EXAMPLES=OFF - # Do not build integrated libraries, use external ones whenever possible - -DBUILD_JASPER=OFF - -DBUILD_JPEG=OFF - -DBUILD_OPENEXR=OFF - -DBUILD_PACKAGE=OFF - -DBUILD_PERF_TESTS=OFF - -DBUILD_PNG=OFF - -DBUILD_PROTOBUF=OFF - -DBUILD_TESTS=OFF - -DBUILD_TIFF=OFF - -DBUILD_WEBP=OFF - -DBUILD_WITH_DEBUG_INFO=ON - -DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT} - -DBUILD_ZLIB=OFF - # Select which OpenCV modules should be built - -DBUILD_opencv_apps=OFF - -DBUILD_opencv_bgsegm=${BUILD_opencv_bgsegm} - -DBUILD_opencv_dnn=${BUILD_opencv_dnn} - -DBUILD_opencv_flann=${BUILD_opencv_flann} - -DBUILD_opencv_line_descriptor=${BUILD_opencv_line_descriptor} - -DBUILD_opencv_ovis=${BUILD_opencv_ovis} - -DBUILD_opencv_python2=OFF - -DBUILD_opencv_python3=OFF - -DBUILD_opencv_saliency=${BUILD_opencv_saliency} - -DBUILD_opencv_sfm=${BUILD_opencv_sfm} - -DBUILD_opencv_world=${BUILD_opencv_world} - # PROTOBUF - -DPROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES} - -DUPDATE_PROTO_FILES=${UPDATE_PROTO_FILES} - # CMAKE - -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON - -DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON - "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" - # ENABLE - -DENABLE_CXX11=ON - -DENABLE_PYLINT=OFF - -DOPENCV_ENABLE_NONFREE=${OPENCV_ENABLE_NONFREE} - # INSTALL - -DINSTALL_FORCE_UNIX_PATHS=ON - -DINSTALL_LICENSE=OFF - # OPENCV - -DOPENCV_CONFIG_INSTALL_PATH=share/opencv - "-DOPENCV_DOWNLOAD_PATH=${DOWNLOADS}/opencv-cache" - ${BUILD_WITH_CONTRIB_FLAG} - -DOPENCV_OTHER_INSTALL_PATH=share/opencv - # WITH - -DWITH_CUBLAS=${WITH_CUDA} - -DWITH_CUDA=${WITH_CUDA} - -DWITH_EIGEN=${WITH_EIGEN} - -DWITH_FFMPEG=${WITH_FFMPEG} - -DWITH_GDCM=${WITH_GDCM} - -DWITH_IPP=${WITH_IPP} - -DWITH_JASPER=${WITH_JASPER} - -DWITH_JPEG=${WITH_JPEG} - -DWITH_LAPACK=OFF - -DWITH_MATLAB=OFF - -DWITH_MSMF=${WITH_MSMF} - -DWITH_OPENCLAMDBLAS=OFF - -DWITH_OPENEXR=${WITH_OPENEXR} - -DWITH_OPENGL=${WITH_OPENGL} - -DWITH_PNG=${WITH_PNG} - -DWITH_PROTOBUF=${WITH_PROTOBUF} - -DWITH_QT=${WITH_QT} - -DWITH_TBB=${WITH_TBB} - -DWITH_TIFF=${WITH_TIFF} - -DWITH_VTK=${WITH_VTK} - -DWITH_WEBP=${WITH_WEBP} - -DWITH_ZLIB=${WITH_ZLIB} - -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR} - OPTIONS_DEBUG - -DINSTALL_HEADERS=OFF - -DINSTALL_OTHER=OFF -) - -vcpkg_install_cmake() - -file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/opencv/LICENSE ${CURRENT_PACKAGES_DIR}/share/opencv/copyright) -file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE) - -if(VCPKG_PLATFORM_TOOLSET STREQUAL "v141") - set(OpenCV_RUNTIME vc15) -else() - set(OpenCV_RUNTIME vc14) -endif() -if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - set(OpenCV_ARCH x64) -elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") - set(OpenCV_ARCH ARM) -elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") - set(OpenCV_ARCH ARM64) -else() - set(OpenCV_ARCH x86) -endif() - -file(GLOB BIN_AND_LIB ${CURRENT_PACKAGES_DIR}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/*) -file(COPY ${BIN_AND_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}) -file(GLOB DEBUG_BIN_AND_LIB ${CURRENT_PACKAGES_DIR}/debug/${OpenCV_ARCH}/${OpenCV_RUNTIME}/*) -file(COPY ${DEBUG_BIN_AND_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}/debug) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/${OpenCV_ARCH}) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/${OpenCV_ARCH}) - -file(GLOB STATICLIB ${CURRENT_PACKAGES_DIR}/staticlib/*) -if(STATICLIB) - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib) - file(COPY ${STATICLIB} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/staticlib) -endif() -file(GLOB STATICLIB ${CURRENT_PACKAGES_DIR}/debug/staticlib/*) -if(STATICLIB) - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib) - file(COPY ${STATICLIB} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/staticlib) -endif() - -file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake OPENCV_CONFIG) -string(REPLACE "/staticlib/" - "/lib/" OPENCV_CONFIG "${OPENCV_CONFIG}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake "${OPENCV_CONFIG}") - -file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-release.cmake OPENCV_CONFIG_LIB) -string(REPLACE "/staticlib/" - "/lib/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-release.cmake "${OPENCV_CONFIG_LIB}") - -file(READ ${CURRENT_PACKAGES_DIR}/debug/share/opencv/OpenCVModules-debug.cmake OPENCV_CONFIG_LIB) -string(REPLACE "/staticlib/" - "/lib/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") -string(REPLACE "PREFIX}/lib" - "PREFIX}/debug/lib" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") -string(REPLACE "PREFIX}/bin" - "PREFIX}/debug/bin" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake "${OPENCV_CONFIG_LIB}") - -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/share/opencv/OpenCVModules.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake) - -file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES) -string(REPLACE "${CURRENT_INSTALLED_DIR}" - "\${_VCPKG_INSTALLED_DIR}/\${VCPKG_TARGET_TRIPLET}" OPENCV_MODULES "${OPENCV_MODULES}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}") - -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES) - string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" - "set(CMAKE_IMPORT_FILE_VERSION 1) - find_package(TIFF REQUIRED)" OPENCV_MODULES "${OPENCV_MODULES}") - file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}") -endif() - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv) - -vcpkg_copy_pdbs() - -set(VCPKG_LIBRARY_LINKAGE "dynamic") - -set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
diff --git a/ports/opencv/0001-winrt-fixes.patch b/ports/opencv3/0001-winrt-fixes.patch index b2fe1a021..b2fe1a021 100644 --- a/ports/opencv/0001-winrt-fixes.patch +++ b/ports/opencv3/0001-winrt-fixes.patch diff --git a/ports/opencv/0002-install-options.patch b/ports/opencv3/0002-install-options.patch index 0719a7cb9..0719a7cb9 100644 --- a/ports/opencv/0002-install-options.patch +++ b/ports/opencv3/0002-install-options.patch diff --git a/ports/opencv/0003-disable-downloading.patch b/ports/opencv3/0003-disable-downloading.patch index 28b00251f..28b00251f 100644 --- a/ports/opencv/0003-disable-downloading.patch +++ b/ports/opencv3/0003-disable-downloading.patch diff --git a/ports/opencv/0004-use-find-package-required.patch b/ports/opencv3/0004-use-find-package-required.patch index 4e1daf659..4e1daf659 100644 --- a/ports/opencv/0004-use-find-package-required.patch +++ b/ports/opencv3/0004-use-find-package-required.patch diff --git a/ports/opencv/0005-remove-custom-protobuf-find-package.patch b/ports/opencv3/0005-remove-custom-protobuf-find-package.patch index 91ac137f9..91ac137f9 100644 --- a/ports/opencv/0005-remove-custom-protobuf-find-package.patch +++ b/ports/opencv3/0005-remove-custom-protobuf-find-package.patch diff --git a/ports/opencv/0006-fix-missing-openjp2.patch b/ports/opencv3/0006-fix-missing-openjp2.patch index c0afb9952..c0afb9952 100644 --- a/ports/opencv/0006-fix-missing-openjp2.patch +++ b/ports/opencv3/0006-fix-missing-openjp2.patch diff --git a/ports/opencv3/CONTROL b/ports/opencv3/CONTROL new file mode 100644 index 000000000..5f65d9e43 --- /dev/null +++ b/ports/opencv3/CONTROL @@ -0,0 +1,93 @@ +Source: opencv3 +Version: 3.4.3-10 +Build-Depends: zlib +Homepage: https://github.com/opencv/opencv +Description: computer vision library +Default-Features: opengl, jpeg, png, tiff, eigen, flann + +Feature: opengl +Build-Depends: opengl +Description: opengl support for opencv + +Feature: dnn +Build-Depends: protobuf +Description: opencv_dnn module + +Feature: ovis +Build-Depends: ogre +Description: opencv_ovis module + +Feature: flann +Description: opencv_flann module + +Feature: sfm +Build-Depends: eigen3, glog, gflags, ceres +Description: opencv_sfm module + +Feature: contrib +Build-Depends: opencv3[flann] +Description: opencv_contrib module + +Feature: cuda +Build-Depends: cuda +Description: CUDA support for opencv + +Feature: ffmpeg +Description: prebuilt ffmpeg support for opencv + +Feature: ipp +Description: Enable Intel Integrated Performance Primitives + +Feature: tbb +Build-Depends: tbb +Description: Enable Intel Threading Building Blocks + +Feature: qt +Build-Depends: qt5 +Description: Qt GUI support for opencv + +Feature: vtk +Build-Depends: vtk +Description: vtk support for opencv + +Feature: gdcm +Build-Depends: gdcm +Description: GDCM support for opencv + +Feature: webp +Build-Depends: libwebp +Description: WebP support for opencv + +Feature: openexr +Build-Depends: openexr +Description: OpenEXR support for opencv + +Feature: tiff +Build-Depends: tiff +Description: TIFF support for opencv + +Feature: png +Build-Depends: libpng +Description: PNG support for opencv + +Feature: jpeg +Build-Depends: libjpeg-turbo +Description: JPEG support for opencv + +Feature: jasper +Build-Depends: jasper +Description: JPEG 2000 support for opencv + +Feature: eigen +Build-Depends: eigen3 +Description: Eigen support for opencv + +Feature: halide +Build-Depends: halide, opencv3[dnn] +Description: Halide support for opencv + +Feature: world +Description: Compile to a single package support for opencv + +Feature: nonfree +Description: allow nonfree and unredistributable libraries diff --git a/ports/opencv3/portfile.cmake b/ports/opencv3/portfile.cmake new file mode 100644 index 000000000..12c4dadae --- /dev/null +++ b/ports/opencv3/portfile.cmake @@ -0,0 +1,423 @@ +if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv4") + message(FATAL_ERROR "OpenCV 4 is installed, please uninstall and try again:\n vcpkg remove opencv4") +endif() + +include(vcpkg_common_functions) + +set(OPENCV_PORT_VERSION "3.4.3") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO opencv/opencv + REF ${OPENCV_PORT_VERSION} + SHA512 d653a58eb5e3939b9fdb7438ac35f77cf4385cf72d5d22bfd21722a109e1b3283dbb9407985061b7548114f0d05c9395aac9bb62b4d2bc1f68da770a49987fef + HEAD_REF master + PATCHES + 0001-winrt-fixes.patch + 0002-install-options.patch + 0003-disable-downloading.patch + 0004-use-find-package-required.patch + 0005-remove-custom-protobuf-find-package.patch + 0006-fix-missing-openjp2.patch +) + +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) + +set(CMAKE_MODULE_PATH) + +set(BUILD_opencv_world OFF) +if("world" IN_LIST FEATURES) + set(BUILD_opencv_world ON) +endif() + +set(BUILD_opencv_dnn OFF) +set(WITH_PROTOBUF OFF) +if("dnn" IN_LIST FEATURES) + set(BUILD_opencv_dnn ON) + set(WITH_PROTOBUF ON) + set(PROTOBUF_UPDATE_FILES ON) + set(UPDATE_PROTO_FILES ON) + vcpkg_download_distfile(TINYDNN_ARCHIVE + URLS "https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz" + FILENAME "opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz" + SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b + ) +endif() + +set(BUILD_opencv_flann OFF) +if("flann" IN_LIST FEATURES) + set(BUILD_opencv_flann ON) +endif() + +set(BUILD_opencv_ovis OFF) +if("ovis" IN_LIST FEATURES) + set(BUILD_opencv_ovis ON) +endif() + +set(BUILD_opencv_sfm OFF) +if("sfm" IN_LIST FEATURES) + set(BUILD_opencv_sfm ON) +endif() + +set(BUILD_opencv_contrib OFF) +if("contrib" IN_LIST FEATURES) + set(BUILD_opencv_contrib ON) + + # Used for opencv's face module + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat" + FILENAME "opencv-cache/data/7505c44ca4eb54b4ab1e4777cb96ac05-face_landmark_model.dat" + SHA512 c16e60a6c4bb4de3ab39b876ae3c3f320ea56f69c93e9303bd2dff8760841dcd71be4161fff8bc71e8fe4fe8747fa8465d49d6bd8f5ebcdaea161f4bc2da7c93 + ) + + vcpkg_download_distfile(TINYDNN_ARCHIVE + URLS "https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz" + FILENAME "opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz" + SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b + ) + + function(download_opencv_3rdparty ID COMMIT HASH) + if(NOT EXISTS "${DOWNLOADS}/opencv-cache/${ID}/${COMMIT}.stamp") + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://github.com/opencv/opencv_3rdparty/archive/${COMMIT}.zip" + FILENAME "opencv_3rdparty-${COMMIT}.zip" + SHA512 ${HASH} + ) + vcpkg_extract_source_archive(${OCV_DOWNLOAD}) + file(MAKE_DIRECTORY "${DOWNLOADS}/opencv-cache/${ID}") + file(GLOB XFEATURES2D_I ${CURRENT_BUILDTREES_DIR}/src/opencv_3rdparty-${COMMIT}/*) + foreach(FILE ${XFEATURES2D_I}) + file(COPY ${FILE} DESTINATION "${DOWNLOADS}/opencv-cache/${ID}") + get_filename_component(XFEATURES2D_I_NAME "${FILE}" NAME) + file(MD5 "${FILE}" FILE_HASH) + file(RENAME "${DOWNLOADS}/opencv-cache/${ID}/${XFEATURES2D_I_NAME}" "${DOWNLOADS}/opencv-cache/${ID}/${FILE_HASH}-${XFEATURES2D_I_NAME}") + endforeach() + file(WRITE "${DOWNLOADS}/opencv-cache/${ID}/${COMMIT}.stamp") + endif() + endfunction() + + # Used for opencv's xfeature2d module + download_opencv_3rdparty( + xfeatures2d/boostdesc + 34e4206aef44d50e6bbcd0ab06354b52e7466d26 + 2ccdc8fb59da55eabc73309a80a4d3b1e73e2341027cdcdd2d714e0f519e60f243f38f79b13ed3de32f595aa23e4f86418eed42e741f32a81b1e6e0879190601 + ) + + # Used for opencv's xfeature2d module + download_opencv_3rdparty( + xfeatures2d/vgg + fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d + 7051f5d6ccb938d296b919dd6d5dcddc5afb527aed456639c9984276a8f64565c084d96a72499a7756f127f8d2b1ce9ab70e4cbb3f89c4e16f82296c2a15daed + ) +endif() + +set(WITH_CUDA OFF) +if("cuda" IN_LIST FEATURES) + set(WITH_CUDA ON) +endif() + +set(WITH_FFMPEG OFF) +if("ffmpeg" IN_LIST FEATURES) + set(WITH_FFMPEG ON) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8041bd6f5ad37045c258904ba3030bb3442e3911/ffmpeg/opencv_ffmpeg.dll" + FILENAME "opencv-cache/ffmpeg/fa5a2a4e2f37defcb95bde8ed145c2b3-opencv_ffmpeg.dll" + SHA512 875f922e1d9fc2fe7c8e879ede35b1001b6ad8b3c4d71feb3823421ce861f580df3418c791315b23870fcb0378d297b01e0761d3f65277ff11ec2fef8c0b08b7 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8041bd6f5ad37045c258904ba3030bb3442e3911/ffmpeg/opencv_ffmpeg_64.dll" + FILENAME "opencv-cache/ffmpeg/2cc08fc4fef8199fe80e0f126684834f-opencv_ffmpeg_64.dll" + SHA512 4e74aa4cb115f103b929f93bbc8dcf675de7d0c7916f8f0a80ac46761134b088634be95f959ce5827753ae9ecb2365ca40440dfbb9a9bf89f22ee11b6c8342b3 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8041bd6f5ad37045c258904ba3030bb3442e3911/ffmpeg/ffmpeg_version.cmake" + FILENAME "opencv-cache/ffmpeg/3b90f67f4b429e77d3da36698cef700c-ffmpeg_version.cmake" + SHA512 7d0142c30ac6f6260c1bcabc22753030fd25a708477fa28053e8df847c366967d3b93a8ac14af19a2b7b73d9f8241749a431458faf21a0c8efc7d6d99eecfdcf + ) +endif() + +set(WITH_IPP OFF) +if("ipp" IN_LIST FEATURES) + set(WITH_IPP ON) + + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/bdb7bb85f34a8cb0d35e40a81f58da431aa1557a/ippicv/ippicv_2017u3_win_intel64_general_20180518.zip" + FILENAME "opencv-cache/ippicv/915ff92958089ede8ea532d3c4fe7187-ippicv_2017u3_win_intel64_general_20180518.zip" + SHA512 8aa08292d542d521c042864446e47a7a6bdbf3896d86fc7b43255459c24a2e9f34a4e9b177023d178fed7a2e82a9db410f89d81375a542d049785d263f46c64d + ) + else() + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/bdb7bb85f34a8cb0d35e40a81f58da431aa1557a/ippicv/ippicv_2017u3_win_ia32_general_20180518.zip" + FILENAME "opencv-cache/ippicv/928168c2d99ab284047dfcfb7a821d91-ippicv_2017u3_win_ia32_general_20180518.zip" + SHA512 b89b0fb739152303cafc9fb064fa8b24fd94850697137ccbb5c1e344e0f5094115603a5e3be3a25f85d0faefc5c53429a7d65da0142d012ada41e8db2bcdd6b7 + ) + endif() +endif() + +set(WITH_TBB OFF) +if("tbb" IN_LIST FEATURES) + set(WITH_TBB ON) +endif() + +set(WITH_QT OFF) +if("qt" IN_LIST FEATURES) + set(WITH_QT ON) +endif() + +set(WITH_VTK OFF) +if("vtk" IN_LIST FEATURES) + set(WITH_VTK ON) +endif() + +set(WITH_WEBP OFF) +if("webp" IN_LIST FEATURES) + set(WITH_WEBP ON) + list(APPEND CMAKE_MODULE_PATH ${CURRENT_INSTALLED_DIR}/share/libwebp) +endif() + +set(WITH_GDCM OFF) +if("gdcm" IN_LIST FEATURES) + set(WITH_GDCM ON) +endif() + +set(WITH_OPENGL OFF) +if("opengl" IN_LIST FEATURES) + set(WITH_OPENGL ON) +endif() + +set(WITH_OPENEXR OFF) +if("openexr" IN_LIST FEATURES) + set(WITH_OPENEXR ON) + list(APPEND CMAKE_MODULE_PATH ${CURRENT_INSTALLED_DIR}/share/openexr) +endif() + +set(WITH_MSMF ON) +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(WITH_MSMF OFF) +endif() + +set(WITH_TIFF OFF) +if("tiff" IN_LIST FEATURES) + set(WITH_TIFF ON) +endif() + +set(WITH_JPEG OFF) +if("jpeg" IN_LIST FEATURES) + set(WITH_JPEG ON) +endif() + +set(WITH_JASPER OFF) +if("jasper" IN_LIST FEATURES) + set(WITH_JASPER ON) +endif() + +set(WITH_PNG OFF) +if("png" IN_LIST FEATURES) + set(WITH_PNG ON) +endif() + +set(WITH_EIGEN OFF) +if("eigen" IN_LIST FEATURES) + set(WITH_EIGEN ON) +endif() + +set(WITH_HALIDE OFF) +if("halide" IN_LIST FEATURES) + set(WITH_HALIDE ON) +endif() + +set(OPENCV_ENABLE_NONFREE OFF) +if("nonfree" IN_LIST FEATURES) + set(OPENCV_ENABLE_NONFREE ON) +endif() + +if(BUILD_opencv_contrib) + vcpkg_from_github( + OUT_SOURCE_PATH CONTRIB_SOURCE_PATH + REPO opencv/opencv_contrib + REF ${OPENCV_PORT_VERSION} + SHA512 456c6f878fb3bd5459f6430405cf05c609431f8d7db743aa699fc75c305d019682ee3a804bf0cf5107597dd1dbbb69b08be3535a0e6c717e4773ed7c05d08e59 + HEAD_REF master + ) + set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") +endif() + +set(WITH_ZLIB ON) +set(BUILD_opencv_line_descriptor ON) +set(BUILD_opencv_saliency ON) +set(BUILD_opencv_bgsegm ON) +if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") + set(BUILD_opencv_line_descriptor OFF) + set(BUILD_opencv_saliency OFF) + set(BUILD_opencv_bgsegm OFF) +endif() + +string(REPLACE ";" "\\\\\;" CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") + +vcpkg_configure_cmake( + PREFER_NINJA + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + # Ungrouped Entries + -DOpenCV_DISABLE_ARCH_PATH=ON + # Do not build docs/examples + -DBUILD_DOCS=OFF + -DBUILD_EXAMPLES=OFF + # Do not build integrated libraries, use external ones whenever possible + -DBUILD_JASPER=OFF + -DBUILD_JPEG=OFF + -DBUILD_OPENEXR=OFF + -DBUILD_PACKAGE=OFF + -DBUILD_PERF_TESTS=OFF + -DBUILD_PNG=OFF + -DBUILD_PROTOBUF=OFF + -DBUILD_TESTS=OFF + -DBUILD_TIFF=OFF + -DBUILD_WEBP=OFF + -DBUILD_WITH_DEBUG_INFO=ON + -DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT} + -DBUILD_ZLIB=OFF + # Select which OpenCV modules should be built + -DBUILD_opencv_apps=OFF + -DBUILD_opencv_bgsegm=${BUILD_opencv_bgsegm} + -DBUILD_opencv_dnn=${BUILD_opencv_dnn} + -DBUILD_opencv_flann=${BUILD_opencv_flann} + -DBUILD_opencv_line_descriptor=${BUILD_opencv_line_descriptor} + -DBUILD_opencv_ovis=${BUILD_opencv_ovis} + -DBUILD_opencv_python2=OFF + -DBUILD_opencv_python3=OFF + -DBUILD_opencv_saliency=${BUILD_opencv_saliency} + -DBUILD_opencv_sfm=${BUILD_opencv_sfm} + -DBUILD_opencv_world=${BUILD_opencv_world} + # PROTOBUF + -DPROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES} + -DUPDATE_PROTO_FILES=${UPDATE_PROTO_FILES} + # CMAKE + -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON + -DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON + "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" + # ENABLE + -DENABLE_CXX11=ON + -DENABLE_PYLINT=OFF + -DOPENCV_ENABLE_NONFREE=${OPENCV_ENABLE_NONFREE} + # INSTALL + -DINSTALL_FORCE_UNIX_PATHS=ON + -DINSTALL_LICENSE=OFF + # OPENCV + -DOPENCV_CONFIG_INSTALL_PATH=share/opencv + "-DOPENCV_DOWNLOAD_PATH=${DOWNLOADS}/opencv-cache" + ${BUILD_WITH_CONTRIB_FLAG} + -DOPENCV_OTHER_INSTALL_PATH=share/opencv + # WITH + -DWITH_CUBLAS=${WITH_CUDA} + -DWITH_CUDA=${WITH_CUDA} + -DWITH_EIGEN=${WITH_EIGEN} + -DWITH_FFMPEG=${WITH_FFMPEG} + -DWITH_GDCM=${WITH_GDCM} + -DWITH_HALIDE=${WITH_HALIDE} + -DWITH_IPP=${WITH_IPP} + -DWITH_JASPER=${WITH_JASPER} + -DWITH_JPEG=${WITH_JPEG} + -DWITH_LAPACK=OFF + -DWITH_MATLAB=OFF + -DWITH_MSMF=${WITH_MSMF} + -DWITH_OPENCLAMDBLAS=OFF + -DWITH_OPENEXR=${WITH_OPENEXR} + -DWITH_OPENGL=${WITH_OPENGL} + -DWITH_PNG=${WITH_PNG} + -DWITH_PROTOBUF=${WITH_PROTOBUF} + -DWITH_QT=${WITH_QT} + -DWITH_TBB=${WITH_TBB} + -DWITH_TIFF=${WITH_TIFF} + -DWITH_VTK=${WITH_VTK} + -DWITH_WEBP=${WITH_WEBP} + -DWITH_ZLIB=${WITH_ZLIB} + -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR} + OPTIONS_DEBUG + -DINSTALL_HEADERS=OFF + -DINSTALL_OTHER=OFF +) + +vcpkg_install_cmake() + +if(VCPKG_PLATFORM_TOOLSET STREQUAL "v141") + set(OpenCV_RUNTIME vc15) +else() + set(OpenCV_RUNTIME vc14) +endif() +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(OpenCV_ARCH x64) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(OpenCV_ARCH ARM) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(OpenCV_ARCH ARM64) +else() + set(OpenCV_ARCH x86) +endif() + +file(GLOB BIN_AND_LIB ${CURRENT_PACKAGES_DIR}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/*) +file(COPY ${BIN_AND_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}) +file(GLOB DEBUG_BIN_AND_LIB ${CURRENT_PACKAGES_DIR}/debug/${OpenCV_ARCH}/${OpenCV_RUNTIME}/*) +file(COPY ${DEBUG_BIN_AND_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}/debug) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/${OpenCV_ARCH}) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/${OpenCV_ARCH}) + +file(GLOB STATICLIB ${CURRENT_PACKAGES_DIR}/staticlib/*) +if(STATICLIB) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib) + file(COPY ${STATICLIB} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/staticlib) +endif() +file(GLOB STATICLIB ${CURRENT_PACKAGES_DIR}/debug/staticlib/*) +if(STATICLIB) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib) + file(COPY ${STATICLIB} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/staticlib) +endif() + +file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake OPENCV_CONFIG) +string(REPLACE "/staticlib/" + "/lib/" OPENCV_CONFIG "${OPENCV_CONFIG}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake "${OPENCV_CONFIG}") + +file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-release.cmake OPENCV_CONFIG_LIB) +string(REPLACE "/staticlib/" + "/lib/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-release.cmake "${OPENCV_CONFIG_LIB}") + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/opencv/OpenCVModules-debug.cmake OPENCV_CONFIG_LIB) +string(REPLACE "/staticlib/" + "/lib/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") +string(REPLACE "PREFIX}/lib" + "PREFIX}/debug/lib" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") +string(REPLACE "PREFIX}/bin" + "PREFIX}/debug/bin" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake "${OPENCV_CONFIG_LIB}") + +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/share/opencv/OpenCVModules.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake) + +file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES) +string(REPLACE "${CURRENT_INSTALLED_DIR}" + "\${_VCPKG_INSTALLED_DIR}/\${VCPKG_TARGET_TRIPLET}" OPENCV_MODULES "${OPENCV_MODULES}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES) + string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" + "set(CMAKE_IMPORT_FILE_VERSION 1) + find_package(TIFF REQUIRED)" OPENCV_MODULES "${OPENCV_MODULES}") + file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}") +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv) + +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv3) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/opencv3/LICENSE ${CURRENT_PACKAGES_DIR}/share/opencv3/copyright) + +set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) diff --git a/ports/opencv/usage b/ports/opencv3/usage index 1c30e5fea..1c30e5fea 100644 --- a/ports/opencv/usage +++ b/ports/opencv3/usage diff --git a/ports/opencv4/0001-disable-downloading.patch b/ports/opencv4/0001-disable-downloading.patch new file mode 100644 index 000000000..28b00251f --- /dev/null +++ b/ports/opencv4/0001-disable-downloading.patch @@ -0,0 +1,11 @@ +--- a/cmake/OpenCVDownload.cmake ++++ b/cmake/OpenCVDownload.cmake +@@ -151,6 +151,8 @@ function(ocv_download) + # Download + if(NOT EXISTS "${CACHE_CANDIDATE}") + ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"") ++ string(REPLACE "${OPENCV_DOWNLOAD_PATH}/" "opencv-cache/" CACHE_SUBPATH "${CACHE_CANDIDATE}") ++ message(FATAL_ERROR " Downloads are not permitted during configure. Please pre-download the file \"${CACHE_CANDIDATE}\":\n \n vcpkg_download_distfile(OCV_DOWNLOAD\n URLS \"${DL_URL}\"\n FILENAME \"${CACHE_SUBPATH}\"\n SHA512 0\n )") + file(DOWNLOAD "${DL_URL}" "${CACHE_CANDIDATE}" + INACTIVITY_TIMEOUT 60 + TIMEOUT 600 diff --git a/ports/opencv4/0002-install-options.patch b/ports/opencv4/0002-install-options.patch new file mode 100644 index 000000000..10aa08c24 --- /dev/null +++ b/ports/opencv4/0002-install-options.patch @@ -0,0 +1,69 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8631bbc..e801558 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -647,7 +647,7 @@ endif() + + if(WIN32) + # Postfix of DLLs: +- set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}") ++ set(OPENCV_DLLVERSION "") + set(OPENCV_DEBUG_POSTFIX d) + else() + # Postfix of so's: +@@ -698,7 +698,7 @@ endif() + ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS) + + # --- Python Support --- +-if(NOT IOS) ++if(0) + include(cmake/OpenCVDetectPython.cmake) + endif() + +diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake +index e3ae62f..d866162 100644 +--- a/cmake/OpenCVCompilerOptions.cmake ++++ b/cmake/OpenCVCompilerOptions.cmake +@@ -256,7 +256,6 @@ if(MSVC) + #endif() + + if(BUILD_WITH_DEBUG_INFO) +- set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi") + set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug") + set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug") + endif() +diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake +index cef9d0b..b6ddb81 100644 +--- a/cmake/OpenCVGenConfig.cmake ++++ b/cmake/OpenCVGenConfig.cmake +@@ -109,7 +109,7 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) + endif() + endfunction() + +-if((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" OR UNIX) AND NOT ANDROID) ++if(NOT ANDROID) + ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "") + endif() + +@@ -121,7 +121,7 @@ endif() + # -------------------------------------------------------------------------------------------- + # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages + # -------------------------------------------------------------------------------------------- +-if(WIN32) ++if(0) + if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + if(BUILD_SHARED_LIBS) + set(_lib_suffix "lib") +diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt +index 1f0d720..0bb1ff7 100644 +--- a/data/CMakeLists.txt ++++ b/data/CMakeLists.txt +@@ -1,8 +1,6 @@ + file(GLOB HAAR_CASCADES haarcascades/*.xml) + file(GLOB LBP_CASCADES lbpcascades/*.xml) + +-install(FILES ${HAAR_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/haarcascades COMPONENT libs) +-install(FILES ${LBP_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/lbpcascades COMPONENT libs) + + if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) + install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests") diff --git a/ports/opencv4/0003-force-package-requirements.patch b/ports/opencv4/0003-force-package-requirements.patch new file mode 100644 index 000000000..b6051f849 --- /dev/null +++ b/ports/opencv4/0003-force-package-requirements.patch @@ -0,0 +1,128 @@ +diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake +index 227cfb2..7a97a19 100644 +--- a/cmake/OpenCVFindLibsGrfmt.cmake ++++ b/cmake/OpenCVFindLibsGrfmt.cmake +@@ -6,7 +6,7 @@ + if(BUILD_ZLIB) + ocv_clear_vars(ZLIB_FOUND) + else() +- find_package(ZLIB "${MIN_VER_ZLIB}") ++ find_package(ZLIB "${MIN_VER_ZLIB}" REQUIRED) + if(ZLIB_FOUND AND ANDROID) + if(ZLIB_LIBRARIES MATCHES "/usr/(lib|lib32|lib64)/libz.so$") + set(ZLIB_LIBRARIES z) +@@ -30,7 +30,7 @@ if(WITH_JPEG) + if(BUILD_JPEG) + ocv_clear_vars(JPEG_FOUND) + else() +- include(FindJPEG) ++ find_package(JPEG REQUIRED) + endif() + + if(NOT JPEG_FOUND) +@@ -74,7 +74,7 @@ if(WITH_TIFF) + if(BUILD_TIFF) + ocv_clear_vars(TIFF_FOUND) + else() +- include(FindTIFF) ++ find_package(TIFF REQUIRED) + if(TIFF_FOUND) + ocv_parse_header("${TIFF_INCLUDE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION) + endif() +@@ -117,7 +117,7 @@ if(WITH_WEBP) + if(BUILD_WEBP) + ocv_clear_vars(WEBP_FOUND WEBP_LIBRARY WEBP_LIBRARIES WEBP_INCLUDE_DIR) + else() +- include(cmake/OpenCVFindWebP.cmake) ++ find_package(WebP REQUIRED) + if(WEBP_FOUND) + set(HAVE_WEBP 1) + endif() +@@ -158,7 +158,7 @@ if(WITH_JASPER) + if(BUILD_JASPER) + ocv_clear_vars(JASPER_FOUND) + else() +- include(FindJasper) ++ find_package(Jasper REQUIRED) + endif() + + if(NOT JASPER_FOUND) +@@ -182,7 +182,7 @@ if(WITH_PNG) + if(BUILD_PNG) + ocv_clear_vars(PNG_FOUND) + else() +- include(FindPNG) ++ find_package(PNG REQUIRED) + if(PNG_FOUND) + include(CheckIncludeFile) + check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H) +@@ -213,7 +213,7 @@ endif() + if(WITH_OPENEXR) + ocv_clear_vars(HAVE_OPENEXR) + if(NOT BUILD_OPENEXR) +- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake") ++ find_package(OpenEXR REQUIRED) + endif() + + if(OPENEXR_FOUND) +@@ -231,7 +231,7 @@ endif() + + # --- GDAL (optional) --- + if(WITH_GDAL) +- find_package(GDAL QUIET) ++ find_package(GDAL REQUIRED) + + if(NOT GDAL_FOUND) + set(HAVE_GDAL NO) +@@ -243,7 +243,7 @@ if(WITH_GDAL) + endif() + + if (WITH_GDCM) +- find_package(GDCM QUIET) ++ find_package(GDCM REQUIRED) + if(NOT GDCM_FOUND) + set(HAVE_GDCM NO) + ocv_clear_vars(GDCM_VERSION GDCM_LIBRARIES) +@@ -273,4 +273,4 @@ if(WITH_IMGCODEC_PFM) + set(HAVE_IMGCODEC_PFM ON) + elseif(DEFINED WITH_IMGCODEC_PFM) + set(HAVE_IMGCODEC_PFM OFF) +-endif() +\ No newline at end of file ++endif() +diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake +index a658bf6..5c9411a 100644 +--- a/cmake/OpenCVFindLibsPerf.cmake ++++ b/cmake/OpenCVFindLibsPerf.cmake +@@ -41,14 +41,9 @@ endif(WITH_CUDA) + + # --- Eigen --- + if(WITH_EIGEN AND NOT HAVE_EIGEN) +- find_package(Eigen3 QUIET) ++ find_package(Eigen3 REQUIRED) + + if(Eigen3_FOUND) +- if(TARGET Eigen3::Eigen) +- # Use Eigen3 imported target if possible +- list(APPEND OPENCV_LINKER_LIBS Eigen3::Eigen) +- set(HAVE_EIGEN 1) +- else() + if(DEFINED EIGEN3_INCLUDE_DIRS) + set(EIGEN_INCLUDE_PATH ${EIGEN3_INCLUDE_DIRS}) + set(HAVE_EIGEN 1) +@@ -56,7 +51,6 @@ if(WITH_EIGEN AND NOT HAVE_EIGEN) + set(EIGEN_INCLUDE_PATH ${EIGEN3_INCLUDE_DIR}) + set(HAVE_EIGEN 1) + endif() +- endif() + if(HAVE_EIGEN) + if(DEFINED EIGEN3_WORLD_VERSION) # CMake module + set(EIGEN_WORLD_VERSION ${EIGEN3_WORLD_VERSION}) +@@ -67,6 +61,7 @@ if(WITH_EIGEN AND NOT HAVE_EIGEN) + set(EIGEN_MAJOR_VERSION ${EIGEN3_VERSION_MINOR}) + set(EIGEN_MINOR_VERSION ${EIGEN3_VERSION_PATCH}) + endif() ++ ocv_include_directories(${EIGEN_INCLUDE_PATH}) + endif() + endif() + diff --git a/ports/opencv4/0009-fix-uwp.patch b/ports/opencv4/0009-fix-uwp.patch new file mode 100644 index 000000000..5c54256a5 --- /dev/null +++ b/ports/opencv4/0009-fix-uwp.patch @@ -0,0 +1,57 @@ +diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake +index 799592b..3f44173 100644 +--- a/cmake/OpenCVModule.cmake ++++ b/cmake/OpenCVModule.cmake +@@ -852,7 +852,7 @@ macro(ocv_create_module) + set(the_module_target ${the_module}) + endif() + +- if(WINRT) ++ if(WINRT AND BUILD_TESTS) + # removing APPCONTAINER from modules to run from console + # in case of usual starting of WinRT test apps output is missing + # so starting of console version w/o APPCONTAINER is required to get test results +@@ -1175,7 +1175,7 @@ function(ocv_add_perf_tests) + set_target_properties(${the_target} PROPERTIES FOLDER "tests performance") + endif() + +- if(WINRT) ++ if(WINRT AND BUILD_TESTS) + # removing APPCONTAINER from tests to run from console + # look for detailed description inside of ocv_create_module macro above + add_custom_command(TARGET "opencv_perf_${name}" +diff --git a/modules/core/src/utils/datafile.cpp b/modules/core/src/utils/datafile.cpp +index aafbfdf..10543ae 100644 +--- a/modules/core/src/utils/datafile.cpp ++++ b/modules/core/src/utils/datafile.cpp +@@ -108,7 +108,7 @@ static cv::String getModuleLocation(const void* addr) + CV_UNUSED(addr); + #ifdef _WIN32 + HMODULE m = 0; +-#if _WIN32_WINNT >= 0x0501 ++#if _WIN32_WINNT >= 0x0501 && (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) + ::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + reinterpret_cast<LPCTSTR>(addr), + &m); +@@ -155,7 +155,7 @@ bool getBinLocation(std::wstring& dst) + { + void* addr = (void*)getModuleLocation; // using code address, doesn't work with static linkage! + HMODULE m = 0; +-#if _WIN32_WINNT >= 0x0501 ++#if _WIN32_WINNT >= 0x0501 && (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) + ::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + reinterpret_cast<LPCTSTR>(addr), + &m); +diff --git a/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp b/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp +index 236e227..eccf97e 100644 +--- a/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp ++++ b/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp +@@ -94,7 +94,7 @@ Media::CaptureFrameGrabber::~CaptureFrameGrabber() + + void Media::CaptureFrameGrabber::ShowCameraSettings() + { +-#if WINAPI_FAMILY!=WINAPI_FAMILY_PHONE_APP ++#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY != WINAPI_FAMILY_PC_APP) + if (_state == State::Started) + { + CameraOptionsUI::Show(_capture.Get()); diff --git a/ports/opencv4/CONTROL b/ports/opencv4/CONTROL new file mode 100644 index 000000000..ca52577c7 --- /dev/null +++ b/ports/opencv4/CONTROL @@ -0,0 +1,96 @@ +Source: opencv4 +Version: 4.1.1-1 +Build-Depends: protobuf, zlib +Description: computer vision library +Default-Features: dnn, jpeg, opengl, png, tiff, webp + +Feature: nonfree +Description: opencv nonfree module + +Feature: ade +Build-Depends: ade +Description: graph api + +Feature: contrib +Build-Depends: hdf5 (!uwp) +Description: opencv_contrib module + +Feature: cuda +Build-Depends: opencv4[contrib], cuda +Description: CUDA support for opencv + +Feature: dnn +Description: Enable dnn module + +Feature: eigen +Build-Depends: eigen3 +Description: Eigen support for opencv + +Feature: ffmpeg +Build-Depends: ffmpeg +Description: ffmpeg support for opencv + +Feature: gdcm +Build-Depends: gdcm +Description: GDCM support for opencv + +Feature: ipp +Description: Enable Intel Integrated Performance Primitives + +Feature: jasper +Build-Depends: jasper +Description: JPEG 2000 support for opencv + +Feature: jpeg +Build-Depends: libjpeg-turbo +Description: JPEG support for opencv + +Feature: openexr +Build-Depends: openexr +Description: OpenEXR support for opencv + +Feature: opengl +Build-Depends: opengl +Description: opengl support for opencv + +Feature: openmp +Description: Enable openmp support for opencv + +Feature: ovis +Build-Depends: opencv4[contrib], ogre +Description: opencv_ovis module + +Feature: png +Build-Depends: libpng +Description: PNG support for opencv + +Feature: qt +Build-Depends: qt5 +Description: Qt GUI support for opencv + +Feature: sfm +Build-Depends: opencv4[contrib], eigen3, glog, gflags, ceres +Description: opencv_sfm module + +Feature: tbb +Build-Depends: tbb +Description: Enable Intel Threading Building Blocks + +Feature: tiff +Build-Depends: tiff +Description: TIFF support for opencv + +Feature: vtk +Build-Depends: vtk +Description: vtk support for opencv + +Feature: webp +Build-Depends: libwebp +Description: WebP support for opencv + +Feature: halide +Build-Depends: halide, opencv4[dnn] +Description: Halide support for opencv + +Feature: world +Description: Compile to a single package support for opencv diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake new file mode 100644 index 000000000..efafab614 --- /dev/null +++ b/ports/opencv4/portfile.cmake @@ -0,0 +1,379 @@ +if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv3") + message(FATAL_ERROR "OpenCV 3 is installed, please uninstall and try again:\n vcpkg remove opencv3") +endif() + +include(vcpkg_common_functions) + +set(OPENCV_VERSION "4.1.1") + +if(VCPKG_TARGET_IS_LINUX) + message("OpenCV currently requires the following library from the system package manager:\n libgtk3\n\nThis can be installed on Ubuntu systems via apt-get install libgtk-3-dev") +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO opencv/opencv + REF ${OPENCV_VERSION} + SHA512 80fa48d992ca06a2a4ab6740df6d8c21f4926165486b393969da2c5bbe2f3a0b799fb76dee5e3654e90c743e49bbd2b5b02ad59a4766896bbf4cd5b4e3251e0f + HEAD_REF master + PATCHES + 0001-disable-downloading.patch + 0002-install-options.patch + 0003-force-package-requirements.patch + 0009-fix-uwp.patch +) + +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) + +set(ADE_DIR ${CURRENT_INSTALLED_DIR}/share/ade CACHE PATH "Path to existing ADE CMake Config file") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + "ade" WITH_ADE + "contrib" WITH_CONTRIB + "cuda" WITH_CUDA + "cuda" WITH_CUBLAS + "dnn" BUILD_opencv_dnn + "eigen" WITH_EIGEN + "ffmpeg" WITH_FFMPEG + "gdcm" WITH_GDCM + "halide" WITH_HALIDE + "jasper" WITH_JASPER + "jpeg" WITH_JPEG + "nonfree" OPENCV_ENABLE_NONFREE + "openexr" WITH_OPENEXR + "opengl" WITH_OPENGL + "openmp" WITH_OPENMP + "png" WITH_PNG + "qt" WITH_QT + "sfm" BUILD_opencv_sfm + "tiff" WITH_TIFF + "webp" WITH_WEBP + "world" BUILD_opencv_world +) + +# Cannot use vcpkg_check_features() for "ipp", "ovis", "tbb", and "vtk". +# As the respective value of their variables can be unset conditionally. +set(WITH_IPP OFF) +if("ipp" IN_LIST FEATURES) + set(WITH_IPP ON) +endif() + +set(BUILD_opencv_ovis OFF) +if("ovis" IN_LIST FEATURES) + set(BUILD_opencv_ovis ON) +endif() + +set(WITH_TBB OFF) +if("tbb" IN_LIST FEATURES) + set(WITH_TBB ON) +endif() + +set(WITH_VTK OFF) +if("vtk" IN_LIST FEATURES) + set(WITH_VTK ON) +endif() + +if("cuda" IN_LIST FEATURES) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://github.com/NVIDIA/NVIDIAOpticalFlowSDK/archive/79c6cee80a2df9a196f20afd6b598a9810964c32.zip" + FILENAME "opencv-cache/nvidia_optical_flow/ca5acedee6cb45d0ec610a6732de5c15-79c6cee80a2df9a196f20afd6b598a9810964c32.zip" + SHA512 d80cdedec588dafaad4ebb8615349f842ecdc64d3ca9480fee7086d606e6f2362606a9a2ce273c5cf507be2840ec24bbcbe32c2962672c3bcfb72d31428ef73d + ) +endif() + +# Build image quality module when building with 'contrib' feature and not UWP. +set(BUILD_opencv_quality OFF) +if("contrib" IN_LIST FEATURES) + if (VCPKG_TARGET_IS_UWP) + set(BUILD_opencv_quality OFF) + message(WARNING "The image quality module (quality) does not build for UWP, the module has been disabled.") + # The hdf module is silently disabled by OpenCVs buildsystem if HDF5 is not detected. + message(WARNING "The hierarchical data format module (hdf) depends on HDF5 which doesn't support UWP, the module has been disabled.") + else() + set(BUILD_opencv_quality CMAKE_DEPENDS_IN_PROJECT_ONLY) + endif() + + vcpkg_from_github( + OUT_SOURCE_PATH CONTRIB_SOURCE_PATH + REPO opencv/opencv_contrib + REF ${OPENCV_VERSION} + SHA512 8af13f0a5f350360316662c1ce5e58c21d906a58591acfbd575a8dacde19b6f3bbd694c3c199feb35c33549cf8c37e3fb4c494b586a00ad29fe3b4aeeb2d22ab + HEAD_REF master + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i" + FILENAME "opencv-cache/xfeatures2d/boostdesc/0ea90e7a8f3f7876d450e4149c97c74f-boostdesc_bgm.i" + SHA512 5c8702a60314fac4ebb6dafb62a603948ec034058d1a582fcb89a063b51511802c02e192eadfc0b233b1f711f4c74cabab6d9ebe8a50c3554ea0ccdbef87dc5c + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_bi.i" + FILENAME "opencv-cache/xfeatures2d/boostdesc/232c966b13651bd0e46a1497b0852191-boostdesc_bgm_bi.i" + SHA512 b28ba2b615e0755ff0f6733b567682800fb9e7d522250aa498075cc1b8927f4177cacdcb0cfdf712539a29c4773232dc714931b6d292292b091b5cf170b203a6 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_hd.i" + FILENAME "opencv-cache/xfeatures2d/boostdesc/324426a24fa56ad9c5b8e3e0b3e5303e-boostdesc_bgm_hd.i" + SHA512 c214045c3730a1d9dfc594f70895edf82d2fd3058a3928908627014371e02460d052cbaedf41bb96cf76460c0a8b4b01b7b0ac7d269ec5d3f17f2a46c9f0091b + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_064.i" + FILENAME "opencv-cache/xfeatures2d/boostdesc/202e1b3e9fec871b04da31f7f016679f-boostdesc_binboost_064.i" + SHA512 f32240a7b975233d2bbad02fdb74c6e29ed71ed6f0c08172ca33eb1e69a7a7f6d6964adf41422213a0452121a9c4bb2effe3d7b9d6743c9bf58d4bc8c9b1db36 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_128.i" + FILENAME "opencv-cache/xfeatures2d/boostdesc/98ea99d399965c03d555cef3ea502a0b-boostdesc_binboost_128.i" + SHA512 f58e2bebfaa690d324691a6c2067d9a1e5267037ea0f2b397966289253b9efd27d8238aff6206e95262086e1fcddf01ae1a1c49f066a8bbac3aa7908214b9a8f + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_256.i" + FILENAME "opencv-cache/xfeatures2d/boostdesc/e6dcfa9f647779eb1ce446a8d759b6ea-boostdesc_binboost_256.i" + SHA512 351ee07b9714a379c311f293d96e99f001c894393c911a421b4c536345d43c02ba2d867e9f657eac104841563045ab8c8edab878e5ffeb1e1a7494375ef58987 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_lbgm.i" + FILENAME "opencv-cache/xfeatures2d/boostdesc/0ae0675534aa318d9668f2a179c2a052-boostdesc_lbgm.i" + SHA512 7fa12e2207ff154acf2433bbb4f3f47aa71d1fa8789493b688d635d20586b7ead30ee8dcd3b3753992ebbe98062cbde44d02683db1c563d52e35aefd7912a4f2 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_48.i" + FILENAME "opencv-cache/xfeatures2d/vgg/e8d0dcd54d1bcfdc29203d011a797179-vgg_generated_48.i" + SHA512 2403e9119738261a05a3116ca7e5c9e11da452c422f8670cd96ad2cb5bf970f76172e23b9913a3172adf06f2b31bee956f605b66dbccf3d706c4334aff713774 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_64.i" + FILENAME "opencv-cache/xfeatures2d/vgg/7126a5d9a8884ebca5aea5d63d677225-vgg_generated_64.i" + SHA512 2c954223677905f489b01988389ac80a8caa33bdb57adb3cb9409075012b5e2f472f14966d8be75d75c90c9330f66d59c69539dc6b5a5e265a4d98ff5041f0ea + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_80.i" + FILENAME "opencv-cache/xfeatures2d/vgg/7cd47228edec52b6d82f46511af325c5-vgg_generated_80.i" + SHA512 9931ad1d1bd6d11951ca5357ab0a524f6ff9b33f936ceeafebc0dafb379ec7e2105e467443e9f424f60a0f2f445bdff821ed9e42330abed883227183ebad4a9e + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_120.i" + FILENAME "opencv-cache/xfeatures2d/vgg/151805e03568c9f490a5e3a872777b75-vgg_generated_120.i" + SHA512 ad7c1d2b159ab5790c898815663bb90549f1cf7ade3c82d939d381608b26d26c5b2af01eb1ba21f4d114ced74586ab3fc83f14e2d8cfe4e6faac538aa0e7e255 + ) + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat" + FILENAME "opencv-cache/data/7505c44ca4eb54b4ab1e4777cb96ac05-face_landmark_model.dat" + SHA512 c16e60a6c4bb4de3ab39b876ae3c3f320ea56f69c93e9303bd2dff8760841dcd71be4161fff8bc71e8fe4fe8747fa8465d49d6bd8f5ebcdaea161f4bc2da7c93 + ) + set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") +endif() + +if("dnn" IN_LIST FEATURES) + vcpkg_download_distfile(TINYDNN_ARCHIVE + URLS "https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz" + FILENAME "opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz" + SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b + ) +endif() + +if(WITH_IPP) + if(VCPKG_TARGET_IS_OSX) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_mac_intel64_general_20180723.tgz" + FILENAME "opencv-cache/ippicv/fe6b2bb75ae0e3f19ad3ae1a31dfa4a2-ippicv_2019_mac_intel64_general_20180723.tgz" + SHA512 266fe3fecf8e95e1f51c09b65330a577743ef72b423b935d4d1fe8d87f1b4f258c282fe6a18fc805d489592f137ebed37c9f1d1b34026590d9f1ba107015132e + ) + else() + message(WARNING "This target architecture is not supported IPPICV") + set(WITH_IPP OFF) + endif() + elseif(VCPKG_TARGET_IS_LINUX) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_lnx_intel64_general_20180723.tgz" + FILENAME "opencv-cache/ippicv/c0bd78adb4156bbf552c1dfe90599607-ippicv_2019_lnx_intel64_general_20180723.tgz" + SHA512 e4ec6b3b9fc03d7b3ae777c2a26f57913e83329fd2f7be26c259b07477ca2a641050b86979e0c96e25aa4c1f9f251b28727690358a77418e76dd910d0f4845c9 + ) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_lnx_ia32_general_20180723.tgz" + FILENAME "opencv-cache/ippicv/4f38432c30bfd6423164b7a24bbc98a0-ippicv_2019_lnx_ia32_general_20180723.tgz" + SHA512 d96d3989928ff11a18e631bf5ecfdedf88fd350162a23fa2c8f7dbc3bf878bf442aff7fb2a07dc56671d7268cc20682055891be75b9834e9694d20173e92b6a3 + ) + else() + message(WARNING "This target architecture is not supported IPPICV") + set(WITH_IPP OFF) + endif() + elseif(VCPKG_TARGET_IS_WINDOWS) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_win_intel64_20180723_general.zip" + FILENAME "opencv-cache/ippicv/1d222685246896fe089f88b8858e4b2f-ippicv_2019_win_intel64_20180723_general.zip" + SHA512 b6c4f2696e2004b8f5471efd9bdc6c684b77830e0533d8880310c0b665b450d6f78e10744c937f5592ab900e187c475e46cb49e98701bb4bcbbc7da77723011d + ) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_win_ia32_20180723_general.zip" + FILENAME "opencv-cache/ippicv/0157251a2eb9cd63a3ebc7eed0f3e59e-ippicv_2019_win_ia32_20180723_general.zip" + SHA512 c33fd4019c71b064b153e1b25e0307f9c7ada693af8ec910410edeab471c6f14df9b11bf9f5302ceb0fcd4282f5c0b6c92fb5df0e83eb50ed630c45820d1e184 + ) + else() + message(WARNING "This target architecture is not supported IPPICV") + set(WITH_IPP OFF) + endif() + else() + message(WARNING "This target architecture is not supported IPPICV") + set(WITH_IPP OFF) + endif() +endif() + +set(WITH_MSMF ON) +if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) + set(WITH_MSMF OFF) +endif() + +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + if (WITH_TBB) + message(WARNING "TBB is currently unsupported in this build configuration, turning it off") + set(WITH_TBB OFF) + endif() + + if (WITH_VTK) + message(WARNING "VTK is currently unsupported in this build configuration, turning it off") + set(WITH_VTK OFF) + endif() + + if (VCPKG_TARGET_IS_WINDOWS AND BUILD_opencv_ovis) + message(WARNING "OVIS is currently unsupported in this build configuration, turning it off") + set(BUILD_opencv_ovis OFF) + endif() +endif() + +vcpkg_configure_cmake( + PREFER_NINJA + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + ###### ocv_options + -DOpenCV_INSTALL_BINARIES_PREFIX= + -DOPENCV_LIB_INSTALL_PATH=lib + -DOPENCV_3P_LIB_INSTALL_PATH=lib + -DOPENCV_CONFIG_INSTALL_PATH=share/opencv + -DOPENCV_FFMPEG_USE_FIND_PACKAGE=FFMPEG + -DCMAKE_DEBUG_POSTFIX=d + ###### Ungrouped Entries + -DBUILD_opencv_java=OFF + -Dade_DIR=${ADE_DIR} + ###### Disable build 3rd party libs + -DBUILD_JASPER=OFF + -DBUILD_JPEG=OFF + -DBUILD_OPENEXR=OFF + -DBUILD_PNG=OFF + -DBUILD_TIFF=OFF + -DBUILD_WEBP=OFF + -DBUILD_ZLIB=OFF + -DBUILD_TBB=OFF + -DBUILD_IPP_IW=OFF + -DBUILD_ITT=OFF + ###### Disable build 3rd party components + -DBUILD_PROTOBUF=OFF + ###### OpenCV Build components + -DBUILD_opencv_apps=OFF + -DBUILD_opencv_js=OFF + -DBUILD_ANDROID_PROJECT=OFF + -DBUILD_ANDROID_EXAMPLES=OFF + -DBUILD_DOCS=OFF + -DBUILD_EXAMPLES=OFF + -DBUILD_PACKAGE=OFF + -DBUILD_PERF_TESTS=OFF + -DBUILD_TESTS=OFF + -DBUILD_WITH_DEBUG_INFO=ON + -DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT} + -DBUILD_JAVA=OFF + -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR} + ###### PROTOBUF + -DPROTOBUF_UPDATE_FILES=ON + -DUPDATE_PROTO_FILES=ON + ###### PYLINT/FLAKE8 + -DENABLE_PYLINT=OFF + -DENABLE_FLAKE8=OFF + # CMAKE + -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON + -DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON + -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON + # ENABLE + -DENABLE_CXX11=ON + ###### OPENCV vars + "-DOPENCV_DOWNLOAD_PATH=${DOWNLOADS}/opencv-cache" + ${BUILD_WITH_CONTRIB_FLAG} + -DOPENCV_OTHER_INSTALL_PATH=share/opencv + ###### customized properties + ## Options from vcpkg_check_features() + ${FEATURE_OPTIONS} + -DWITH_IPP=${WITH_IPP} + -DWITH_MSMF=${WITH_MSMF} + -DWITH_PROTOBUF=ON + -DWITH_TBB=${WITH_TBB} + -DWITH_VTK=${WITH_VTK} + ###### WITH PROPERTIES explicitly disabled, they have problems with libraries if already installed by user and that are "involuntarily" found during install + -DWITH_LAPACK=OFF + ###### BUILD_options (mainly modules which require additional libraries) + -DBUILD_opencv_ovis=${BUILD_opencv_ovis} + ###### The following modules are disabled for UWP + -DBUILD_opencv_quality=${BUILD_opencv_quality} +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH "share/opencv" TARGET_PATH "share/opencv") +vcpkg_copy_pdbs() + +# OpenCV does not list TIFF as a dependency. +# We explicitly add it to the module file, +# in order to fix unresolved symbols linking problems +# for downstream projects using OpenCV as static library +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES) + string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" + "set(CMAKE_IMPORT_FILE_VERSION 1) +find_package(TIFF REQUIRED) +find_package(Protobuf REQUIRED) +if(Protobuf_FOUND) + if(TARGET protobuf::libprotobuf) + add_library(libprotobuf INTERFACE IMPORTED) + set_target_properties(libprotobuf PROPERTIES + INTERFACE_LINK_LIBRARIES protobuf::libprotobuf + ) + else() + add_library(libprotobuf UNKNOWN IMPORTED) + set_target_properties(libprotobuf PROPERTIES + IMPORTED_LOCATION \"${Protobuf_LIBRARY}\" + INTERFACE_INCLUDE_DIRECTORIES \"${Protobuf_INCLUDE_DIR}\" + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES \"${Protobuf_INCLUDE_DIR}\" + ) + endif() +endif() +find_package(HDF5 QUIET) +find_package(Freetype QUIET) +find_package(Ogre QUIET) +find_package(gflags QUIET) +find_package(Ceres QUIET) +find_package(ade QUIET) +find_package(VTK QUIET) +find_package(OpenMP QUIET) +find_package(GDCM QUIET)" OPENCV_MODULES "${OPENCV_MODULES}") + + if("openmp" IN_LIST FEATURES) + string(REPLACE "set_target_properties(opencv_core PROPERTIES + INTERFACE_LINK_LIBRARIES \"" + "set_target_properties(opencv_core PROPERTIES + INTERFACE_LINK_LIBRARIES \"\$<LINK_ONLY:OpenMP::OpenMP_CXX>;" OPENCV_MODULES "${OPENCV_MODULES}") + endif() + + file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}") + + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE ${CURRENT_PACKAGES_DIR}/setup_vars_opencv4.cmd) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/setup_vars_opencv4.cmd) +file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE) + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv4 RENAME copyright) diff --git a/ports/openimageio/CONTROL b/ports/openimageio/CONTROL index ceb4b9408..94ae8654e 100644 --- a/ports/openimageio/CONTROL +++ b/ports/openimageio/CONTROL @@ -1,5 +1,5 @@ Source: openimageio -Version: 2.0.8 +Version: 2019-08-08-1 Homepage: https://github.com/OpenImageIO/oiio Description: A library for reading and writing images, and a bunch of related classes, utilities, and application Build-Depends: libjpeg-turbo, tiff, libpng, openexr, boost-thread, boost-smart-ptr, boost-foreach, boost-regex, boost-type-traits, boost-static-assert, boost-unordered, boost-config, boost-algorithm, boost-filesystem, boost-system, boost-thread, boost-asio, boost-random, robin-map, boost-stacktrace diff --git a/ports/openimageio/portfile.cmake b/ports/openimageio/portfile.cmake index e40441e4c..7284d58b8 100644 --- a/ports/openimageio/portfile.cmake +++ b/ports/openimageio/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO OpenImageIO/oiio - REF Release-2.0.8 - SHA512 412d240916780b784b89d9eeb36b5b9451e8448100fce494c0d95f0b274506d2946cae0eb929dbe8118b8b04a8bd2a926270a971aad7d0542abcff5f35404953 + REF ad1ab61a56c63d770e4beb335efe8b1f1a9e36cd + SHA512 48ee7862583e7adb86b56b20634c34aebf83ef0a3a14ad96182494ce6a84cb027334840a6c4c335e9342110c3a36532e3eeae22a3ed7363cd91b27cb7ca58154 HEAD_REF master PATCHES fix_libraw.patch @@ -71,6 +71,9 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/doc) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(COPY ${SOURCE_PATH}/src/cmake/modules/FindOpenImageIO.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) + # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/openimageio) file(RENAME ${CURRENT_PACKAGES_DIR}/share/openimageio/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/openimageio/copyright) diff --git a/ports/openimageio/remove_wrong_dependency.patch b/ports/openimageio/remove_wrong_dependency.patch index 307ef1dec..5338c6563 100644 --- a/ports/openimageio/remove_wrong_dependency.patch +++ b/ports/openimageio/remove_wrong_dependency.patch @@ -1,15 +1,15 @@ -diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt -index 61ed97b..4435426 100644 ---- a/src/libOpenImageIO/CMakeLists.txt -+++ b/src/libOpenImageIO/CMakeLists.txt -@@ -164,10 +164,6 @@ if (WIN32) - target_link_libraries (OpenImageIO psapi.lib) - endif () - --if (VISIBILITY_MAP_FILE) -- add_dependencies (OpenImageIO "${VISIBILITY_MAP_FILE}") --endif () -- - if (USE_EXTERNAL_PUGIXML) - target_link_libraries (OpenImageIO ${PUGIXML_LIBRARIES}) - endif () +diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt
+index 5449675..cdd5235 100644
+--- a/src/libOpenImageIO/CMakeLists.txt
++++ b/src/libOpenImageIO/CMakeLists.txt
+@@ -171,10 +171,6 @@ elseif(MINGW)
+ target_link_libraries (OpenImageIO psapi ws2_32)
+ endif ()
+
+-if (VISIBILITY_MAP_FILE)
+- add_dependencies (OpenImageIO "${VISIBILITY_MAP_FILE}")
+-endif ()
+-
+ if (USE_EXTERNAL_PUGIXML)
+ target_link_libraries (OpenImageIO ${PUGIXML_LIBRARIES})
+ endif ()
diff --git a/ports/openimageio/vcpkg-cmake-wrapper.cmake b/ports/openimageio/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..82dc991f0 --- /dev/null +++ b/ports/openimageio/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,8 @@ +set(OPENIMAGEIO_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +if(NOT OPENIMAGEIO_LIBRARIES) + _find_package(${ARGS}) +endif() + +set(CMAKE_MODULE_PATH ${OPENIMAGEIO_PREV_MODULE_PATH}) diff --git a/ports/openmpi/CONTROL b/ports/openmpi/CONTROL new file mode 100644 index 000000000..6ea5a17c1 --- /dev/null +++ b/ports/openmpi/CONTROL @@ -0,0 +1,4 @@ +Source: openmpi +Version: 4.0.1 +Homepage: https://www.open-mpi.org/ +Description: The Open MPI Project is an open source Message Passing Interface implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers. diff --git a/ports/openmpi/portfile.cmake b/ports/openmpi/portfile.cmake new file mode 100644 index 000000000..9f69f9f9b --- /dev/null +++ b/ports/openmpi/portfile.cmake @@ -0,0 +1,100 @@ +include(vcpkg_common_functions) + +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME) + message(FATAL_ERROR "This port is only for openmpi on Unix-like systems") +endif() + +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + +set(OpenMPI_FULL_VERSION "4.0.1") +set(OpenMPI_SHORT_VERSION "4.0") + +vcpkg_download_distfile(ARCHIVE + URLS "https://download.open-mpi.org/release/open-mpi/v${OpenMPI_SHORT_VERSION}/openmpi-${OpenMPI_FULL_VERSION}.tar.gz" + FILENAME "openmpi-${OpenMPI_FULL_VERSION}.tar.gz" + SHA512 760716974cb6b25ad820184622e1ee7926bc6fda87db6b574f76792bc1ca99522e52195866c14b7cb2df5a4981efdaf9f71d2c5533cc0e8e45c2c4b3b74cbacc +) + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + list(APPEND BUILD_TYPES "release") +endif() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + list(APPEND BUILD_TYPES "debug") +endif() + +set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/openmpi-${OpenMPI_FULL_VERSION}) +set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/openmpi-${OpenMPI_FULL_VERSION}) +set(OUT_PATH_DEBUG ${SOURCE_PATH_RELEASE}/../../make-build-${TARGET_TRIPLET}-debug) +set(OUT_PATH_RELEASE ${SOURCE_PATH_RELEASE}/../../make-build-${TARGET_TRIPLET}-release) +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/) +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/) +file(MAKE_DIRECTORY ${OUT_PATH_DEBUG}) +file(MAKE_DIRECTORY ${OUT_PATH_RELEASE}) + +foreach(BUILD_TYPE IN LISTS BUILD_TYPES) + vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}) + #vcpkg_apply_patches(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/openmpi-${OpenMPI_FULL_VERSION} PATCHES patch.file) +endforeach() + +vcpkg_find_acquire_program(PERL) +get_filename_component(PERL_PATH ${PERL} DIRECTORY) +vcpkg_add_to_path(${PERL_PATH}) + +set(BASH bash) + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc -c "${SOURCE_PATH_DEBUG}/configure --prefix=${OUT_PATH_DEBUG} --enable-debug" + WORKING_DIRECTORY "${SOURCE_PATH_DEBUG}" + LOGNAME "config-${TARGET_TRIPLET}-dbg" + ) + message(STATUS "Building ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc -c "make -j ${VCPKG_CONCURRENCY}" + NO_PARALLEL_COMMAND ${BASH} --noprofile --norc -c "make" + WORKING_DIRECTORY "${SOURCE_PATH_DEBUG}" + LOGNAME "make-build-${TARGET_TRIPLET}-dbg" + ) + message(STATUS "Installing ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc -c "make install" + WORKING_DIRECTORY "${SOURCE_PATH_DEBUG}" + LOGNAME "make-install-${TARGET_TRIPLET}-dbg" + ) + file(COPY ${OUT_PATH_DEBUG}/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug) + message(STATUS "Installing ${TARGET_TRIPLET}-dbg done") +endif() + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + message(STATUS "Configuring ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc -c "${SOURCE_PATH_RELEASE}/configure --prefix=${OUT_PATH_RELEASE}" + WORKING_DIRECTORY "${SOURCE_PATH_RELEASE}" + LOGNAME "config-${TARGET_TRIPLET}-rel" + ) + message(STATUS "Building ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc -c "make -j ${VCPKG_CONCURRENCY}" + NO_PARALLEL_COMMAND ${BASH} --noprofile --norc -c "make" + WORKING_DIRECTORY "${SOURCE_PATH_RELEASE}" + LOGNAME "make-build-${TARGET_TRIPLET}-rel" + ) + message(STATUS "Installing ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc -c "make install" + WORKING_DIRECTORY "${SOURCE_PATH_RELEASE}" + LOGNAME "make-install-${TARGET_TRIPLET}-rel" + ) + file(COPY ${OUT_PATH_RELEASE}/lib DESTINATION ${CURRENT_PACKAGES_DIR}) + file(COPY ${OUT_PATH_RELEASE}/include DESTINATION ${CURRENT_PACKAGES_DIR}) + file(COPY ${OUT_PATH_RELEASE}/share DESTINATION ${CURRENT_PACKAGES_DIR}) + file(COPY ${OUT_PATH_RELEASE}/bin DESTINATION ${CURRENT_PACKAGES_DIR}) + message(STATUS "Installing ${TARGET_TRIPLET}-rel done") +endif() + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(INSTALL ${SOURCE_PATH_DEBUG}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openmpi RENAME copyright) +else() + file(INSTALL ${SOURCE_PATH_RELEASE}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openmpi RENAME copyright) +endif() diff --git a/ports/openxr-loader/0001-fix-embedded-python-path.patch b/ports/openxr-loader/0001-fix-embedded-python-path.patch deleted file mode 100644 index 3fe7e61e8..000000000 --- a/ports/openxr-loader/0001-fix-embedded-python-path.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/specification/scripts/genxr.py b/specification/scripts/genxr.py
-index 906c044..b0a414f 100755
---- a/specification/scripts/genxr.py
-+++ b/specification/scripts/genxr.py
-@@ -17,6 +17,12 @@
- import argparse
- import re
- import sys
-+import os
-+
-+base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
-+sys.path.append(os.path.join(base_dir, 'src', 'scripts'))
-+sys.path.append(os.path.join(base_dir, 'specification', 'scripts'))
-+
- import time
- import xml.etree.ElementTree as etree
-
-diff --git a/src/scripts/src_genxr.py b/src/scripts/src_genxr.py
-index 960b6cd..6f49296 100755
---- a/src/scripts/src_genxr.py
-+++ b/src/scripts/src_genxr.py
-@@ -14,7 +14,12 @@
- # See the License for the specific language governing permissions and
- # limitations under the License.
-
--import argparse, cProfile, pdb, string, sys, time
-+import argparse, cProfile, pdb, string, sys, time, os
-+
-+base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
-+sys.path.append(os.path.join(base_dir, 'src', 'scripts'))
-+sys.path.append(os.path.join(base_dir, 'specification', 'scripts'))
-+
- from reg import *
- from generator import write
- from cgenerator import CGeneratorOptions, COutputGenerator
diff --git a/ports/openxr-loader/0002-fix-linux-pkgconfig-dependency.patch b/ports/openxr-loader/0002-fix-linux-pkgconfig-dependency.patch deleted file mode 100644 index 3f9cbc328..000000000 --- a/ports/openxr-loader/0002-fix-linux-pkgconfig-dependency.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/src/cmake/presentation.cmake b/src/cmake/presentation.cmake -index 3970546..c2e7bc3 100644 ---- a/src/cmake/presentation.cmake -+++ b/src/cmake/presentation.cmake -@@ -12,21 +12,17 @@ endif() - - message(STATUS "Using presentation backend: ${PRESENTATION_BACKEND}") - --find_package(PkgConfig REQUIRED) - - if( PRESENTATION_BACKEND MATCHES "xlib" ) -- pkg_search_module(X11 REQUIRED x11) -- pkg_search_module(XXF86VM REQUIRED xxf86vm) -- pkg_search_module(XRANDR REQUIRED xrandr) -- - add_definitions( -DSUPPORT_X ) - add_definitions( -DOS_LINUX_XLIB ) - set( XLIB_LIBRARIES -- ${X11_LIBRARIES} -- ${XXF86VM_LIBRARIES} -- ${XRANDR_LIBRARIES} ) -+ X11 -+ Xxf86vm -+ Xrandr) - - elseif( PRESENTATION_BACKEND MATCHES "xcb" ) -+ find_package(PkgConfig REQUIRED) - # XCB + XCB GLX is limited to OpenGL 2.1 - # add_definitions( -DOS_LINUX_XCB ) - # XCB + Xlib GLX 1.3 -@@ -49,6 +45,7 @@ elseif( PRESENTATION_BACKEND MATCHES "xcb" ) - ${X11_LIBRARIES} ) - - elseif( PRESENTATION_BACKEND MATCHES "wayland" ) -+ find_package(PkgConfig REQUIRED) - pkg_search_module(WAYLAND_CLIENT REQUIRED wayland-client) - pkg_search_module(WAYLAND_EGL REQUIRED wayland-egl) - pkg_search_module(WAYLAND_SCANNER REQUIRED wayland-scanner) diff --git a/ports/openxr-loader/0003-windows-path-python-fix.patch b/ports/openxr-loader/0003-windows-path-python-fix.patch deleted file mode 100644 index a68f87722..000000000 --- a/ports/openxr-loader/0003-windows-path-python-fix.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/specification/scripts/generator.py b/specification/scripts/generator.py -index d6a1afe..5f9d0b6 100644 ---- a/specification/scripts/generator.py -+++ b/specification/scripts/generator.py -@@ -516,9 +516,10 @@ class OutputGenerator: - # Generator can be used without writing to a file. - if self.genOpts.filename is not None: - if sys.platform == 'win32': -- directory = Path(self.genOpts.directory) -+ directory = self.genOpts.directory - if not os.path.exists(directory): - os.makedirs(directory) -- self.outFile = io.open(directory / self.genOpts.filename, 'w', encoding='utf-8') -+ self.outFile = io.open(directory + '/' + self.genOpts.filename, 'w', encoding='utf-8') - else: - filename = self.genOpts.directory + '/' + self.genOpts.filename diff --git a/ports/openxr-loader/CONTROL b/ports/openxr-loader/CONTROL index 3c9379e9b..cff29cb1b 100644 --- a/ports/openxr-loader/CONTROL +++ b/ports/openxr-loader/CONTROL @@ -1,5 +1,5 @@ Source: openxr-loader -Version: 0.90.1 +Version: 1.0.0-2 Description: Khronos API for abstracting VR/MR/AR hardware Feature: vulkan diff --git a/ports/openxr-loader/portfile.cmake b/ports/openxr-loader/portfile.cmake index 8b2fb4671..efb57b0c3 100644 --- a/ports/openxr-loader/portfile.cmake +++ b/ports/openxr-loader/portfile.cmake @@ -12,16 +12,9 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO KhronosGroup/OpenXR-SDK - REF release-0.90.1 - SHA512 99b16b52511fef740fa7a1e234213310a4490b8d7baf4d1e003b93cf4f37b28abf526f6ed2d1e27e9ee2b4949b1957f15c20d4e0f8d30687806fe782780697af + REF release-1.0.0 + SHA512 423079b841a01f3b51283839c565cfa1b8ff38348c3f3d6f62e9120569d4ad540d8d6bfe8010e74d9bbb76aeaedcf273e5e3b1717bb0b424898793fb4712aa58 HEAD_REF master - PATCHES - # embedded python uses ignores PYTHONPATH - 0001-fix-embedded-python-path.patch - # Pkg-config is not available on the Vcpkg CI systems, don't depend on it for the xlib backend - 0002-fix-linux-pkgconfig-dependency.patch - # Python < 3.6 doesn't allow a WindowsPath object to act as a pathlike in os.path functions - 0003-windows-path-python-fix.patch ) # Weird behavior inside the OpenXR loader. On Windows they force shared libraries to use static crt, and @@ -44,6 +37,7 @@ vcpkg_configure_cmake( OPTIONS -DBUILD_API_LAYERS=OFF -DBUILD_TESTS=OFF + -DBUILD_CONFORMANCE_TESTS=OFF -DDYNAMIC_LOADER=${DYNAMIC_LOADER} -DPYTHON_EXECUTABLE=${PYTHON3} ) diff --git a/ports/osg-qt/OsgMacroUtils.patch b/ports/osg-qt/OsgMacroUtils.patch new file mode 100644 index 000000000..96f040cd3 --- /dev/null +++ b/ports/osg-qt/OsgMacroUtils.patch @@ -0,0 +1,11 @@ +--- a/CMakeModules/OsgMacroUtils.cmake ++++ b/CMakeModules/OsgMacroUtils.cmake +@@ -88,7 +88,7 @@ MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME) + ENDIF() + + LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES}) +- LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY) ++ #LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY) + IF(OPENSCENEGRAPH_SONAMES) + SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION}) + ENDIF(OPENSCENEGRAPH_SONAMES) diff --git a/ports/osg-qt/portfile.cmake b/ports/osg-qt/portfile.cmake index 1ab23e63f..f78dbf37f 100644 --- a/ports/osg-qt/portfile.cmake +++ b/ports/osg-qt/portfile.cmake @@ -6,6 +6,8 @@ vcpkg_from_github( REF Qt4 SHA512 426a4ba88f680978d24817248b99c68cafa4517144e6e3d2480612870c4a224bb955539cacb438274d4ee1c93c36d94f8437d142070b2ecde2b81517bf357e71
HEAD_REF master
+ PATCHES
+ OsgMacroUtils.patch
)
diff --git a/ports/osg/CONTROL b/ports/osg/CONTROL index 9b981af9d..f677e0284 100644 --- a/ports/osg/CONTROL +++ b/ports/osg/CONTROL @@ -1,8 +1,8 @@ Source: osg -Version: 3.6.3-1 +Version: 3.6.4 Homepage: https://github.com/openscenegraph/OpenSceneGraph Description: The OpenSceneGraph is an open source high performance 3D graphics toolkit. -Build-Depends: freetype, jasper, openexr, zlib, gdal, giflib, libjpeg-turbo, libpng, tiff +Build-Depends: freetype, jasper, openexr, zlib, gdal, giflib, libjpeg-turbo, libpng, tiff, fontconfig Feature: collada Description: Support for Collada (.dae) files diff --git a/ports/osg/collada.patch b/ports/osg/collada.patch index 9787b7f5c..80b260618 100644 --- a/ports/osg/collada.patch +++ b/ports/osg/collada.patch @@ -1,173 +1,126 @@ -diff --git a/CMakeModules/FindCOLLADA.cmake b/CMakeModules/FindCOLLADA.cmake
-index 8c9c2fc33..6a8ab04ca 100644
---- a/CMakeModules/FindCOLLADA.cmake
-+++ b/CMakeModules/FindCOLLADA.cmake
-@@ -25,11 +25,11 @@ ENDIF()
-
- IF(APPLE)
- SET(COLLADA_BUILDNAME "mac")
-- SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
-+ SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
- ELSEIF(MINGW)
- SET(COLLADA_BUILDNAME "mingw")
-- SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
--ELSEIF(MSVC_VERSION EQUAL 1900 OR MSVC_VERSION EQUAL 1910 )
-+ SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME})
-+ELSEIF(MSVC_VERSION GREATER_EQUAL 1900 )
- SET(COLLADA_BUILDNAME "vc14")
- SET(COLLADA_BOOST_BUILDNAME "vc140")
- ELSEIF(MSVC_VERSION EQUAL 1800)
-@@ -58,6 +58,7 @@ ENDIF()
-
-
- FIND_PATH(COLLADA_INCLUDE_DIR dae.h
-+ PATHS
- ${COLLADA_DOM_ROOT}/include
- $ENV{COLLADA_DIR}/include
- $ENV{COLLADA_DIR}
-@@ -65,27 +66,19 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
- /Library/Frameworks
- /opt/local/Library/Frameworks #macports
- /usr/local/include
-- /usr/local/include/colladadom
-- /usr/local/include/collada-dom
-- /usr/local/include/collada-dom2.5
-- /usr/local/include/collada-dom2.4
-- /usr/local/include/collada-dom2.2
-- /opt/local/include/collada-dom
-- /opt/local/include/collada-dom2.5
-- /opt/local/include/collada-dom2.4
-- /opt/local/include/collada-dom2.2
- /usr/include/
-- /usr/include/colladadom
-- /usr/include/collada-dom
-- /usr/include/collada-dom2.5
-- /usr/include/collada-dom2.4
-- /usr/include/collada-dom2.2
- /sw/include # Fink
- /opt/local/include # DarwinPorts
- /opt/csw/include # Blastwave
- /opt/include
- /usr/freeware/include
- ${ACTUAL_3DPARTY_DIR}/include
-+ PATH_SUFFIXES
-+ colladadom
-+ collada-dom
-+ collada-dom2.5
-+ collada-dom2.4
-+ collada-dom2.2
- )
-
- FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
-@@ -15,6 +15,8 @@
-
-
- # Check if COLLADA_DIR is set, otherwise use ACTUAL_3DPARTY_DIR:
-+include(SelectLibraryConfigurations)
-+
- SET( COLLADA_ENV_VAR_AVAILABLE $ENV{COLLADA_DIR} )
- IF ( COLLADA_ENV_VAR_AVAILABLE )
- SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
-@@ -192,31 +194,9 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
- ENDIF(WIN32)
- ENDIF(LIBXML2_FOUND)
-
-- FIND_PACKAGE(ZLIB)
-- IF (ZLIB_FOUND)
-- IF (ZLIB_LIBRARY_RELEASE)
-- SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY_RELEASE}" CACHE FILEPATH "" FORCE)
-- ELSE(ZLIB_LIBRARY_RELEASE)
-- SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
-- ENDIF(ZLIB_LIBRARY_RELEASE)
-- IF (ZLIB_LIBRARY_DEBUG)
-- SET(COLLADA_ZLIB_LIBRARY_DEBUG "${ZLIB_LIBRARY_DEBUG}" CACHE FILEPATH "" FORCE)
-- ELSE(ZLIB_LIBRARY_DEBUG)
-- SET(COLLADA_ZLIB_LIBRARY_DEBUG "${COLLADA_ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
-- ENDIF(ZLIB_LIBRARY_DEBUG)
-- ELSE(ZLIB_FOUND)
-- IF(WIN32)
-- FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
-- NAMES zlib
-- PATHS
-- ${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
-- ${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
-- ${ACTUAL_3DPARTY_DIR}/lib
-- )
-- ENDIF(WIN32)
-- ENDIF(ZLIB_FOUND)
-+ FIND_PACKAGE(ZLIB REQUIRED)
-
-- FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY
-+ FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY_RELEASE
- NAMES pcrecpp
- PATHS
- ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
-@@ -233,8 +213,9 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
- ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
- ${ACTUAL_3DPARTY_DIR}/lib
- )
-+ select_library_configurations(COLLADA_PCRECPP)
-
-- FIND_LIBRARY(COLLADA_PCRE_LIBRARY
-+ FIND_LIBRARY(COLLADA_PCRE_LIBRARY_RELEASE
- NAMES pcre
- PATHS
- ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
-@@ -251,8 +232,9 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
- ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
- ${ACTUAL_3DPARTY_DIR}/lib
- )
-+ select_library_configurations(COLLADA_PCRE)
-
-- FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY
-+ FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY_RELEASE
- NAMES minizip
- PATHS
- ${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
-@@ -267,8 +249,9 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
- ${COLLADA_DOM_ROOT}/external-libs/minizip/mac
- ${ACTUAL_3DPARTY_DIR}/lib
- )
--
-- FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
-+ select_library_configurations(COLLADA_MINIZIP)
-+
-+ FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_RELEASE
- NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_54 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_55 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_58 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_62 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_63
- PATHS
- ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
-@@ -283,8 +266,9 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
- ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
- ${ACTUAL_3DPARTY_DIR}/lib
- )
-+ select_library_configurations(COLLADA_BOOST_FILESYSTEM)
-
-- FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
-+ FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_RELEASE
- NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BOOST_BUILDNAME}-mt libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_54 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_55 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_58 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_62 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_63
- PATHS
- ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
-@@ -299,7 +283,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
- ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
- ${ACTUAL_3DPARTY_DIR}/lib
- )
--
-+ select_library_configurations(COLLADA_BOOST_SYSTEM_LIBRARY)
-
- SET(COLLADA_FOUND "NO")
- IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
-diff --git a/src/osgPlugins/dae/CMakeLists.txt b/src/osgPlugins/dae/CMakeLists.txt
-index af03fb866..7eadfc2f3 100644
---- a/src/osgPlugins/dae/CMakeLists.txt
-+++ b/src/osgPlugins/dae/CMakeLists.txt
-@@ -49,7 +49,9 @@ ELSE()
- ENDIF()
-
- ADD_DEFINITIONS(-DNO_BOOST)
--ADD_DEFINITIONS(-DCOLLADA_DOM_SUPPORT141)
-+ADD_DEFINITIONS(-DCOLLADA_DOM_USING_141
-+ -DCOLLADA_DOM_SUPPORT141
-+ -DCOLLADA_DOM_SUPPORT150)
-
- IF (COLLADA_DOM_2_4_OR_LATER)
- ADD_DEFINITIONS(-DCOLLADA_DOM_2_4_OR_LATER)
+diff --git a/CMakeModules/FindCOLLADA.cmake b/CMakeModules/FindCOLLADA.cmake +index 7c7d290..5b456d7 100644 +--- a/CMakeModules/FindCOLLADA.cmake ++++ b/CMakeModules/FindCOLLADA.cmake +@@ -29,10 +29,7 @@ IF(APPLE) + ELSEIF(MINGW) + SET(COLLADA_BUILDNAME "mingw") + SET(COLLADA_BOOST_BUILDNAME ${COLLADA_BUILDNAME}) +-ELSEIF((MSVC_VERSION GREATER 1910) OR (MSVC_VERSION EQUAL 1910)) +- SET(COLLADA_BUILDNAME "vc14") +- SET(COLLADA_BOOST_BUILDNAME "vc141") +-ELSEIF(MSVC_VERSION EQUAL 1900) ++ELSEIF(MSVC_VERSION GREATER_EQUAL 1900) + SET(COLLADA_BUILDNAME "vc14") + SET(COLLADA_BOOST_BUILDNAME "vc140") + ELSEIF(MSVC_VERSION EQUAL 1800) +@@ -61,6 +58,7 @@ ENDIF() + + + FIND_PATH(COLLADA_INCLUDE_DIR dae.h ++ PATHS + ${COLLADA_DOM_ROOT}/include + $ENV{COLLADA_DIR}/include + $ENV{COLLADA_DIR} +@@ -68,27 +66,19 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h + /Library/Frameworks + /opt/local/Library/Frameworks #macports + /usr/local/include +- /usr/local/include/colladadom +- /usr/local/include/collada-dom +- /usr/local/include/collada-dom2.5 +- /usr/local/include/collada-dom2.4 +- /usr/local/include/collada-dom2.2 +- /opt/local/include/collada-dom +- /opt/local/include/collada-dom2.5 +- /opt/local/include/collada-dom2.4 +- /opt/local/include/collada-dom2.2 + /usr/include/ +- /usr/include/colladadom +- /usr/include/collada-dom +- /usr/include/collada-dom2.5 +- /usr/include/collada-dom2.4 +- /usr/include/collada-dom2.2 + /sw/include # Fink + /opt/local/include # DarwinPorts + /opt/csw/include # Blastwave + /opt/include + /usr/freeware/include + ${ACTUAL_3DPARTY_DIR}/include ++ PATH_SUFFIXES ++ colladadom ++ collada-dom ++ collada-dom2.5 ++ collada-dom2.4 ++ collada-dom2.2 + ) + + FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY +@@ -116,7 +106,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY + ) + + FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG +- NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.5-dp-d collada-dom2.5-dp-${COLLADA_BOOST_BUILDNAME}-mt-d collada-dom2.4-dp-d collada-dom2.4-dp-${COLLADA_BOOST_BUILDNAME}-mt-d ++ NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.5-dp-d collada-dom2.5-dp-${COLLADA_BOOST_BUILDNAME}-mt-d collada-dom2.4-dp-d collada-dom2.4-dp-${COLLADA_BOOST_BUILDNAME}-mt-d collada-dom2.5-dp-${COLLADA_BOOST_BUILDNAME}-mt + PATHS + ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d + ${COLLADA_DOM_ROOT} +@@ -279,7 +269,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG + ) + + FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY +- NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_54 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_55 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_58 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_62 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_63 ++ NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_54 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_55 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_58 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_62 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-1_63 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt + PATHS + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw +@@ -287,7 +277,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG + ) + + FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG +- NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_54 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_55 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_58 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_62 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_63 ++ NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_54 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_55 libboost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_58 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_62 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_63 boost_filesystem-${COLLADA_BOOST_BUILDNAME}-mt-gd + PATHS + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw +@@ -295,7 +285,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG + ) + + FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY +- NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BOOST_BUILDNAME}-mt libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_54 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_55 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_58 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_62 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_63 ++ NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BOOST_BUILDNAME}-mt libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_54 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_55 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_58 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_62 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-1_63 boost_system-${COLLADA_BOOST_BUILDNAME}-mt + PATHS + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw +@@ -303,7 +293,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG + ) + + FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG +- NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_54 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_55 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_58 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_62 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_63 ++ NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_54 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_55 libboost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_58 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_62 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd-1_63 boost_system-${COLLADA_BOOST_BUILDNAME}-mt-gd + PATHS + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} + ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw +@@ -329,5 +319,3 @@ IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY) + + ENDIF() + ENDIF() +- +- + +diff --git a/src/osgPlugins/dae/CMakeLists.txt b/src/osgPlugins/dae/CMakeLists.txt +index af03fb866..7eadfc2f3 100644 +--- a/src/osgPlugins/dae/CMakeLists.txt ++++ b/src/osgPlugins/dae/CMakeLists.txt +@@ -49,7 +49,9 @@ ELSE() + ENDIF() + + ADD_DEFINITIONS(-DNO_BOOST) +-ADD_DEFINITIONS(-DCOLLADA_DOM_SUPPORT141) ++ADD_DEFINITIONS(-DCOLLADA_DOM_USING_141 ++ -DCOLLADA_DOM_SUPPORT141 ++ -DCOLLADA_DOM_SUPPORT150) + + IF (COLLADA_DOM_2_4_OR_LATER) + ADD_DEFINITIONS(-DCOLLADA_DOM_2_4_OR_LATER) + diff --git a/ports/osg/portfile.cmake b/ports/osg/portfile.cmake index cb759ca1a..8c6b5f299 100644 --- a/ports/osg/portfile.cmake +++ b/ports/osg/portfile.cmake @@ -5,8 +5,8 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO openscenegraph/OpenSceneGraph - REF OpenSceneGraph-3.6.3 - SHA512 5d66002cffa935ce670a119ffaebd8e4709acdf79ae2b34b37ad9df284ec8a1a74fee5a7a4109fbf3da6b8bd857960f2b7ae68c4c2e26036edbf484fccf08322 + REF OpenSceneGraph-3.6.4 + SHA512 7cb34fc279ba62a7d7177d3f065f845c28255688bd29026ffb305346e1bb2e515a22144df233e8a7246ed392044ee3e8b74e51bf655282d33ab27dcaf12f4b19 HEAD_REF master PATCHES collada.patch @@ -38,12 +38,12 @@ file(REMOVE_RECURSE ${OSG_TOOLS}) file(GLOB OSG_TOOLS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) file(REMOVE_RECURSE ${OSG_TOOLS_DBG}) -file(GLOB OSG_PLUGINS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-3.6.3/*.dll) -file(COPY ${OSG_PLUGINS_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/osg/osgPlugins-3.6.3) -file(GLOB OSG_PLUGINS_REL ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.3/*.dll) -file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-3.6.3) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-3.6.3/) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.3/) +file(GLOB OSG_PLUGINS_DBG ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-3.6.4/*.dll) +file(COPY ${OSG_PLUGINS_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/osg/osgPlugins-3.6.4) +file(GLOB OSG_PLUGINS_REL ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.4/*.dll) +file(COPY ${OSG_PLUGINS_REL} DESTINATION ${OSG_TOOL_PATH}/osgPlugins-3.6.4) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/osgPlugins-3.6.4/) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.4/) # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/osg) diff --git a/ports/osgearth/CONTROL b/ports/osgearth/CONTROL index c46d03451..d54992b82 100644 --- a/ports/osgearth/CONTROL +++ b/ports/osgearth/CONTROL @@ -1,4 +1,4 @@ Source: osgearth
-Version: 2.10.1 +Version: 2.10.2 Description: osgEarth - Dynamic map generation toolkit for OpenSceneGraph Copyright 2015 Pelican Mapping.
Build-Depends: osg
diff --git a/ports/osgearth/RocksDB.patch b/ports/osgearth/RocksDB.patch new file mode 100644 index 000000000..07fd7e603 --- /dev/null +++ b/ports/osgearth/RocksDB.patch @@ -0,0 +1,84 @@ +diff --git a/CMakeModules/FindRocksDB.cmake b/CMakeModules/FindRocksDB.cmake +index 109b383..8382ed9 100644 +--- a/CMakeModules/FindRocksDB.cmake ++++ b/CMakeModules/FindRocksDB.cmake +@@ -40,5 +40,49 @@ find_package_handle_standard_args(ROCKSDB + "Could NOT find ROCKSDB" + ) + ++if(ROCKSDB_FOUND) ++ FIND_PACKAGE(ZLIB REQUIRED) ++ ++ include(SelectLibraryConfigurations) ++ # Find Snappy library ++ find_library(SNAPPY_LIBRARY_DEBUG NAMES snappyd) ++ find_library(SNAPPY_LIBRARY_RELEASE NAMES snappy) ++ select_library_configurations(SNAPPY) ++ find_package_handle_standard_args(SNAPPY ++ FOUND_VAR ++ SNAPPY_FOUND ++ REQUIRED_VARS ++ SNAPPY_LIBRARY ++ FAIL_MESSAGE ++ "Could NOT find SNAPPY" ++ ) ++ ++ # Find LZ4 library ++ find_library(LZ4_LIBRARY_DEBUG NAMES lz4d) ++ find_library(LZ4_LIBRARY_RELEASE NAMES lz4) ++ select_library_configurations(LZ4) ++ find_package_handle_standard_args(LZ4 ++ FOUND_VAR ++ LZ4_FOUND ++ REQUIRED_VARS ++ LZ4_LIBRARY ++ FAIL_MESSAGE ++ "Could NOT find LZ4" ++ ) ++ ++ # Find ZSTD library ++ find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd) ++ find_library(ZSTD_LIBRARY_RELEASE NAMES zstd) ++ select_library_configurations(ZSTD) ++ find_package_handle_standard_args(ZSTD ++ FOUND_VAR ++ ZSTD_FOUND ++ REQUIRED_VARS ++ ZSTD_LIBRARY ++ FAIL_MESSAGE ++ "Could NOT find ZSTD_" ++ ) ++endif(ROCKSDB_FOUND) ++ + set(ROCKSDB_INCLUDE_DIRS ${ROCKSDB_INCLUDE_DIR} ) + set(ROCKSDB_LIBRARIES ${ROCKSDB_LIBRARY}) +- +- + +diff --git a/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt b/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt +index 68ad85d..86bb18a 100644 +--- a/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt ++++ b/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt +@@ -16,7 +16,19 @@ SET(TARGET_SRC + RocksDBCacheDriver.cpp + ) + +-SET(TARGET_LIBRARIES_VARS ROCKSDB_LIBRARY ZLIB_LIBRARY) ++if(SNAPPY_FOUND) ++ SET(ROCKSDB_DEPENDENT_LIBRARY ${ROCKSDB_DEPENDENT_LIBRARY} ${SNAPPY_LIBRARY}) ++endif(SNAPPY_FOUND) ++ ++if(LZ4_FOUND) ++ SET(ROCKSDB_DEPENDENT_LIBRARY ${ROCKSDB_DEPENDENT_LIBRARY} ${LZ4_LIBRARY}) ++endif(LZ4_FOUND) ++ ++if(ZSTD_FOUND) ++ SET(ROCKSDB_DEPENDENT_LIBRARY ${ROCKSDB_DEPENDENT_LIBRARY} ${ZSTD_LIBRARY}) ++endif(ZSTD_FOUND) ++ ++SET(TARGET_LIBRARIES_VARS ROCKSDB_LIBRARY ZLIB_LIBRARY ROCKSDB_DEPENDENT_LIBRARY) + + IF(MSVC) + SET(TARGET_EXTERNAL_LIBRARIES ws2_32 winmm rpcrt4 shlwapi) +- +-
\ No newline at end of file diff --git a/ports/osgearth/portfile.cmake b/ports/osgearth/portfile.cmake index 6bc95df7c..8f74dea63 100644 --- a/ports/osgearth/portfile.cmake +++ b/ports/osgearth/portfile.cmake @@ -9,20 +9,14 @@ if(NOT OSG_PLUGINS_SUBDIR_LENGTH EQUAL 1) endif() string(REPLACE "${CURRENT_INSTALLED_DIR}/tools/osg/" "" OSG_PLUGINS_SUBDIR "${OSG_PLUGINS_SUBDIR}") -vcpkg_download_distfile( - VS2017PATCH - URLS "https://github.com/remoe/osgearth/commit/f7081cc4f9991c955c6a0ef7b7b50e48360d14fd.diff" - FILENAME "osgearth-f7081cc4f9991c955c6a0ef7b7b50e48360d14fd.patch" - SHA512 eadb47a5713c00c05add8627e5cad22844db041da34081d59104151a1a1e2d5ac9552909d67171bfc0449a3e4d2930dd3a7914d3ec7ef7ff1015574e9c9a6105 -) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO gwaldron/osgearth - REF osgearth-2.10.1 - SHA512 a74e6922ae29f85b4227b23a83dbccba92e08b7880533c281ceb244703c38b51a02823fdee3199c975c969db963b35ebad0e3bfed3c1e218a36d130b20a48e5b + REF osgearth-2.10.2 + SHA512 fa306a82374716dafae9d834ed0fb07a7369ae0961696de36b6e2af45bc150040295985d9b9781ab713fd0707691451a6a8f173b34253749ab22764f51e60045 HEAD_REF master - PATCHES ${VS2017PATCH} + PATCHES + RocksDB.patch ) vcpkg_configure_cmake( diff --git a/ports/otl/CONTROL b/ports/otl/CONTROL new file mode 100644 index 000000000..c3950ec25 --- /dev/null +++ b/ports/otl/CONTROL @@ -0,0 +1,4 @@ +Source: otl
+Version: 4.0.442
+Description: Oracle, Odbc and DB2-CLI Template Library
+Homepage: http://otl.sourceforge.net/
diff --git a/ports/otl/portfile.cmake b/ports/otl/portfile.cmake new file mode 100644 index 000000000..eeaa6f225 --- /dev/null +++ b/ports/otl/portfile.cmake @@ -0,0 +1,17 @@ +include(vcpkg_common_functions)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://otl.sourceforge.net/otlv4_h2.zip"
+ FILENAME "otl-4.0.442.zip"
+ SHA512 2f4005c2351021c92b86411e9c5847757b3596c485c34aa6a7228d86c446b0d9f1dcbfd228e9262d10c7460b77af0709b8ba9d5c7599ae54442efd88ccdbb96d
+)
+
+vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE ${ARCHIVE}
+ NO_REMOVE_ONE_LEVEL
+ REF 4.0.422
+)
+
+file(INSTALL ${SOURCE_PATH}/otlv4.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/otl)
+file(INSTALL ${SOURCE_PATH}/otlv4.h DESTINATION ${CURRENT_PACKAGES_DIR}/share/otl RENAME copyright)
diff --git a/ports/p-ranav-csv/CONTROL b/ports/p-ranav-csv/CONTROL new file mode 100644 index 000000000..958341f9e --- /dev/null +++ b/ports/p-ranav-csv/CONTROL @@ -0,0 +1,4 @@ +Source: p-ranav-csv
+Version: 2019-07-11
+Description: CSV for modern C++
+Homepage: https://github.com/p-ranav/csv
diff --git a/ports/p-ranav-csv/portfile.cmake b/ports/p-ranav-csv/portfile.cmake new file mode 100644 index 000000000..123842478 --- /dev/null +++ b/ports/p-ranav-csv/portfile.cmake @@ -0,0 +1,25 @@ +# header-only library
+
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO p-ranav/csv
+ REF 13e04e5b31b585855c7d7e7f3c65e47ae863569b
+ SHA512 ddcdc7af68a0dabb2b7e15822f5900461b9f424ff5e0ac6cafd2454c2f21ca97785ef09ddb805a92e2452fe14c14167c762a822a8af6c5b86446f67e7f3f71bd
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DCSV_BUILD_TESTS=OFF
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
diff --git a/ports/paho-mqttpp3/CONTROL b/ports/paho-mqttpp3/CONTROL index 68f1867f6..7e3391668 100644 --- a/ports/paho-mqttpp3/CONTROL +++ b/ports/paho-mqttpp3/CONTROL @@ -1,5 +1,5 @@ Source: paho-mqttpp3 -Version: 1.0.1 +Version: 1.0.1-1 Description: Paho project provides open-source C++ wrapper for Paho C library Build-Depends: paho-mqtt Default-Features: ssl diff --git a/ports/paho-mqttpp3/portfile.cmake b/ports/paho-mqttpp3/portfile.cmake index dcc745d72..f91177ac0 100644 --- a/ports/paho-mqttpp3/portfile.cmake +++ b/ports/paho-mqttpp3/portfile.cmake @@ -9,7 +9,9 @@ vcpkg_from_github( HEAD_REF master ) -vcpkg_check_features("ssl" PAHO_WITH_SSL) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + "ssl" PAHO_WITH_SSL +) # Link with 'paho-mqtt3as' library set(PAHO_C_LIBNAME paho-mqtt3as) @@ -48,8 +50,8 @@ vcpkg_configure_cmake( OPTIONS -DPAHO_BUILD_STATIC=${PAHO_MQTTPP3_STATIC} -DPAHO_BUILD_SHARED=${PAHO_MQTTPP3_SHARED} - -DPAHO_WITH_SSL=${PAHO_WITH_SSL} -DPAHO_MQTT_C_INCLUDE_DIRS=${PAHO_C_INC} + ${FEATURE_OPTIONS} ${PAHO_OPTIONS} ) diff --git a/ports/pango/CONTROL b/ports/pango/CONTROL index 192c5c048..c221c1e37 100644 --- a/ports/pango/CONTROL +++ b/ports/pango/CONTROL @@ -2,4 +2,4 @@ Source: pango Version: 1.40.11-4
Homepage: https://ftp.gnome.org/pub/GNOME/sources/pango/
Description: Text and font handling library.
-Build-Depends: glib, gettext, cairo, fontconfig, freetype, harfbuzz[glib] (!windows-static)
+Build-Depends: glib, gettext, cairo, fontconfig, freetype, harfbuzz[glib] (!(windows&static))
diff --git a/ports/parmetis/CONTROL b/ports/parmetis/CONTROL index 7e5e3b21b..c98d4869f 100644 --- a/ports/parmetis/CONTROL +++ b/ports/parmetis/CONTROL @@ -1,5 +1,5 @@ Source: parmetis
-Version: 4.0.3-2
+Version: 4.0.3-3
Homepage: https://glaros.dtc.umn.edu/gkhome/metis/parmetis/overview
Description: Parallel Graph Partitioning and Fill-reducing Matrix Ordering
-Build-Depends: metis, msmpi
+Build-Depends: metis, mpi
diff --git a/ports/parmetis/portfile.cmake b/ports/parmetis/portfile.cmake index 63b2cb87b..f3eee992f 100644 --- a/ports/parmetis/portfile.cmake +++ b/ports/parmetis/portfile.cmake @@ -22,6 +22,7 @@ vcpkg_extract_source_archive_ex( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS ${ADDITIONAL_OPTIONS} ) diff --git a/ports/pcl/CONTROL b/ports/pcl/CONTROL index 1a9852c8e..7d9e3a8db 100644 --- a/ports/pcl/CONTROL +++ b/ports/pcl/CONTROL @@ -1,5 +1,5 @@ Source: pcl -Version: 1.9.1-4 +Version: 1.9.1-8 Homepage: https://github.com/PointCloudLibrary/pcl Description: Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing. Build-Depends: eigen3, flann, qhull, vtk, libpng, boost-system, boost-filesystem, boost-thread, boost-date-time, boost-iostreams, boost-random, boost-foreach, boost-dynamic-bitset, boost-property-map, boost-graph, boost-multi-array, boost-signals2, boost-ptr-container, boost-uuid, boost-interprocess, boost-asio @@ -23,3 +23,6 @@ Build-Depends: boost-accumulators Feature: cuda Description: CUDA support for PCL Build-Depends: cuda + +Feature: opengl +Description: OpenGL support for PCL diff --git a/ports/pcl/boost-1.70.patch b/ports/pcl/boost-1.70.patch index 1c8a02121..c4b9955d2 100644 --- a/ports/pcl/boost-1.70.patch +++ b/ports/pcl/boost-1.70.patch @@ -11,3 +11,17 @@ index 05e6002..99e3a07 100644 typedef boost::ptr_list<SupervoxelHelper> HelperListT;
HelperListT supervoxel_helpers_;
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 68cc438..8cfa1c6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -416,6 +416,9 @@ endif()
+
+ # Boost (required)
+ include("${PCL_SOURCE_DIR}/cmake/pcl_find_boost.cmake")
++if (NOT APPLE)
++ add_definitions(-fext-numeric-literals)
++endif()
+
+ ### ---[ Create the config.h file
+ set(pcl_config_h_in "${CMAKE_CURRENT_SOURCE_DIR}/pcl_config.h.in")
diff --git a/ports/pcl/cuda_10_1.patch b/ports/pcl/cuda_10_1.patch new file mode 100644 index 000000000..4b46149a4 --- /dev/null +++ b/ports/pcl/cuda_10_1.patch @@ -0,0 +1,133 @@ +diff --git a/cuda/common/include/pcl/cuda/thrust.h b/cuda/common/include/pcl/cuda/thrust.h +index 57586ab..af073d7 100644 +--- a/cuda/common/include/pcl/cuda/thrust.h ++++ b/cuda/common/include/pcl/cuda/thrust.h +@@ -42,6 +42,7 @@ + + #include <thrust/host_vector.h> + #include <thrust/device_vector.h> ++#include <thrust/device_malloc.h> + #include <thrust/copy.h> + #include <thrust/device_ptr.h> + #include <thrust/sequence.h> +diff --git a/gpu/features/src/fpfh.cu b/gpu/features/src/fpfh.cu +index 8d34f76..59a5f0c 100644 +--- a/gpu/features/src/fpfh.cu ++++ b/gpu/features/src/fpfh.cu +@@ -231,12 +231,12 @@ namespace pcl + int *sinds = sindices + Warp::WARP_SIZE * warp_idx; + int size = sizes[idx]; + +- for(int i = lane; __any(i < size); i += Warp::STRIDE) ++ for(int i = lane; __any_sync(0xFFFFFFFF, i < size); i += Warp::STRIDE) + { + if (i < size) + sinds[lane] = ginds[i]; + +- int inds_num = __popc(__ballot(i < size)); ++ int inds_num = __popc(__ballot_sync(0xFFFFFFFF, i < size)); + + for(int j = 0; j < inds_num; ++j) + { +diff --git a/gpu/octree/src/cuda/approx_nsearch.cu b/gpu/octree/src/cuda/approx_nsearch.cu +index e457255..3e1adfe 100644 +--- a/gpu/octree/src/cuda/approx_nsearch.cu ++++ b/gpu/octree/src/cuda/approx_nsearch.cu +@@ -141,7 +141,7 @@ namespace pcl { namespace device { namespace appnearest_search + { + __shared__ volatile int per_warp_buffer[KernelPolicy::WARPS_COUNT]; + +- int mask = __ballot(node_idx != -1); ++ int mask = __ballot_sync(0xFFFFFFFF, node_idx != -1); + + while(mask) + { +@@ -275,7 +275,7 @@ namespace pcl { namespace device { namespace appnearest_search + + bool active = query_index < batch.queries_num; + +- if (__all(active == false)) ++ if (__all_sync(0xFFFFFFFF, active == false)) + return; + + Warp_appNearestSearch search(batch, query_index); +diff --git a/gpu/octree/src/cuda/knn_search.cu b/gpu/octree/src/cuda/knn_search.cu +index a99655d..b55e3c1 100644 +--- a/gpu/octree/src/cuda/knn_search.cu ++++ b/gpu/octree/src/cuda/knn_search.cu +@@ -106,7 +106,7 @@ namespace pcl { namespace device { namespace knn_search + else + query_index = -1; + +- while(__any(active)) ++ while(__any_sync(0xFFFFFFFF, active)) + { + int leaf = -1; + +@@ -163,7 +163,7 @@ namespace pcl { namespace device { namespace knn_search + + __device__ __forceinline__ void processLeaf(int node_idx) + { +- int mask = __ballot(node_idx != -1); ++ int mask = __ballot_sync(0xFFFFFFFF, node_idx != -1); + + unsigned int laneId = Warp::laneId(); + unsigned int warpId = Warp::id(); +@@ -310,7 +310,7 @@ namespace pcl { namespace device { namespace knn_search + + bool active = query_index < batch.queries_num; + +- if (__all(active == false)) ++ if (__all_sync(0xFFFFFFFF, active == false)) + return; + + Warp_knnSearch search(batch, query_index); +diff --git a/gpu/octree/src/cuda/radius_search.cu b/gpu/octree/src/cuda/radius_search.cu +index f90273f..8ae84e7 100644 +--- a/gpu/octree/src/cuda/radius_search.cu ++++ b/gpu/octree/src/cuda/radius_search.cu +@@ -155,7 +155,7 @@ namespace pcl + else + query_index = -1; + +- while(__any(active)) ++ while(__any_sync(0xFFFFFFFF, active)) + { + int leaf = -1; + +@@ -217,7 +217,7 @@ namespace pcl + + __device__ __forceinline__ void processLeaf(int leaf) + { +- int mask = __ballot(leaf != -1); ++ int mask = __ballot_sync(0xFFFFFFFF, leaf != -1); + + while(mask) + { +@@ -255,7 +255,7 @@ namespace pcl + int *out = batch.output + active_query_index * batch.max_results + active_found_count; + int length_left = batch.max_results - active_found_count; + +- int test = __any(active_lane == laneId && (leaf & KernelPolicy::CHECK_FLAG)); ++ int test = __any_sync(0xFFFFFFFF, active_lane == laneId && (leaf & KernelPolicy::CHECK_FLAG)); + + if (test) + { +@@ -329,7 +329,7 @@ namespace pcl + total_new += new_nodes; + out += new_nodes; + +- if (__all(idx >= length) || __any(out_of_bounds) || total_new == length_left) ++ if (__all_sync(0xFFFFFFFF, idx >= length) || __any_sync(0xFFFFFFFF, out_of_bounds) || total_new == length_left) + break; + } + return min(total_new, length_left); +@@ -343,7 +343,7 @@ namespace pcl + + bool active = query_index < batch.queries.size; + +- if (__all(active == false)) ++ if (__all_sync(0xFFFFFFFF, active == false)) + return; + + Warp_radiusSearch<BatchType> search(batch, query_index); diff --git a/ports/pcl/portfile.cmake b/ports/pcl/portfile.cmake index b30ceb0d8..aa4435dd5 100644 --- a/ports/pcl/portfile.cmake +++ b/ports/pcl/portfile.cmake @@ -11,36 +11,23 @@ vcpkg_from_github( pcl_config.patch use_flann_targets.patch boost-1.70.patch + cuda_10_1.patch ) file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindFLANN.cmake) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PCL_SHARED_LIBS) -set(WITH_OPENNI2 OFF) -if("openni2" IN_LIST FEATURES) - set(WITH_OPENNI2 ON) -endif() - -set(WITH_QT OFF) -if("qt" IN_LIST FEATURES) - set(WITH_QT ON) -endif() - -set(WITH_PCAP OFF) -if("pcap" IN_LIST FEATURES) - set(WITH_PCAP ON) -endif() - -set(WITH_CUDA OFF) -if("cuda" IN_LIST FEATURES) - set(WITH_CUDA ON) -endif() - -set(BUILD_TOOLS OFF) -if("tools" IN_LIST FEATURES) - set(BUILD_TOOLS ON) -endif() +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + openni2 WITH_OPENNI2 + qt WITH_QT + pcap WITH_PCAP + cuda WITH_CUDA + cuda BUILD_CUDA + cuda BUILD_GPU + tools BUILD_tools + opengl WITH_OPENGL +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} @@ -48,23 +35,18 @@ vcpkg_configure_cmake( OPTIONS # BUILD -DBUILD_surface_on_nurbs=ON - -DBUILD_tools=${BUILD_TOOLS} - -DBUILD_CUDA=${WITH_CUDA} - -DBUILD_GPU=${WITH_CUDA} # build GPU when use CUDA # PCL -DPCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32=${PCL_SHARED_LIBS} -DPCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32=${PCL_SHARED_LIBS} -DPCL_BUILD_WITH_QHULL_DYNAMIC_LINKING_WIN32=${PCL_SHARED_LIBS} -DPCL_SHARED_LIBS=${PCL_SHARED_LIBS} # WITH - -DWITH_CUDA=${WITH_CUDA} -DWITH_LIBUSB=OFF - -DWITH_OPENNI2=${WITH_OPENNI2} - -DWITH_PCAP=${WITH_PCAP} -DWITH_PNG=ON -DWITH_QHULL=ON - -DWITH_QT=${WITH_QT} -DWITH_VTK=ON + # FEATURES + ${FEATURE_OPTIONS} ) vcpkg_install_cmake() @@ -74,7 +56,7 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -if(BUILD_TOOLS) +if("tools" IN_LIST FEATURES) file(GLOB EXEFILES_RELEASE ${CURRENT_PACKAGES_DIR}/bin/*.exe) file(GLOB EXEFILES_DEBUG ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) file(COPY ${EXEFILES_RELEASE} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/pcl) diff --git a/ports/pdqsort/CONTROL b/ports/pdqsort/CONTROL new file mode 100644 index 000000000..6d1d9e660 --- /dev/null +++ b/ports/pdqsort/CONTROL @@ -0,0 +1,4 @@ +Source: pdqsort +Version: 2019-07-30 +Homepage: https://github.com/orlp/pdqsort +Description: Pattern-defeating quicksort (pdqsort) is a novel sorting algorithm diff --git a/ports/pdqsort/portfile.cmake b/ports/pdqsort/portfile.cmake new file mode 100644 index 000000000..a9c6a9211 --- /dev/null +++ b/ports/pdqsort/portfile.cmake @@ -0,0 +1,15 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO orlp/pdqsort + REF 08879029ab8dcb80a70142acb709e3df02de5d37 + SHA512 38e8b6e35edf1e88e26850a13ce892d8adc0d3e1d7954287d024b3bb858a6b2284e25fbf7c92a694b3ec77cacaf6bbc27fc365187115f7cca6bc88088f67a18f + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/pdqsort.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/pdqsort) + +# Handle copyright +file(COPY ${SOURCE_PATH}/license.txt ${SOURCE_PATH}/readme.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/pdqsort) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/pdqsort/license.txt ${CURRENT_PACKAGES_DIR}/share/pdqsort/copyright)
\ No newline at end of file diff --git a/ports/pegtl/CONTROL b/ports/pegtl/CONTROL index f7f685e0d..52906a8c1 100644 --- a/ports/pegtl/CONTROL +++ b/ports/pegtl/CONTROL @@ -1,3 +1,3 @@ Source: pegtl
-Version: 3.0.0-pre
+Version: 3.0.0-pre-697aaa0
Description: The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only parser combinator library for creating parsers according to a Parsing Expression Grammar (PEG).
diff --git a/ports/pegtl/portfile.cmake b/ports/pegtl/portfile.cmake index f12b170b5..3e3f92f97 100644 --- a/ports/pegtl/portfile.cmake +++ b/ports/pegtl/portfile.cmake @@ -2,8 +2,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO taocpp/pegtl
- REF c5d158ffab4baa0e1c3f6d54c0684f05a2412f74
- SHA512 efd5d36ca14c27948005cd034e72e24855f6046141c316a1d4b7186af9753fd035dab8303dc86e2f2de1b185f5fa3f5d678672892b1fc4ab69e827492a94e897
+ REF 697aaa06564c6ea9d13f95de081a2d2d46b39160
+ SHA512 453821966526569a2d1842ec0bebe6f65dee0241d6ab7d38255726243326356b6a972bf5ca58168e94f51dd87c74ce17fdefffd19fe67570fe9dc52f1f6a4f16
HEAD_REF master
)
diff --git a/ports/physx/CONTROL b/ports/physx/CONTROL index 284216488..5d2e85896 100644 --- a/ports/physx/CONTROL +++ b/ports/physx/CONTROL @@ -1,3 +1,3 @@ Source: physx
-Version: commit-624f2cb6c0392013d54b235d9072a49d01c3cb6c
+Version: 4.1.1-1
Description: The NVIDIA PhysX SDK is a scalable multi-platform physics solution supporting a wide range of devices, from smartphones to high-end multicore CPUs and GPUs
diff --git a/ports/physx/msvc_142_bug_workaround.patch b/ports/physx/msvc_142_bug_workaround.patch new file mode 100644 index 000000000..55433350d --- /dev/null +++ b/ports/physx/msvc_142_bug_workaround.patch @@ -0,0 +1,13 @@ +diff --git a/physx/source/foundation/include/windows/PsWindowsInlineAoS.h b/physx/source/foundation/include/windows/PsWindowsInlineAoS.h
+index 881dffb..7111189 100644
+--- a/physx/source/foundation/include/windows/PsWindowsInlineAoS.h
++++ b/physx/source/foundation/include/windows/PsWindowsInlineAoS.h
+@@ -363,7 +363,7 @@
+ PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f)
+ {
+ ASSERT_ISALIGNED16(f);
+- return V4ClearW(_mm_load_ps(f));
++ return [ & ](){ return V4ClearW(_mm_load_ps(f)); }(); // MSVC 142 bug workaround
+ }
+
+ PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const i)
diff --git a/ports/physx/portfile.cmake b/ports/physx/portfile.cmake index 2e0dfa963..0eef2901b 100644 --- a/ports/physx/portfile.cmake +++ b/ports/physx/portfile.cmake @@ -20,6 +20,9 @@ if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140") elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
set(MSVC_VERSION "15")
set(TOOLSET_VERSION "141")
+elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
+ set(MSVC_VERSION "16")
+ set(TOOLSET_VERSION "142")
else()
message(FATAL_ERROR "Unsupported platform toolset.")
endif()
@@ -27,9 +30,10 @@ endif() vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO NVIDIAGameWorks/PhysX
- REF 624f2cb6c0392013d54b235d9072a49d01c3cb6c
- SHA512 80b465f6214434fd53954fe124d8f8aa1ddfcb60d80261f1dc06713bf7fb0f42d8cd96a393fbc46547d9c2199039f386220d7eea63c849ad98863ff26b731e0c
+ REF ae80dede0546d652040ae6260a810e53e20a06fa
+ SHA512 f3a690039cf39fe2db9a728b82af0d39eaa02340a853bdad4b5152d63532367eb24fc7033a614882168049b80d803b6225fc60ed2900a9d0deab847f220540be
HEAD_REF master
+ PATCHES msvc_142_bug_workaround.patch
)
set(BUILD_SNIPPETS "False")
@@ -73,13 +77,14 @@ set(RELEASE_CONFIGURATION "release") set(DEBUG_CONFIGURATION "debug")
vcpkg_build_msbuild(
- PROJECT_PATH ${SOURCE_PATH}/physx/compiler/vc15win${WINDOWS_PLATFORM}/PhysXSDK.sln
+ PROJECT_PATH ${SOURCE_PATH}/physx/compiler/vc${MSVC_VERSION}win${WINDOWS_PLATFORM}/PhysXSDK.sln
RELEASE_CONFIGURATION ${RELEASE_CONFIGURATION}
DEBUG_CONFIGURATION ${DEBUG_CONFIGURATION}
PLATFORM ${MSBUILD_PLATFORM}
)
file(INSTALL ${SOURCE_PATH}/physx/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/physx/)
+file(INSTALL ${SOURCE_PATH}/pxshared/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/physx/)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(GLOB RELEASE_BINS ${SOURCE_PATH}/physx/bin/win.x86_${WINDOWS_PLATFORM}.vc${TOOLSET_VERSION}.${RUNTIME_LIBRARY_LINKAGE}/${RELEASE_CONFIGURATION}/*.dll)
diff --git a/ports/pistache/CONTROL b/ports/pistache/CONTROL new file mode 100644 index 000000000..c1b4408cf --- /dev/null +++ b/ports/pistache/CONTROL @@ -0,0 +1,4 @@ +Source: pistache +Version: 2019-08-05 +Homepage: https://github.com/oktal/pistache +Description: Pistache is a modern and elegant HTTP and REST framework for C++. It is entirely written in pure-C++11 and provides a clear and pleasant API.
\ No newline at end of file diff --git a/ports/pistache/portfile.cmake b/ports/pistache/portfile.cmake new file mode 100644 index 000000000..d0400dcdf --- /dev/null +++ b/ports/pistache/portfile.cmake @@ -0,0 +1,31 @@ +include(vcpkg_common_functions) + +if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") + message(FATAL_ERROR "${PORT} currently only supports Linux platform.") +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO oktal/pistache + REF 4dc9e3ef9a1b953a62e5fadbed88e72b4b3734de + SHA512 427b6a6e7200e5f91ce8737cd1cc5d6cd689025033c85979c96f0ece64ae05d9c6839a936d7d6015b0e1065dc72362f6f70ab588ea7cae7aa718dfe5cd288554 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) diff --git a/ports/plf-colony/CONTROL b/ports/plf-colony/CONTROL new file mode 100644 index 000000000..384ce2d19 --- /dev/null +++ b/ports/plf-colony/CONTROL @@ -0,0 +1,4 @@ +Source: plf-colony +Version: 2019-08-10 +Description: An unordered data container providing fast iteration/insertion/erasure while maintaining pointer validity to non-erased elements +Homepage: https://www.plflib.org/ diff --git a/ports/plf-colony/portfile.cmake b/ports/plf-colony/portfile.cmake new file mode 100644 index 000000000..eef608ce8 --- /dev/null +++ b/ports/plf-colony/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mattreecebentley/plf_colony + REF 81fe8c4daf433491f14248837ee8ed5cf447c856 + SHA512 a6ae03d383c94b0a758e7aedee2838d46b3665881e2c0823b064a3579140a351d96fec66d456de5843b6c4c8d2f6f6efac5f547841c08edd349b0f153e9c4871 + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/plf_colony.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/plf-list/CONTROL b/ports/plf-list/CONTROL new file mode 100644 index 000000000..338eec5ea --- /dev/null +++ b/ports/plf-list/CONTROL @@ -0,0 +1,4 @@ +Source: plf-list +Version: 2019-08-10 +Description: A drop-in replacement for std::list with 293% faster insertion, 57% faster erasure, 17% faster iteration and 77% faster sorting on average +Homepage: https://www.plflib.org/ diff --git a/ports/plf-list/portfile.cmake b/ports/plf-list/portfile.cmake new file mode 100644 index 000000000..f9efd1e61 --- /dev/null +++ b/ports/plf-list/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mattreecebentley/plf_list + REF 42fcfca9890598d1c1fda45eb9dbe2b2b2d4dd2b + SHA512 879157aac16dc1b76db942a8ddf25dc33ede10e769496b7f300a070913c6c6946cb40853dd3071ecf3d9c870e1dee5d420d42fbb388e83361235659171f6bd44 + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/plf_list.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/plf-nanotimer/CONTROL b/ports/plf-nanotimer/CONTROL new file mode 100644 index 000000000..10ac0ac2c --- /dev/null +++ b/ports/plf-nanotimer/CONTROL @@ -0,0 +1,4 @@ +Source: plf-nanotimer +Version: 2019-08-10 +Description: A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking +Homepage: https://www.plflib.org/ diff --git a/ports/plf-nanotimer/portfile.cmake b/ports/plf-nanotimer/portfile.cmake new file mode 100644 index 000000000..4c25a2c73 --- /dev/null +++ b/ports/plf-nanotimer/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mattreecebentley/plf_nanotimer + REF bc8b44d2befc4395f63701c923ece89835d8415c + SHA512 ec816e82ab855dd7029b03931ffb1e945d3e77f7bb446c4985c4a8404afe20e9de8fac02f64459c47c34e31c06fa8838dba310263197d309e39ec1b0b5da0b6d + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/plf_nanotimer.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/plf-stack/CONTROL b/ports/plf-stack/CONTROL new file mode 100644 index 000000000..d0a40be45 --- /dev/null +++ b/ports/plf-stack/CONTROL @@ -0,0 +1,4 @@ +Source: plf-stack +Version: 2019-08-10 +Description: A C++ data container replicating std::stack functionality but with better performance +Homepage: https://www.plflib.org/ diff --git a/ports/plf-stack/portfile.cmake b/ports/plf-stack/portfile.cmake new file mode 100644 index 000000000..11a9fb068 --- /dev/null +++ b/ports/plf-stack/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mattreecebentley/plf_stack + REF 9d046154d8954eafc12f8d4845505beec8c4a5da + SHA512 2202bbff0e93bf515ae7b237551d084dcba9b870bca82f49b4e1a64446f4574079b0cb45fb91f0ad0472e008f21ad014464b45e307ffa6dab19affc6dc38626a + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/plf_stack.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/plibsys/CONTROL b/ports/plibsys/CONTROL index 2c71346bb..004f07084 100644 --- a/ports/plibsys/CONTROL +++ b/ports/plibsys/CONTROL @@ -1,4 +1,4 @@ Source: plibsys
-Version: 0.0.4-1
+Version: 0.0.4-2
Homepage: https://github.com/saprykin/plibsys
Description: Highly portable C system library: threads and synchronization, sockets, IPC, data structures and more.
diff --git a/ports/plibsys/portfile.cmake b/ports/plibsys/portfile.cmake index 210fddd37..a4a032370 100644 --- a/ports/plibsys/portfile.cmake +++ b/ports/plibsys/portfile.cmake @@ -15,6 +15,7 @@ endif() vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DPLIBSYS_TESTS=OFF
-DPLIBSYS_COVERAGE=OFF
diff --git a/ports/poco/CONTROL b/ports/poco/CONTROL index 72c7cc72f..e7e1656bb 100644 --- a/ports/poco/CONTROL +++ b/ports/poco/CONTROL @@ -1,6 +1,6 @@ Source: poco -Version: 2.0.0-pre-3 -Build-Depends: expat, libpq, pcre, sqlite3, zlib +Version: 1.9.2 +Build-Depends: expat, libpq, pcre, sqlite3, zlib, libpng Description: Modern, powerful open source C++ class libraries for building network and internet-based applications that run on desktop, server, mobile and embedded systems. Homepage: https://github.com/pocoproject/poco diff --git a/ports/poco/find_pcre.patch b/ports/poco/find_pcre.patch index 1a07882bc..3b73ae4f1 100644 --- a/ports/poco/find_pcre.patch +++ b/ports/poco/find_pcre.patch @@ -1,13 +1,22 @@ -diff --git a/cmake/FindPCRE.cmake b/cmake/FindPCRE.cmake
-index 41a99cb..77f3a42 100644
---- a/cmake/FindPCRE.cmake
-+++ b/cmake/FindPCRE.cmake
-@@ -14,7 +14,7 @@ ENDIF (PCRE_INCLUDE_DIRS)
-
- FIND_PATH(PCRE_INCLUDE_DIR pcre.h)
-
--SET(PCRE_NAMES pcre)
-+SET(PCRE_NAMES pcred pcre)
- FIND_LIBRARY(PCRE_LIBRARY NAMES ${PCRE_NAMES} )
-
- # handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
+diff --git a/cmake/FindPCRE.cmake b/cmake/FindPCRE.cmake +index 41a99cb..b1acb32 100644 +--- a/cmake/FindPCRE.cmake ++++ b/cmake/FindPCRE.cmake +@@ -14,9 +14,15 @@ ENDIF (PCRE_INCLUDE_DIRS) + + FIND_PATH(PCRE_INCLUDE_DIR pcre.h) + +-SET(PCRE_NAMES pcre) ++if (WIN32) ++include(SelectLibraryConfigurations) ++find_library(PCRE_LIBRARY_RELEASE NAMES pcre) ++find_library(PCRE_LIBRARY_DEBUG NAMES pcred) ++select_library_configurations(PCRE) ++else() ++SET(PCRE_NAMES pcred pcre) + FIND_LIBRARY(PCRE_LIBRARY NAMES ${PCRE_NAMES} ) +- ++endif() + # handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if + # all listed variables are TRUE + INCLUDE(FindPackageHandleStandardArgs) diff --git a/ports/poco/fix_foundation_link.patch b/ports/poco/fix_foundation_link.patch index f3af572b1..c8830ed4f 100644 --- a/ports/poco/fix_foundation_link.patch +++ b/ports/poco/fix_foundation_link.patch @@ -1,26 +1,24 @@ -diff --git a/Foundation/src/Environment_WIN32.cpp b/Foundation/src/Environment_WIN32.cpp
-index 3cca5c7..8ed1df2 100644
---- a/Foundation/src/Environment_WIN32.cpp
-+++ b/Foundation/src/Environment_WIN32.cpp
-@@ -23,7 +23,7 @@
- #include <ws2ipdef.h>
- #include <wincrypt.h>
- #include <iphlpapi.h>
--
-+#pragma comment(lib, "IPHLPAPI.lib")
-
- namespace Poco {
-
-diff --git a/Foundation/src/Environment_WINCE.cpp b/Foundation/src/Environment_WINCE.cpp
-index 62f19bc..d409356 100644
---- a/Foundation/src/Environment_WINCE.cpp
-+++ b/Foundation/src/Environment_WINCE.cpp
-@@ -22,7 +22,7 @@
- #include <cstring>
- #include <windows.h>
- #include <iphlpapi.h>
--
-+#pragma comment(lib, "IPHLPAPI.lib")
-
- namespace Poco {
-
+diff --git a/Foundation/src/Environment_WIN32.cpp b/Foundation/src/Environment_WIN32.cpp +index 62845fa..edcf6fe 100644 +--- a/Foundation/src/Environment_WIN32.cpp ++++ b/Foundation/src/Environment_WIN32.cpp +@@ -22,6 +22,7 @@ + #include <ws2ipdef.h> + #include <iphlpapi.h> + ++#pragma comment(lib, "IPHLPAPI.lib") + + namespace Poco { + +diff --git a/Foundation/src/Environment_WINCE.cpp b/Foundation/src/Environment_WINCE.cpp +index afa59b6..c43767b 100644 +--- a/Foundation/src/Environment_WINCE.cpp ++++ b/Foundation/src/Environment_WINCE.cpp +@@ -23,6 +23,7 @@ + #include <windows.h> + #include <iphlpapi.h> + ++#pragma comment(lib, "IPHLPAPI.lib") + + namespace Poco { + diff --git a/ports/poco/include_pcre.patch b/ports/poco/include_pcre.patch index 6594a30fe..5db2372ea 100644 --- a/ports/poco/include_pcre.patch +++ b/ports/poco/include_pcre.patch @@ -1,12 +1,12 @@ -diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt
-index 5b7df96..4fedfd5 100644
---- a/Foundation/CMakeLists.txt
-+++ b/Foundation/CMakeLists.txt
-@@ -101,6 +101,7 @@ target_link_libraries(Foundation PUBLIC ${PCRE_LIBRARIES} ${ZLIB_LIBRARIES})
- target_include_directories(Foundation
- PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
-+ $<BUILD_INTERFACE:${PCRE_INCLUDE_DIRS}>
- $<INSTALL_INTERFACE:include>
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
- )
+diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index 26a2365..0b8f7bc 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -168,6 +168,7 @@ target_link_libraries( "${LIBNAME}" ${SYSLIBS}) + target_include_directories( "${LIBNAME}" + PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> ++ $<BUILD_INTERFACE:${PCRE_INCLUDE_DIRS}> + $<INSTALL_INTERFACE:include> + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src + ) diff --git a/ports/poco/portfile.cmake b/ports/poco/portfile.cmake index f6a1255aa..6d53a0048 100644 --- a/ports/poco/portfile.cmake +++ b/ports/poco/portfile.cmake @@ -1,13 +1,11 @@ include(vcpkg_common_functions) -# Poco 2.0.0 (pre) -# commit 46e00c8 vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO pocoproject/poco - REF 46e00c8d6f6d03864397c3e517a165e82f9efd5e - SHA512 2c2f5048b7bfbbfe47ac303ed79213197c97f3d90362dd2d7629c8b353a6c8bd303b1bcf477e3493cc6c984645822ca043dd0a77e9186e001e6808dc2d17a5b4 - HEAD_REF develop + REF 8a127d6f16795d914cadc342d3f4f3b9b7999e3b #1.9.2 + SHA512 282097ee2118ac55320ebdde05bb53ed27d68af49c201b0b26027706ef935ae08f8090abb8aab1cafe84c72520ea73b01263b439d32bd2d0bd55319b0634b168 + HEAD_REF master PATCHES # Find pcre in debug find_pcre.patch @@ -52,37 +50,34 @@ vcpkg_configure_cmake( -DPOCO_STATIC=${POCO_STATIC} -DPOCO_MT=${POCO_MT} # Set to OFF|ON (default is OFF) to control build of POCO tests - -DPOCO_ENABLE_TESTS=OFF + -DENABLE_TESTS=OFF # Set to OFF|ON (default is OFF) to control build of POCO samples - -DPOCO_ENABLE_SAMPLES=OFF + -DENABLE_SAMPLES=OFF # Allow enabling and disabling components # POCO_ENABLE_SQL_ODBC, POCO_ENABLE_SQL_MYSQL and POCO_ENABLE_SQL_POSTGRESQL are # defined on the fly if the required librairies are present - -DPOCO_ENABLE_ENCODINGS=ON - -DPOCO_ENABLE_ENCODINGS_COMPILER=ON - -DPOCO_ENABLE_XML=ON - -DPOCO_ENABLE_JSON=ON - -DPOCO_ENABLE_MONGODB=ON - -DPOCO_ENABLE_SQL_SQLITE=ON - -DPOCO_ENABLE_REDIS=ON - -DPOCO_ENABLE_PDF=ON - -DPOCO_ENABLE_UTIL=ON - -DPOCO_ENABLE_NET=ON - -DPOCO_ENABLE_SEVENZIP=ON - -DPOCO_ENABLE_ZIP=ON - -DPOCO_ENABLE_CPPPARSER=ON - -DPOCO_ENABLE_POCODOC=ON - -DPOCO_ENABLE_PAGECOMPILER=ON - -DPOCO_ENABLE_PAGECOMPILER_FILE2PAGE=ON - -DPOCO_ENABLE_WSTRING=ON - -DPOCO_ENABLE_FPENVIRONMENT=ON - -DPOCO_ENABLE_CPPUNIT=ON + -DENABLE_ENCODINGS=ON + -DENABLE_ENCODINGS_COMPILER=ON + -DENABLE_XML=ON + -DENABLE_JSON=ON + -DENABLE_MONGODB=ON + # -DPOCO_ENABLE_SQL_SQLITE=ON # SQLITE are not supported. + -DENABLE_REDIS=ON + -DENABLE_PDF=ON + -DENABLE_UTIL=ON + -DENABLE_NET=ON + -DENABLE_SEVENZIP=ON + -DENABLE_ZIP=ON + -DENABLE_CPPPARSER=ON + -DENABLE_POCODOC=ON + -DENABLE_PAGECOMPILER=ON + -DENABLE_PAGECOMPILER_FILE2PAGE=ON # -DMYSQL_INCLUDE_DIR=${MYSQL_INCLUDE_DIR} OPTIONS_RELEASE - -DMYSQL_LIBRARY=${MYSQL_LIBRARY} + -DMYSQL_LIB=${MYSQL_LIBRARY} OPTIONS_DEBUG - -DMYSQL_LIBRARY=${MYSQL_LIBRARY_DEBUG} + -DMYSQL_LIB=${MYSQL_LIBRARY_DEBUG} ) vcpkg_install_cmake() @@ -154,7 +149,7 @@ endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) # copy license -file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/poco) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/poco/LICENSE ${CURRENT_PACKAGES_DIR}/share/poco/copyright) +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) vcpkg_copy_pdbs() diff --git a/ports/poco/static_pcre.patch b/ports/poco/static_pcre.patch index b9bac7629..a6dab02ce 100644 --- a/ports/poco/static_pcre.patch +++ b/ports/poco/static_pcre.patch @@ -1,27 +1,26 @@ -diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt
-index 4fedfd5..741313b 100644
---- a/Foundation/CMakeLists.txt
-+++ b/Foundation/CMakeLists.txt
-@@ -35,6 +35,22 @@ if (POCO_UNBUNDLED)
- find_package(PCRE REQUIRED)
- find_package(ZLIB REQUIRED)
-
-+ add_definitions(
-+ -D_pcre_utf8_table1=_poco_pcre_utf8_table1
-+ -D_pcre_utf8_table1_size=_poco_pcre_utf8_table1_size
-+ -D_pcre_utf8_table2=_poco_pcre_utf8_table2
-+ -D_pcre_utf8_table3=_poco_pcre_utf8_table3
-+ -D_pcre_utf8_table4=_poco_pcre_utf8_table4
-+ -D_pcre_utt_names=_poco_pcre_utt_names
-+ -D_pcre_utt=_poco_pcre_utt
-+ -D_pcre_utt_size=_poco_pcre_utt_size
-+ -D_pcre_OP_lengths=_poco_pcre_OP_lengths
-+ -D_pcre_hspace_list=_poco_pcre_hspace_list
-+ -D_pcre_vspace_list=_poco_pcre_vspace_list
-+ -D_pcre_ucp_gentype=_poco_pcre_ucp_gentype
-+ -D_pcre_ucp_gbtable=_poco_pcre_ucp_gbtable
-+ )
-+
- #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
- POCO_SOURCES( SRCS RegExp
- src/pcre_ucd.c
+diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index 0b8f7bc..c362890 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -53,6 +53,21 @@ if (POCO_UNBUNDLED) + include_directories(${ZLIB_INCLUDE_DIRS}) + + add_definitions(-DPOCO_UNBUNDLED) ++ add_definitions( ++ -D_pcre_utf8_table1=_poco_pcre_utf8_table1 ++ -D_pcre_utf8_table1_size=_poco_pcre_utf8_table1_size ++ -D_pcre_utf8_table2=_poco_pcre_utf8_table2 ++ -D_pcre_utf8_table3=_poco_pcre_utf8_table3 ++ -D_pcre_utf8_table4=_poco_pcre_utf8_table4 ++ -D_pcre_utt_names=_poco_pcre_utt_names ++ -D_pcre_utt=_poco_pcre_utt ++ -D_pcre_utt_size=_poco_pcre_utt_size ++ -D_pcre_OP_lengths=_poco_pcre_OP_lengths ++ -D_pcre_hspace_list=_poco_pcre_hspace_list ++ -D_pcre_vspace_list=_poco_pcre_vspace_list ++ -D_pcre_ucp_gentype=_poco_pcre_ucp_gentype ++ -D_pcre_ucp_gbtable=_poco_pcre_ucp_gbtable ++ ) + + else() + # pcre diff --git a/ports/poco/unbundled_pdf.patch b/ports/poco/unbundled_pdf.patch index b7abcf541..e7f88f035 100644 --- a/ports/poco/unbundled_pdf.patch +++ b/ports/poco/unbundled_pdf.patch @@ -1,17 +1,30 @@ -diff --git a/PDF/CMakeLists.txt b/PDF/CMakeLists.txt
-index b377035..9cfbd32 100644
---- a/PDF/CMakeLists.txt
-+++ b/PDF/CMakeLists.txt
-@@ -31,6 +31,12 @@ endif (POCO_UNBUNDLED)
- # TODO: Currently only bundled is supported, in future this should also be possible
- # with an unbundled version of hpdf
- # hpdf
-+if (POCO_UNBUNDLED)
-+ POCO_SOURCES( SRCS hpdf
-+ src/bmpread.c
-+ )
-+endif (POCO_UNBUNDLED)
-+
- POCO_SOURCES(SRCS hpdf
- src/hpdf_3dmeasure.c
- src/hpdf_annotation.c
+diff --git a/PDF/CMakeLists.txt b/PDF/CMakeLists.txt +index 3e44906..ae8fe6e 100644 +--- a/PDF/CMakeLists.txt ++++ b/PDF/CMakeLists.txt +@@ -97,6 +97,8 @@ POCO_SOURCES(SRCS hpdf + + # TODO: Currently only bundled is supported, in future this should also be possible + # with an unbundled version of libpng ++find_package(PNG REQUIRED) ++if (0) + POCO_SOURCES( SRCS libpng + src/png.c + src/pngerror.c +@@ -117,6 +119,7 @@ POCO_SOURCES( SRCS libpng + src/pngwtran.c + src/pngwutil.c + ) ++endif(0) + + # Version Resource + if(MSVC AND NOT POCO_STATIC) +@@ -136,7 +139,7 @@ set_target_properties( "${LIBNAME}" + DEFINE_SYMBOL PDF_EXPORTS + ) + +-target_link_libraries( "${LIBNAME}" ${SYSLIBS} XML Util Foundation ) ++target_link_libraries( "${LIBNAME}" ${SYSLIBS} XML Util Foundation ${PNG_LIBRARIES}) + target_include_directories( "${LIBNAME}" + PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> diff --git a/ports/pprint/CONTROL b/ports/pprint/CONTROL index 0f06b8c4c..ea94b198e 100644 --- a/ports/pprint/CONTROL +++ b/ports/pprint/CONTROL @@ -1,3 +1,4 @@ Source: pprint
-Version: 2019-06-01
+Version: 2019-07-19
Description: Pretty Printer for Modern C++
+Homepage: https://github.com/p-ranav/pprint
diff --git a/ports/pprint/portfile.cmake b/ports/pprint/portfile.cmake index 792b4851b..3b360e683 100644 --- a/ports/pprint/portfile.cmake +++ b/ports/pprint/portfile.cmake @@ -5,8 +5,8 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO p-ranav/pprint
- REF 71d85f0cd4ec2012c9cf19bfa741e094fcecfa3e
- SHA512 6b0ff7a75a09226f775fa01fd9753d0f69c4838b40253fe9fc824eeee3c2efa1884e711188858f185f9c765f1dadace0bb72227d71e4d2218c493ddfb60224fa
+ REF 2fb81cd4af62c019ea28ea1707164fc3637bc656
+ SHA512 51bdf0e06666511fb475b46ff2d512e5d04b231f63c274c021f56b194501885a0302af95cc90977b0a3b39b555d1076926f618d0a6751926acb5f8b2a968bc0a
HEAD_REF master
)
diff --git a/ports/proj4/CONTROL b/ports/proj4/CONTROL index 265b8173d..f2a6ae8b6 100644 --- a/ports/proj4/CONTROL +++ b/ports/proj4/CONTROL @@ -1,4 +1,4 @@ Source: proj4 -Version: 4.9.3-3 +Version: 4.9.3-4 Homepage: https://download.osgeo.org/proj Description: PROJ.4 library for cartographic projections diff --git a/ports/proj4/portfile.cmake b/ports/proj4/portfile.cmake index b34f04ac3..70878aae6 100644 --- a/ports/proj4/portfile.cmake +++ b/ports/proj4/portfile.cmake @@ -26,6 +26,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DBUILD_LIBPROJ_SHARED=${VCPKG_BUILD_SHARED_LIBS} -DPROJ_LIB_SUBDIR=lib diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL index 0dc2aa6dc..ba4ce7d91 100644 --- a/ports/protobuf/CONTROL +++ b/ports/protobuf/CONTROL @@ -1,5 +1,5 @@ Source: protobuf -Version: 3.8.0-1 +Version: 3.9.1 Homepage: https://github.com/google/protobuf Description: Protocol Buffers - Google's data interchange format diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake index 7c04158a8..bb6726410 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -2,9 +2,9 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO google/protobuf - REF v3.8.0 - SHA512 ba27c64e5193cd4a144bf0c9dc0d195fbbe6e580aaca01960362f0f185074588ca40046d3bcea76e1deae7508b722f6c5be484ea957122ae8e98229c7c3a4ad2 + REPO protocolbuffers/protobuf + REF v3.9.1 + SHA512 9accb56c1aadef83bf27280e15a99809a3561cbd4b39d6605dec730cc112bf4fd2e9f1ac39127b32a1b87253e712be4b4f12afe4061a8f7be76266b3f4bca314 HEAD_REF master PATCHES fix-uwp.patch diff --git a/ports/pthreads/CONTROL b/ports/pthreads/CONTROL index 53d5706c7..448fb9951 100644 --- a/ports/pthreads/CONTROL +++ b/ports/pthreads/CONTROL @@ -1,4 +1,4 @@ Source: pthreads -Version: 3.0.0-2 +Version: 3.0.0-3 Homepage: https://sourceware.org/pub/pthreads-win32/ Description: pthreads for windows diff --git a/ports/pthreads/vcpkg-cmake-wrapper.cmake b/ports/pthreads/vcpkg-cmake-wrapper.cmake index 8d3a4e875..12d390a7a 100644 --- a/ports/pthreads/vcpkg-cmake-wrapper.cmake +++ b/ports/pthreads/vcpkg-cmake-wrapper.cmake @@ -70,18 +70,21 @@ if(NOT PThreads4W_STRUCTEXC_LIBRARY) find_library(PThreads4W_STRUCTEXC_LIBRARY_DEBUG NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d) select_library_configurations(PThreads4W_STRUCTEXC) endif() -if(WIN32) - string( REPLACE ".lib" ".dll" PThreads4W_LIBRARY_RELEASE_DLL "${PThreads4W_LIBRARY_RELEASE}" ) - string( REPLACE ".lib" ".dll" PThreads4W_LIBRARY_DEBUG_DLL "${PThreads4W_LIBRARY_DEBUG}" ) - string( REPLACE ".lib" ".dll" PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL "${PThreads4W_CXXEXC_LIBRARY_RELEASE}" ) - string( REPLACE ".lib" ".dll" PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" ) - string( REPLACE ".lib" ".dll" PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}" ) - string( REPLACE ".lib" ".dll" PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" ) -endif() find_package_handle_standard_args(PThreads4W DEFAULT_MSG PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY PThreads4W_INCLUDE_DIR) mark_as_advanced(PThreads4W_INCLUDE_DIR PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY) +set(PThreads4W_DLL_DIR ${PThreads4W_INCLUDE_DIR}) +list(TRANSFORM PThreads4W_DLL_DIR APPEND "/../bin") +message(STATUS "PThreads4W_DLL_DIR: ${PThreads4W_DLL_DIR}") + +find_file(PThreads4W_LIBRARY_RELEASE_DLL NAMES pthreadVC${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR}) +find_file(PThreads4W_LIBRARY_DEBUG_DLL NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DLL_DIR}) +find_file(PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR}) +find_file(PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DLL_DIR}) +find_file(PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR}) +find_file(PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DLL_DIR}) + #Compatibility definitions, deprecated set(PTHREAD_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "") set(PTHREADS_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "") diff --git a/ports/pugixml/CONTROL b/ports/pugixml/CONTROL index a68f43833..7024b6b04 100644 --- a/ports/pugixml/CONTROL +++ b/ports/pugixml/CONTROL @@ -1,4 +1,4 @@ Source: pugixml -Version: 1.9-2 +Version: 1.9-3 Homepage: https://github.com/zeux/pugixml Description: C++ XML processing library diff --git a/ports/pugixml/portfile.cmake b/ports/pugixml/portfile.cmake index 62d0a4b74..746e9c2d4 100644 --- a/ports/pugixml/portfile.cmake +++ b/ports/pugixml/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/qhull/CONTROL b/ports/qhull/CONTROL index d8a402049..67812997b 100644 --- a/ports/qhull/CONTROL +++ b/ports/qhull/CONTROL @@ -1,4 +1,4 @@ Source: qhull -Version: 7.2.1-3 +Version: 7.3.2-1 Homepage: https://github.com/qhull/qhull Description: computes the convex hull, Delaunay triangulation, Voronoi diagram diff --git a/ports/qhull/portfile.cmake b/ports/qhull/portfile.cmake index b7939dddb..ade241dc8 100644 --- a/ports/qhull/portfile.cmake +++ b/ports/qhull/portfile.cmake @@ -3,9 +3,10 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO qhull/qhull - REF v7.2.1 # Qhull 2015.2 - SHA512 8f5177ea45f82fa28f13e95105497e7e29086d7301e1cb8d3860fff09ebf8d0f01cfcb0f044c422f0ac0ba94b845bba223232e5eeb613bf671f65a569b8766d0 + REF v7.3.2 # Qhull 2019.1 + SHA512 aea2c70179de10f648aba960129a3b9a3fe309a0eb085bdb86f697e3d4b214570c241e88d4f0b4d2974137759ee7086452d0a3957c4b2a256708402fb3c9eb3d HEAD_REF master + PATCHES uwp.patch ) if(${TARGET_TRIPLET} STREQUAL "x64-windows-static") # workaround for visual studio toolset regression LNK1201 (remove if solved) @@ -37,6 +38,8 @@ endif() vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/Qhull) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(GLOB_RECURSE HTMFILES ${CURRENT_PACKAGES_DIR}/include/*.htm) file(REMOVE ${HTMFILES}) diff --git a/ports/qhull/uwp.patch b/ports/qhull/uwp.patch new file mode 100644 index 000000000..98c74564e --- /dev/null +++ b/ports/qhull/uwp.patch @@ -0,0 +1,26 @@ +diff --git a/src/libqhull/global.c b/src/libqhull/global.c +index e7de8e6..81be9df 100644 +--- a/src/libqhull/global.c ++++ b/src/libqhull/global.c +@@ -636,7 +636,7 @@ void qh_init_qhull_command(int argc, char *argv[]) { + */ + void qh_initflags(char *command) { + int k, i, lastproject; +- char *s= command, *t, *prev_s, *start, key, *lastwarning= NULL; ++ char *s= command, *t = NULL, *prev_s, *start, key, *lastwarning= NULL; + boolT isgeom= False, wasproject; + realT r; + +diff --git a/src/libqhull_r/global_r.c b/src/libqhull_r/global_r.c +index 3e6919f..8d13e47 100644 +--- a/src/libqhull_r/global_r.c ++++ b/src/libqhull_r/global_r.c +@@ -610,7 +610,7 @@ void qh_init_qhull_command(qhT *qh, int argc, char *argv[]) { + */ + void qh_initflags(qhT *qh, char *command) { + int k, i, lastproject; +- char *s= command, *t, *prev_s, *start, key, *lastwarning= NULL; ++ char *s= command, *t = NULL, *prev_s, *start, key, *lastwarning= NULL; + boolT isgeom= False, wasproject; + realT r; + diff --git a/ports/qt5/CONTROL b/ports/qt5/CONTROL index 74b69467a..0f6bdeafd 100644 --- a/ports/qt5/CONTROL +++ b/ports/qt5/CONTROL @@ -2,4 +2,4 @@ Source: qt5 Version: 5.12.3 Homepage: https://www.qt.io/ Description: Qt5 Application Framework -Build-Depends: qt5-3d, qt5-activeqt, qt5-base, qt5-charts, qt5-datavis3d, qt5-declarative, qt5-gamepad, qt5-graphicaleffects, qt5-imageformats, qt5-location, qt5-multimedia, qt5-mqtt, qt5-networkauth, qt5-purchasing, qt5-quickcontrols, qt5-quickcontrols2, qt5-script, qt5-scxml, qt5-sensors, qt5-serialport, qt5-speech, qt5-svg, qt5-tools, qt5-virtualkeyboard, qt5-webchannel, qt5-websockets, qt5-winextras (windows), qt5-macextras (osx), qt5-xmlpatterns +Build-Depends: qt5-3d, qt5-activeqt (windows), qt5-base, qt5-charts, qt5-datavis3d, qt5-declarative, qt5-gamepad, qt5-graphicaleffects, qt5-imageformats, qt5-location, qt5-multimedia, qt5-mqtt, qt5-networkauth, qt5-purchasing, qt5-quickcontrols, qt5-quickcontrols2, qt5-script, qt5-scxml, qt5-sensors, qt5-serialport, qt5-speech, qt5-svg, qt5-tools, qt5-virtualkeyboard, qt5-webchannel, qt5-websockets, qt5-winextras (windows), qt5-macextras (osx), qt5-xmlpatterns diff --git a/ports/qwt/CONTROL b/ports/qwt/CONTROL index 230203b34..c1271a72f 100644 --- a/ports/qwt/CONTROL +++ b/ports/qwt/CONTROL @@ -1,5 +1,5 @@ Source: qwt -Version: 6.1.3-6 +Version: 6.1.3-7 Homepage: https://sourceforge.net/projects/qwt Description: Qt widgets library for technical applications Build-Depends: qt5-base, qt5-svg, qt5-tools diff --git a/ports/qwt/build-shared-lib.patch b/ports/qwt/build-shared-lib.patch deleted file mode 100644 index 2a8447d52..000000000 --- a/ports/qwt/build-shared-lib.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/qwtconfig.pri b/qwtconfig.pri -index 756231a..2dc3715 100644 ---- a/qwtconfig.pri -+++ b/qwtconfig.pri -@@ -72,7 +72,7 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features - # it will be a static library. - ###################################################################### - --# QWT_CONFIG += QwtDll -+QWT_CONFIG += QwtDll - - ###################################################################### - # QwtPlot enables all classes, that are needed to use the QwtPlot diff --git a/ports/qwt/build-static-lib.patch b/ports/qwt/fix-dynamic-static.patch index 3e1b462ac..b608681f2 100644 --- a/ports/qwt/build-static-lib.patch +++ b/ports/qwt/fix-dynamic-static.patch @@ -1,13 +1,15 @@ diff --git a/qwtconfig.pri b/qwtconfig.pri -index 2dc3715..756231a 100644 +index 1fe6055..441c69b 100644 --- a/qwtconfig.pri +++ b/qwtconfig.pri -@@ -72,7 +72,7 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features +@@ -72,7 +72,10 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features # it will be a static library. ###################################################################### --QWT_CONFIG += QwtDll -+# QWT_CONFIG += QwtDll ++CONFIG(dynamic, dynamic|static) { ++ + QWT_CONFIG += QwtDll ++} ###################################################################### # QwtPlot enables all classes, that are needed to use the QwtPlot diff --git a/ports/qwt/portfile.cmake b/ports/qwt/portfile.cmake index 918914a01..002272e24 100644 --- a/ports/qwt/portfile.cmake +++ b/ports/qwt/portfile.cmake @@ -1,30 +1,25 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/qwt-6.1.3) + vcpkg_download_distfile(ARCHIVE URLS "https://sourceforge.net/projects/qwt/files/qwt/6.1.3/qwt-6.1.3.zip" FILENAME "qwt-6.1.3.zip" SHA512 8f249e23d50f71d14fca37776ea40d8d6931db14d9602e03a343bfb7a9bf55502202103135b77f583c3890a7924220e8a142a01c448dbde311860d89a3b10fc8 ) -vcpkg_extract_source_archive(${ARCHIVE}) -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/build-shared-lib.patch" - QUIET - ) -else() - vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/build-static-lib.patch" - QUIET - ) -endif() +vcpkg_extract_source_archive_ex( + ARCHIVE ${ARCHIVE} + OUT_SOURCE_PATH SOURCE_PATH + PATCHES fix-dynamic-static.patch +) set(DEBUG_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") set(RELEASE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") -vcpkg_configure_qmake(SOURCE_PATH ${SOURCE_PATH}) +vcpkg_configure_qmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + CONFIG+=${VCPKG_LIBRARY_LINKAGE} +) vcpkg_build_qmake( RELEASE_TARGETS sub-src-release_ordered diff --git a/ports/ragel/CONTROL b/ports/ragel/CONTROL index 112128a52..1e23db117 100644 --- a/ports/ragel/CONTROL +++ b/ports/ragel/CONTROL @@ -1,4 +1,4 @@ Source: ragel -Version: 6.10-1 +Version: 6.10-2 Homepage: https://www.colm.net/files/ragel Description: Ragel State Machine Compiler diff --git a/ports/ragel/portfile.cmake b/ports/ragel/portfile.cmake index 00082e4bd..820ded5df 100644 --- a/ports/ragel/portfile.cmake +++ b/ports/ragel/portfile.cmake @@ -19,6 +19,7 @@ vcpkg_apply_patches( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/re2/CONTROL b/ports/re2/CONTROL index 4bf7106e7..d8ff925d8 100644 --- a/ports/re2/CONTROL +++ b/ports/re2/CONTROL @@ -1,4 +1,4 @@ Source: re2 -Version: 2019-05-07-1 +Version: 2019-05-07-2 Homepage: https://github.com/google/re2 Description: RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python. It is a C++ library. diff --git a/ports/re2/portfile.cmake b/ports/re2/portfile.cmake index ef2c9e842..690889c70 100644 --- a/ports/re2/portfile.cmake +++ b/ports/re2/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_from_github( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS -DRE2_BUILD_TESTING=OFF
)
diff --git a/ports/recast/CONTROL b/ports/recast/CONTROL index e19df38c8..3726b99d5 100644 --- a/ports/recast/CONTROL +++ b/ports/recast/CONTROL @@ -1,4 +1,4 @@ Source: recast
-Version: 1.5.1-2
+Version: 1.5.1-3
Homepage: https://github.com/recastnavigation/recastnavigation
Description: Navigation-mesh Toolset for Games
diff --git a/ports/recast/portfile.cmake b/ports/recast/portfile.cmake index a544971d8..a84d06e3c 100644 --- a/ports/recast/portfile.cmake +++ b/ports/recast/portfile.cmake @@ -14,6 +14,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/restbed/CONTROL b/ports/restbed/CONTROL index d0eab13ce..53f6ea0de 100644 --- a/ports/restbed/CONTROL +++ b/ports/restbed/CONTROL @@ -1,4 +1,8 @@ Source: restbed
-Version: 4.16-07-28-2018
+Version: 4.16-07-28-2018-1
Description: Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++11 applications.
-Build-Depends: asio
\ No newline at end of file +Build-Depends: asio
+
+Feature: openssl
+Build-Depends: openssl
+Description: Secure over the wire communication allowing you to transmit private data online.
\ No newline at end of file diff --git a/ports/restbed/add_openssl_support.patch b/ports/restbed/add_openssl_support.patch new file mode 100644 index 000000000..72d4dc406 --- /dev/null +++ b/ports/restbed/add_openssl_support.patch @@ -0,0 +1,37 @@ +diff --git a/cmake/Findopenssl.cmake b/cmake/Findopenssl.cmake +index 8db9799..626ff55 100644 +--- a/cmake/Findopenssl.cmake ++++ b/cmake/Findopenssl.cmake +@@ -1,24 +1,7 @@ +-find_library( ssl_LIBRARY_STATIC libssl.a ssleay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) +-find_library( crypto_LIBRARY_STATIC libcrypto.a libeay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) +- +-find_library( ssl_LIBRARY_SHARED libssl.so libssl.dylib ssleay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) +-find_library( crypto_LIBRARY_SHARED libcrypto.so libcrypto.dylib libeay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) +- +-find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include" ) +- +-if ( ssl_LIBRARY_STATIC AND ssl_LIBRARY_SHARED AND crypto_LIBRARY_STATIC AND crypto_LIBRARY_SHARED ) +- set( OPENSSL_FOUND TRUE ) +- add_definitions( -DBUILD_SSL=TRUE ) +- +- if ( APPLE AND BUILD_SSL ) +- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" ) +- endif( ) +- +- message( STATUS "Found OpenSSL include at: ${ssl_INCLUDE}" ) +- message( STATUS "Found OpenSSL library at: ${ssl_LIBRARY_STATIC}" ) +- message( STATUS "Found OpenSSL library at: ${ssl_LIBRARY_SHARED}" ) +- message( STATUS "Found Crypto library at: ${crypto_LIBRARY_STATIC}" ) +- message( STATUS "Found Crypto library at: ${crypto_LIBRARY_SHARED}" ) +-else ( ) +- message( FATAL_ERROR "Failed to locate OpenSSL dependency. see restbed/dependency/openssl; ./config shared; make all" ) +-endif ( ) ++if (BUILD_SSL) ++ set( OPENSSL_FOUND TRUE ) ++ add_definitions( -DBUILD_SSL=TRUE ) ++ if ( APPLE AND BUILD_SSL ) ++ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" ) ++ endif( ) ++endif() +\ No newline at end of file diff --git a/ports/restbed/portfile.cmake b/ports/restbed/portfile.cmake index 60f1247d8..7b4a2d944 100644 --- a/ports/restbed/portfile.cmake +++ b/ports/restbed/portfile.cmake @@ -11,11 +11,20 @@ vcpkg_from_github( PATCHES cmake.patch
)
+set(USE_OPENSSL OFF)
+if("openssl" IN_LIST FEATURES)
+ vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES add_openssl_support.patch
+ )
+ set(USE_OPENSSL ON)
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
- -DBUILD_SSL=OFF
+ -DBUILD_SSL=${USE_OPENSSL}
-DDISABLE_TESTS=ON
)
diff --git a/ports/restinio/CONTROL b/ports/restinio/CONTROL index a7c81a55f..fc536c2fe 100644 --- a/ports/restinio/CONTROL +++ b/ports/restinio/CONTROL @@ -1,4 +1,4 @@ Source: restinio -Version: 0.5.1-1 +Version: 0.5.1.1 Description: A header-only C++14 library that gives you an embedded HTTP/Websocket server targeted primarily for asynchronous processing of HTTP-requests. Build-Depends: asio, fmt, http-parser diff --git a/ports/restinio/portfile.cmake b/ports/restinio/portfile.cmake index 5ae3cc2e2..fa329a9bd 100644 --- a/ports/restinio/portfile.cmake +++ b/ports/restinio/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_bitbucket(
OUT_SOURCE_PATH SOURCE_PATH
REPO sobjectizerteam/restinio
- REF v.0.5.1
- SHA512 e8d1f9ac6dcb87012a656ba9f80412db93280b436199013ed36aa31398f0c0e65b634e2e714b9709afae717e2bc432891d5125f4af01b0d3a0ce79169de40870
+ REF v.0.5.1.1
+ SHA512 f5eedd53f4459936d4b32a4243c703a350a611bfc7b0c17c2bb047944cc054f8a93f9fd4904f76d601eb2ce0c9b078c33a6a545b5698ddaf63c3f5327dabd5f6
)
vcpkg_configure_cmake(
diff --git a/ports/riffcpp/CONTROL b/ports/riffcpp/CONTROL new file mode 100644 index 000000000..3667dd786 --- /dev/null +++ b/ports/riffcpp/CONTROL @@ -0,0 +1,4 @@ +Source: riffcpp +Version: 2.1.0 +Homepage: https://github.com/libdmusic/riffcpp +Description: Simple library for reading RIFF files diff --git a/ports/riffcpp/portfile.cmake b/ports/riffcpp/portfile.cmake new file mode 100644 index 000000000..85b623cb8 --- /dev/null +++ b/ports/riffcpp/portfile.cmake @@ -0,0 +1,26 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libdmusic/riffcpp + REF v2.2.1 + SHA512 646a98e6f6cd3995081a6242a866effab2968e20b2700248e3d19036bed426236e3844ad09d4b542e023f5f280d74575c47abe5e5e94ce0d77536f4f0a33b8c1 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DRIFFCPP_INSTALL_EXAMPLE=OFF +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/riffcpp) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/riffcpp/LICENSE ${CURRENT_PACKAGES_DIR}/share/riffcpp/copyright) +vcpkg_test_cmake(PACKAGE_NAME riffcpp)
\ No newline at end of file diff --git a/ports/rocksdb/CONTROL b/ports/rocksdb/CONTROL index 6daf694b5..1d37c85ca 100644 --- a/ports/rocksdb/CONTROL +++ b/ports/rocksdb/CONTROL @@ -1,5 +1,5 @@ Source: rocksdb -Version: 6.1.2 +Version: 6.1.2-1 Homepage: https://github.com/facebook/rocksdb Description: A library that provides an embeddable, persistent key-value store for fast storage Default-Features: zlib diff --git a/ports/rocksdb/portfile.cmake b/ports/rocksdb/portfile.cmake index 7cab8b7d9..e50a306fc 100644 --- a/ports/rocksdb/portfile.cmake +++ b/ports/rocksdb/portfile.cmake @@ -1,5 +1,7 @@ include(vcpkg_common_functions) +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO facebook/rocksdb @@ -26,44 +28,22 @@ string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" WITH_MD_LIBRARY) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ROCKSDB_DISABLE_INSTALL_SHARED_LIB) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ROCKSDB_DISABLE_INSTALL_STATIC_LIB) -set(WITH_LZ4 OFF) -if("lz4" IN_LIST FEATURES) - set(WITH_LZ4 ON) -endif() - -set(WITH_SNAPPY OFF) -if("snappy" IN_LIST FEATURES) - set(WITH_SNAPPY ON) -endif() - -set(WITH_ZLIB OFF) -if("zlib" IN_LIST FEATURES) - set(WITH_ZLIB ON) -endif() - -set(WITH_ZLIB OFF) -if("zstd" IN_LIST FEATURES) - set(WITH_ZLIB ON) -endif() - -set(WITH_TBB OFF) -set(ROCKSDB_IGNORE_PACKAGE_TBB TRUE) -if("tbb" IN_LIST FEATURES) - set(WITH_TBB ON) - set(ROCKSDB_IGNORE_PACKAGE_TBB FALSE) -endif() - +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + "lz4" WITH_LZ4 + "snappy" WITH_SNAPPY + "zlib" WITH_ZLIB + "zstd" WITH_ZSTD + "tbb" WITH_TBB + INVERTED_FEATURES + "tbb" CMAKE_DISABLE_FIND_PACKAGE_TBB +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DWITH_GFLAGS=0 - -DWITH_SNAPPY=${WITH_SNAPPY} - -DWITH_LZ4=${WITH_LZ4} - -DWITH_ZLIB=${WITH_ZLIB} - -DWITH_TBB=${WITH_TBB} - -DWITH_ZSTD=${WITH_ZSTD} -DWITH_TESTS=OFF -DUSE_RTTI=1 -DROCKSDB_INSTALL_ON_WINDOWS=ON @@ -73,10 +53,10 @@ vcpkg_configure_cmake( -DCMAKE_DEBUG_POSTFIX=d -DROCKSDB_DISABLE_INSTALL_SHARED_LIB=${ROCKSDB_DISABLE_INSTALL_SHARED_LIB} -DROCKSDB_DISABLE_INSTALL_STATIC_LIB=${ROCKSDB_DISABLE_INSTALL_STATIC_LIB} - -DCMAKE_DISABLE_FIND_PACKAGE_TBB=${ROCKSDB_IGNORE_PACKAGE_TBB} -DCMAKE_DISABLE_FIND_PACKAGE_NUMA=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_gtest=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE + ${FEATURE_OPTIONS} ) vcpkg_install_cmake() diff --git a/ports/rttr/portfile.cmake b/ports/rttr/portfile.cmake index a85a2b157..cb3bfe68c 100644 --- a/ports/rttr/portfile.cmake +++ b/ports/rttr/portfile.cmake @@ -1,7 +1,5 @@ include(vcpkg_common_functions) -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO rttrorg/rttr @@ -10,15 +8,23 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-directory-output.patch - remove-owner-read-perms.patch + remove-owner-read-perms.patch ) +#Handle static lib +set(BUILD_STATIC_LIB OFF) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(BUILD_STATIC_LIB ON) +else() + set(BUILD_STATIC_LIB OFF) +endif() vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS - -DBUILD_BENCHMARKS=OFF - -DBUILD_UNIT_TESTS=OFF + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_BENCHMARKS=OFF + -DBUILD_UNIT_TESTS=OFF + -DBUILD_STATIC=${BUILD_STATIC_LIB} ) vcpkg_install_cmake() @@ -31,6 +37,11 @@ else() message(FATAL_ERROR "RTTR does not support this platform") endif() +#Handle static lib +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + #Handle copyright file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/rttr) file(RENAME ${CURRENT_PACKAGES_DIR}/share/rttr/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/rttr/copyright) diff --git a/ports/sdl1/CONTROL b/ports/sdl1/CONTROL index ce37bc05d..59606dcb0 100644 --- a/ports/sdl1/CONTROL +++ b/ports/sdl1/CONTROL @@ -1,3 +1,3 @@ Source: sdl1 -Version: 1.2.15-5 +Version: 1.2.15-6 Description: Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. diff --git a/ports/sdl1/SDL.vcxproj b/ports/sdl1/SDL_dynamic.vcxproj index 1db10bb76..1db10bb76 100644 --- a/ports/sdl1/SDL.vcxproj +++ b/ports/sdl1/SDL_dynamic.vcxproj diff --git a/ports/sdl1/SDL_static.vcxproj b/ports/sdl1/SDL_static.vcxproj new file mode 100644 index 000000000..c435662ab --- /dev/null +++ b/ports/sdl1/SDL_static.vcxproj @@ -0,0 +1,354 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}</ProjectGuid>
+ <RootNamespace>SDL</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>15.0.27924.0</_ProjectFileVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/SDL.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Debug/SDL.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>winmm.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\Debug/SDL.dll</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/SDL.pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ <CLRUnmanagedCodeCheck>false</CLRUnmanagedCodeCheck>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\Debug/SDL.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Debug/SDL.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>winmm.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\Debug/SDL.dll</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/SDL.pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ <TargetMachine>MachineX64</TargetMachine>
+ <CLRUnmanagedCodeCheck>false</CLRUnmanagedCodeCheck>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/SDL.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Release/SDL.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>winmm.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\Release/SDL.dll</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ <ProgramDatabaseFile>.\Release/SDL.pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\Release/SDL.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Release/SDL.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>winmm.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\Release/SDL.dll</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ <ProgramDatabaseFile>.\Release/SDL.pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
+ <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" />
+ <ClCompile Include="..\..\src\audio\SDL_audio.c" />
+ <ClCompile Include="..\..\src\audio\SDL_audiocvt.c" />
+ <ClCompile Include="..\..\src\audio\SDL_mixer.c" />
+ <ClCompile Include="..\..\src\audio\SDL_mixer_MMX_VC.c" />
+ <ClCompile Include="..\..\src\audio\SDL_wave.c" />
+ <ClCompile Include="..\..\src\audio\windib\SDL_dibaudio.c" />
+ <ClCompile Include="..\..\src\audio\windx5\SDL_dx5audio.c" />
+ <ClCompile Include="..\..\src\cdrom\SDL_cdrom.c" />
+ <ClCompile Include="..\..\src\cdrom\win32\SDL_syscdrom.c" />
+ <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
+ <ClCompile Include="..\..\src\events\SDL_active.c" />
+ <ClCompile Include="..\..\src\events\SDL_events.c" />
+ <ClCompile Include="..\..\src\events\SDL_expose.c" />
+ <ClCompile Include="..\..\src\events\SDL_keyboard.c" />
+ <ClCompile Include="..\..\src\events\SDL_mouse.c" />
+ <ClCompile Include="..\..\src\events\SDL_quit.c" />
+ <ClCompile Include="..\..\src\events\SDL_resize.c" />
+ <ClCompile Include="..\..\src\file\SDL_rwops.c" />
+ <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
+ <ClCompile Include="..\..\src\joystick\win32\SDL_mmjoystick.c" />
+ <ClCompile Include="..\..\src\loadso\win32\SDL_sysloadso.c" />
+ <ClCompile Include="..\..\src\SDL.c" />
+ <ClCompile Include="..\..\src\SDL_error.c" />
+ <ClCompile Include="..\..\src\SDL_fatal.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
+ <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
+ <ClCompile Include="..\..\src\thread\SDL_thread.c" />
+ <ClCompile Include="..\..\src\thread\win32\SDL_sysmutex.c" />
+ <ClCompile Include="..\..\src\thread\win32\SDL_syssem.c" />
+ <ClCompile Include="..\..\src\thread\win32\SDL_systhread.c" />
+ <ClCompile Include="..\..\src\timer\SDL_timer.c" />
+ <ClCompile Include="..\..\src\timer\win32\SDL_systimer.c" />
+ <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />
+ <ClCompile Include="..\..\src\video\dummy\SDL_nullmouse.c" />
+ <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c" />
+ <ClCompile Include="..\..\src\video\SDL_blit.c" />
+ <ClCompile Include="..\..\src\video\SDL_blit_0.c" />
+ <ClCompile Include="..\..\src\video\SDL_blit_1.c" />
+ <ClCompile Include="..\..\src\video\SDL_blit_A.c" />
+ <ClCompile Include="..\..\src\video\SDL_blit_N.c" />
+ <ClCompile Include="..\..\src\video\SDL_bmp.c" />
+ <ClCompile Include="..\..\src\video\SDL_cursor.c" />
+ <ClCompile Include="..\..\src\video\SDL_gamma.c" />
+ <ClCompile Include="..\..\src\video\SDL_pixels.c" />
+ <ClCompile Include="..\..\src\video\SDL_RLEaccel.c" />
+ <ClCompile Include="..\..\src\video\SDL_stretch.c" />
+ <ClCompile Include="..\..\src\video\SDL_surface.c" />
+ <ClCompile Include="..\..\src\video\SDL_video.c" />
+ <ClCompile Include="..\..\src\video\SDL_yuv.c" />
+ <ClCompile Include="..\..\src\video\SDL_yuv_sw.c" />
+ <ClCompile Include="..\..\src\video\wincommon\SDL_sysevents.c" />
+ <ClCompile Include="..\..\src\video\wincommon\SDL_sysmouse.c" />
+ <ClCompile Include="..\..\src\video\wincommon\SDL_syswm.c" />
+ <ClCompile Include="..\..\src\video\wincommon\SDL_wingl.c" />
+ <ClCompile Include="..\..\src\video\windib\SDL_dibevents.c" />
+ <ClCompile Include="..\..\src\video\windib\SDL_dibvideo.c" />
+ <ClCompile Include="..\..\src\video\Windx5\SDL_dx5events.c" />
+ <ClCompile Include="..\..\src\video\Windx5\SDL_dx5video.c" />
+ <ClCompile Include="..\..\src\video\windx5\SDL_dx5yuv.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
+ <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" />
+ <ClInclude Include="..\..\src\audio\SDL_audiomem.h" />
+ <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
+ <ClInclude Include="..\..\src\audio\SDL_sysaudio.h" />
+ <ClInclude Include="..\..\src\audio\SDL_wave.h" />
+ <ClInclude Include="..\..\src\audio\windib\SDL_dibaudio.h" />
+ <ClInclude Include="..\..\src\audio\windx5\SDL_dx5audio.h" />
+ <ClInclude Include="..\..\src\cdrom\SDL_syscdrom.h" />
+ <ClInclude Include="..\..\src\events\SDL_events_c.h" />
+ <ClInclude Include="..\..\src\events\SDL_sysevents.h" />
+ <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
+ <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
+ <ClInclude Include="..\..\src\SDL_error_c.h" />
+ <ClInclude Include="..\..\src\SDL_fatal.h" />
+ <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
+ <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
+ <ClInclude Include="..\..\src\thread\win32\SDL_systhread_c.h" />
+ <ClInclude Include="..\..\src\timer\SDL_systimer.h" />
+ <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
+ <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
+ <ClInclude Include="..\..\src\video\dummy\SDL_nullmouse_c.h" />
+ <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h" />
+ <ClInclude Include="..\..\src\video\SDL_blit.h" />
+ <ClInclude Include="..\..\src\video\SDL_blit_A.h" />
+ <ClInclude Include="..\..\src\video\SDL_cursor_c.h" />
+ <ClInclude Include="..\..\src\video\SDL_leaks.h" />
+ <ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
+ <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
+ <ClInclude Include="..\..\src\video\SDL_stretch_c.h" />
+ <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
+ <ClInclude Include="..\..\src\video\SDL_yuvfuncs.h" />
+ <ClInclude Include="..\..\src\video\SDL_yuv_sw_c.h" />
+ <ClInclude Include="..\..\src\video\wincommon\SDL_lowvideo.h" />
+ <ClInclude Include="..\..\src\video\wincommon\SDL_sysmouse_c.h" />
+ <ClInclude Include="..\..\src\video\wincommon\SDL_syswm_c.h" />
+ <ClInclude Include="..\..\src\video\wincommon\SDL_wingl_c.h" />
+ <ClInclude Include="..\..\src\video\wincommon\Wmmsg.h" />
+ <ClInclude Include="..\..\src\video\windib\SDL_dibevents_c.h" />
+ <ClInclude Include="..\..\src\video\windib\SDL_dibvideo.h" />
+ <ClInclude Include="..\..\src\video\windib\SDL_vkeys.h" />
+ <ClInclude Include="..\..\src\video\Windx5\SDL_dx5events_c.h" />
+ <ClInclude Include="..\..\src\video\Windx5\SDL_dx5video.h" />
+ <ClInclude Include="..\..\src\video\windx5\SDL_dx5yuv_c.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/ports/sdl1/SDLmain.vcxproj b/ports/sdl1/SDLmain_dynamic.vcxproj index 228045d41..228045d41 100644 --- a/ports/sdl1/SDLmain.vcxproj +++ b/ports/sdl1/SDLmain_dynamic.vcxproj diff --git a/ports/sdl1/SDLmain_static.vcxproj b/ports/sdl1/SDLmain_static.vcxproj new file mode 100644 index 000000000..3f3b6ca01 --- /dev/null +++ b/ports/sdl1/SDLmain_static.vcxproj @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_NoSTDIO|Win32">
+ <Configuration>Release_NoSTDIO</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_NoSTDIO|x64">
+ <Configuration>Release_NoSTDIO</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}</ProjectGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>15.0.27924.0</_ProjectFileVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>.\Release\</OutDir>
+ <IntDir>.\Release\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|Win32'">
+ <OutDir>.\Release_NOSTDIO\</OutDir>
+ <IntDir>.\Release_NOSTDIO\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|x64'">
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>.\Debug\</OutDir>
+ <IntDir>.\Debug\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Release/SDLmain.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Release/SDLmain.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|Win32'">
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;NO_STDIO_REDIRECT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Release_NOSTDIO/SDLmain.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;NO_STDIO_REDIRECT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Release_NOSTDIO/SDLmain.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Debug/SDLmain.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>OldStyle</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>.\Debug/SDLmain.pch</PrecompiledHeaderOutputFile>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>OldStyle</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\Src\Main\Win32\SDL_win32_main.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/ports/sdl1/portfile.cmake b/ports/sdl1/portfile.cmake index 2cbdfc42c..4e8d512df 100644 --- a/ports/sdl1/portfile.cmake +++ b/ports/sdl1/portfile.cmake @@ -9,18 +9,16 @@ vcpkg_from_github( PATCHES export-symbols-only-in-shared-build.patch ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDL1_2017.sln DESTINATION ${SOURCE_PATH}/VisualC/ ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDL.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDL ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDLmain.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDLmain ) - configure_file(${SOURCE_PATH}/include/SDL_config.h.default ${SOURCE_PATH}/include/SDL_config.h COPYONLY) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDL1_2017.sln DESTINATION ${SOURCE_PATH}/VisualC/ ) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/static-build.patch - ) + file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/SDL_static.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDL RENAME SDL.vcxproj) + file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/SDLmain_static.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDLmain RENAME SDLmain.vcxproj) +else() + file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/SDL_dynamic.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDL RENAME SDL.vcxproj) + file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/SDLmain_dynamic.vcxproj DESTINATION ${SOURCE_PATH}/VisualC/SDLmain RENAME SDLmain.vcxproj) endif() # This text file gets copied as a library, and included as one in the package diff --git a/ports/sdl1/static-build.patch b/ports/sdl1/static-build.patch deleted file mode 100644 index 89bc39ddc..000000000 --- a/ports/sdl1/static-build.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- a/VisualC/SDL/SDL.vcxproj Sun Mar 31 11:28:40 2019
-+++ b/VisualC/SDL/SDL.vcxproj Sun Mar 31 19:00:00 2019
-@@ -26,3 +26,3 @@
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-- <ConfigurationType>DynamicLibrary</ConfigurationType>
-+ <ConfigurationType>StaticLibrary</ConfigurationType>
- <PlatformToolset>v141</PlatformToolset>
-@@ -31,3 +31,3 @@
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-- <ConfigurationType>DynamicLibrary</ConfigurationType>
-+ <ConfigurationType>StaticLibrary</ConfigurationType>
- <PlatformToolset>v141</PlatformToolset>
-@@ -36,3 +36,3 @@
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-- <ConfigurationType>DynamicLibrary</ConfigurationType>
-+ <ConfigurationType>StaticLibrary</ConfigurationType>
- <PlatformToolset>v141</PlatformToolset>
-@@ -41,3 +41,3 @@
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-- <ConfigurationType>DynamicLibrary</ConfigurationType>
-+ <ConfigurationType>StaticLibrary</ConfigurationType>
- <PlatformToolset>v141</PlatformToolset>
-@@ -100,3 +100,3 @@
- <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
-@@ -137,3 +137,3 @@
- <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
-@@ -176,3 +176,3 @@
- <StringPooling>true</StringPooling>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
-@@ -213,3 +213,3 @@
- <StringPooling>true</StringPooling>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
---- a/VisualC/SDLmain/SDLmain.vcxproj Sun Mar 31 11:28:40 2019
-+++ b/VisualC/SDLmain/SDLmain.vcxproj Sun Mar 31 19:00:00 2019
-@@ -123,3 +123,3 @@
- <StringPooling>true</StringPooling>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
-@@ -140,3 +140,3 @@
- <StringPooling>true</StringPooling>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
-@@ -154,3 +154,3 @@
- <StringPooling>true</StringPooling>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
-@@ -171,3 +171,3 @@
- <StringPooling>true</StringPooling>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
-@@ -184,3 +184,3 @@
- <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader />
-@@ -200,3 +200,3 @@
- <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader />
diff --git a/ports/sdl2-gfx/CONTROL b/ports/sdl2-gfx/CONTROL index 96a4d2776..8b4af0e61 100644 --- a/ports/sdl2-gfx/CONTROL +++ b/ports/sdl2-gfx/CONTROL @@ -1,4 +1,4 @@ Source: sdl2-gfx -Version: 1.0.4-1 +Version: 1.0.4-2 Build-Depends: sdl2 Description: Graphics primitives (line, circle, rectangle etc.) with AA support, rotozoomer and other drawing related support functions wrapped up in a C based add-on library for the Simple Direct Media (SDL) cross-platform API layer. diff --git a/ports/sdl2-gfx/portfile.cmake b/ports/sdl2-gfx/portfile.cmake index 9cc6a6ca8..ce83fd21e 100644 --- a/ports/sdl2-gfx/portfile.cmake +++ b/ports/sdl2-gfx/portfile.cmake @@ -18,6 +18,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DSDL_GFX_SKIP_HEADERS=1 ) diff --git a/ports/sdl2-image/CONTROL b/ports/sdl2-image/CONTROL index 1c28b50f0..19218ef3e 100644 --- a/ports/sdl2-image/CONTROL +++ b/ports/sdl2-image/CONTROL @@ -1,5 +1,5 @@ Source: sdl2-image -Version: 2.0.4-3 +Version: 2.0.5 Build-Depends: sdl2, libpng Homepage: https://www.libsdl.org/projects/SDL_image Description: SDL_image is an image file loading library. It loads images as SDL surfaces and textures, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV diff --git a/ports/sdl2-image/portfile.cmake b/ports/sdl2-image/portfile.cmake index a1e69af54..ea4744148 100644 --- a/ports/sdl2-image/portfile.cmake +++ b/ports/sdl2-image/portfile.cmake @@ -1,11 +1,11 @@ include(vcpkg_common_functions) -set(SDL2_IMAGE_VERSION "2.0.4") +set(SDL2_IMAGE_VERSION "2.0.5") vcpkg_download_distfile(ARCHIVE URLS "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-${SDL2_IMAGE_VERSION}.zip" FILENAME "SDL2_image-${SDL2_IMAGE_VERSION}.zip" - SHA512 b26ef2546718754481385ddad800ee61c84c58a9e141127c0a12215362d41c23603bfb21d556803396c0cb17bd7f48a45dd1b2e66573a1b2e32f590cc3fa48d0 + SHA512 c10e28a0d50fb7a6c985ffe8904370ab4faeb9bbed6f2ffbc81536422e8f8bb66eddbf69b12423082216c2bcfcb617cba4c5970f63fe75bfacccd9f99f02a6a2 ) vcpkg_extract_source_archive_ex( diff --git a/ports/septag-sx/CONTROL b/ports/septag-sx/CONTROL index a9748b910..ee9917e66 100644 --- a/ports/septag-sx/CONTROL +++ b/ports/septag-sx/CONTROL @@ -1,3 +1,3 @@ Source: septag-sx -Version: 2019-05-07-1 +Version: 2019-05-07-2 Description: Portable base library for C programmers, designed for performance and simplicity. diff --git a/ports/septag-sx/portfile.cmake b/ports/septag-sx/portfile.cmake index d77545134..4fb87a250 100644 --- a/ports/septag-sx/portfile.cmake +++ b/ports/septag-sx/portfile.cmake @@ -16,6 +16,7 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SX_SHARED_LIB) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DSX_BUILD_TESTS=OFF -DSX_SHARED_LIB=${SX_SHARED_LIB} diff --git a/ports/sfml/CONTROL b/ports/sfml/CONTROL index d23645a30..606095d88 100644 --- a/ports/sfml/CONTROL +++ b/ports/sfml/CONTROL @@ -1,5 +1,5 @@ Source: sfml
-Version: 2.5.1-1
+Version: 2.5.1-2
Homepage: https://github.com/sfml/sfml
Description: Simple and fast multimedia library
Build-Depends: freetype, libflac, libogg, libvorbis, openal-soft, stb
diff --git a/ports/sfml/portfile.cmake b/ports/sfml/portfile.cmake index a25c5628b..a4c0d89c4 100644 --- a/ports/sfml/portfile.cmake +++ b/ports/sfml/portfile.cmake @@ -21,6 +21,7 @@ endif() vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DSFML_BUILD_FRAMEWORKS=OFF
-DSFML_USE_SYSTEM_DEPS=ON
diff --git a/ports/shaderc/CONTROL b/ports/shaderc/CONTROL index 044fdd410..0878b17be 100644 --- a/ports/shaderc/CONTROL +++ b/ports/shaderc/CONTROL @@ -1,5 +1,5 @@ Source: shaderc -Version: 2019-06-26 +Version: 2019-06-26-1 Homepage: https://github.com/google/shaderc Description: A collection of tools, libraries and tests for shader compilation. Build-Depends: glslang, spirv-tools
\ No newline at end of file diff --git a/ports/shaderc/portfile.cmake b/ports/shaderc/portfile.cmake index fbdc1e4dd..297842296 100644 --- a/ports/shaderc/portfile.cmake +++ b/ports/shaderc/portfile.cmake @@ -32,6 +32,7 @@ vcpkg_add_to_path(PREPEND "${PYTHON3_EXE_PATH}") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DSHADERC_SKIP_TESTS=true ${OPTIONS} -Dglslang_SOURCE_DIR=${CURRENT_INSTALLED_DIR}/include -Dspirv-tools_SOURCE_DIR=${CURRENT_INSTALLED_DIR}/include OPTIONS_DEBUG -DSUFFIX_D=true OPTIONS_RELEASE -DSUFFIX_D=false diff --git a/ports/signalrclient/CONTROL b/ports/signalrclient/CONTROL index e64b920ba..85e4427d5 100644 --- a/ports/signalrclient/CONTROL +++ b/ports/signalrclient/CONTROL @@ -1,5 +1,5 @@ Source: signalrclient -Version: 1.0.0-beta1-6 +Version: 1.0.0-beta1-7 Build-Depends: cpprestsdk, openssl Homepage: https://github.com/aspnet/SignalR-Client-Cpp Description: C++ client for SignalR. diff --git a/ports/signalrclient/portfile.cmake b/ports/signalrclient/portfile.cmake index e3b6e7c4d..39f1992b8 100644 --- a/ports/signalrclient/portfile.cmake +++ b/ports/signalrclient/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DCPPREST_SO=${CURRENT_INSTALLED_DIR}/debug/lib/cpprest_2_10d.lib OPTIONS_RELEASE diff --git a/ports/simdjson/CONTROL b/ports/simdjson/CONTROL index 8c71eeee5..df8c5deba 100644 --- a/ports/simdjson/CONTROL +++ b/ports/simdjson/CONTROL @@ -1,3 +1,4 @@ Source: simdjson
-Version: 2019-03-09
+Version: 2019-08-05
Description: A extremely fast JSON library that can parse gigabytes of JSON per second
+Homepage: https://github.com/lemire/simdjson
diff --git a/ports/simdjson/portfile.cmake b/ports/simdjson/portfile.cmake index f6b2f347a..a5eea7b68 100644 --- a/ports/simdjson/portfile.cmake +++ b/ports/simdjson/portfile.cmake @@ -10,8 +10,8 @@ endif() vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lemire/simdjson
- REF d2fa086198b77df44e7fa48b25200e118fa81eb0
- SHA512 fe92b65e44502381d286b6a7c949055d185e56e7c244a5ab3086b2fe7da76ce81a966daa2d8459794ff0a911b426b1c77e1fc9ef0d616e20868621b1bb30cf67
+ REF d9a0e2b8f441c20ad46276fdb8ce24f2aebdc07b
+ SHA512 05523c59b95485b93646370ac1ef9f80a72351a5bfe76797c5bbbf249bedd81b962dad19040a7eaac80744aaec18be9bec1120da44a9a1e4328e68b3d671bdaf
HEAD_REF master
)
@@ -22,6 +22,8 @@ vcpkg_configure_cmake( PREFER_NINJA
OPTIONS
-DSIMDJSON_BUILD_STATIC=${SIMDJSON_BUILD_STATIC}
+ OPTIONS_DEBUG
+ -DSIMDJSON_SANITIZE=ON
)
vcpkg_install_cmake()
@@ -38,4 +40,4 @@ file(REMOVE_RECURSE configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
# CMake integration test
-#vcpkg_test_cmake(PACKAGE_NAME ${PORT})
+vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/so5extra/CONTROL b/ports/so5extra/CONTROL index 882ac0712..fbe4a1e16 100644 --- a/ports/so5extra/CONTROL +++ b/ports/so5extra/CONTROL @@ -1,4 +1,4 @@ Source: so5extra -Version: 1.2.3-1 +Version: 1.3.1-1 Description: A set of additional tools for SObjectizer framework. Build-Depends: sobjectizer diff --git a/ports/so5extra/portfile.cmake b/ports/so5extra/portfile.cmake index 26472935e..71e1cb443 100644 --- a/ports/so5extra/portfile.cmake +++ b/ports/so5extra/portfile.cmake @@ -1,17 +1,18 @@ include(vcpkg_common_functions) -set(VERSION 1.2.3) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/so_5_extra-${VERSION}/dev/so_5_extra) +set(VERSION 1.3.1) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/so5extra-${VERSION}/dev/so_5_extra) vcpkg_download_distfile(ARCHIVE - URLS "https://sourceforge.net/projects/sobjectizer/files/sobjectizer/so_5_extra/so_5_extra-${VERSION}.zip/download" - FILENAME "so_5_extra-${VERSION}.zip" - SHA512 ed12cdae9d23d652cbedd12e37b7faa935ace4c951eb5cb3881306c1384973ac0a90bd59244471a671ec734f6319f0a3144f7a727342c94cec6330eb4195bae9 + URLS "https://sourceforge.net/projects/sobjectizer/files/sobjectizer/so_5_extra/so5extra-${VERSION}.tar.bz2/download" + FILENAME "so5extra-${VERSION}.tar.bz2" + SHA512 58532426f85121f8f6c3b18a70950c048c8a695a7fca7be5d9c95434bdabdb2bfcf73d755737434a8d8aa5f3051785e13e7e293e057527c72047dad293a56ae7 ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DSO5EXTRA_INSTALL=ON ) diff --git a/ports/sobjectizer/CONTROL b/ports/sobjectizer/CONTROL index 3e37f70e3..f5bfe31c0 100644 --- a/ports/sobjectizer/CONTROL +++ b/ports/sobjectizer/CONTROL @@ -1,4 +1,4 @@ Source: sobjectizer -Version: 5.5.24.4-1 +Version: 5.6.0.2 Homepage: https://sourceforge.net/projects/sobjectizer Description: SObjectizer is a C++ in-process message dispatching framework with implementation of Actor Model, Publish-Subscribe Model and CSP-like channels. diff --git a/ports/sobjectizer/portfile.cmake b/ports/sobjectizer/portfile.cmake index 4588ea4f2..8231f372e 100644 --- a/ports/sobjectizer/portfile.cmake +++ b/ports/sobjectizer/portfile.cmake @@ -1,12 +1,12 @@ include(vcpkg_common_functions) -set(VERSION 5.5.24.4) +set(VERSION 5.6.0.2) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/so-${VERSION}/dev) vcpkg_download_distfile(ARCHIVE - URLS "https://sourceforge.net/projects/sobjectizer/files/sobjectizer/SObjectizer%20Core%20v.5.5/so-${VERSION}.zip" - FILENAME "so-${VERSION}.zip" - SHA512 83f20091b9aa9ecec08b72a97c9190da7bfbe7cc69076dd70074f814208a2712ec722a8c9e7367ab8a416a5c0d488edebb6066371f7cec5dd566f51ef297b382 + URLS "https://sourceforge.net/projects/sobjectizer/files/sobjectizer/SObjectizer%20Core%20v.5.6/so-${VERSION}.tar.bz2" + FILENAME "so-${VERSION}.tar.bz2" + SHA512 8f330c757fe401d715584da224925158d97ab5bba59e442af29ac64cb6feeae00434bd9bf11601f0796737f901a4f8ada1728b60d5706294d607d4d365c2d6da ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/sol2/portfile.cmake b/ports/sol2/portfile.cmake index ee89b9f54..a055d18b1 100644 --- a/ports/sol2/portfile.cmake +++ b/ports/sol2/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ThePhD/sol2 - REF 5a4d7dca7f77e65aed15c0fb8f8acf1570677335 - SHA512 5fc88a000d7a8379c3c8d8ee2dc3371514c4a58dcc3340b700565278ec69b7be0f108d599e3fe3b3ca347ef7c5b25ac01d83b1a988ac0189c8517b6ae66e96d6 + REF 57990845726e17fba11a39cfcb1fc0127a7ea638 + SHA512 3894610a08f7a47c43fc14e2abe750fc41ce7ea90106a6f0290d1ae2bbcc829d340f2c211426686c061a42a77effec1f1c898f19153e9f904e5fab416c7b6399 HEAD_REF develop ) diff --git a/ports/spaceland/CONTROL b/ports/spaceland/CONTROL index 4f885e6eb..97b5a9156 100644 --- a/ports/spaceland/CONTROL +++ b/ports/spaceland/CONTROL @@ -1,4 +1,4 @@ Source: spaceland
-Version: 7.8.2-2
+Version: 7.8.2-3
Description: Spaceland Lib (sl) is a suite for geometric computation, specifically adapted to OpenGL.
Build-Depends: zlib
diff --git a/ports/spaceland/portfile.cmake b/ports/spaceland/portfile.cmake index d90ceafd7..def38d6d1 100644 --- a/ports/spaceland/portfile.cmake +++ b/ports/spaceland/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DSL_TEST=OFF
diff --git a/ports/spdlog/CONTROL b/ports/spdlog/CONTROL index aa5474709..0864d7858 100644 --- a/ports/spdlog/CONTROL +++ b/ports/spdlog/CONTROL @@ -1,5 +1,5 @@ Source: spdlog -Version: 1.3.1-1 +Version: 1.3.1-2 Homepage: https://github.com/gabime/spdlog Description: Very fast, header only, C++ logging library Build-Depends: fmt diff --git a/ports/spdlog/portfile.cmake b/ports/spdlog/portfile.cmake index 37cd8644f..d25f78712 100644 --- a/ports/spdlog/portfile.cmake +++ b/ports/spdlog/portfile.cmake @@ -27,7 +27,11 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/spdlog) +if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake/${PORT}") + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) +elseif(EXISTS "${CURRENT_PACKAGES_DIR}/lib/${PORT}/cmake") + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/${PORT}/cmake) +endif() vcpkg_copy_pdbs() diff --git a/ports/speexdsp/CONTROL b/ports/speexdsp/CONTROL index d96eb11c1..793281d41 100644 --- a/ports/speexdsp/CONTROL +++ b/ports/speexdsp/CONTROL @@ -1,5 +1,5 @@ Source: speexdsp -Version: 1.2rc3-2 +Version: 1.2rc3-3 Homepage: https://ftp.osuosl.org/pub/xiph/releases/speex/ Description: A patent-free, Open Source/Free Software DSP library. Build-Depends: diff --git a/ports/speexdsp/portfile.cmake b/ports/speexdsp/portfile.cmake index 72bc313d7..0cc6ac71c 100644 --- a/ports/speexdsp/portfile.cmake +++ b/ports/speexdsp/portfile.cmake @@ -16,6 +16,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${CMAKE_PATH} + PREFER_NINJA OPTIONS -DSOURCE_PATH=${SOURCE_PATH} -DUSE_SSE=${USE_SSE} ) diff --git a/ports/spscqueue/CONTROL b/ports/spscqueue/CONTROL new file mode 100644 index 000000000..e8330caaa --- /dev/null +++ b/ports/spscqueue/CONTROL @@ -0,0 +1,4 @@ +Source: spscqueue +Version: 2019-07-26 +Description: A bounded single-producer single-consumer wait-free and lock-free queue written in C++11 +Homepage: https://github.com/rigtorp/SPSCQueue diff --git a/ports/spscqueue/portfile.cmake b/ports/spscqueue/portfile.cmake new file mode 100644 index 000000000..5bc0628bc --- /dev/null +++ b/ports/spscqueue/portfile.cmake @@ -0,0 +1,19 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO rigtorp/SPSCQueue + REF 5165a08ac4474c77c636050332eca6ebfdd53533 + SHA512 30cd60711f816e6003a5b114c48bd12da449cb7b0f19aa58dd57e3abc3e5200847c3eb492627b4013f57eec11d5d6f0a11fedbcb21dd8dd5c44682c49456e4e1 + HEAD_REF master +) + +file(COPY + ${SOURCE_PATH}/include/rigtorp/SPSCQueue.h + DESTINATION ${CURRENT_PACKAGES_DIR}/include/rigtorp +) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index 081ea47b8..d4109ccc9 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -1,5 +1,5 @@ Source: sqlite3 -Version: 3.28.0-2 +Version: 3.29.0-1 Homepage: https://sqlite.org/ Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index b9be87433..4ddc2d8b2 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -1,7 +1,7 @@ include(vcpkg_common_functions)
-set(SQLITE_VERSION 3280000)
-set(SQLITE_HASH 6a2b9c0accd286b09d7e077393a627e22112ef11c76ff6a5896f5ff1a11eb62a8b2700f5a99eebda82df63b3968814ca460582aa4619852f96a899d2f59b9f8d)
+set(SQLITE_VERSION 3290000)
+set(SQLITE_HASH 3306ac3e37ec46f1b2ac74155756c82afadff7bf5b8b4c9b5516f5e8c1c785b5f50ec9b840482292f2f6c5d72cf6d9a78a0dfb727f0a9cf134b6c5522606e9b3 )
vcpkg_download_distfile(ARCHIVE
URLS "https://sqlite.org/2019/sqlite-amalgamation-${SQLITE_VERSION}.zip"
diff --git a/ports/sqlpp11-connector-mysql/CONTROL b/ports/sqlpp11-connector-mysql/CONTROL index e56275137..78817eae7 100644 --- a/ports/sqlpp11-connector-mysql/CONTROL +++ b/ports/sqlpp11-connector-mysql/CONTROL @@ -1,4 +1,4 @@ Source: sqlpp11-connector-mysql
-Version: 0.25-1
+Version: 0.25-2
Description: A C++ wrapper for MySQL meant to be used in combination with sqlpp11.
Build-Depends: date, libmariadb, sqlpp11
diff --git a/ports/sqlpp11-connector-mysql/portfile.cmake b/ports/sqlpp11-connector-mysql/portfile.cmake index fbaaebaf1..9f93058a4 100644 --- a/ports/sqlpp11-connector-mysql/portfile.cmake +++ b/ports/sqlpp11-connector-mysql/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_from_github( # Use sqlpp11-connector-mysql's own build process, skipping tests
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DENABLE_TESTS:BOOL=OFF
-DDATE_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include
diff --git a/ports/sqlpp11-connector-sqlite3/CONTROL b/ports/sqlpp11-connector-sqlite3/CONTROL index 25e680eda..564a9a9a4 100644 --- a/ports/sqlpp11-connector-sqlite3/CONTROL +++ b/ports/sqlpp11-connector-sqlite3/CONTROL @@ -1,4 +1,4 @@ Source: sqlpp11-connector-sqlite3
-Version: 0.29-1
+Version: 0.29-2
Description: A C++ wrapper for sqlite3 meant to be used in combination with sqlpp11.
Build-Depends: date, sqlite3, sqlpp11
diff --git a/ports/sqlpp11-connector-sqlite3/portfile.cmake b/ports/sqlpp11-connector-sqlite3/portfile.cmake index 735912a86..6587df313 100644 --- a/ports/sqlpp11-connector-sqlite3/portfile.cmake +++ b/ports/sqlpp11-connector-sqlite3/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_from_github( # Use sqlpp11-connector-sqlite3's own build process, skipping tests
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DENABLE_TESTS:BOOL=OFF
-DSQLPP11_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include
diff --git a/ports/sqlpp11/CONTROL b/ports/sqlpp11/CONTROL index 282598dc5..b371f0a8c 100644 --- a/ports/sqlpp11/CONTROL +++ b/ports/sqlpp11/CONTROL @@ -1,4 +1,4 @@ Source: sqlpp11
-Version: 0.58 +Version: 0.58-1 Description: A type safe embedded domain specific language for SQL queries and results in C++.
Build-Depends: date
diff --git a/ports/sqlpp11/portfile.cmake b/ports/sqlpp11/portfile.cmake index a11d563d9..7fe915213 100644 --- a/ports/sqlpp11/portfile.cmake +++ b/ports/sqlpp11/portfile.cmake @@ -12,6 +12,7 @@ vcpkg_from_github( # Use sqlpp11's own build process, skipping tests
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DENABLE_TESTS:BOOL=OFF
)
diff --git a/ports/stlab/CONTROL b/ports/stlab/CONTROL index 01651f59b..6a289c531 100644 --- a/ports/stlab/CONTROL +++ b/ports/stlab/CONTROL @@ -1,5 +1,5 @@ Source: stlab
-Version: 1.4.1
+Version: 1.4.1-1
Description:
stlab is the ongoing work of what was Adobe’s Software Technology Lab.
The Concurrency library provides futures and channels, high level constructs for implementing algorithms that eases the use of multiple CPU cores while minimizing contention. This library solves several problems of the C++11 and C++17 TS futures.
diff --git a/ports/stlab/portfile.cmake b/ports/stlab/portfile.cmake index 7c8925d93..2bcb7d102 100644 --- a/ports/stlab/portfile.cmake +++ b/ports/stlab/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_from_github( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DBUILD_TESTING=OFF
)
diff --git a/ports/stormlib/CMakeLists.txt b/ports/stormlib/CMakeLists.txt new file mode 100644 index 000000000..6b0e2a66c --- /dev/null +++ b/ports/stormlib/CMakeLists.txt @@ -0,0 +1,279 @@ +cmake_minimum_required(VERSION 3.9)
+project(stormlib)
+
+set(SRC_FILES
+ stormlib_dll/StormLib.def
+ src/adpcm/adpcm.cpp
+ src/huffman/huff.cpp
+ src/jenkins/lookup3.c
+ src/lzma/C/LzFind.c
+ src/lzma/C/LzmaDec.c
+ src/lzma/C/LzmaEnc.c
+ src/pklib/explode.c
+ src/pklib/implode.c
+ src/sparse/sparse.cpp
+ src/FileStream.cpp
+ src/SBaseCommon.cpp
+ src/SBaseDumpData.cpp
+ src/SBaseFileTable.cpp
+ src/SBaseSubTypes.cpp
+ src/SCompression.cpp
+ src/SFileAddFile.cpp
+ src/SFileAttributes.cpp
+ src/SFileCompactArchive.cpp
+ src/SFileCreateArchive.cpp
+ src/SFileExtractFile.cpp
+ src/SFileFindFile.cpp
+ src/SFileGetFileInfo.cpp
+ src/SFileListFile.cpp
+ src/SFileOpenArchive.cpp
+ src/SFileOpenFileEx.cpp
+ src/SFilePatchArchives.cpp
+ src/SFileReadFile.cpp
+ src/SFileVerify.cpp
+ src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c
+ src/libtomcrypt/src/misc/crypt_libc.c
+)
+
+if(MSVC)
+ # This file is used to create a DLL on windows
+ # Use BUILD_SHARED_LIBS to create StormLib.dll
+ set(STORM_DEF_FILES
+ stormlib_dll/StormLib.def
+ )
+endif()
+
+set(TOMCRYPT_FILES
+ src/libtomcrypt/src/hashes/hash_memory.c
+ src/libtomcrypt/src/hashes/md5.c
+ src/libtomcrypt/src/hashes/sha1.c
+ src/libtomcrypt/src/math/ltm_desc.c
+ src/libtomcrypt/src/math/multi.c
+ src/libtomcrypt/src/math/rand_prime.c
+ src/libtomcrypt/src/misc/base64_decode.c
+ src/libtomcrypt/src/misc/crypt_argchk.c
+ src/libtomcrypt/src/misc/crypt_find_hash.c
+ src/libtomcrypt/src/misc/crypt_find_prng.c
+ src/libtomcrypt/src/misc/crypt_hash_descriptor.c
+ src/libtomcrypt/src/misc/crypt_hash_is_valid.c
+ src/libtomcrypt/src/misc/crypt_ltc_mp_descriptor.c
+ src/libtomcrypt/src/misc/crypt_prng_descriptor.c
+ src/libtomcrypt/src/misc/crypt_prng_is_valid.c
+ src/libtomcrypt/src/misc/crypt_register_hash.c
+ src/libtomcrypt/src/misc/crypt_register_prng.c
+ src/libtomcrypt/src/misc/zeromem.c
+ src/libtomcrypt/src/pk/asn1/der_decode_bit_string.c
+ src/libtomcrypt/src/pk/asn1/der_decode_boolean.c
+ src/libtomcrypt/src/pk/asn1/der_decode_choice.c
+ src/libtomcrypt/src/pk/asn1/der_decode_ia5_string.c
+ src/libtomcrypt/src/pk/asn1/der_decode_integer.c
+ src/libtomcrypt/src/pk/asn1/der_decode_object_identifier.c
+ src/libtomcrypt/src/pk/asn1/der_decode_octet_string.c
+ src/libtomcrypt/src/pk/asn1/der_decode_printable_string.c
+ src/libtomcrypt/src/pk/asn1/der_decode_sequence_ex.c
+ src/libtomcrypt/src/pk/asn1/der_decode_sequence_flexi.c
+ src/libtomcrypt/src/pk/asn1/der_decode_sequence_multi.c
+ src/libtomcrypt/src/pk/asn1/der_decode_short_integer.c
+ src/libtomcrypt/src/pk/asn1/der_decode_utctime.c
+ src/libtomcrypt/src/pk/asn1/der_decode_utf8_string.c
+ src/libtomcrypt/src/pk/asn1/der_encode_bit_string.c
+ src/libtomcrypt/src/pk/asn1/der_encode_boolean.c
+ src/libtomcrypt/src/pk/asn1/der_encode_ia5_string.c
+ src/libtomcrypt/src/pk/asn1/der_encode_integer.c
+ src/libtomcrypt/src/pk/asn1/der_encode_object_identifier.c
+ src/libtomcrypt/src/pk/asn1/der_encode_octet_string.c
+ src/libtomcrypt/src/pk/asn1/der_encode_printable_string.c
+ src/libtomcrypt/src/pk/asn1/der_encode_sequence_ex.c
+ src/libtomcrypt/src/pk/asn1/der_encode_sequence_multi.c
+ src/libtomcrypt/src/pk/asn1/der_encode_set.c
+ src/libtomcrypt/src/pk/asn1/der_encode_setof.c
+ src/libtomcrypt/src/pk/asn1/der_encode_short_integer.c
+ src/libtomcrypt/src/pk/asn1/der_encode_utctime.c
+ src/libtomcrypt/src/pk/asn1/der_encode_utf8_string.c
+ src/libtomcrypt/src/pk/asn1/der_length_bit_string.c
+ src/libtomcrypt/src/pk/asn1/der_length_boolean.c
+ src/libtomcrypt/src/pk/asn1/der_length_ia5_string.c
+ src/libtomcrypt/src/pk/asn1/der_length_integer.c
+ src/libtomcrypt/src/pk/asn1/der_length_object_identifier.c
+ src/libtomcrypt/src/pk/asn1/der_length_octet_string.c
+ src/libtomcrypt/src/pk/asn1/der_length_printable_string.c
+ src/libtomcrypt/src/pk/asn1/der_length_sequence.c
+ src/libtomcrypt/src/pk/asn1/der_length_utctime.c
+ src/libtomcrypt/src/pk/asn1/der_sequence_free.c
+ src/libtomcrypt/src/pk/asn1/der_length_utf8_string.c
+ src/libtomcrypt/src/pk/asn1/der_length_short_integer.c
+ src/libtomcrypt/src/pk/ecc/ltc_ecc_map.c
+ src/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c
+ src/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c
+ src/libtomcrypt/src/pk/ecc/ltc_ecc_points.c
+ src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c
+ src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c
+ src/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c
+ src/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c
+ src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c
+ src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c
+ src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c
+ src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c
+ src/libtomcrypt/src/pk/rsa/rsa_exptmod.c
+ src/libtomcrypt/src/pk/rsa/rsa_free.c
+ src/libtomcrypt/src/pk/rsa/rsa_import.c
+ src/libtomcrypt/src/pk/rsa/rsa_make_key.c
+ src/libtomcrypt/src/pk/rsa/rsa_sign_hash.c
+ src/libtomcrypt/src/pk/rsa/rsa_verify_hash.c
+)
+
+set(TOMMATH_FILES
+ src/libtommath/bncore.c
+ src/libtommath/bn_fast_mp_invmod.c
+ src/libtommath/bn_fast_mp_montgomery_reduce.c
+ src/libtommath/bn_fast_s_mp_mul_digs.c
+ src/libtommath/bn_fast_s_mp_mul_high_digs.c
+ src/libtommath/bn_fast_s_mp_sqr.c
+ src/libtommath/bn_mp_2expt.c
+ src/libtommath/bn_mp_abs.c
+ src/libtommath/bn_mp_add.c
+ src/libtommath/bn_mp_addmod.c
+ src/libtommath/bn_mp_add_d.c
+ src/libtommath/bn_mp_and.c
+ src/libtommath/bn_mp_clamp.c
+ src/libtommath/bn_mp_clear.c
+ src/libtommath/bn_mp_clear_multi.c
+ src/libtommath/bn_mp_cmp.c
+ src/libtommath/bn_mp_cmp_d.c
+ src/libtommath/bn_mp_cmp_mag.c
+ src/libtommath/bn_mp_cnt_lsb.c
+ src/libtommath/bn_mp_copy.c
+ src/libtommath/bn_mp_count_bits.c
+ src/libtommath/bn_mp_div.c
+ src/libtommath/bn_mp_div_2.c
+ src/libtommath/bn_mp_div_2d.c
+ src/libtommath/bn_mp_div_3.c
+ src/libtommath/bn_mp_div_d.c
+ src/libtommath/bn_mp_dr_is_modulus.c
+ src/libtommath/bn_mp_dr_reduce.c
+ src/libtommath/bn_mp_dr_setup.c
+ src/libtommath/bn_mp_exch.c
+ src/libtommath/bn_mp_exptmod.c
+ src/libtommath/bn_mp_exptmod_fast.c
+ src/libtommath/bn_mp_expt_d.c
+ src/libtommath/bn_mp_exteuclid.c
+ src/libtommath/bn_mp_fread.c
+ src/libtommath/bn_mp_fwrite.c
+ src/libtommath/bn_mp_gcd.c
+ src/libtommath/bn_mp_get_int.c
+ src/libtommath/bn_mp_grow.c
+ src/libtommath/bn_mp_init.c
+ src/libtommath/bn_mp_init_copy.c
+ src/libtommath/bn_mp_init_multi.c
+ src/libtommath/bn_mp_init_set.c
+ src/libtommath/bn_mp_init_set_int.c
+ src/libtommath/bn_mp_init_size.c
+ src/libtommath/bn_mp_invmod.c
+ src/libtommath/bn_mp_invmod_slow.c
+ src/libtommath/bn_mp_is_square.c
+ src/libtommath/bn_mp_jacobi.c
+ src/libtommath/bn_mp_karatsuba_mul.c
+ src/libtommath/bn_mp_karatsuba_sqr.c
+ src/libtommath/bn_mp_lcm.c
+ src/libtommath/bn_mp_lshd.c
+ src/libtommath/bn_mp_mod.c
+ src/libtommath/bn_mp_mod_2d.c
+ src/libtommath/bn_mp_mod_d.c
+ src/libtommath/bn_mp_montgomery_calc_normalization.c
+ src/libtommath/bn_mp_montgomery_reduce.c
+ src/libtommath/bn_mp_montgomery_setup.c
+ src/libtommath/bn_mp_mul.c
+ src/libtommath/bn_mp_mulmod.c
+ src/libtommath/bn_mp_mul_2.c
+ src/libtommath/bn_mp_mul_2d.c
+ src/libtommath/bn_mp_mul_d.c
+ src/libtommath/bn_mp_neg.c
+ src/libtommath/bn_mp_n_root.c
+ src/libtommath/bn_mp_or.c
+ src/libtommath/bn_mp_prime_fermat.c
+ src/libtommath/bn_mp_prime_is_divisible.c
+ src/libtommath/bn_mp_prime_is_prime.c
+ src/libtommath/bn_mp_prime_miller_rabin.c
+ src/libtommath/bn_mp_prime_next_prime.c
+ src/libtommath/bn_mp_prime_rabin_miller_trials.c
+ src/libtommath/bn_mp_prime_random_ex.c
+ src/libtommath/bn_mp_radix_size.c
+ src/libtommath/bn_mp_radix_smap.c
+ src/libtommath/bn_mp_rand.c
+ src/libtommath/bn_mp_read_radix.c
+ src/libtommath/bn_mp_read_signed_bin.c
+ src/libtommath/bn_mp_read_unsigned_bin.c
+ src/libtommath/bn_mp_reduce.c
+ src/libtommath/bn_mp_reduce_2k.c
+ src/libtommath/bn_mp_reduce_2k_l.c
+ src/libtommath/bn_mp_reduce_2k_setup.c
+ src/libtommath/bn_mp_reduce_2k_setup_l.c
+ src/libtommath/bn_mp_reduce_is_2k.c
+ src/libtommath/bn_mp_reduce_is_2k_l.c
+ src/libtommath/bn_mp_reduce_setup.c
+ src/libtommath/bn_mp_rshd.c
+ src/libtommath/bn_mp_set.c
+ src/libtommath/bn_mp_set_int.c
+ src/libtommath/bn_mp_shrink.c
+ src/libtommath/bn_mp_signed_bin_size.c
+ src/libtommath/bn_mp_sqr.c
+ src/libtommath/bn_mp_sqrmod.c
+ src/libtommath/bn_mp_sqrt.c
+ src/libtommath/bn_mp_sub.c
+ src/libtommath/bn_mp_submod.c
+ src/libtommath/bn_mp_sub_d.c
+ src/libtommath/bn_mp_toom_mul.c
+ src/libtommath/bn_mp_toom_sqr.c
+ src/libtommath/bn_mp_toradix.c
+ src/libtommath/bn_mp_toradix_n.c
+ src/libtommath/bn_mp_to_signed_bin.c
+ src/libtommath/bn_mp_to_signed_bin_n.c
+ src/libtommath/bn_mp_to_unsigned_bin.c
+ src/libtommath/bn_mp_to_unsigned_bin_n.c
+ src/libtommath/bn_mp_unsigned_bin_size.c
+ src/libtommath/bn_mp_xor.c
+ src/libtommath/bn_mp_zero.c
+ src/libtommath/bn_prime_tab.c
+ src/libtommath/bn_reverse.c
+ src/libtommath/bn_s_mp_add.c
+ src/libtommath/bn_s_mp_exptmod.c
+ src/libtommath/bn_s_mp_mul_digs.c
+ src/libtommath/bn_s_mp_mul_high_digs.c
+ src/libtommath/bn_s_mp_sqr.c
+ src/libtommath/bn_s_mp_sub.c
+)
+
+find_package(ZLIB REQUIRED)
+find_package(BZip2 REQUIRED)
+
+if(WIN32)
+ set(LINK_LIBS wininet)
+endif()
+
+list(APPEND LINK_LIBS ZLIB::ZLIB BZip2::BZip2)
+
+if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ message(STATUS "Using FreeBSD port")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE=0 -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate")
+endif()
+
+add_library(stormlib ${LIB_TYPE} ${SRC_FILES} ${TOMCRYPT_FILES} ${TOMMATH_FILES} ${STORM_DEF_FILES})
+add_definitions(-D__SYS_ZLIB -D__SYS_BZLIB)
+
+target_link_libraries(stormlib PRIVATE ${LINK_LIBS})
+
+target_compile_definitions(stormlib PRIVATE _7ZIP_ST BZ_STRICT_ANSI)
+
+if(WIN32)
+ target_compile_definitions(stormlib PRIVATE UNICODE _UNICODE)
+endif()
+
+set_target_properties(stormlib PROPERTIES PUBLIC_HEADER "src/StormLib.h;src/StormPort.h")
+
+install(TARGETS stormlib EXPORT stormlibConfig
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+)
+
+install(EXPORT stormlibConfig NAMESPACE stormlib:: DESTINATION share/stormlib)
\ No newline at end of file diff --git a/ports/stormlib/CONTROL b/ports/stormlib/CONTROL index 348e09616..beb6fd3c1 100644 --- a/ports/stormlib/CONTROL +++ b/ports/stormlib/CONTROL @@ -1,4 +1,4 @@ Source: stormlib
-Version: 9.22
+Version: 2019-05-10
Build-Depends: zlib, bzip2
Description: StormLib is a library for opening and manipulating Blizzard MPQ files
diff --git a/ports/stormlib/disable-building-tests.patch b/ports/stormlib/disable-building-tests.patch deleted file mode 100644 index fe0d7f70c..000000000 --- a/ports/stormlib/disable-building-tests.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f5211b1..4025ea1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -358,10 +358,4 @@ install(TARGETS ${LIBRARY_NAME} - - INCLUDE(CPack) - --if(STORM_BUILD_TESTS) -- target_link_libraries(storm_test ${LIBRARY_NAME}) -- install(TARGETS storm_test DESTINATION bin) --endif() - --add_executable(storm_test ${SRC_FILES} ${TOMCRYPT_FILES} ${TOMMATH_FILES} ${ZLIB_BZIP2_FILES} ${TEST_SRC_FILES}) --install(TARGETS storm_test RUNTIME DESTINATION bin) diff --git a/ports/stormlib/portfile.cmake b/ports/stormlib/portfile.cmake index 82e0aedf9..d0e9e36a4 100644 --- a/ports/stormlib/portfile.cmake +++ b/ports/stormlib/portfile.cmake @@ -3,15 +3,14 @@ include(vcpkg_common_functions) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ladislav-zezula/StormLib
- REF v9.22
- SHA512 e08571fca21be2e853d390b8feda32001df810b8f4b60d36822a9de2a877f2be9d3dadacfeec181a2eb80e00b8fed66d0dc9a0d8d9e043e2959478a41ed4d13a
+ REF 2f0e0e69e6b3739d7c450ac3d38816aee45ac3c2
+ SHA512 54cbe4270963944edf3d75b845047add2b004e0d95b20b75a4c4790c2a12a41bf19cc4f55aaeaec697a0a913827e11cfabde2123b2b13730556310dd89eef1e9
HEAD_REF master
)
-vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES
- ${CMAKE_CURRENT_LIST_DIR}/disable-building-tests.patch
+file(COPY
+ ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
+ DESTINATION ${SOURCE_PATH}
)
vcpkg_configure_cmake(
@@ -20,5 +19,7 @@ vcpkg_configure_cmake( )
vcpkg_install_cmake()
+
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/stormlib RENAME copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+vcpkg_fixup_cmake_targets()
\ No newline at end of file diff --git a/ports/string-theory/CONTROL b/ports/string-theory/CONTROL index 538b4a989..ec053695c 100644 --- a/ports/string-theory/CONTROL +++ b/ports/string-theory/CONTROL @@ -1,4 +1,4 @@ Source: string-theory -Version: 2.1-1 +Version: 2.2 Homepage: https://github.com/zrax/string_theory Description: Flexible C++11 string library with type-safe formatting. diff --git a/ports/string-theory/portfile.cmake b/ports/string-theory/portfile.cmake index 002eae1b1..f8f9b216f 100644 --- a/ports/string-theory/portfile.cmake +++ b/ports/string-theory/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO zrax/string_theory - REF 2.1 - SHA512 c20f481ba1bd3f1add2d7ee085db7dfa387e3675df5551e64bf294a96f4902551635e83faf2580fb0d6a55fd5ed1c906510d6cb39580a07234e5638e6c747fe0 + REF 2.2 + SHA512 84b0eb645fdb302f233c162afbcea1b1b201546a60d81448a86437fe599c4184d7abe3d6ea8bd1743bdffab75bcd4e4ab296ce1fffb7da8ae6aab880d0bbda2d HEAD_REF master ) diff --git a/ports/stxxl/0001-fix-visual-studio.patch b/ports/stxxl/0001-fix-visual-studio.patch new file mode 100644 index 000000000..3506c51ab --- /dev/null +++ b/ports/stxxl/0001-fix-visual-studio.patch @@ -0,0 +1,272 @@ +diff --git a/include/stxxl/bits/algo/ksort.h b/include/stxxl/bits/algo/ksort.h
+index 33ec8cf..4079a57 100644
+--- a/include/stxxl/bits/algo/ksort.h
++++ b/include/stxxl/bits/algo/ksort.h
+@@ -299,11 +299,7 @@ create_runs(
+ template <typename BlockType,
+ typename prefetcher_type,
+ typename KeyExtractor>
+-struct run_cursor2_cmp : public std::binary_function<
+- run_cursor2<BlockType, prefetcher_type>,
+- run_cursor2<BlockType, prefetcher_type>,
+- bool
+- >
++struct run_cursor2_cmp
+ {
+ typedef run_cursor2<BlockType, prefetcher_type> cursor_type;
+ KeyExtractor keyobj;
+@@ -327,7 +323,7 @@ private:
+ };
+
+ template <typename RecordType, typename KeyExtractor>
+-class key_comparison : public std::binary_function<RecordType, RecordType, bool>
++class key_comparison
+ {
+ KeyExtractor ke;
+
+diff --git a/include/stxxl/bits/algo/sort_helper.h b/include/stxxl/bits/algo/sort_helper.h
+index 524e40d..69234c4 100644
+--- a/include/stxxl/bits/algo/sort_helper.h
++++ b/include/stxxl/bits/algo/sort_helper.h
+@@ -51,7 +51,6 @@ struct trigger_entry
+
+ template <typename TriggerEntryType, typename ValueCmp>
+ struct trigger_entry_cmp
+- : public std::binary_function<TriggerEntryType, TriggerEntryType, bool>
+ {
+ typedef TriggerEntryType trigger_entry_type;
+ ValueCmp cmp;
+@@ -67,11 +66,6 @@ template <typename BlockType,
+ typename PrefetcherType,
+ typename ValueCmp>
+ struct run_cursor2_cmp
+- : public std::binary_function<
+- run_cursor2<BlockType, PrefetcherType>,
+- run_cursor2<BlockType, PrefetcherType>,
+- bool
+- >
+ {
+ typedef BlockType block_type;
+ typedef PrefetcherType prefetcher_type;
+diff --git a/include/stxxl/bits/compat/unique_ptr.h b/include/stxxl/bits/compat/unique_ptr.h
+index 9df12ff..7110246 100644
+--- a/include/stxxl/bits/compat/unique_ptr.h
++++ b/include/stxxl/bits/compat/unique_ptr.h
+@@ -22,12 +22,7 @@ STXXL_BEGIN_NAMESPACE
+
+ template <class Type>
+ struct compat_unique_ptr {
+-#if __cplusplus >= 201103L && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40400)
+ typedef std::unique_ptr<Type> result;
+-#else
+- // auto_ptr is inherently broken and is deprecated by unique_ptr in c++0x
+- typedef std::auto_ptr<Type> result;
+-#endif
+ };
+
+ STXXL_END_NAMESPACE
+diff --git a/include/stxxl/bits/containers/btree/leaf.h b/include/stxxl/bits/containers/btree/leaf.h
+index d7c619f..c6b2fcc 100644
+--- a/include/stxxl/bits/containers/btree/leaf.h
++++ b/include/stxxl/bits/containers/btree/leaf.h
+@@ -66,7 +66,7 @@ public:
+ typedef node_cache<normal_leaf, btree_type> leaf_cache_type;
+
+ public:
+- struct value_compare : public std::binary_function<value_type, value_type, bool>
++ struct value_compare
+ {
+ key_compare comp;
+
+diff --git a/include/stxxl/bits/containers/btree/node.h b/include/stxxl/bits/containers/btree/node.h
+index 13dec7b..a4c47d8 100644
+--- a/include/stxxl/bits/containers/btree/node.h
++++ b/include/stxxl/bits/containers/btree/node.h
+@@ -71,7 +71,7 @@ public:
+ typedef node_cache<normal_node, btree_type> node_cache_type;
+
+ private:
+- struct value_compare : public std::binary_function<value_type, value_type, bool>
++ struct value_compare
+ {
+ key_compare comp;
+
+diff --git a/include/stxxl/bits/containers/hash_map/hash_map.h b/include/stxxl/bits/containers/hash_map/hash_map.h
+index 0759bd2..ecf19cd 100644
+--- a/include/stxxl/bits/containers/hash_map/hash_map.h
++++ b/include/stxxl/bits/containers/hash_map/hash_map.h
+@@ -1258,10 +1258,7 @@ protected:
+ * lexicographically by <hash-value, key> Note: the hash-value has already
+ * been computed.
+ */
+- struct Cmp : public std::binary_function<
+- std::pair<internal_size_type, value_type>,
+- std::pair<internal_size_type, value_type>, bool
+- >
++ struct Cmp
+ {
+ self_type& map_;
+ Cmp(self_type& map) : map_(map) { }
+@@ -1520,7 +1517,7 @@ protected:
+
+ public:
+ //! Construct an equality predicate from the comparison operator
+- struct equal_to : public std::binary_function<key_type, key_type, bool>
++ struct equal_to
+ {
+ //! reference to hash_map
+ const self_type& m_map;
+diff --git a/include/stxxl/bits/io/wbtl_file.h b/include/stxxl/bits/io/wbtl_file.h
+index 933a216..30828a0 100644
+--- a/include/stxxl/bits/io/wbtl_file.h
++++ b/include/stxxl/bits/io/wbtl_file.h
+@@ -65,7 +65,7 @@ class wbtl_file : public disk_queued_file
+ size_type curpos;
+ request_ptr backend_request;
+
+- struct FirstFit : public std::binary_function<place, offset_type, bool>
++ struct FirstFit
+ {
+ bool operator () (
+ const place& entry,
+diff --git a/include/stxxl/bits/mng/block_alloc.h b/include/stxxl/bits/mng/block_alloc.h
+index 19ade8b..887f0e6 100644
+--- a/include/stxxl/bits/mng/block_alloc.h
++++ b/include/stxxl/bits/mng/block_alloc.h
+@@ -138,7 +138,7 @@ private:
+ perm[i] = i;
+
+ stxxl::random_number<random_uniform_fast> rnd;
+- std::random_shuffle(perm.begin(), perm.end(), rnd _STXXL_FORCE_SEQUENTIAL);
++ std::shuffle(perm.begin(), perm.end(), std::mt19937(std::random_device()()));
+ }
+
+ public:
+diff --git a/include/stxxl/bits/mng/block_alloc_interleaved.h b/include/stxxl/bits/mng/block_alloc_interleaved.h
+index a82ee34..5aba23a 100644
+--- a/include/stxxl/bits/mng/block_alloc_interleaved.h
++++ b/include/stxxl/bits/mng/block_alloc_interleaved.h
+@@ -93,7 +93,7 @@ struct interleaved_RC : public interleaved_striping
+ perms[i][j] = j;
+
+ random_number<random_uniform_fast> rnd;
+- std::random_shuffle(perms[i].begin(), perms[i].end(), rnd _STXXL_FORCE_SEQUENTIAL);
++ std::shuffle(perms[i].begin(), perms[i].end(), std::mt19937(std::random_device()()));
+ }
+ }
+
+diff --git a/include/stxxl/bits/mng/disk_allocator.h b/include/stxxl/bits/mng/disk_allocator.h
+index 59ad085..c1e0f83 100644
+--- a/include/stxxl/bits/mng/disk_allocator.h
++++ b/include/stxxl/bits/mng/disk_allocator.h
+@@ -44,7 +44,7 @@ class disk_allocator : private noncopyable
+ {
+ typedef std::pair<stxxl::int64, stxxl::int64> place;
+
+- struct first_fit : public std::binary_function<place, stxxl::int64, bool>
++ struct first_fit
+ {
+ bool operator () (
+ const place& entry,
+@@ -189,7 +189,7 @@ void disk_allocator::new_blocks(BID<BlockSize>* begin, BID<BlockSize>* end)
+
+ sortseq::iterator space;
+ space = std::find_if(free_space.begin(), free_space.end(),
+- bind2nd(first_fit(), requested_size) _STXXL_FORCE_SEQUENTIAL);
++ std::bind(first_fit(), std::placeholders::_1, requested_size) _STXXL_FORCE_SEQUENTIAL);
+
+ if (space == free_space.end() && requested_size == BlockSize)
+ {
+@@ -207,7 +207,7 @@ void disk_allocator::new_blocks(BID<BlockSize>* begin, BID<BlockSize>* end)
+ grow_file(BlockSize);
+
+ space = std::find_if(free_space.begin(), free_space.end(),
+- bind2nd(first_fit(), requested_size) _STXXL_FORCE_SEQUENTIAL);
++ std::bind(first_fit(), std::placeholders::_1, requested_size) _STXXL_FORCE_SEQUENTIAL);
+ }
+
+ if (space != free_space.end())
+diff --git a/include/stxxl/bits/parallel.h b/include/stxxl/bits/parallel.h
+index d973861..c858d87 100644
+--- a/include/stxxl/bits/parallel.h
++++ b/include/stxxl/bits/parallel.h
+@@ -121,7 +121,6 @@ using __gnu_parallel::random_shuffle;
+ #elif STXXL_PARALLEL
+
+ using std::sort;
+-using std::random_shuffle;
+
+ #else
+
+diff --git a/include/stxxl/bits/parallel/base.h b/include/stxxl/bits/parallel/base.h
+index 141d515..7dae74f 100644
+--- a/include/stxxl/bits/parallel/base.h
++++ b/include/stxxl/bits/parallel/base.h
+@@ -33,7 +33,6 @@ namespace parallel {
+ */
+ template <class Predicate, typename first_argument_type, typename second_argument_type>
+ class binary_negate
+- : public std::binary_function<first_argument_type, second_argument_type, bool>
+ {
+ protected:
+ Predicate pred;
+@@ -80,7 +79,7 @@ static inline void decode2(lcas_t x, int& a, int& b)
+ * Constructs predicate for equality from strict weak ordering predicate
+ */
+ template <class Comparator, typename T1, typename T2>
+-class equal_from_less : public std::binary_function<T1, T2, bool>
++class equal_from_less
+ {
+ private:
+ Comparator& comp;
+@@ -126,7 +125,7 @@ median_of_three_iterators(RandomAccessIterator a, RandomAccessIterator b,
+
+ /** Similar to std::equal_to, but allows two different types. */
+ template <typename T1, typename T2>
+-struct equal_to : std::binary_function<T1, T2, bool>
++struct equal_to
+ {
+ bool operator () (const T1& t1, const T2& t2) const
+ {
+@@ -136,7 +135,7 @@ struct equal_to : std::binary_function<T1, T2, bool>
+
+ /** Similar to std::less, but allows two different types. */
+ template <typename T1, typename T2>
+-struct less : std::binary_function<T1, T2, bool>
++struct less
+ {
+ bool operator () (const T1& t1, const T2& t2) const
+ {
+diff --git a/include/stxxl/bits/parallel/multiseq_selection.h b/include/stxxl/bits/parallel/multiseq_selection.h
+index 57e7599..f41d9aa 100644
+--- a/include/stxxl/bits/parallel/multiseq_selection.h
++++ b/include/stxxl/bits/parallel/multiseq_selection.h
+@@ -35,7 +35,6 @@ namespace parallel {
+ //! Compare a pair of types lexcigraphically, ascending.
+ template <typename T1, typename T2, typename Comparator>
+ class lexicographic
+- : public std::binary_function<std::pair<T1, T2>, std::pair<T1, T2>, bool>
+ {
+ protected:
+ Comparator& m_comp;
+@@ -60,7 +59,6 @@ public:
+ //! Compare a pair of types lexcigraphically, descending.
+ template <typename T1, typename T2, typename Comparator>
+ class lexicographic_rev
+- : public std::binary_function<std::pair<T1, T2>, std::pair<T1, T2>, bool>
+ {
+ protected:
+ Comparator& m_comp;
+diff --git a/lib/io/wbtl_file.cpp b/lib/io/wbtl_file.cpp
+index 310d76a..6d52e2e 100644
+--- a/lib/io/wbtl_file.cpp
++++ b/lib/io/wbtl_file.cpp
+@@ -304,7 +304,7 @@ wbtl_file::offset_type wbtl_file::get_next_write_block()
+ // mapping_lock has to be aquired by caller
+ sortseq::iterator space =
+ std::find_if(free_space.begin(), free_space.end(),
+- bind2nd(FirstFit(), write_block_size) _STXXL_FORCE_SEQUENTIAL);
++ std::bind(FirstFit(), std::placeholders::_1, write_block_size) _STXXL_FORCE_SEQUENTIAL);
+
+ if (space != free_space.end())
+ {
diff --git a/ports/stxxl/CONTROL b/ports/stxxl/CONTROL index 847a31067..42609d34f 100644 --- a/ports/stxxl/CONTROL +++ b/ports/stxxl/CONTROL @@ -1,3 +1,3 @@ Source: stxxl
-Version: 2018-11-15-1
+Version: 2018-11-15-2
Description: Standard Template Library for Extra Large Data Sets
diff --git a/ports/stxxl/portfile.cmake b/ports/stxxl/portfile.cmake index 41665c4cd..01d072d09 100644 --- a/ports/stxxl/portfile.cmake +++ b/ports/stxxl/portfile.cmake @@ -11,10 +11,12 @@ vcpkg_from_github( PATCHES # This patch can be removed when stxxl/stxxl/#95 is accepted fix-include-dir.patch + 0001-fix-visual-studio.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DBUILD_STATIC_LIBS=ON -DBUILD_EXAMPLES=OFF @@ -31,7 +33,7 @@ vcpkg_configure_cmake( OPTIONS_DEBUG -DSTXXL_DEBUG_ASSERTIONS=ON OPTIONS_RELEASE - -DSTXXL_DEBUG_ASSERTIONS=OFF + -DSTXXL_DEBUG_ASSERTIONS=OFF ) vcpkg_install_cmake() diff --git a/ports/sundials/CONTROL b/ports/sundials/CONTROL index dc6955d40..101325d37 100644 --- a/ports/sundials/CONTROL +++ b/ports/sundials/CONTROL @@ -1,4 +1,4 @@ Source: sundials -Version: 3.1.1 +Version: 3.1.1-1 Homepage: https://computation.llnl.gov/projects/sundials Description: SUNDIALS (SUite of Nonlinear and DIfferential/ALgebraic equation Solvers) diff --git a/ports/sundials/portfile.cmake b/ports/sundials/portfile.cmake index 6798f0272..da4d9c4a2 100644 --- a/ports/sundials/portfile.cmake +++ b/ports/sundials/portfile.cmake @@ -18,6 +18,7 @@ vcpkg_apply_patches( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DEXAMPLES_ENABLE=OFF ) diff --git a/ports/szip/CONTROL b/ports/szip/CONTROL index ac60f1a9d..8f1fedbc6 100644 --- a/ports/szip/CONTROL +++ b/ports/szip/CONTROL @@ -1,4 +1,4 @@ Source: szip -Version: 2.1.1-4 +Version: 2.1.1-5 Homepage: https://support.hdfgroup.org/ftp/lib-external/szip Description: Szip compression software, providing lossless compression of scientific data diff --git a/ports/szip/portfile.cmake b/ports/szip/portfile.cmake index 047abf392..cffb1693c 100644 --- a/ports/szip/portfile.cmake +++ b/ports/szip/portfile.cmake @@ -17,6 +17,7 @@ vcpkg_extract_source_archive_ex( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DSZIP_INSTALL_DATA_DIR=share/szip/data -DSZIP_INSTALL_CMAKE_DIR=share/szip diff --git a/ports/tesseract/CONTROL b/ports/tesseract/CONTROL index df6e60fec..a24dd9435 100644 --- a/ports/tesseract/CONTROL +++ b/ports/tesseract/CONTROL @@ -1,5 +1,12 @@ Source: tesseract
-Version: 4.0.0-3
+Version: 4.1.0-2
Homepage: https://github.com/tesseract-ocr/tesseract
Description: An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.
-Build-Depends: leptonica, icu
+Build-Depends: leptonica
+
+Feature: training_tools
+Description: build training tools
+Build-Depends: icu, pango, cairo, fontconfig
+
+Feature: cpu_independed
+Description: build on any cpu extension commands support
diff --git a/ports/tesseract/fix-text2image.patch b/ports/tesseract/fix-text2image.patch new file mode 100644 index 000000000..a4ff21d6b --- /dev/null +++ b/ports/tesseract/fix-text2image.patch @@ -0,0 +1,64 @@ +diff --git a/src/training/CMakeLists.txt b/src/training/CMakeLists.txt +index 8fd96a9..ef258e1 100644 +--- a/src/training/CMakeLists.txt ++++ b/src/training/CMakeLists.txt +@@ -253,7 +253,7 @@ if (NOT CPPAN_BUILD) + find_package(PkgConfig) + endif() + +-if (PKG_CONFIG_FOUND OR CPPAN_BUILD) ++if (1) + + if (PKG_CONFIG_FOUND) + pkg_check_modules(Pango REQUIRED pango) +@@ -261,8 +261,35 @@ pkg_check_modules(Cairo REQUIRED cairo) + pkg_check_modules(PangoFt2 REQUIRED pangoft2) + pkg_check_modules(PangoCairo REQUIRED pangocairo) + pkg_check_modules(FontConfig REQUIRED fontconfig) +-endif() ++else() ++find_library(Glib_LIBRARY_RELEASE NAMES glib-2.0) ++find_library(Glib_LIBRARY_DEBUG NAMES glib-2.0) ++select_library_configurations(Glib) ++ ++find_library(GObject_LIBRARY_RELEASE NAMES gobject-2.0) ++find_library(GObject_LIBRARY_DEBUG NAMES gobject-2.0) ++select_library_configurations(GObject) ++ ++find_library(Pango_LIBRARY_RELEASE NAMES pango-1.0) ++find_library(Pango_LIBRARY_DEBUG NAMES pango-1.0) ++select_library_configurations(Pango) ++ ++find_library(Cairo_LIBRARY_RELEASE NAMES cairo) ++find_library(Cairo_LIBRARY_DEBUG NAMES cairod) ++select_library_configurations(Cairo) + ++find_library(FontConfig_LIBRARY_RELEASE NAMES fontconfig) ++find_library(FontConfig_LIBRARY_DEBUG NAMES fontconfig) ++select_library_configurations(FontConfig) ++ ++find_library(PangoFt2_LIBRARY_RELEASE NAMES pangoft2-1.0) ++find_library(PangoFt2_LIBRARY_DEBUG NAMES pangoft2-1.0) ++select_library_configurations(PangoFt2) ++ ++find_library(PangoCairo_LIBRARY_RELEASE NAMES pangocairo-1.0) ++find_library(PangoCairo_LIBRARY_DEBUG NAMES pangocairo-1.0) ++select_library_configurations(PangoCairo) ++endif() + set(text2image_src + text2image.cpp + boxchar.cpp +@@ -285,10 +312,12 @@ set(text2image_src + + add_executable (text2image ${text2image_src}) + target_link_libraries (text2image unicharset_training) +-if (PKG_CONFIG_FOUND) ++if (1) + target_include_directories (text2image BEFORE PRIVATE ${Cairo_INCLUDE_DIRS} ${Pango_INCLUDE_DIRS}) + target_compile_definitions (text2image PRIVATE -DPANGO_ENABLE_ENGINE) + target_link_libraries (text2image ++ ${GObject_LIBRARIES} ++ ${Glib_LIBRARIES} + ${Pango_LIBRARIES} + ${Cairo_LIBRARIES} + ${PangoCairo_LIBRARIES} diff --git a/ports/tesseract/fix-tiff-linkage.patch b/ports/tesseract/fix-tiff-linkage.patch new file mode 100644 index 000000000..f4720c022 --- /dev/null +++ b/ports/tesseract/fix-tiff-linkage.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f154663..c07b827 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -431,7 +431,7 @@ endif() + add_executable (tesseract ${tesseractmain_src} ${tesseractmain_rsc}) + target_link_libraries (tesseract libtesseract) + if (HAVE_TIFFIO_H) +- target_link_libraries(tesseract tiff) ++ target_link_libraries(tesseract TIFF::TIFF) + endif() + + if (OPENMP_BUILD AND UNIX) diff --git a/ports/tesseract/leptonica.patch b/ports/tesseract/leptonica.patch deleted file mode 100644 index 507721d9d..000000000 --- a/ports/tesseract/leptonica.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cmake/templates/TesseractConfig.cmake.in b/cmake/templates/TesseractConfig.cmake.in -index 13838361..245ca2bc 100644 ---- a/cmake/templates/TesseractConfig.cmake.in -+++ b/cmake/templates/TesseractConfig.cmake.in -@@ -21,6 +21,8 @@ - - include(${CMAKE_CURRENT_LIST_DIR}/TesseractTargets.cmake) - -+find_package(Leptonica REQUIRED) -+ - # ====================================================== - # Version variables: - # ====================================================== diff --git a/ports/tesseract/portfile.cmake b/ports/tesseract/portfile.cmake index 9650db44a..08f581cfe 100644 --- a/ports/tesseract/portfile.cmake +++ b/ports/tesseract/portfile.cmake @@ -5,24 +5,43 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO tesseract-ocr/tesseract - REF 4.0.0 - SHA512 69e57d4ba1fc43d212fd0fff69a2b5d48a3b37cfee7054fdc083cbb7e04d92317609a32e457229661d70ce8d9b16c9d25e81bfc3861db660dd2c8f292202d447 - HEAD_REF master + REF 4.1.0 + SHA512 d617f5c5b826640b2871dbe3d7973bcc5e66fafd837921a20e009d683806ed50f0f258aa455019d99fc54f5cb65c2fa0380e3a3c92b39ab0684b8799c730b09d PATCHES - use-vcpkg-icu.patch - ws2-32.patch - leptonica.patch + fix-tiff-linkage.patch + fix-text2image.patch ) # The built-in cmake FindICU is better file(REMOVE ${SOURCE_PATH}/cmake/FindICU.cmake) +# Handle Static Library Output +if(VCPKG_LIBRARY_LINKAGE EQUAL "static") + list(APPEND OPTIONS_LIST -DSTATIC=ON) +endif() + +# Handle CONTROL +if("training_tools" IN_LIST FEATURES) + list(APPEND OPTIONS_LIST -DBUILD_TRAINING_TOOLS=ON) +else() + list(APPEND OPTIONS_LIST -DBUILD_TRAINING_TOOLS=OFF) +endif() +if("independed_architecture" IN_LIST FEATURES) + list(APPEND OPTIONS_LIST -DTARGET_ARCHITECTURE=none) +else() + list(APPEND OPTIONS_LIST -DTARGET_ARCHITECTURE=auto) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DSTATIC=ON -DUSE_SYSTEM_ICU=True + -DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=ON + -DCMAKE_DISABLE_FIND_PACKAGE_OpenCL=ON + -DLeptonica_DIR=YES + ${OPTIONS_LIST} ) vcpkg_install_cmake() @@ -35,6 +54,26 @@ set(EXTENSION) if(WIN32) set(EXTENSION ".exe") endif() + +# copy training tools +set(TRAINING_TOOLS_DIR ${CURRENT_PACKAGES_DIR}/tools/tesseract/training) +if("training_tools" IN_LIST FEATURES) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/ambiguous_words${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/classifier_tester${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/combine_tessdata${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/cntraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/dawg2wordlist${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/mftraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/shapeclustering${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/wordlist2dawg${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/combine_lang_model${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/lstmeval${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/lstmtraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/set_unicharset_properties${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/unicharset_extractor${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/text2image${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR}) +endif() + file(COPY ${CURRENT_PACKAGES_DIR}/bin/tesseract${EXTENSION} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/tesseract) vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/tesseract) diff --git a/ports/tesseract/use-vcpkg-icu.patch b/ports/tesseract/use-vcpkg-icu.patch deleted file mode 100644 index 9c75726e1..000000000 --- a/ports/tesseract/use-vcpkg-icu.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/training/CMakeLists.txt Thu Aug 17 02:46:15 2017 -+++ b/training/CMakeLists.txt Thu Aug 17 02:46:15 2017 -@@ -11,7 +11,7 @@ - endif() - - # experimental --if (MSVC AND NOT CPPAN_BUILD) -+if (MSVC AND NOT CPPAN_BUILD AND NOT USE_SYSTEM_ICU) - - include(CheckTypeSize) - check_type_size("void *" SIZEOF_VOID_P) diff --git a/ports/tesseract/ws2-32.patch b/ports/tesseract/ws2-32.patch deleted file mode 100644 index 1d3be8189..000000000 --- a/ports/tesseract/ws2-32.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/viewer/svutil.cpp b/viewer/svutil.cpp
-index 34a2286..bc2a7e1 100644
---- a/viewer/svutil.cpp
-+++ b/viewer/svutil.cpp
-@@ -23,6 +23,7 @@
- #include <stdio.h>
- #ifdef _WIN32
- #include <windows.h>
-+#pragma comment(lib, "Ws2_32.lib")
- struct addrinfo {
- struct sockaddr* ai_addr;
- int ai_addrlen;
diff --git a/ports/tgc/CMakeLists.txt b/ports/tgc/CMakeLists.txt new file mode 100644 index 000000000..20f5f0a1a --- /dev/null +++ b/ports/tgc/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.14)
+
+project(tgc LANGUAGES C)
+
+include(GNUInstallDirs)
+
+add_library(tgc tgc.c)
+
+target_include_directories(
+ tgc
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+set_target_properties(tgc PROPERTIES PUBLIC_HEADER tgc.h)
+
+install(TARGETS tgc EXPORT unofficial-tgc-config)
+
+install(
+ EXPORT unofficial-tgc-config
+ NAMESPACE unofficial::tgc::
+ DESTINATION share/unofficial-tgc
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
diff --git a/ports/tgc/CONTROL b/ports/tgc/CONTROL new file mode 100644 index 000000000..85466c147 --- /dev/null +++ b/ports/tgc/CONTROL @@ -0,0 +1,4 @@ +Source: tgc
+Version: 2019-08-11
+Description: A tiny garbage collector for C
+Homepage: https://github.com/orangeduck/tgc
diff --git a/ports/tgc/portfile.cmake b/ports/tgc/portfile.cmake new file mode 100644 index 000000000..ebd9c66c3 --- /dev/null +++ b/ports/tgc/portfile.cmake @@ -0,0 +1,54 @@ +include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+set(SOURCE_VERSION 35207051557c79ea25942c021fb18856c72af8e3)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/orangeduck-tgc-${SOURCE_VERSION})
+
+file(MAKE_DIRECTORY ${SOURCE_PATH})
+
+# See ports/nlohmann-json/portfile.cmake
+function(download_src SUBPATH SHA512)
+ vcpkg_download_distfile(
+ FILE
+ URLS "https://raw.githubusercontent.com/orangeduck/tgc/master/${SUBPATH}"
+ FILENAME "orangeduck-tgc-${SOURCE_VERSION}/${SUBPATH}"
+ SHA512 ${SHA512}
+ )
+ get_filename_component(SUBPATH_DIR "${SOURCE_PATH}/${SUBPATH}" DIRECTORY)
+ file(COPY ${FILE} DESTINATION ${SUBPATH_DIR})
+endfunction()
+
+download_src(
+ tgc.h
+ 55944055fa83cfc1cbdf026f6ea65d42c1704800d26a7cb6d31a0afcfc61a2ca61d5e539edbf354c4572a885dbc6f38cbb6593cbb66d5dc78eb7d3b66d613dd8
+)
+download_src(
+ tgc.c
+ 942eefd9b02558f94315023734e9b3b74e326d5a705e9e8809cb4ddb0c6272d8ba9b9715f7d53d7a6151b8cff1377561d169a310c48d200698f9d26ba2c106c3
+)
+download_src(
+ LICENSE.md
+ 89c46e23f61d2912f47a10e807ee823e78b708804c5cfea2382e1d5a9955f0f1a67e421453b5868db2f71229aae8b83c271bb1cf89631b43e91e5d6c4fcbf1a7
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME unofficial-${PORT})
diff --git a/ports/thrift/CONTROL b/ports/thrift/CONTROL index 2ee3ef03e..cfff0ac7e 100644 --- a/ports/thrift/CONTROL +++ b/ports/thrift/CONTROL @@ -1,5 +1,5 @@ Source: thrift -Version: 2019-05-07-2 +Version: 2019-05-07-3 Build-Depends: zlib, libevent, openssl, boost-range, boost-smart-ptr, boost-date-time, boost-locale, boost-scope-exit Homepage: https://github.com/apache/thrift Description: Apache Thrift is a software project spanning a variety of programming languages and use cases. Our goal is to make reliable, performant communication and data serialization across languages as efficient and seamless as possible. diff --git a/ports/thrift/portfile.cmake b/ports/thrift/portfile.cmake index c7fd84003..5c5a76e9f 100644 --- a/ports/thrift/portfile.cmake +++ b/ports/thrift/portfile.cmake @@ -1,5 +1,10 @@ include(vcpkg_common_functions) +# We currently insist on static only because: +# - Thrift doesn't yet support building as a DLL on Windows, +# - x64-linux only builds static anyway. +# From https://github.com/apache/thrift/blob/master/CHANGES.md +# it looks like it will be supported in v0.13. vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_find_acquire_program(FLEX) @@ -13,11 +18,15 @@ vcpkg_from_github( HEAD_REF master ) +# note we specify values for WITH_STATIC_LIB and WITH_SHARED_LIB because even though +# they're marked as deprecated, Thrift incorrectly hard-codes a value for BUILD_SHARED_LIBS. vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA NO_CHARSET_FLAG OPTIONS + -DWITH_SHARED_LIB=off + -DWITH_STATIC_LIB=on -DWITH_STDTHREADS=ON -DBUILD_TESTING=off -DBUILD_JAVA=off @@ -38,14 +47,23 @@ file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/th # Move CMake config files to the right place vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/thrift) -file(GLOB COMPILER "${CURRENT_PACKAGES_DIR}/bin/thrift*") +file(GLOB COMPILER "${CURRENT_PACKAGES_DIR}/bin/thrift" "${CURRENT_PACKAGES_DIR}/bin/thrift.exe") if(COMPILER) file(COPY ${COMPILER} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/thrift) file(REMOVE ${COMPILER}) vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/thrift) endif() +file(GLOB COMPILERD "${CURRENT_PACKAGES_DIR}/debug/bin/thrift" "${CURRENT_PACKAGES_DIR}/debug/bin/thrift.exe") +if(COMPILERD) + file(REMOVE ${COMPILERD}) +endif() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + +if ("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) +endif() + vcpkg_copy_pdbs() diff --git a/ports/tiff/CONTROL b/ports/tiff/CONTROL index 9c88261a6..7cf6005dc 100644 --- a/ports/tiff/CONTROL +++ b/ports/tiff/CONTROL @@ -1,5 +1,5 @@ Source: tiff -Version: 4.0.10-6 +Version: 4.0.10-7 Build-Depends: zlib, libjpeg-turbo, liblzma Homepage: https://download.osgeo.org/libtiff Description: A library that supports the manipulation of TIFF image files diff --git a/ports/tiff/portfile.cmake b/ports/tiff/portfile.cmake index d36dce238..373ceac7c 100644 --- a/ports/tiff/portfile.cmake +++ b/ports/tiff/portfile.cmake @@ -33,6 +33,8 @@ vcpkg_configure_cmake( -Djpeg12=OFF -Dwebp=OFF -Dzstd=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_OpenGL=ON + -DCMAKE_DISABLE_FIND_PACKAGE_GLUT=ON ${TIFF_CXX_TARGET} ) diff --git a/ports/tiny-aes-c/CMakeLists.txt b/ports/tiny-aes-c/CMakeLists.txt new file mode 100644 index 000000000..6e3222547 --- /dev/null +++ b/ports/tiny-aes-c/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.14)
+
+project(tiny-aes-c LANGUAGES C ASM)
+
+include(GNUInstallDirs)
+
+add_library(tiny-aes-c aes.c)
+
+target_include_directories(
+ tiny-aes-c
+ PUBLIC
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+install(FILES aes.h aes.hpp DESTINATION include)
+
+install(TARGETS tiny-aes-c EXPORT unofficial-tiny-aes-c-config)
+
+install(
+ EXPORT unofficial-tiny-aes-c-config
+ NAMESPACE unofficial::tiny-aes-c::
+ DESTINATION share/unofficial-tiny-aes-c
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
diff --git a/ports/tiny-aes-c/CONTROL b/ports/tiny-aes-c/CONTROL new file mode 100644 index 000000000..e87499074 --- /dev/null +++ b/ports/tiny-aes-c/CONTROL @@ -0,0 +1,4 @@ +Source: tiny-aes-c
+Version: 2019-07-31
+Description: Small portable AES128/192/256 in C
+Homepage: https://github.com/kokke/tiny-AES-c
diff --git a/ports/tiny-aes-c/portfile.cmake b/ports/tiny-aes-c/portfile.cmake new file mode 100644 index 000000000..e1bb5cb31 --- /dev/null +++ b/ports/tiny-aes-c/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO kokke/tiny-AES-c
+ REF ca85e00de963102d3999ea5fa865c0deff6370d3
+ SHA512 538d5d9cee8cecbf801d3553f2425f8a1331b59c652c11ee56c6e46a23450c1e9a59e3e1833f4384b7a4d992a93f30635855a47e2414b9293e0d27c426b6a4f3
+ HEAD_REF master
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/unlicense.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME unofficial-${PORT})
diff --git a/ports/tiny-bignum-c/CMakeLists.txt b/ports/tiny-bignum-c/CMakeLists.txt new file mode 100644 index 000000000..8891356d7 --- /dev/null +++ b/ports/tiny-bignum-c/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.14)
+
+project(tiny-bignum-c LANGUAGES C)
+
+include(GNUInstallDirs)
+
+add_library(tiny-bignum-c bn.c)
+
+target_include_directories(
+ tiny-bignum-c
+ PUBLIC
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+target_compile_definitions(
+ tiny-bignum-c
+ PRIVATE
+ $<$<C_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
+)
+set_target_properties(tiny-bignum-c PROPERTIES PUBLIC_HEADER bn.h)
+
+install(TARGETS tiny-bignum-c EXPORT unofficial-tiny-bignum-c-config)
+
+install(
+ EXPORT unofficial-tiny-bignum-c-config
+ NAMESPACE unofficial::tiny-bignum-c::
+ DESTINATION share/unofficial-tiny-bignum-c
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
diff --git a/ports/tiny-bignum-c/CONTROL b/ports/tiny-bignum-c/CONTROL new file mode 100644 index 000000000..5015bc2d0 --- /dev/null +++ b/ports/tiny-bignum-c/CONTROL @@ -0,0 +1,4 @@ +Source: tiny-bignum-c
+Version: 2019-07-31
+Description: Small portable multiple-precision unsigned integer arithmetic in C
+Homepage: https://github.com/kokke/tiny-bignum-c
diff --git a/ports/tiny-bignum-c/portfile.cmake b/ports/tiny-bignum-c/portfile.cmake new file mode 100644 index 000000000..732271241 --- /dev/null +++ b/ports/tiny-bignum-c/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO kokke/tiny-bignum-c
+ REF e814d2b6b522ecaa67701453c492811a8adbc555
+ SHA512 2cea21588d018bd74fb9a128576764feecd87364d157acee21bd37cd8890c0776b228e25580de88a0c6d723a7b8e88cb8120c8c66b3999661c707b04dffc3f5b
+ HEAD_REF master
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME unofficial-${PORT})
diff --git a/ports/tiny-regex-c/CMakeLists.txt b/ports/tiny-regex-c/CMakeLists.txt new file mode 100644 index 000000000..44c7ad710 --- /dev/null +++ b/ports/tiny-regex-c/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.14)
+
+project(tiny-regex-c LANGUAGES C)
+
+include(GNUInstallDirs)
+
+add_library(tiny-regex-c re.c)
+
+target_include_directories(
+ tiny-regex-c
+ PUBLIC
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+set_target_properties(tiny-regex-c PROPERTIES PUBLIC_HEADER re.h)
+
+install(TARGETS tiny-regex-c EXPORT unofficial-tiny-regex-c-config)
+
+install(
+ EXPORT unofficial-tiny-regex-c-config
+ NAMESPACE unofficial::tiny-regex-c::
+ DESTINATION share/unofficial-tiny-regex-c
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
diff --git a/ports/tiny-regex-c/CONTROL b/ports/tiny-regex-c/CONTROL new file mode 100644 index 000000000..12b5ea0c5 --- /dev/null +++ b/ports/tiny-regex-c/CONTROL @@ -0,0 +1,4 @@ +Source: tiny-regex-c
+Version: 2019-07-31
+Description: A small regex implementation in C
+Homepage: https://github.com/kokke/tiny-regex-c
diff --git a/ports/tiny-regex-c/portfile.cmake b/ports/tiny-regex-c/portfile.cmake new file mode 100644 index 000000000..2e21fb433 --- /dev/null +++ b/ports/tiny-regex-c/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO kokke/tiny-regex-c
+ REF d3058f271f7a06ff298dff0a6a9a1e0753a5fa17
+ SHA512 bd524c63850b08f02fa5f7725fcde85cbd9c9c6ec8a804f2570df0e04518961a758c017cdb33ebaf72df1abca42ba3b82681655404bc26e6142b5a52a0534ab4
+ HEAD_REF master
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME unofficial-${PORT})
diff --git a/ports/tinycthread/CONTROL b/ports/tinycthread/CONTROL new file mode 100644 index 000000000..da87db141 --- /dev/null +++ b/ports/tinycthread/CONTROL @@ -0,0 +1,4 @@ +Source: tinycthread
+Version: 2019-08-06
+Description: Small, portable implementation of the C11 threads API
+Homepage: https://tinycthread.github.io/
diff --git a/ports/tinycthread/portfile.cmake b/ports/tinycthread/portfile.cmake new file mode 100644 index 000000000..e521ffb00 --- /dev/null +++ b/ports/tinycthread/portfile.cmake @@ -0,0 +1,29 @@ +include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO tinycthread/tinycthread
+ REF 6957fc8383d6c7db25b60b8c849b29caab1caaee
+ SHA512 d8b1ad73676f90b236bef06464cfd34996e7b6676ef28cf011cfff86d63e9d6322f7b00ca15290b3f87ed40e704d5325f676440d0223a7f8716d3392a5d1345d
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DTINYCTHREAD_DISABLE_TESTS=OFF
+ -DTINYCTHREAD_INSTALL=ON
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(STRINGS ${SOURCE_PATH}/README.txt SOURCE_LINES)
+list(SUBLIST SOURCE_LINES 70 120 SOURCE_LINES)
+list(JOIN SOURCE_LINES "\n" _contents)
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright "${_contents}")
diff --git a/ports/tinyexif/CONTROL b/ports/tinyexif/CONTROL index 24350d8be..7d2da6da0 100644 --- a/ports/tinyexif/CONTROL +++ b/ports/tinyexif/CONTROL @@ -1,5 +1,5 @@ Source: tinyexif -Version: 1.0.2-5 +Version: 1.0.2-6 Build-Depends: tinyxml2 Homepage: https://github.com/cdcseacave/TinyEXIF Description: tiny ISO-compliant C++ EXIF and XMP parsing library for JPEG images diff --git a/ports/tinyexif/portfile.cmake b/ports/tinyexif/portfile.cmake index b6e489384..b1940ad94 100644 --- a/ports/tinyexif/portfile.cmake +++ b/ports/tinyexif/portfile.cmake @@ -20,7 +20,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/tinyexif) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/TinyEXIF) vcpkg_copy_pdbs() diff --git a/ports/tinynpy/CONTROL b/ports/tinynpy/CONTROL new file mode 100644 index 000000000..ccef53ad8 --- /dev/null +++ b/ports/tinynpy/CONTROL @@ -0,0 +1,4 @@ +Source: tinynpy +Version: 1.0.0-2 +Build-Depends: zlib +Description: tiny C++ loader/exporter of python numpy array NPY/NPZ files diff --git a/ports/tinynpy/portfile.cmake b/ports/tinynpy/portfile.cmake new file mode 100644 index 000000000..7daf6f7a3 --- /dev/null +++ b/ports/tinynpy/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cdcseacave/TinyNPY + REF 721a498ebff5ba537a136c9df330158f5c85c00c + SHA512 c22382306ed7c33b147a93093cfb1217504e6dee8172b1684c0519e3b95bb3ac7ed48de7c6b6759db5187ce85301880702e28e08f149f369dbc630e5b646a06a + HEAD_REF master +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS} + -DBUILD_DEMO=OFF +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/TinyNPY") + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/tinynpy RENAME copyright) diff --git a/ports/tinyxml2/CONTROL b/ports/tinyxml2/CONTROL index 5a33ae078..c0016a412 100644 --- a/ports/tinyxml2/CONTROL +++ b/ports/tinyxml2/CONTROL @@ -1,5 +1,5 @@ Source: tinyxml2 -Version: 7.0.1-1 +Version: 7.0.1-2 Homepage: https://github.com/leethomason/tinyxml2 Description: A simple, small, efficient, C++ XML parser diff --git a/ports/tinyxml2/portfile.cmake b/ports/tinyxml2/portfile.cmake index 7d4ceaff1..b98e45a5a 100644 --- a/ports/tinyxml2/portfile.cmake +++ b/ports/tinyxml2/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/tsl-hopscotch-map/CONTROL b/ports/tsl-hopscotch-map/CONTROL index 5fe5d726a..0f2b82e36 100644 --- a/ports/tsl-hopscotch-map/CONTROL +++ b/ports/tsl-hopscotch-map/CONTROL @@ -1,3 +1,3 @@ Source: tsl-hopscotch-map -Version: 2.2.1 +Version: 2.2.1-1 Description: C++ implementation of a fast hash map and hash set using hopscotch hashing diff --git a/ports/tsl-hopscotch-map/portfile.cmake b/ports/tsl-hopscotch-map/portfile.cmake index c96df35c6..00998338a 100644 --- a/ports/tsl-hopscotch-map/portfile.cmake +++ b/ports/tsl-hopscotch-map/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/tsl-ordered-map/CONTROL b/ports/tsl-ordered-map/CONTROL index bb2b75a9d..2170432d2 100644 --- a/ports/tsl-ordered-map/CONTROL +++ b/ports/tsl-ordered-map/CONTROL @@ -1,3 +1,3 @@ Source: tsl-ordered-map -Version: 0.8.1 +Version: 0.8.1-1 Description: C++ hash map and hash set which preserve the order of insertion diff --git a/ports/tsl-ordered-map/portfile.cmake b/ports/tsl-ordered-map/portfile.cmake index 19940d270..9f4fe996b 100644 --- a/ports/tsl-ordered-map/portfile.cmake +++ b/ports/tsl-ordered-map/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/tsl-sparse-map/CONTROL b/ports/tsl-sparse-map/CONTROL index 627d5bea1..556386857 100644 --- a/ports/tsl-sparse-map/CONTROL +++ b/ports/tsl-sparse-map/CONTROL @@ -1,3 +1,3 @@ Source: tsl-sparse-map -Version: 0.6.1 +Version: 0.6.1-1 Description: C++ implementation of a memory efficient hash map and hash set diff --git a/ports/tsl-sparse-map/portfile.cmake b/ports/tsl-sparse-map/portfile.cmake index 07d1f3048..44a366d87 100644 --- a/ports/tsl-sparse-map/portfile.cmake +++ b/ports/tsl-sparse-map/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() diff --git a/ports/usd/CONTROL b/ports/usd/CONTROL index e04784de4..d14831d54 100644 --- a/ports/usd/CONTROL +++ b/ports/usd/CONTROL @@ -1,4 +1,4 @@ Source: usd -Version: 0.8.4-1 +Version: 0.8.4-2 Build-Depends: boost-assign, boost-crc, boost-date-time, boost-filesystem, boost-format, boost-multi-index, boost-program-options, boost-regex, boost-system, boost-vmd, tbb, zlib Description: Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications. diff --git a/ports/usd/portfile.cmake b/ports/usd/portfile.cmake index cada7b4e1..76b1473be 100644 --- a/ports/usd/portfile.cmake +++ b/ports/usd/portfile.cmake @@ -17,6 +17,7 @@ vcpkg_add_to_path("${PYTHON2_DIR}") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DPXR_BUILD_ALEMBIC_PLUGIN:BOOL=OFF -DPXR_BUILD_EMBREE_PLUGIN:BOOL=OFF diff --git a/ports/usockets/CONTROL b/ports/usockets/CONTROL index 107ed27ac..69db6dce9 100644 --- a/ports/usockets/CONTROL +++ b/ports/usockets/CONTROL @@ -1,4 +1,4 @@ Source: usockets -Version: 0.1.2 +Version: 0.3.1 Build-Depends:libuv Description: Miniscule cross-platform eventing, networking & crypto for async applications
\ No newline at end of file diff --git a/ports/usockets/portfile.cmake b/ports/usockets/portfile.cmake index 55e35e12b..c5b92f84f 100644 --- a/ports/usockets/portfile.cmake +++ b/ports/usockets/portfile.cmake @@ -7,8 +7,8 @@ EndIF () vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO uNetworking/uSockets - REF v0.1.2 - SHA512 fedfc50e3498320600247920360db38977f5be4aa9067146a5a0db13dc789b8fa39fa9315b19f56555915bcb818cd0f77ccf0b8cb40ed48e2b193b083d16b242 + REF v0.3.1 + SHA512 f02b72844fb87acbf435d86a89e55244e45e047b049f36bda8e89c9ddeba8d7e6432008d33d33771faec60dcca60a3e3bfa3918c3af08ba80741e09df62c91fd HEAD_REF master ) diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL index 7b07132d2..c44c77880 100644 --- a/ports/vtk/CONTROL +++ b/ports/vtk/CONTROL @@ -1,5 +1,5 @@ Source: vtk -Version: 8.2.0-4 +Version: 8.2.0-5 Description: Software system for 3D computer graphics, image processing, and visualization Homepage: https://github.com/Kitware/VTK Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora, atlmfc (windows), eigen3, double-conversion, pugixml, libharu, sqlite3, netcdf-c @@ -14,7 +14,7 @@ Build-Depends: qt5 Feature: mpi Description: MPI functionality for VTK -Build-Depends: msmpi, hdf5[parallel] +Build-Depends: mpi, hdf5[parallel] Feature: python Description: Python functionality for VTK diff --git a/ports/wg21-sg14/CONTROL b/ports/wg21-sg14/CONTROL new file mode 100644 index 000000000..e09697226 --- /dev/null +++ b/ports/wg21-sg14/CONTROL @@ -0,0 +1,4 @@ +Source: wg21-sg14
+Version: 2019-08-13
+Description: A library for Study Group 14 of Working Group 21 (C++)
+Homepage: https://github.com/WG21-SG14/SG14
diff --git a/ports/wg21-sg14/portfile.cmake b/ports/wg21-sg14/portfile.cmake new file mode 100644 index 000000000..d72be282a --- /dev/null +++ b/ports/wg21-sg14/portfile.cmake @@ -0,0 +1,21 @@ +include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO WG21-SG14/SG14
+ REF 836e4d202249a86ba5ff56139c35e0afa60e7a1c
+ SHA512 002a6b83ecfb41bde978e912feda77639460ff376ad634e1cd0a908e2be35863489132db579d399bb6e5087fcb0355a222e611eae58eb0c2d8372bdd25f60e07
+ HEAD_REF master
+)
+
+file(COPY ${SOURCE_PATH}/SG14 DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+# Handle copyright
+
+file(STRINGS "${SOURCE_PATH}/SG14/flat_map.h" SOURCE_LINES)
+list(SUBLIST SOURCE_LINES 0 26 SOURCE_LINES)
+list(JOIN SOURCE_LINES "\n" _contents)
+
+file(READ "${SOURCE_PATH}/Docs/plf_licensing.txt" plf_licensing_contents)
+
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright "${_contents}\n${plf_licensing_contents}")
diff --git a/ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch b/ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch deleted file mode 100644 index a01096b0d..000000000 --- a/ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff --git a/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj b/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj -index 5a9d6a0..a0d12e8 100644 ---- a/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj -+++ b/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj -@@ -159,7 +159,7 @@ - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\src\;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -- <PreprocessorDefinitions>XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <PreprocessorDefinitions>_ALLOW_RTCc_IN_STL;XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> -@@ -197,7 +197,7 @@ - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\src\;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -- <PreprocessorDefinitions>XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <PreprocessorDefinitions>_ALLOW_RTCc_IN_STL;XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> -diff --git a/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj b/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj -index 27958b5..9f7767b 100644 ---- a/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj -+++ b/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj -@@ -159,6 +159,7 @@ - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -+ <PreprocessorDefinitions>_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> -@@ -191,7 +192,7 @@ - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -- <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <PreprocessorDefinitions>_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> -diff --git a/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj b/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj -index facbbc1..53b83a8 100644 ---- a/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj -+++ b/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj -@@ -144,7 +144,7 @@ - <Optimization>Disabled</Optimization> - <WholeProgramOptimization>false</WholeProgramOptimization> - <AdditionalIncludeDirectories>$(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -- <PreprocessorDefinitions>XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <PreprocessorDefinitions>_ALLOW_RTCc_IN_STL;XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <SmallerTypeCheck>true</SmallerTypeCheck> -@@ -170,7 +170,7 @@ - <Optimization>Disabled</Optimization> - <WholeProgramOptimization>false</WholeProgramOptimization> - <AdditionalIncludeDirectories>$(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> -- <PreprocessorDefinitions>XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> -+ <PreprocessorDefinitions>_ALLOW_RTCc_IN_STL;XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <SmallerTypeCheck>true</SmallerTypeCheck> diff --git a/ports/xalan-c/0002-no-mfc.patch b/ports/xalan-c/0002-no-mfc.patch deleted file mode 100644 index 3935251f5..000000000 --- a/ports/xalan-c/0002-no-mfc.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -urN a/c/Projects/Win32/Res/AllInOne/AllInOne.rc b/c/Projects/Win32/Res/AllInOne/AllInOne.rc ---- a/c/Projects/Win32/Res/AllInOne/AllInOne.rc 2012-03-19 16:18:11.000000000 +0000 -+++ b/c/Projects/Win32/Res/AllInOne/AllInOne.rc 2018-09-07 16:08:59.871434376 +0100 -@@ -7,7 +7,7 @@ - // - // Generated from the TEXTINCLUDE 2 resource. - // --#include "afxres.h" -+#include "windows.h" - - - ///////////////////////////////////////////////////////////////////////////// -@@ -75,7 +75,7 @@ - - 2 TEXTINCLUDE - BEGIN -- "#include ""afxres.h""\r\n" -+ "#include ""windows.h""\r\n" - "\r\n" - "\0" - END diff --git a/ports/xalan-c/0003-char16_t.patch b/ports/xalan-c/0003-char16_t.patch deleted file mode 100644 index e8ed83bb0..000000000 --- a/ports/xalan-c/0003-char16_t.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -urN a/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp b/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp ---- a/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp 2012-03-19 16:18:10.000000000 +0000 -+++ b/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp 2018-09-07 16:08:39.207316486 +0100 -@@ -84,7 +84,7 @@ - const XalanDOMChar* - getName() const - { -- return name; -+ return const_cast<XalanDOMChar*>(reinterpret_cast<const XalanDOMChar*>(&name[0])); - } - - /** -@@ -261,7 +261,7 @@ - #pragma warning(disable: 4244) - theHandleType theSearchHandle = - _wfindfirst( -- const_cast<wchar_t*>(theConversionFunction(theFullSearchSpec)), -+ reinterpret_cast<wchar_t*>(const_cast<XalanDOMChar*>(theConversionFunction(theFullSearchSpec))), - &theFindData); - #pragma warning(pop) - -diff -urN a/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp b/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp ---- a/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp 2012-03-19 16:18:10.000000000 +0000 -+++ b/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp 2018-09-07 16:08:39.207316486 +0100 -@@ -868,7 +868,7 @@ - const XalanDOMChar* theRHS) - { - #if defined(XALAN_USE_WINDOWS_COLLATION) -- return _wcscoll_l(theLHS, theRHS, s_locale); -+ return _wcscoll_l(reinterpret_cast<const wchar_t *>(theLHS), reinterpret_cast<const wchar_t *>(theRHS), s_locale); - #else - return doCollationCompare( - theLHS, -diff -urN a/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp b/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp ---- a/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp 2012-03-19 16:18:10.000000000 +0000 -+++ b/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp 2018-09-07 16:08:39.207316486 +0100 -@@ -123,7 +123,7 @@ - - #if defined(XALAN_WINDOWS) - HandleType theFileHandle = CreateFileW( -- theFileName.c_str(), -+ reinterpret_cast<const wchar_t *>(theFileName.c_str()), - GENERIC_WRITE, - 0, - 0, diff --git a/ports/xalan-c/0004-macosx-dyld-fallback.patch b/ports/xalan-c/0004-macosx-dyld-fallback.patch deleted file mode 100644 index db0871698..000000000 --- a/ports/xalan-c/0004-macosx-dyld-fallback.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN a/c/Makefile.incl.in b/c/Makefile.incl.in ---- a/c/Makefile.incl.in 2012-10-14 21:54:01.000000000 +0100 -+++ b/c/Makefile.incl.in 2018-09-07 16:08:15.559182228 +0100 -@@ -598,7 +598,7 @@ - MAKE_SHARED = ${CXX} $(CXXFLAGS) -D${PLATFORM} -dynamiclib -prebind -seg1addr 0x38000000 -compatibility_version 1 -current_version $(LIB_MAJOR_DOT_VER) -install_name ${LINK_NAME} ${LDFLAGS} - LINK = ${CXX} $(CXXFLAGS) ${PLATFORM_COMPILE_OPTIONS} ${LDFLAGS} - -- export DYLD_LIBRARY_PATH := $(XERCESCROOT)/lib:$(ICULIB_LOC):$(DYLD_LIBRARY_PATH) -+ export DYLD_FALLBACK_LIBRARY_PATH := $(XERCESCROOT)/lib:$(ICULIB_LOC):$(DYLD_FALLBACK_LIBRARY_PATH) - LOC_LIB = ${LOC_LIBNAME}.${LIB_MAJOR_VER}.${LIB_MINOR_VER}$(SHLIBSUFFIX) - LOC_SONAME = ${LOC_LIBNAME}.${LIB_MAJOR_VER}${SHLIBSUFFIX} - MAKE_SHARED_LOC= ${CXX} $(CXXFLAGS) -D${PLATFORM} -dynamiclib -prebind -seg1addr 0x40000000 -compatibility_version 1 -current_version $(LIB_MAJOR_DOT_VER) -install_name ${LOC_LIBNAME}${SHLIBSUFFIX} ${LDFLAGS} diff --git a/ports/xalan-c/0005-fix-ftbfs-ld-as-needed.patch b/ports/xalan-c/0005-fix-ftbfs-ld-as-needed.patch deleted file mode 100644 index 434877214..000000000 --- a/ports/xalan-c/0005-fix-ftbfs-ld-as-needed.patch +++ /dev/null @@ -1,186 +0,0 @@ -diff -urN a/c/samples/Makefile.in b/c/samples/Makefile.in ---- a/c/samples/Makefile.in 2012-03-19 16:18:12.000000000 +0000 -+++ b/c/samples/Makefile.in 2018-09-07 16:07:59.063089005 +0100 -@@ -88,7 +88,7 @@ - - $(XSL_LIB_DIR)/mod_xslt$(SHLIBSUFFIX) : $(XSL_OBJ_DIR)/mod_xslt.o - $(MAKE_SHARED) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ApacheModuleXSLT/%.c - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) -I/usr/include/apache/ $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -96,7 +96,7 @@ - - $(XSL_BIN_DIR)/CompileStylesheet: $(XSL_OBJ_DIR)/CompileStylesheet.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/CompileStylesheet/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -104,7 +104,7 @@ - - $(XSL_BIN_DIR)/DocumentBuilder: $(XSL_OBJ_DIR)/DocumentBuilder.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/DocumentBuilder/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -112,7 +112,7 @@ - - $(XSL_BIN_DIR)/EntityResolver: $(XSL_OBJ_DIR)/EntityResolver.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/EntityResolver/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -120,7 +120,7 @@ - - $(XSL_BIN_DIR)/ExternalFunction: $(XSL_OBJ_DIR)/ExternalFunction.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ExternalFunction/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -128,7 +128,7 @@ - - $(XSL_BIN_DIR)/ParsedSourceWrappers: $(XSL_OBJ_DIR)/ParsedSourceWrappers.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ParsedSourceWrappers/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -136,7 +136,7 @@ - - $(XSL_BIN_DIR)/SerializeNodeSet: $(XSL_OBJ_DIR)/SerializeNodeSet.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SerializeNodeSet/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -144,7 +144,7 @@ - - $(XSL_BIN_DIR)/SimpleTransform: $(XSL_OBJ_DIR)/SimpleTransform.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SimpleTransform/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -152,7 +152,7 @@ - - $(XSL_BIN_DIR)/SimpleXPathAPI: $(XSL_OBJ_DIR)/SimpleXPathAPI.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SimpleXPathAPI/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -160,7 +160,7 @@ - - $(XSL_BIN_DIR)/SimpleXPathCAPI: $(XSL_OBJ_DIR)/SimpleXPathCAPI.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SimpleXPathCAPI/%.c - $(CC4) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -168,7 +168,7 @@ - - $(XSL_BIN_DIR)/StreamTransform: $(XSL_OBJ_DIR)/StreamTransform.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/StreamTransform/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -176,7 +176,7 @@ - - $(XSL_BIN_DIR)/TraceListen: $(XSL_OBJ_DIR)/TraceListen.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/TraceListen/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -184,7 +184,7 @@ - - $(XSL_BIN_DIR)/TransformToXercesDOM: $(XSL_OBJ_DIR)/TransformToXercesDOM.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/TransformToXercesDOM/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -192,7 +192,7 @@ - - $(XSL_BIN_DIR)/UseStylesheetParam: $(XSL_OBJ_DIR)/UseStylesheetParam.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/UseStylesheetParam/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -200,7 +200,7 @@ - - $(XSL_BIN_DIR)/XalanTransform: $(XSL_OBJ_DIR)/XalanTransform.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/XalanTransform/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -208,7 +208,7 @@ - - $(XSL_BIN_DIR)/XalanTransformerCallback: $(XSL_OBJ_DIR)/XalanTransformerCallback.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/XalanTransformerCallback/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -216,7 +216,7 @@ - - $(XSL_BIN_DIR)/ThreadSafe: $(XSL_OBJ_DIR)/ThreadSafe.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ThreadSafe/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -diff -urN a/c/Tests/Makefile.in b/c/Tests/Makefile.in ---- a/c/Tests/Makefile.in 2012-03-19 16:18:12.000000000 +0000 -+++ b/c/Tests/Makefile.in 2018-09-07 16:07:59.063089005 +0100 -@@ -62,7 +62,7 @@ - - $(XSL_BIN_DIR)/ThreadTest: ${XSL_OBJ_DIR}/ThreadTest.o - ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \ -- ${EXTRA_LINK_OPTIONS} $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ ${EXTRA_LINK_OPTIONS} $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - ${XSL_OBJ_DIR}/%.o:$(TESTS_DIR)/Threads/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -70,7 +70,7 @@ - - $(XSL_BIN_DIR)/Conf: ${XSL_OBJ_DIR}/conf.o - ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \ -- ${EXTRA_LINK_OPTIONS} $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ ${EXTRA_LINK_OPTIONS} $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - ${XSL_OBJ_DIR}/%.o:$(TESTS_DIR)/Conf/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -92,7 +92,7 @@ - - $(XSL_BIN_DIR)/Perf: $(PERF_OBJECTS) - ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \ -- ${EXTRA_LINK_OPTIONS} $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ ${EXTRA_LINK_OPTIONS} $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - - ${XSL_OBJ_DIR}/%.o:$(TESTS_DIR)/Performance/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< diff --git a/ports/xalan-c/0006-fix-testxslt-segfault.patch b/ports/xalan-c/0006-fix-testxslt-segfault.patch deleted file mode 100644 index b8f9b09ab..000000000 --- a/ports/xalan-c/0006-fix-testxslt-segfault.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN a/c/src/xalanc/PlatformSupport/XalanLocator.hpp b/c/src/xalanc/PlatformSupport/XalanLocator.hpp ---- a/c/src/xalanc/PlatformSupport/XalanLocator.hpp 2012-09-27 07:59:33.000000000 +0100 -+++ b/c/src/xalanc/PlatformSupport/XalanLocator.hpp 2018-09-07 16:07:11.070819930 +0100 -@@ -91,7 +91,7 @@ - const XalanDOMChar* theAlternateId = getEmptyPtr()) - { - return theLocator == 0 ? theAlternateId : (theLocator->getSystemId() ? -- theLocator->getPublicId() : theAlternateId); -+ theLocator->getSystemId() : theAlternateId); - } - - /** diff --git a/ports/xalan-c/0007-fix-readme-typos.patch b/ports/xalan-c/0007-fix-readme-typos.patch deleted file mode 100644 index e97d16749..000000000 --- a/ports/xalan-c/0007-fix-readme-typos.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -urN a/c/README b/c/README ---- a/c/README 2012-10-13 05:52:45.000000000 +0100 -+++ b/c/README 2018-09-07 16:06:24.602562653 +0100 -@@ -3,7 +3,7 @@ - - Project Description: - The Apache Xalan C/C++ Project provides a library and a -- comand line program to transform XML documents using a -+ command line program to transform XML documents using a - stylesheet that conforms to XSLT 1.0 standards. - - The source package contains all the code to create the library, -@@ -84,7 +84,7 @@ - XalanMessages_1_11.exp - Windows DLL export definitions - XalanMessages_1_11.lib - Windows DLL library definitions - XalanMessages_1_11D.exp - Windows DLL export definitions -- XalanMessages_1_11D.lib - Windows DLL library defnitions -+ XalanMessages_1_11D.lib - Windows DLL library definitions - - SUPPORTED PLATFORMS: - - This is only a partial list diff --git a/ports/xalan-c/CONTROL b/ports/xalan-c/CONTROL index 06ab8967d..6a6ead6ad 100644 --- a/ports/xalan-c/CONTROL +++ b/ports/xalan-c/CONTROL @@ -1,5 +1,5 @@ Source: xalan-c -Version: 1.11-5 -Homepage: https://www-us.apache.org/dist/xalan/xalan-c/ +Version: 1.11-7 +Homepage: https://github.com/apache/xalan-c Description: Xalan is an XSLT processor for transforming XML documents into HTML, text, or other XML document types Build-Depends: xerces-c diff --git a/ports/xalan-c/fix-missing-dll-error.patch b/ports/xalan-c/fix-missing-dll-error.patch new file mode 100644 index 000000000..db49a2be6 --- /dev/null +++ b/ports/xalan-c/fix-missing-dll-error.patch @@ -0,0 +1,48 @@ +diff --git a/src/xalanc/Utils/CMakeLists.txt b/src/xalanc/Utils/CMakeLists.txt +index dc39ad0..2d78685 100644 +--- a/src/xalanc/Utils/CMakeLists.txt ++++ b/src/xalanc/Utils/CMakeLists.txt +@@ -40,6 +40,13 @@ set(SUPPORTMSGINDEX "${GEN_SUPPORTDIR}/LocalMsgIndex.hpp") + add_custom_target(locale ALL) + set_target_properties(locale PROPERTIES FOLDER "Message Library") + ++# workaround for case of missing xerces-c dll ++if(EXISTS ${XercesC_INCLUDE_DIR}/../bin) ++ set(MsgCreator_WD $<TARGET_FILE_DIR:XercesC::XercesC>/../bin) ++else() ++ set(MsgCreator_WD "${XSL_NLS_GEN_DIR}") ++endif() ++ + if(msgloader STREQUAL "inmemory") + add_custom_command( + OUTPUT "${GENMSGINDEX}" +@@ -48,7 +55,8 @@ if(msgloader STREQUAL "inmemory") + "${XLIFF_FILE_NAME}" + -TYPE inmem + -LOCALE ${LOCALE} +- WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}" ++ -OUTDIR "${XSL_NLS_GEN_DIR}" ++ WORKING_DIRECTORY "${MsgCreator_WD}" + COMMENT "Generating inmemory locale message data" + DEPENDS MsgCreator "${XLIFF_FILE_NAME}") + +@@ -92,7 +100,8 @@ if(msgloader STREQUAL "icu") + "${XLIFF_FILE_NAME}" + -TYPE icu + -LOCALE ${LOCALE} +- WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}" ++ -OUTDIR "${XSL_NLS_GEN_DIR}" ++ WORKING_DIRECTORY "${MsgCreator_WD}" + COMMENT "Generating ICU locale message data" + DEPENDS MsgCreator "${XLIFF_FILE_NAME}") + +@@ -141,7 +150,8 @@ if(msgloader STREQUAL "nls") + "${XLIFF_FILE_NAME}" + -TYPE nls + -LOCALE ${LOCALE} +- WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}" ++ -OUTDIR "${XSL_NLS_GEN_DIR}" ++ WORKING_DIRECTORY "${MsgCreator_WD}" + COMMENT "Generating nls locale message data" + DEPENDS MsgCreator "${XLIFF_FILE_NAME}") + diff --git a/ports/xalan-c/fix-win-deprecated-err.patch b/ports/xalan-c/fix-win-deprecated-err.patch new file mode 100644 index 000000000..1484f4e27 --- /dev/null +++ b/ports/xalan-c/fix-win-deprecated-err.patch @@ -0,0 +1,15 @@ +diff --git a/src/xalanc/Utils/MsgCreator/CMakeLists.txt b/src/xalanc/Utils/MsgCreator/CMakeLists.txt +index 20215d4..dc74c1b 100644 +--- a/src/xalanc/Utils/MsgCreator/CMakeLists.txt ++++ b/src/xalanc/Utils/MsgCreator/CMakeLists.txt +@@ -37,6 +37,10 @@ set(msgcreator_headers + NLSHandler.hpp + SAX2Handler.hpp) + ++if(MSVC) ++ add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) ++endif() ++ + add_executable(MsgCreator ${msgcreator_sources} ${msgcreator_headers}) + target_include_directories(MsgCreator PUBLIC + $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src> diff --git a/ports/xalan-c/portfile.cmake b/ports/xalan-c/portfile.cmake index 52e8b34fa..0460c7464 100644 --- a/ports/xalan-c/portfile.cmake +++ b/ports/xalan-c/portfile.cmake @@ -1,81 +1,42 @@ include(vcpkg_common_functions) -string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH) -if(BUILDTREES_PATH_LENGTH GREATER 37 AND CMAKE_HOST_WIN32) - message(WARNING "${PORT}'s buildsystem uses very long paths and may fail on your system.\n" - "We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command." - ) -endif() - -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) - -set(XALANC_VERSION 1.11) - -vcpkg_download_distfile(ARCHIVE - URLS "http://www-us.apache.org/dist/xalan/xalan-c/sources/xalan_c-${XALANC_VERSION}-src.zip" - FILENAME "xalan_c-${XALANC_VERSION}-src.zip" - SHA512 2e79a2c8f755c9660ffc94b26b6bd4b140685e05a88d8e5abb19a2f271383a3f2f398b173ef403f65dc33af75206214bd21ac012c39b4c0051b3a9f61f642fe6 +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO apache/xalan-c + REF 177da75646a80fae2c22a315c0d987a5eadba143 + SHA512 e0f095b7031394c39c8e0fdca1f820c4222466f8c6e9df7bc40a21f9ca0e9291b7b6cdfb0a2d67db275ae97d7a7cdd447637102639e74716f0fb23a946b30ebe + PATCHES + fix-win-deprecated-err.patch + fix-missing-dll-error.patch ) -vcpkg_download_distfile(XALAN_PATCH8 - URLS "https://github.com/rleigh-codelibre/vcpkg-patches/raw/ca09d69280469ce8f787c67b48f86e46a463ef5d/xalan-c/0008-remove-unary-binary-function.patch" - FILENAME "0008-remove-unary-binary-function.patch" - SHA512 059d9a39b29125ae770369e4c44ab7804ae16d4ff5c90e35f25b7990dc987161bf1187ceb2dcbab181ffb72490a9d9f45e30ab5928644734e7627cb74b03e201 +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) -vcpkg_download_distfile(XALAN_PATCH9 - URLS "https://raw.githubusercontent.com/rleigh-codelibre/vcpkg-patches/ca09d69280469ce8f787c67b48f86e46a463ef5d/xalan-c/0009-remove-select-workaround.patch" - FILENAME "0009-remove-select-workaround.patch" - SHA512 73730736cd1f1809ebcc35562017402d606cbfd5a64665d104a21d89d679ab3274f6f5685ab63305c57fffab74e62084c0e18c76d19eb5f9c2e36be6679fd4d3 -) +vcpkg_install_cmake() -vcpkg_extract_source_archive_ex( - OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} - REF ${XALANC_VERSION} - PATCHES - 0001-ALLOW_RTCc_IN_STL.patch - 0002-no-mfc.patch - 0003-char16_t.patch - 0004-macosx-dyld-fallback.patch - 0005-fix-ftbfs-ld-as-needed.patch - 0006-fix-testxslt-segfault.patch - 0007-fix-readme-typos.patch - ${XALAN_PATCH8} - ${XALAN_PATCH9} -) - -if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86") -elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64") +if(EXISTS ${CURRENT_PACKAGES_DIR}/cmake) + vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/xalan-c) else() - message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}") + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/XalanC TARGET_PATH share/xalan-c) endif() -set(ENV{CL} "$ENV{CL} \"/I${CURRENT_INSTALLED_DIR}/include\"") -set(ENV{PATH} "$ENV{PATH};${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/debug/bin") - -vcpkg_install_msbuild( - SOURCE_PATH ${SOURCE_PATH} - PROJECT_SUBPATH c/projects/Win32/VC10/AllInOne/AllInOne.vcxproj - OPTIONS_RELEASE /p:XERCESCROOT=${CURRENT_INSTALLED_DIR} - OPTIONS_DEBUG /p:XERCESCROOT=${CURRENT_INSTALLED_DIR}/debug - LICENSE_SUBPATH c/LICENSE - SKIP_CLEAN +# cleanup +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share ) -file(COPY ${SOURCE_PATH}/c/src/xalanc DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.hpp) - -# LocalMsgIndex.hpp and LocalMsgData.hpp are here -file(GLOB NLS_INCLUDES "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/c/Build/*/VC10/Release/Nls/Include/*.hpp") -if(NOT NLS_INCLUDES) - message(FATAL_ERROR "Could not locate LocalMsgIndex.hpp") -endif() -file(COPY ${NLS_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/xalanc/PlatformSupport) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +else() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/Xalan.exe ${CURRENT_PACKAGES_DIR}/debug/bin/Xalan.exe) +endif() -vcpkg_clean_msbuild() +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/xalan-c) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/xalan-c/LICENSE ${CURRENT_PACKAGES_DIR}/share/xalan-c/copyright) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/NLS) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/util/MsgLoaders/ICU/resources) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/TestXSLT) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/XalanExe) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/XPathCAPI) +vcpkg_copy_pdbs() diff --git a/ports/xerces-c/CONTROL b/ports/xerces-c/CONTROL index 3d2a4337e..6a7b0d216 100644 --- a/ports/xerces-c/CONTROL +++ b/ports/xerces-c/CONTROL @@ -1,5 +1,5 @@ Source: xerces-c -Version: 3.2.2-10 +Version: 3.2.2-11 Homepage: https://github.com/apache/xerces-c Description: Xerces-C++ is a XML parser, for parsing, generating, manipulating, and validating XML documents using the DOM, SAX, and SAX2 APIs. diff --git a/ports/xerces-c/no-symlinks-in-static-build.patch b/ports/xerces-c/no-symlinks-in-static-build.patch new file mode 100644 index 000000000..34bd732d3 --- /dev/null +++ b/ports/xerces-c/no-symlinks-in-static-build.patch @@ -0,0 +1,31 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c29aa25..3106d77 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -1285,15 +1285,17 @@ if(MSVC) + set_target_properties(xerces-c PROPERTIES RUNTIME_OUTPUT_NAME "xerces-c_${INTERFACE_VERSION_U}") + set_target_properties(xerces-c PROPERTIES DEBUG_POSTFIX "D") + elseif(UNIX) +- # For strict libtool compatibility on Unix. It's a horrible hack to +- # set the version in the filename, and create the symlink at install +- # time. Note: could be dropped when the SONAME is updated and +- # libtool compatibility is no longer required. +- set_target_properties(xerces-c PROPERTIES OUTPUT_NAME "xerces-c-${INTERFACE_VERSION_D}") +- file(GENERATE +- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/InstallLibrarySymlink.cmake" +- CONTENT "execute_process(COMMAND ln -sf \"$<TARGET_FILE_NAME:xerces-c>\" \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LIBDIR}/libxerces-c.so\")") +- install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/InstallLibrarySymlink.cmake") ++ if(BUILD_SHARED_LIBS) ++ # For strict libtool compatibility on Unix. It's a horrible hack to ++ # set the version in the filename, and create the symlink at install ++ # time. Note: could be dropped when the SONAME is updated and ++ # libtool compatibility is no longer required. ++ set_target_properties(xerces-c PROPERTIES OUTPUT_NAME "xerces-c-${INTERFACE_VERSION_D}") ++ file(GENERATE ++ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/InstallLibrarySymlink.cmake" ++ CONTENT "execute_process(COMMAND ln -sf \"$<TARGET_FILE_NAME:xerces-c>\" \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LIBDIR}/libxerces-c.so\")") ++ install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/InstallLibrarySymlink.cmake") ++ endif() + else() + # Not used for the common cases, though this would be the default if + # not for libtool compatibility. diff --git a/ports/xerces-c/portfile.cmake b/ports/xerces-c/portfile.cmake index 5f8fa4c11..214cf971b 100644 --- a/ports/xerces-c/portfile.cmake +++ b/ports/xerces-c/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_from_github( PATCHES disable-tests.patch remove-dll-export-macro.patch + no-symlinks-in-static-build.patch ) set(DISABLE_ICU ON) @@ -27,6 +28,7 @@ vcpkg_configure_cmake( -DDISABLE_DOC=ON -DDISABLE_SAMPLES=ON -DCMAKE_DISABLE_FIND_PACKAGE_ICU=${DISABLE_ICU} + -DCMAKE_DISABLE_FIND_PACKAGE_CURL=ON ${XMLCHTYPE} ) diff --git a/ports/xlnt/CONTROL b/ports/xlnt/CONTROL index 6433b748e..b3fbc8422 100644 --- a/ports/xlnt/CONTROL +++ b/ports/xlnt/CONTROL @@ -1,4 +1,4 @@ Source: xlnt
-Version: 1.3.0-1
+Version: 1.3.0-2
Homepage: https://github.com/tfussell/xlnt
Description: Cross-platform user-friendly xlsx library for C++14
diff --git a/ports/xlnt/portfile.cmake b/ports/xlnt/portfile.cmake index 29a0e2201..1e1a9cb43 100644 --- a/ports/xlnt/portfile.cmake +++ b/ports/xlnt/portfile.cmake @@ -16,6 +16,7 @@ endif() vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS -DTESTS=OFF -DSAMPLES=OFF -DBENCHMARKS=OFF -DSTATIC=${STATIC}
)
diff --git a/ports/xorstr/CONTROL b/ports/xorstr/CONTROL new file mode 100644 index 000000000..f3555680c --- /dev/null +++ b/ports/xorstr/CONTROL @@ -0,0 +1,4 @@ +Source: xorstr +Version: 2019-08-10 +Description: Heavily vectorized c++17 compile time string encryption +Homepage: https://github.com/JustasMasiulis/xorstr diff --git a/ports/xorstr/portfile.cmake b/ports/xorstr/portfile.cmake new file mode 100644 index 000000000..3d97ba190 --- /dev/null +++ b/ports/xorstr/portfile.cmake @@ -0,0 +1,16 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO JustasMasiulis/xorstr + REF 5d7371dcb70601ce9c252d475cc3dc6cf8f1e0db + SHA512 7625d2ebdb95a5414f0a1ac7ac8951b612d5159be5eccce4e13b88a4d17ffa3c65ff81ce5df5b64064b5712da7238ec1f564d2c213852731cad30c367ebad72e + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/include/xorstr.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/xsimd/CONTROL b/ports/xsimd/CONTROL index 6147d355c..dc442f858 100644 --- a/ports/xsimd/CONTROL +++ b/ports/xsimd/CONTROL @@ -1,5 +1,5 @@ Source: xsimd
-Version: 7.2.3-1
+Version: 7.2.3-2
Description: Modern, portable C++ wrappers for SIMD intrinsics
Homepage: https://github.com/QuantStack/xsimd
diff --git a/ports/xsimd/portfile.cmake b/ports/xsimd/portfile.cmake index 338afff45..ab293c408 100644 --- a/ports/xsimd/portfile.cmake +++ b/ports/xsimd/portfile.cmake @@ -10,16 +10,18 @@ vcpkg_from_github( HEAD_REF master
)
-vcpkg_check_features(xcomplex ENABLE_XTL_COMPLEX)
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ xcomplex ENABLE_XTL_COMPLEX
+)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DENABLE_FALLBACK=OFF
- -DENABLE_XTL_COMPLEX=${ENABLE_XTL_COMPLEX}
-DBUILD_TESTS=OFF
-DDOWNLOAD_GTEST=OFF
+ ${FEATURE_OPTIONS}
)
vcpkg_install_cmake()
diff --git a/ports/xtensor-io/CONTROL b/ports/xtensor-io/CONTROL new file mode 100644 index 000000000..734c0becf --- /dev/null +++ b/ports/xtensor-io/CONTROL @@ -0,0 +1,5 @@ +Source: xtensor-io
+Version: 0.7.0
+Description: xtensor plugin to read and write images, audio files, numpy (compressed) npz and HDF5
+Build-Depends: xtensor, xtl
+
diff --git a/ports/xtensor-io/portfile.cmake b/ports/xtensor-io/portfile.cmake new file mode 100644 index 000000000..d8cc89a09 --- /dev/null +++ b/ports/xtensor-io/portfile.cmake @@ -0,0 +1,31 @@ +# header-only library
+
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO QuantStack/xtensor-io
+ REF 0.7.0
+ SHA512 6c8416c595d022ed60cd802deec6d63128d205d6fd13962098b6242ace4fa9e61122e5b05837a1aab3b64bc042da7cbf2f72f2328155c342de3a6db741d4d4ee
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DBUILD_TESTS=OFF
+ -DDOWNLOAD_GTEST=OFF
+ -DDOWNLOAD_GBENCHMARK=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
+
diff --git a/ports/xtensor/CONTROL b/ports/xtensor/CONTROL index 138d9e1fe..14df243d9 100644 --- a/ports/xtensor/CONTROL +++ b/ports/xtensor/CONTROL @@ -1,5 +1,5 @@ Source: xtensor
-Version: 0.20.7-1
+Version: 0.20.7-2
Description: C++ tensors with broadcasting and lazy computing
Homepage: https://quantstack.net/xtensor
Build-Depends: nlohmann-json, xtl
diff --git a/ports/xtensor/portfile.cmake b/ports/xtensor/portfile.cmake index 9c8b3b63e..d30743a40 100644 --- a/ports/xtensor/portfile.cmake +++ b/ports/xtensor/portfile.cmake @@ -10,7 +10,7 @@ vcpkg_from_github( HEAD_REF master
)
-vcpkg_check_features(
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
xsimd XTENSOR_USE_XSIMD
tbb XTENSOR_USE_TBB
)
diff --git a/ports/yasm/CONTROL b/ports/yasm/CONTROL new file mode 100644 index 000000000..5cb349270 --- /dev/null +++ b/ports/yasm/CONTROL @@ -0,0 +1,4 @@ +Source: yasm +Version: 1.3.0 +Homepage: https://github.com/yasm/yasm +Description: Yasm is a complete rewrite of the NASM assembler under the “new” BSD License. diff --git a/ports/yasm/portfile.cmake b/ports/yasm/portfile.cmake new file mode 100644 index 000000000..5dfe2a51c --- /dev/null +++ b/ports/yasm/portfile.cmake @@ -0,0 +1,51 @@ +include(vcpkg_common_functions) + +if (NOT VCPKG_TARGET_IS_WINDOWS) + message(FATAL_ERROR "${PORT} only supports windows") +elseif (TRIPLET_SYSTEM_ARCH MATCHES "arm") + message(FATAL_ERROR "ARM is currently not supported.") +elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore) + message(FATAL_ERROR "Error: UWP builds are currently not supported.") +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO yasm/yasm + REF v1.3.0 + SHA512 f5053e2012e0d2ce88cc1cc06e3bdb501054aed5d1f78fae40bb3e676fe2eb9843d335a612d7614d99a2b9e49dca998d57f61b0b89fac8225afa4ae60ae848f1 + HEAD_REF master +) + +vcpkg_find_acquire_program(PYTHON2) +get_filename_component(PYTHON_PATH ${PYTHON2} DIRECTORY) +vcpkg_add_to_path("${PYTHON_PATH}") + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +file(REMOVE + ${CURRENT_PACKAGES_DIR}/debug/bin/vsyasm.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/yasm.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/ytasm.exe +) + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vsyasm.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/vsyasm.exe) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/yasm.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/yasm.exe) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/ytasm.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/ytasm.exe) + +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING ${SOURCE_PATH}/README DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
\ No newline at end of file diff --git a/ports/yato/CONTROL b/ports/yato/CONTROL index f19519315..65546494d 100644 --- a/ports/yato/CONTROL +++ b/ports/yato/CONTROL @@ -1,3 +1,3 @@ Source: yato
-Version: 1.0-1
+Version: 1.0-2
Description: Modern C++14 containers and utilities, actors system, typesafe config
diff --git a/ports/yato/portfile.cmake b/ports/yato/portfile.cmake index 44ee93782..76a54ee13 100644 --- a/ports/yato/portfile.cmake +++ b/ports/yato/portfile.cmake @@ -21,6 +21,7 @@ file(COPY "${SOURCE_PATH}/modules/config/yato" vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DYATO_BUILD_TESTS:BOOL=OFF
-DYATO_BUILD_ACTORS:BOOL=ON
diff --git a/ports/zeromq/CONTROL b/ports/zeromq/CONTROL index 4a638759d..d0dbe6be9 100644 --- a/ports/zeromq/CONTROL +++ b/ports/zeromq/CONTROL @@ -1,5 +1,5 @@ Source: zeromq -Version: 2019-07-09 +Version: 2019-07-09-1 Homepage: https://github.com/zeromq/libzmq Description: The ZeroMQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products diff --git a/ports/zeromq/portfile.cmake b/ports/zeromq/portfile.cmake index 381bbccee..7f42cf521 100644 --- a/ports/zeromq/portfile.cmake +++ b/ports/zeromq/portfile.cmake @@ -11,7 +11,9 @@ vcpkg_from_github( string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) -vcpkg_check_features(sodium WITH_LIBSODIUM) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + sodium WITH_LIBSODIUM +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} @@ -21,8 +23,8 @@ vcpkg_configure_cmake( -DPOLLER=select -DBUILD_STATIC=${BUILD_STATIC} -DBUILD_SHARED=${BUILD_SHARED} - -DWITH_LIBSODIUM=${WITH_LIBSODIUM} -DWITH_PERF_TOOL=OFF + ${FEATURE_OPTIONS} OPTIONS_DEBUG "-DCMAKE_PDB_OUTPUT_DIRECTORY=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" ) diff --git a/ports/zxing-cpp/0001-opencv4-compat.patch b/ports/zxing-cpp/0001-opencv4-compat.patch index 51cec5387..76ad1f4a0 100644 --- a/ports/zxing-cpp/0001-opencv4-compat.patch +++ b/ports/zxing-cpp/0001-opencv4-compat.patch @@ -1,5 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ccb2ba9..5ade734 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,7 @@ + cmake_minimum_required(VERSION 3.0) + + project(zxing) +- ++set(CMAKE_CXX_STANDARD 11) + option(BUILD_TESTING "Enable generation of test targets" OFF) + + set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH}) diff --git a/opencv-cli/src/main.cpp b/opencv-cli/src/main.cpp -index 63b6fd3..430dda6 100755 +index 63b6fd3..5900c4f 100644 --- a/opencv-cli/src/main.cpp +++ b/opencv-cli/src/main.cpp @@ -135,14 +135,14 @@ int main(int argc, char** argv) { diff --git a/ports/zxing-cpp/CONTROL b/ports/zxing-cpp/CONTROL index c97ad1734..16343782d 100644 --- a/ports/zxing-cpp/CONTROL +++ b/ports/zxing-cpp/CONTROL @@ -1,4 +1,4 @@ Source: zxing-cpp -Version: 3.3.3-5 +Version: 3.3.3-6 Build-Depends: opencv Description: Barcode detection and decoding library. diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index b0e4f98a5..09d77b07d 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -249,7 +249,7 @@ buildDir="$vcpkgRootDir/toolsrc/build.rel" rm -rf "$buildDir" mkdir -p "$buildDir" -(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DDEFINE_DISABLE_METRICS=$vcpkgDisableMetrics" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1 +(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DBUILD_TESTING=OFF" "-DDEFINE_DISABLE_METRICS=$vcpkgDisableMetrics" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1 (cd "$buildDir" && "$cmakeExe" --build .) || exit 1 rm -rf "$vcpkgRootDir/vcpkg" diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index 2fdd9fdb4..ab51dc9be 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -29,7 +29,7 @@ function deployBinary([string]$targetBinaryDir, [string]$SourceDir, [string]$tar Copy-Item "$SourceDir\$targetBinaryName" $targetBinaryDir } if ($copiedFilesLog) { Add-Content $copiedFilesLog "$targetBinaryDir\$targetBinaryName" -Encoding UTF8 } - if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$targetBinaryName" } + if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$targetBinaryName" -Encoding Unicode } } diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index f657e2710..6eb0f62dd 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -38,17 +38,7 @@ else() elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019$") - if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Xx]86$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Mm][Dd]64$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Rr][Mm]$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[Aa][Rr][Mm]64$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm64) - else() - - endif() + set(_VCPKG_TARGET_TRIPLET_ARCH x86) else() find_program(_VCPKG_CL cl) if(_VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$") diff --git a/scripts/cmake/vcpkg_check_features.cmake b/scripts/cmake/vcpkg_check_features.cmake index d089ac5b1..81ebc234d 100644 --- a/scripts/cmake/vcpkg_check_features.cmake +++ b/scripts/cmake/vcpkg_check_features.cmake @@ -1,112 +1,191 @@ ## # vcpkg_check_features -## -## Check if one or more features are a part of the package installation. -## +## Check if one or more features are a part of a package installation. +## ## ## Usage ## ```cmake ## vcpkg_check_features( -## <feature1> <output_variable1> -## [<feature2> <output_variable2>] -## ... +## OUT_FEATURE_OPTIONS <FEATURE_OPTIONS> +## [FEATURES +## <cuda> <WITH_CUDA> +## [<opencv> <WITH_OPENCV>] +## ...] +## [INVERTED_FEATURES +## <cuda> <IGNORE_PACKAGE_CUDA> +## [<opencv> <IGNORE_PACKAGE_OPENCV>] +## ...] ## ) ## ``` -## -## `vcpkg_check_features` accepts a list of (feature, output_variable) pairs. If a feature is specified, the corresponding output variable will be set as `ON`, or `OFF` otherwise. The syntax is similar to the `PROPERTIES` argument of `set_target_properties`. -## -## `vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the parent scope, which you can pass as a part of `OPTIONS` argument when calling functions like `vcpkg_config_cmake`: -## ```cmake -## vcpkg_config_cmake( -## SOURCE_PATH ${SOURCE_PATH} -## PREFER_NINJA -## OPTIONS -## -DBUILD_TESTING=ON -## ${FEATURE_OPTIONS} -## ) -## ``` -## +## `vcpkg_check_features()` accepts these parameters: +## +## * `OUT_FEATURE_OPTIONS`: +## An output variable, the function will clear the variable passed to `OUT_FEATURE_OPTIONS` +## and then set it to contain a list of option definitions (`-D<OPTION_NAME>=ON|OFF`). +## +## This should be set to `FEATURE_OPTIONS` by convention. +## +## * `FEATURES`: +## A list of (`FEATURE_NAME`, `OPTION_NAME`) pairs. +## For each `FEATURE_NAME` a definition is added to `OUT_FEATURE_OPTIONS` in the form of: +## +## * `-D<OPTION_NAME>=ON`, if a feature is specified for installation, +## * `-D<OPTION_NAME>=OFF`, otherwise. +## +## * `INVERTED_FEATURES`: +## A list of (`FEATURE_NAME`, `OPTION_NAME`) pairs, uses reversed logic from `FEATURES`. +## For each `FEATURE_NAME` a definition is added to `OUT_FEATURE_OPTIONS` in the form of: +## +## * `-D<OPTION_NAME>=OFF`, if a feature is specified for installation, +## * `-D<OPTION_NAME>=ON`, otherwise. +## +## ## ## Notes +## +## The `FEATURES` name parameter can be omitted if no `INVERTED_FEATURES` are used. +## +## At least one (`FEATURE_NAME`, `OPTION_NAME`) pair must be passed to the function call. +## +## Arguments passed to `FEATURES` and `INVERTED_FEATURES` are not validated to prevent duplication. +## If the same (`FEATURE_NAME`, `OPTION_NAME`) pair is passed to both lists, +## two conflicting definitions are added to `OUT_FEATURE_OPTIONS`. +## +## +## ## Examples +## +## ### Example 1: Regular features +## ## ```cmake -## vcpkg_check_features(<feature> <output_variable>) -## ``` -## can be used as a replacement of: -## ```cmake -## if(<feature> IN_LIST FEATURES) -## set(<output_variable> ON) -## else() -## set(<output_variable> OFF) -## endif() +## $ ./vcpkg install mimalloc[asm,secure] +## +## # ports/mimalloc/portfile.cmake +## vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +## # Keyword FEATURES is optional if INVERTED_FEATURES are not used +## asm MI_SEE_ASM +## override MI_OVERRIDE +## secure MI_SECURE +## ) +## +## vcpkg_configure_cmake( +## SOURCE_PATH ${SOURCE_PATH} +## PREFER_NINJA +## OPTIONS +## # Expands to "-DMI_SEE_ASM=ON; -DMI_OVERRIDE=OFF; -DMI_SECURE=ON" +## ${FEATURE_OPTIONS} +## ) ## ``` -## -## However, if you have a feature that was checked like this before: +## +## ### Example 2: Inverted features +## ## ```cmake -## if(<feature> IN_LIST FEATURES) -## set(<output_variable> OFF) -## else() -## set(<output_variable> ON) -## endif() +## $ ./vcpkg install cpprestsdk[websockets] +## +## # ports/cpprestsdk/portfile.cmake +## vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +## INVERTED_FEATURES # <- Keyword INVERTED_FEATURES required +## brotli CPPREST_EXCLUDE_BROTLI +## websockets CPPREST_EXCLUDE_WEBSOCKETS +## ) +## +## vcpkg_configure_cmake( +## SOURCE_PATH ${SOURCE_PATH} +## PREFER_NINJA +## OPTIONS +## # Expands to "-DCPPREST_EXCLUDE_BROTLI=ON; -DCPPREST_EXCLUDE_WEBSOCKETS=OFF" +## ${FEATURE_OPTIONS} +## ) ## ``` -## then you should not use `vcpkg_check_features` instead. [```oniguruma```](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake), for example, has a feature named `non-posix` which is checked with: +## +## ### Example 3: Set multiple options for same feature +## ## ```cmake -## if("non-posix" IN_LIST FEATURES) -## set(ENABLE_POSIX_API OFF) -## else() -## set(ENABLE_POSIX_API ON) -## endif() -## ``` -## and by replacing these code with: +## $ ./vcpkg install pcl[cuda] +## +## # ports/pcl/portfile.cmake +## vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +## cuda WITH_CUDA +## cuda BUILD_CUDA +## cuda BUILD_GPU +## ) +## +## vcpkg_configure_cmake( +## SOURCE_PATH ${SOURCE_PATH} +## PREFER_NINJA +## OPTIONS +## # Expands to "-DWITH_CUDA=ON; -DBUILD_CUDA=ON; -DBUILD_GPU=ON" +## ${FEATURE_OPTIONS} +## ) +## ``` +## +## ### Example 4: Use regular and inverted features +## ## ```cmake -## vcpkg_check_features(non-posix ENABLE_POSIX_API) -## ``` -## is totally wrong. -## -## `vcpkg_check_features` is supposed to be called only once. Otherwise, the `FEATURE_OPTIONS` variable set by a previous call will be overwritten. -## -## ## Examples -## -## * [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake) -## * [xsimd](https://github.com/microsoft/vcpkg/blob/master/ports/xsimd/portfile.cmake) -## * [xtensor](https://github.com/microsoft/vcpkg/blob/master/ports/xtensor/portfile.cmake) +## $ ./vcpkg install rocksdb[tbb] +## +## # ports/rocksdb/portfile.cmake +## vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +## FEATURES # <- Keyword FEATURES is required because INVERTED_FEATURES are being used +## tbb WITH_TBB +## INVERTED_FEATURES +## tbb ROCKSDB_IGNORE_PACKAGE_TBB +## ) +## +## vcpkg_configure_cmake( +## SOURCE_PATH ${SOURCE_PATH} +## PREFER_NINJA +## OPTIONS +## # Expands to "-DWITH_TBB=ON; -DROCKSDB_IGNORE_PACKAGE_TBB=OFF" +## ${FEATURE_OPTIONS} +## ) +## ``` +## +## ## Examples in portfiles +## +## * [cpprestsdk](https://github.com/microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) +## * [pcl](https://github.com/microsoft/vcpkg/blob/master/ports/pcl/portfile.cmake) +## * [rocksdb](https://github.com/microsoft/vcpkg/blob/master/ports/rocksdb/portfile.cmake) +## function(vcpkg_check_features) - cmake_parse_arguments(_vcf "" "" "" ${ARGN}) - - list(LENGTH ARGN _vcf_ARGC) - math(EXPR _vcf_INCORRECT_ARGN "${_vcf_ARGC} % 2") + cmake_parse_arguments(_vcf "" "OUT_FEATURE_OPTIONS" "FEATURES;INVERTED_FEATURES" ${ARGN}) - if(_vcf_INCORRECT_ARGN) - message(FATAL_ERROR "Called with incorrect number of arguments.") + if (NOT DEFINED _vcf_OUT_FEATURE_OPTIONS) + message(FATAL_ERROR "OUT_FEATURE_OPTIONS must be specified.") endif() - set(_vcf_IS_FEATURE_ARG ON) - set(_vcf_FEATURE_OPTIONS) - - # Process (feature, output_var) pairs - foreach(_vcf_ARG ${ARGN}) - if(_vcf_IS_FEATURE_ARG) - set(_vcf_FEATURE ${_vcf_ARG}) - - if(NOT ${_vcf_FEATURE} IN_LIST ALL_FEATURES) - message(FATAL_ERROR "Unknown feature: ${_vcf_FEATURE}") - endif() - - set(_vcf_IS_FEATURE_ARG OFF) - else() - set(_vcf_FEATURE_VAR ${_vcf_ARG}) + macro(_check_features _vcf_ARGUMENT _set_if _set_else) + list(LENGTH ${_vcf_ARGUMENT} FEATURES_SET_LEN) + math(EXPR _vcf_INCORRECT_ARGN "${FEATURES_SET_LEN} % 2") + if(_vcf_INCORRECT_ARGN) + message(FATAL_ERROR "Called with incorrect number of arguments.") + endif() - if(${_vcf_FEATURE} IN_LIST FEATURES) - set(${_vcf_FEATURE_VAR} ON PARENT_SCOPE) - list(APPEND _vcf_FEATURE_OPTIONS "-D${_vcf_FEATURE_VAR}=ON") + set(_vcf_IS_FEATURE_NAME_ARG ON) + foreach(_vcf_ARG ${${_vcf_ARGUMENT}}) + if(_vcf_IS_FEATURE_NAME_ARG) + set(_vcf_FEATURE_NAME ${_vcf_ARG}) + if(NOT ${_vcf_FEATURE_NAME} IN_LIST ALL_FEATURES) + message(FATAL_ERROR "Unknown feature: ${_vcf_FEATURE_NAME}") + endif() + set(_vcf_IS_FEATURE_NAME_ARG OFF) else() - set(${_vcf_FEATURE_VAR} OFF PARENT_SCOPE) - list(APPEND _vcf_FEATURE_OPTIONS "-D${_vcf_FEATURE_VAR}=OFF") + set(_vcf_FEATURE_VARIABLE ${_vcf_ARG}) + if(${_vcf_FEATURE_NAME} IN_LIST FEATURES) + list(APPEND _vcf_FEATURE_OPTIONS "-D${_vcf_FEATURE_VARIABLE}=${_set_if}") + else() + list(APPEND _vcf_FEATURE_OPTIONS "-D${_vcf_FEATURE_VARIABLE}=${_set_else}") + endif() + set(_vcf_IS_FEATURE_NAME_ARG ON) endif() + endforeach() + endmacro() - set(_vcf_IS_FEATURE_ARG ON) - endif() - endforeach() + set(_vcf_FEATURE_OPTIONS) - if(DEFINED FEATURE_OPTIONS) - message(WARNING "FEATURE_OPTIONS is already defined and will be overwritten.") + if (DEFINED _vcf_FEATURES OR DEFINED _vcf_INVERTED_FEATURES) + _check_features(_vcf_FEATURES ON OFF) + _check_features(_vcf_INVERTED_FEATURES OFF ON) + else() + # Skip arguments that correspond to OUT_FEATURE_OPTIONS and its value. + list(SUBLIST ARGN 2 -1 _vcf_ARGN) + _check_features(_vcf_ARGN ON OFF) endif() - - set(FEATURE_OPTIONS ${_vcf_FEATURE_OPTIONS} PARENT_SCOPE) + set(${_vcf_OUT_FEATURE_OPTIONS} "${_vcf_FEATURE_OPTIONS}" PARENT_SCOPE) endfunction() diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index 515b2bafe..e9e52bad8 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -9,6 +9,7 @@ include(vcpkg_extract_source_archive_ex) include(vcpkg_execute_required_process) include(vcpkg_execute_required_process_repeat) include(vcpkg_execute_build_process) +include(vcpkg_fail_port_install) include(vcpkg_find_acquire_program) include(vcpkg_fixup_cmake_targets) include(vcpkg_from_github) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 37362a5a2..6c392d385 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -8,6 +8,7 @@ ## SOURCE_PATH <${SOURCE_PATH}> ## [PREFER_NINJA] ## [DISABLE_PARALLEL_CONFIGURE] +## [NO_CHARSET_FLAG] ## [GENERATOR <"NMake Makefiles">] ## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] ## [OPTIONS_RELEASE <-DOPTIMIZE=1>...] @@ -28,6 +29,11 @@ ## Disables running the CMake configure step in parallel. ## This is needed for libraries which write back into their source directory during configure. ## +## ### NO_CHARSET_FLAG +## Disables passing `utf-8` as the default character set to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`. +## +## This is needed for libraries that set their own source code's character set. +## ## ### GENERATOR ## Specifies the precise generator to use. ## diff --git a/scripts/cmake/vcpkg_fail_port_install.cmake b/scripts/cmake/vcpkg_fail_port_install.cmake new file mode 100644 index 000000000..0fdacb639 --- /dev/null +++ b/scripts/cmake/vcpkg_fail_port_install.cmake @@ -0,0 +1,92 @@ +## # vcpkg_fail_port_install
+##
+## Fails the current portfile with a (default) error message
+##
+## ## Usage
+## ```cmake
+## vcpkg_fail_port_install([MESSAGE <message>] [ON_TARGET <target1> [<target2> ...]]
+## [ON_ARCH <arch1> [<arch2> ...]]
+## [ON_CRT_LINKAGE <link1> [<link2> ...]])
+## [ON_LIBRARY_LINKAGE <linklib1> [<linklib2> ...]])
+## ```
+##
+## ## Parameters
+## ### MESSAGE
+## Additional failure message. If non is given a default message will be displayed depending on the failure condition
+##
+## ### ALWAYS
+## will always fail early
+##
+## ### ON_TARGET
+## targets for which the build should fail early. Valid targets are <target> from VCPKG_IS_TARGET_<target> (see vcpkg_common_definitions.cmake)
+##
+## ### ON_ARCH
+## architecture for which the build should fail early.
+##
+## ### ON_CRT_LINKAGE
+## CRT linkage for which the build should fail early.
+##
+## ### ON_LIBRARY_LINKAGE
+## library linkage for which the build should fail early.
+##
+## ## Examples
+##
+## * [aws-lambda-cpp](https://github.com/Microsoft/vcpkg/blob/master/ports/aws-lambda-cpp/portfile.cmake)
+function(vcpkg_fail_port_install)
+ cmake_parse_arguments(PARSE_ARGV 0 _csc "ALWAYS" "MESSAGE" "ON_TARGET;ON_ARCH;ON_CRT_LINKAGE;ON_LIBRARY_LINKAGE")
+ if(DEFINED _csc_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown arguments passed to vcpkg_fail_port_install. Please correct the portfile!")
+ endif()
+ if(DEFINED _csc_MESSAGE)
+ set(_csc_MESSAGE "${_csc_MESSAGE}\n")
+ else()
+ set(_csc_MESSAGE "")
+ endif()
+
+ unset(_fail_port)
+ #Target fail check
+ if(DEFINED _csc_ON_TARGET)
+ foreach(_target ${_csc_ON_TARGET})
+ string(TOUPPER ${_target} _target_upper)
+ if(VCPKG_TARGET_IS_${_target_upper})
+ set(_fail_port TRUE)
+ set(_csc_MESSAGE "${_csc_MESSAGE}Target '${_target}' not supported by ${PORT}!\n")
+ endif()
+ endforeach()
+ endif()
+
+ #Architecture fail check
+ if(DEFINED _csc_ON_ARCH)
+ foreach(_arch ${_csc_ON_ARCH})
+ if(${VCPKG_TARGET_ARCHITECTURE} MATCHES ${_arch})
+ set(_fail_port TRUE)
+ set(_csc_MESSAGE "${_csc_MESSAGE}Architecture '${_arch}' not supported by ${PORT}!\n")
+ endif()
+ endforeach()
+ endif()
+
+ #CRT linkage fail check
+ if(DEFINED _csc_ON_CRT_LINKAGE)
+ foreach(_crt_link ${_csc_ON_CRT_LINKAGE})
+ if("${VCPKG_CRT_LINKAGE}" MATCHES "${_crt_link}")
+ set(_fail_port TRUE)
+ set(_csc_MESSAGE "${_csc_MESSAGE}CRT linkage '${VCPKG_CRT_LINKAGE}' not supported by ${PORT}!\n")
+ endif()
+ endforeach()
+ endif()
+
+ #Library linkage fail check
+ if(DEFINED _csc_ON_LIBRARY_LINKAGE)
+ foreach(_lib_link ${_csc_ON_LIBRARY_LINKAGE})
+ if("${VCPKG_LIBRARY_LINKAGE}" MATCHES "${_lib_link}")
+ set(_fail_port TRUE)
+ set(_csc_MESSAGE "${_csc_MESSAGE}Library linkage '${VCPKG_LIBRARY_LINKAGE}' not supported by ${PORT}!\n")
+ endif()
+ endforeach()
+ endif()
+
+ if(_fail_port OR _csc_ALWAYS)
+ message(FATAL_ERROR ${_csc_MESSAGE})
+ endif()
+
+endfunction()
\ No newline at end of file diff --git a/scripts/get_triplet_environment.cmake b/scripts/get_triplet_environment.cmake index bc79b16ce..21464bb2e 100644 --- a/scripts/get_triplet_environment.cmake +++ b/scripts/get_triplet_environment.cmake @@ -1,4 +1,7 @@ include(${CMAKE_TRIPLET_FILE}) +if (DEFINED CMAKE_ENV_OVERRIDES_FILE) + include(${CMAKE_ENV_OVERRIDES_FILE} OPTIONAL) +endif() # GUID used as a flag - "cut here line" message("c35112b6-d1ba-415b-aa5d-81de856ef8eb") @@ -9,3 +12,4 @@ message("VCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}") message("VCPKG_VISUAL_STUDIO_PATH=${VCPKG_VISUAL_STUDIO_PATH}") message("VCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") message("VCPKG_BUILD_TYPE=${VCPKG_BUILD_TYPE}") +message("VCPKG_ENV_PASSTHROUGH=${VCPKG_ENV_PASSTHROUGH}") diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 860d08893..58510567b 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -67,6 +67,7 @@ if(CMD MATCHES "^BUILD$") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR} ${CURRENT_PACKAGES_DIR}) include(${CMAKE_TRIPLET_FILE}) + include(${ENV_OVERRIDES_FILE} OPTIONAL) set(TRIPLET_SYSTEM_ARCH ${VCPKG_TARGET_ARCHITECTURE}) include(${CMAKE_CURRENT_LIST_DIR}/cmake/vcpkg_common_definitions.cmake) include(${CMAKE_CURRENT_LIST_DIR}/cmake/vcpkg_common_functions.cmake) diff --git a/toolsrc/.clang-format b/toolsrc/.clang-format index c14765672..4d2c34fc4 100644 --- a/toolsrc/.clang-format +++ b/toolsrc/.clang-format @@ -28,6 +28,7 @@ Cpp11BracedListStyle: true IndentCaseLabels: true KeepEmptyLinesAtTheStartOfBlocks: false NamespaceIndentation: All +ForEachMacros: [TEST_CASE, SECTION] PenaltyReturnTypeOnItsOwnLine: 1000 SpaceAfterTemplateKeyword: false SpaceBeforeCpp11BracedList: false diff --git a/toolsrc/CMakeLists.txt b/toolsrc/CMakeLists.txt index fccf2b7ad..7245179f2 100644 --- a/toolsrc/CMakeLists.txt +++ b/toolsrc/CMakeLists.txt @@ -1,10 +1,18 @@ -cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.14)
project(vcpkg C CXX)
+OPTION(BUILD_TESTING "Option for enabling testing" ON)
+OPTION(VCPKG_BUILD_BENCHMARKING "Option for enabling benchmarking" OFF)
OPTION(DEFINE_DISABLE_METRICS "Option for disabling metrics" OFF)
OPTION(VCPKG_ALLOW_APPLE_CLANG "Option for allowing apple clang" OFF)
+if (DEFINE_DISABLE_METRICS)
+ set(DISABLE_METRICS_VALUE "1")
+else()
+ set(DISABLE_METRICS_VALUE "0")
+endif()
+
if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(GCC 1)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
@@ -20,30 +28,39 @@ If you would like to try anyway, pass --allowAppleClang to bootstrap.sh.") elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
set(CLANG 1)
elseif(MSVC)
- add_compile_options(/std:c++17 /FC)
+ add_compile_options(/FC)
else()
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
-if(GCC OR CLANG)
- add_compile_options(-std=c++1z)
+if(GCC OR (CLANG AND NOT MSVC))
if(WERROR)
add_compile_options(-Wall -Wno-unknown-pragmas -Werror)
endif()
endif()
-file(GLOB_RECURSE VCPKGLIB_SOURCES src/vcpkg/*.cpp)
-
if (DEFINE_DISABLE_METRICS)
set(DISABLE_METRICS_VALUE "1")
else()
set(DISABLE_METRICS_VALUE "0")
endif()
-add_executable(vcpkg src/vcpkg.cpp ${VCPKGLIB_SOURCES})
+file(GLOB_RECURSE VCPKGLIB_SOURCES src/vcpkg/*.cpp)
+
+add_library(vcpkglib OBJECT ${VCPKGLIB_SOURCES})
+add_executable(vcpkg src/vcpkg.cpp $<TARGET_OBJECTS:vcpkglib>)
+
+target_compile_features(vcpkg PRIVATE cxx_std_17)
target_compile_definitions(vcpkg PRIVATE -DDISABLE_METRICS=${DISABLE_METRICS_VALUE})
target_include_directories(vcpkg PRIVATE include)
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_package(Threads REQUIRED)
+
+add_definitions(-DDISABLE_METRICS=${DISABLE_METRICS_VALUE})
+include_directories(include)
+link_libraries(Threads::Threads)
+
if(CLANG)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <iostream>
@@ -57,10 +74,32 @@ endif() if(GCC OR (CLANG AND USES_LIBSTDCXX))
target_link_libraries(vcpkg PRIVATE stdc++fs)
-elseif(CLANG)
+elseif(CLANG AND NOT MSVC)
target_link_libraries(vcpkg PRIVATE c++fs)
endif()
+if(GCC OR CLANG)
+ add_compile_options(-std=c++1z)
+ if(WERROR)
+ add_compile_options(-Wall -Wno-unknown-pragmas -Werror)
+ endif()
+endif()
+
+if (BUILD_TESTING)
+ file(GLOB_RECURSE VCPKGTEST_SOURCES src/vcpkg-test/*.cpp)
+
+ enable_testing()
+ add_executable(vcpkg-test
+ ${VCPKGTEST_SOURCES}
+ $<TARGET_OBJECTS:vcpkglib>)
+
+ add_test(NAME default COMMAND vcpkg-test [${TEST_NAME}])
+
+ if (VCPKG_BUILD_BENCHMARKING)
+ target_compile_options(vcpkg-test PRIVATE -DCATCH_CONFIG_ENABLE_BENCHMARKING)
+ endif()
+endif()
+
if(MSVC)
get_target_property(_srcs vcpkg SOURCES)
@@ -73,7 +112,3 @@ if(MSVC) target_sources(vcpkg PRIVATE src/pch.cpp)
target_compile_options(vcpkg PRIVATE /Yupch.h /FIpch.h /Zm200)
endif()
-
-set(THREADS_PREFER_PTHREAD_FLAG ON)
-find_package(Threads REQUIRED)
-target_link_libraries(vcpkg PRIVATE Threads::Threads)
diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 6b2a31295..d7d695c69 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"2019.06.26"
\ No newline at end of file +"2019.07.18" diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 15ec25e76..ce2a7c9c5 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,14 +1,6 @@ #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(__GNUC__) && __GNUC__ < 7 -// [[nodiscard]] is not recognized before GCC version 7 -#pragma GCC diagnostic ignored "-Wattributes" -#endif +#include <vcpkg/pragmas.h> #if defined(_WIN32) #define NOMINMAX @@ -38,8 +30,8 @@ #include <cstddef> #include <cstdint> #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING -#include <experimental/filesystem> #include <cstring> +#include <experimental/filesystem> #include <fstream> #include <functional> #include <iomanip> diff --git a/toolsrc/include/tests.pch.h b/toolsrc/include/tests.pch.h deleted file mode 100644 index 5c00fca4a..000000000 --- a/toolsrc/include/tests.pch.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include <CppUnitTest.h> - -#include <vcpkg/base/chrono.h> -#include <vcpkg/base/sortedvector.h> -#include <vcpkg/base/strings.h> -#include <vcpkg/base/util.h> -#include <vcpkg/binaryparagraph.h> -#include <vcpkg/dependencies.h> -#include <vcpkg/packagespec.h> -#include <vcpkg/packagespecparseresult.h> -#include <vcpkg/paragraphs.h> -#include <vcpkg/sourceparagraph.h> -#include <vcpkg/statusparagraph.h> -#include <vcpkg/statusparagraphs.h> -#include <vcpkg/triplet.h> -#include <vcpkg/update.h> -#include <vcpkg/vcpkgcmdarguments.h> diff --git a/toolsrc/include/tests.utils.h b/toolsrc/include/tests.utils.h deleted file mode 100644 index 3e8514e67..000000000 --- a/toolsrc/include/tests.utils.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include <CppUnitTest.h> - -#include <vcpkg/dependencies.h> -#include <vcpkg/packagespec.h> -#include <vcpkg/packagespecparseresult.h> -#include <vcpkg/statusparagraph.h> -#include <vcpkg/triplet.h> - -#include <memory> - -namespace Microsoft::VisualStudio::CppUnitTestFramework -{ - template<> - inline std::wstring ToString<vcpkg::Dependencies::InstallPlanType>(const vcpkg::Dependencies::InstallPlanType& t) - { - switch (t) - { - case vcpkg::Dependencies::InstallPlanType::ALREADY_INSTALLED: return L"ALREADY_INSTALLED"; - case vcpkg::Dependencies::InstallPlanType::BUILD_AND_INSTALL: return L"BUILD_AND_INSTALL"; - case vcpkg::Dependencies::InstallPlanType::EXCLUDED: return L"EXCLUDED"; - case vcpkg::Dependencies::InstallPlanType::UNKNOWN: return L"UNKNOWN"; - default: return ToString(static_cast<int>(t)); - } - } - - template<> - inline std::wstring ToString<vcpkg::Dependencies::RequestType>(const vcpkg::Dependencies::RequestType& t) - { - switch (t) - { - case vcpkg::Dependencies::RequestType::AUTO_SELECTED: return L"AUTO_SELECTED"; - case vcpkg::Dependencies::RequestType::USER_REQUESTED: return L"USER_REQUESTED"; - case vcpkg::Dependencies::RequestType::UNKNOWN: return L"UNKNOWN"; - default: return ToString(static_cast<int>(t)); - } - } - - template<> - inline std::wstring ToString<vcpkg::PackageSpecParseResult>(const vcpkg::PackageSpecParseResult& t) - { - return ToString(static_cast<uint32_t>(t)); - } - - template<> - inline std::wstring ToString<vcpkg::PackageSpec>(const vcpkg::PackageSpec& t) - { - return ToString(t.to_string()); - } -} - -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"); - -template<class T, class S> -T&& unwrap(vcpkg::ExpectedT<T, S>&& p) -{ - Assert::IsTrue(p.has_value()); - return std::move(*p.get()); -} - -template<class T> -T&& unwrap(vcpkg::Optional<T>&& opt) -{ - Assert::IsTrue(opt.has_value()); - return std::move(*opt.get()); -} - -vcpkg::PackageSpec unsafe_pspec(std::string name, vcpkg::Triplet t = vcpkg::Triplet::X86_WINDOWS); diff --git a/toolsrc/include/vcpkg-test/catch.h b/toolsrc/include/vcpkg-test/catch.h new file mode 100644 index 000000000..303f664ff --- /dev/null +++ b/toolsrc/include/vcpkg-test/catch.h @@ -0,0 +1,16865 @@ +/* + * Catch v2.9.1 + * Generated: 2019-06-17 11:59:24.363643 + * ---------------------------------------------------------- + * This file has been merged from multiple headers. Please don't edit it directly + * Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +// start catch.hpp + + +#define CATCH_VERSION_MAJOR 2 +#define CATCH_VERSION_MINOR 9 +#define CATCH_VERSION_PATCH 1 + +#ifdef __clang__ +# pragma clang system_header +#elif defined __GNUC__ +# pragma GCC system_header +#endif + +// start catch_suppress_warnings.h + +#ifdef __clang__ +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(push) +# pragma warning(disable: 161 1682) +# else // __ICC +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wswitch-enum" +# pragma clang diagnostic ignored "-Wcovered-switch-default" +# endif +#elif defined __GNUC__ + // Because REQUIREs trigger GCC's -Wparentheses, and because still + // supported version of g++ have only buggy support for _Pragmas, + // Wparentheses have to be suppressed globally. +# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details + +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wpadded" +#endif +// end catch_suppress_warnings.h +#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) +# define CATCH_IMPL +# define CATCH_CONFIG_ALL_PARTS +#endif + +// In the impl file, we want to have access to all parts of the headers +// Can also be used to sanely support PCHs +#if defined(CATCH_CONFIG_ALL_PARTS) +# define CATCH_CONFIG_EXTERNAL_INTERFACES +# if defined(CATCH_CONFIG_DISABLE_MATCHERS) +# undef CATCH_CONFIG_DISABLE_MATCHERS +# endif +# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +# endif +#endif + +#if !defined(CATCH_CONFIG_IMPL_ONLY) +// start catch_platform.h + +#ifdef __APPLE__ +# include <TargetConditionals.h> +# if TARGET_OS_OSX == 1 +# define CATCH_PLATFORM_MAC +# elif TARGET_OS_IPHONE == 1 +# define CATCH_PLATFORM_IPHONE +# endif + +#elif defined(linux) || defined(__linux) || defined(__linux__) +# define CATCH_PLATFORM_LINUX + +#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) +# define CATCH_PLATFORM_WINDOWS +#endif + +// end catch_platform.h + +#ifdef CATCH_IMPL +# ifndef CLARA_CONFIG_MAIN +# define CLARA_CONFIG_MAIN_NOT_DEFINED +# define CLARA_CONFIG_MAIN +# endif +#endif + +// start catch_user_interfaces.h + +namespace Catch { + unsigned int rngSeed(); +} + +// end catch_user_interfaces.h +// start catch_tag_alias_autoregistrar.h + +// start catch_common.h + +// start catch_compiler_capabilities.h + +// Detect a number of compiler features - by compiler +// The following features are defined: +// +// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? +// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? +// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? +// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? +// **************** +// Note to maintainers: if new toggles are added please document them +// in configuration.md, too +// **************** + +// In general each macro has a _NO_<feature name> form +// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. +// Many features, at point of detection, define an _INTERNAL_ macro, so they +// can be combined, en-mass, with the _NO_ forms later. + +#ifdef __cplusplus + +# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +# define CATCH_CPP14_OR_GREATER +# endif + +# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +# define CATCH_CPP17_OR_GREATER +# endif + +#endif + +#if defined(CATCH_CPP17_OR_GREATER) +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + +#ifdef __clang__ + +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +#endif // __clang__ + +//////////////////////////////////////////////////////////////////////////////// +// Assume that non-Windows platforms support posix signals by default +#if !defined(CATCH_PLATFORM_WINDOWS) + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#endif + +//////////////////////////////////////////////////////////////////////////////// +// We know some environments not to support full POSIX signals +#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#endif + +#ifdef __OS400__ +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +# define CATCH_CONFIG_COLOUR_NONE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Android somehow still does not support std::to_string +#if defined(__ANDROID__) +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Not all Windows environments support SEH properly +#if defined(__MINGW32__) +# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#endif + +//////////////////////////////////////////////////////////////////////////////// +// PS4 +#if defined(__ORBIS__) +# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Cygwin +#ifdef __CYGWIN__ + +// Required for some versions of Cygwin to declare gettimeofday +// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin +# define _BSD_SOURCE +// some versions of cygwin (most) do not support std::to_string. Use the libstd check. +// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 +# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) + +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING + +# endif +#endif // __CYGWIN__ + +//////////////////////////////////////////////////////////////////////////////// +// Visual C++ +#ifdef _MSC_VER + +# if _MSC_VER >= 1900 // Visual Studio 2015 or newer +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +# endif + +// Universal Windows platform does not support SEH +// Or console colours (or console at all...) +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define CATCH_CONFIG_COLOUR_NONE +# else +# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH +# endif + +// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ +// _MSVC_TRADITIONAL == 0 means new conformant preprocessor +// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif +#endif // _MSC_VER + +#if defined(_REENTRANT) || defined(_MSC_VER) +// Enable async processing, as -pthread is specified or no additional linking is required +# define CATCH_INTERNAL_CONFIG_USE_ASYNC +#endif // _MSC_VER + +//////////////////////////////////////////////////////////////////////////////// +// Check if we are compiled with -fno-exceptions or equivalent +#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) +# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +#endif + +//////////////////////////////////////////////////////////////////////////////// +// DJGPP +#ifdef __DJGPP__ +# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#endif // __DJGPP__ + +//////////////////////////////////////////////////////////////////////////////// +// Embarcadero C++Build +#if defined(__BORLANDC__) + #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN +#endif + +//////////////////////////////////////////////////////////////////////////////// + +// Use of __COUNTER__ is suppressed during code analysis in +// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly +// handled by it. +// Otherwise all supported compilers support COUNTER macro, +// but user still might want to turn it off +#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) + #define CATCH_INTERNAL_CONFIG_COUNTER +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Check if string_view is available and usable +// The check is split apart to work around v140 (VS2015) preprocessor issue... +#if defined(__has_include) +#if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER) +# define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW +#endif +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Check if optional is available and usable +#if defined(__has_include) +# if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) +# define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL +# endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) +#endif // __has_include + +//////////////////////////////////////////////////////////////////////////////// +// Check if variant is available and usable +#if defined(__has_include) +# if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) +# if defined(__clang__) && (__clang_major__ < 8) + // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 + // fix should be in clang 8, workaround in libstdc++ 8.2 +# include <ciso646> +# if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +# define CATCH_CONFIG_NO_CPP17_VARIANT +# else +# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT +# endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +# else +# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT +# endif // defined(__clang__) && (__clang_major__ < 8) +# endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) +#endif // __has_include + +#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) +# define CATCH_CONFIG_COUNTER +#endif +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) +# define CATCH_CONFIG_WINDOWS_SEH +#endif +// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. +#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) +# define CATCH_CONFIG_POSIX_SIGNALS +#endif +// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. +#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) +# define CATCH_CONFIG_WCHAR +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) +# define CATCH_CONFIG_CPP11_TO_STRING +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) +# define CATCH_CONFIG_CPP17_OPTIONAL +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) +# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +# define CATCH_CONFIG_CPP17_STRING_VIEW +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) +# define CATCH_CONFIG_CPP17_VARIANT +#endif + +#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) +# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +#endif + +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) +# define CATCH_CONFIG_NEW_CAPTURE +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +# define CATCH_CONFIG_DISABLE_EXCEPTIONS +#endif + +#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) +# define CATCH_CONFIG_POLYFILL_ISNAN +#endif + +#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) +# define CATCH_CONFIG_USE_ASYNC +#endif + +#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS +#endif + +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +#define CATCH_TRY if ((true)) +#define CATCH_CATCH_ALL if ((false)) +#define CATCH_CATCH_ANON(type) if ((false)) +#else +#define CATCH_TRY try +#define CATCH_CATCH_ALL catch (...) +#define CATCH_CATCH_ANON(type) catch (type) +#endif + +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#endif + +// end catch_compiler_capabilities.h +#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line +#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) +#ifdef CATCH_CONFIG_COUNTER +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) +#else +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#endif + +#include <iosfwd> +#include <string> +#include <cstdint> + +// We need a dummy global operator<< so we can bring it into Catch namespace later +struct Catch_global_namespace_dummy {}; +std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); + +namespace Catch { + + struct CaseSensitive { enum Choice { + Yes, + No + }; }; + + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; + + protected: + NonCopyable(); + virtual ~NonCopyable(); + }; + + struct SourceLineInfo { + + SourceLineInfo() = delete; + SourceLineInfo( char const* _file, std::size_t _line ) noexcept + : file( _file ), + line( _line ) + {} + + SourceLineInfo( SourceLineInfo const& other ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo( SourceLineInfo&& ) noexcept = default; + SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; + + bool empty() const noexcept; + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; + + char const* file; + std::size_t line; + }; + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); + + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; + + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop { + std::string operator+() const; + }; + template<typename T> + T const& operator + ( T const& value, StreamEndStop ) { + return value; + } +} + +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) ) + +// end catch_common.h +namespace Catch { + + struct RegistrarForTagAliases { + RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); + }; + +} // end namespace Catch + +#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + +// end catch_tag_alias_autoregistrar.h +// start catch_test_registry.h + +// start catch_interfaces_testcase.h + +#include <vector> + +namespace Catch { + + class TestSpec; + + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; + + class TestCase; + struct IConfig; + + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + virtual std::vector<TestCase> const& getAllTests() const = 0; + virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0; + }; + + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ); + +} + +// end catch_interfaces_testcase.h +// start catch_stringref.h + +#include <cstddef> +#include <string> +#include <iosfwd> + +namespace Catch { + + /// A non-owning string class (similar to the forthcoming std::string_view) + /// Note that, because a StringRef may be a substring of another string, + /// it may not be null terminated. c_str() must return a null terminated + /// string, however, and so the StringRef will internally take ownership + /// (taking a copy), if necessary. In theory this ownership is not externally + /// visible - but it does mean (substring) StringRefs should not be shared between + /// threads. + class StringRef { + public: + using size_type = std::size_t; + + private: + friend struct StringRefTestAccess; + + char const* m_start; + size_type m_size; + + char* m_data = nullptr; + + void takeOwnership(); + + static constexpr char const* const s_empty = ""; + + public: // construction/ assignment + StringRef() noexcept + : StringRef( s_empty, 0 ) + {} + + StringRef( StringRef const& other ) noexcept + : m_start( other.m_start ), + m_size( other.m_size ) + {} + + StringRef( StringRef&& other ) noexcept + : m_start( other.m_start ), + m_size( other.m_size ), + m_data( other.m_data ) + { + other.m_data = nullptr; + } + + StringRef( char const* rawChars ) noexcept; + + StringRef( char const* rawChars, size_type size ) noexcept + : m_start( rawChars ), + m_size( size ) + {} + + StringRef( std::string const& stdString ) noexcept + : m_start( stdString.c_str() ), + m_size( stdString.size() ) + {} + + ~StringRef() noexcept { + delete[] m_data; + } + + auto operator = ( StringRef const &other ) noexcept -> StringRef& { + delete[] m_data; + m_data = nullptr; + m_start = other.m_start; + m_size = other.m_size; + return *this; + } + + operator std::string() const; + + void swap( StringRef& other ) noexcept; + + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != ( StringRef const& other ) const noexcept -> bool; + + auto operator[] ( size_type index ) const noexcept -> char; + + public: // named queries + auto empty() const noexcept -> bool { + return m_size == 0; + } + auto size() const noexcept -> size_type { + return m_size; + } + + auto numberOfCharacters() const noexcept -> size_type; + auto c_str() const -> char const*; + + public: // substrings and searches + auto substr( size_type start, size_type size ) const noexcept -> StringRef; + + // Returns the current start pointer. + // Note that the pointer can change when if the StringRef is a substring + auto currentData() const noexcept -> char const*; + + private: // ownership queries - may not be consistent between calls + auto isOwned() const noexcept -> bool; + auto isSubstring() const noexcept -> bool; + }; + + auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string; + auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string; + auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string; + + auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; + auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; + + inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } + +} // namespace Catch + +inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { + return Catch::StringRef( rawChars, size ); +} + +// end catch_stringref.h +// start catch_type_traits.hpp + + +#include <type_traits> + +namespace Catch{ + +#ifdef CATCH_CPP17_OR_GREATER + template <typename...> + inline constexpr auto is_unique = std::true_type{}; + + template <typename T, typename... Rest> + inline constexpr auto is_unique<T, Rest...> = std::bool_constant< + (!std::is_same_v<T, Rest> && ...) && is_unique<Rest...> + >{}; +#else + +template <typename...> +struct is_unique : std::true_type{}; + +template <typename T0, typename T1, typename... Rest> +struct is_unique<T0, T1, Rest...> : std::integral_constant +<bool, + !std::is_same<T0, T1>::value + && is_unique<T0, Rest...>::value + && is_unique<T1, Rest...>::value +>{}; + +#endif +} + +// end catch_type_traits.hpp +// start catch_preprocessor.hpp + + +#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ +#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) + +#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ +// MSVC needs more evaluations +#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#else +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#endif + +#define CATCH_REC_END(...) +#define CATCH_REC_OUT + +#define CATCH_EMPTY() +#define CATCH_DEFER(id) id CATCH_EMPTY() + +#define CATCH_REC_GET_END2() 0, CATCH_REC_END +#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 +#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 +#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) + +#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) + +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) + +// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, +// and passes userdata as the first parameter to each invocation, +// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) +#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ +#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ +#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) +#else +// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) +#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) +#endif + +#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ +#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) + +#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) +#else +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#endif + +#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ + CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) + +#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) +#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) +#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) +#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) +#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) +#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) +#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _4, _5, _6) +#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) +#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) +#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) + +#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N + +#define INTERNAL_CATCH_TYPE_GEN\ + template<typename...> struct TypeList {};\ + template<typename...Ts>\ + constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\ + \ + template<template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2> \ + constexpr auto append(L1<E1...>, L2<E2...>) noexcept -> L1<E1...,E2...> { return {}; }\ + template< template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2, typename...Rest>\ + constexpr auto append(L1<E1...>, L2<E2...>, Rest...) noexcept -> decltype(append(L1<E1...,E2...>{}, Rest{}...)) { return {}; }\ + template< template<typename...> class L1, typename...E1, typename...Rest>\ + constexpr auto append(L1<E1...>, TypeList<mpl_::na>, Rest...) noexcept -> L1<E1...> { return {}; }\ + \ + template< template<typename...> class Container, template<typename...> class List, typename...elems>\ + constexpr auto rewrap(List<elems...>) noexcept -> TypeList<Container<elems...>> { return {}; }\ + template< template<typename...> class Container, template<typename...> class List, class...Elems, typename...Elements>\ + constexpr auto rewrap(List<Elems...>,Elements...) noexcept -> decltype(append(TypeList<Container<Elems...>>{}, rewrap<Container>(Elements{}...))) { return {}; }\ + \ + template<template <typename...> class Final, template< typename...> class...Containers, typename...Types>\ + constexpr auto create(TypeList<Types...>) noexcept -> decltype(append(Final<>{}, rewrap<Containers>(Types{}...)...)) { return {}; }\ + template<template <typename...> class Final, template <typename...> class List, typename...Ts>\ + constexpr auto convert(List<Ts...>) noexcept -> decltype(append(Final<>{},TypeList<Ts>{}...)) { return {}; } + +#define INTERNAL_CATCH_NTTP_1(signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp{};\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { return {}; } \ + \ + template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + constexpr auto rewrap(List<__VA_ARGS__>) noexcept -> TypeList<Container<__VA_ARGS__>> { return {}; }\ + template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature), typename...Elements>\ + constexpr auto rewrap(List<__VA_ARGS__>,Elements...elems) noexcept -> decltype(append(TypeList<Container<__VA_ARGS__>>{}, rewrap<Container>(elems...))) { return {}; }\ + template<template <typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Containers, typename...Types>\ + constexpr auto create(TypeList<Types...>) noexcept -> decltype(append(Final<>{}, rewrap<Containers>(Types{}...)...)) { return {}; } + +#define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName) +#define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() +#define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() + +#define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName) +#define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() +#define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature,...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() + +#define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)\ + template<typename Type>\ + void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\ + template<typename Type>\ + void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\ + } + +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature)\ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \ + void test();\ + } + +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \ + void test();\ + } + +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature)\ + template<typename TestType> \ + void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test() +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \ + void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_NTTP_0 +#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__) +#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__) +#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__) +#else +#define INTERNAL_CATCH_NTTP_0(signature) +#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1,INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_0)( __VA_ARGS__)) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__)) +#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__)) +#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__)) +#endif + +// end catch_preprocessor.hpp +// start catch_meta.hpp + + +#include <type_traits> + +namespace Catch { +template<typename T> +struct always_false : std::false_type {}; + +template <typename> struct true_given : std::true_type {}; +struct is_callable_tester { + template <typename Fun, typename... Args> + true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int); + template <typename...> + std::false_type static test(...); +}; + +template <typename T> +struct is_callable; + +template <typename Fun, typename... Args> +struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {}; + +} // namespace Catch + +namespace mpl_{ + struct na; +} + +// end catch_meta.hpp +namespace Catch { + +template<typename C> +class TestInvokerAsMethod : public ITestInvoker { + void (C::*m_testAsMethod)(); +public: + TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {} + + void invoke() const override { + C obj; + (obj.*m_testAsMethod)(); + } +}; + +auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*; + +template<typename C> +auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* { + return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod ); +} + +struct NameAndTags { + NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept; + StringRef name; + StringRef tags; +}; + +struct AutoReg : NonCopyable { + AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept; + ~AutoReg(); +}; + +} // end namespace Catch + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ + void test(); \ + }; \ + } \ + void TestName::test() + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + namespace{ \ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ + INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + } \ + } \ + INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) + #endif +#endif + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ + static void TestName(); \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE( ... ) \ + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ + void test(); \ + }; \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + void TestName::test() + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ + INTERNAL_CATCH_TYPE_GEN\ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types> \ + struct TestName{\ + TestName(){\ + int index = 0; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ + using expander = int[];\ + (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ + return 0;\ + }();\ + }\ + }\ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ + INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature)) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + template<typename TestType> static void TestFuncName(); \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ + INTERNAL_CATCH_TYPE_GEN \ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \ + template<typename... Types> \ + struct TestName { \ + void reg_tests() { \ + int index = 0; \ + using expander = int[]; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ + constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ + constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */\ + } \ + }; \ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ + using TestInit = decltype(create<TestName, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>(TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>{})); \ + TestInit t; \ + t.reg_tests(); \ + return 0; \ + }(); \ + } \ + } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ + template<typename TestType> \ + static void TestFuncName() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T,__VA_ARGS__) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + template<typename TestType> static void TestFunc(); \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ + INTERNAL_CATCH_TYPE_GEN\ + template<typename... Types> \ + struct TestName { \ + void reg_tests() { \ + int index = 0; \ + using expander = int[]; \ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */\ + } \ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ + using TestInit = decltype(convert<TestName>(TmplList {})); \ + TestInit t; \ + t.reg_tests(); \ + return 0; \ + }(); \ + }}\ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + template<typename TestType> \ + static void TestFunc() + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \ + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList ) + + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \ + INTERNAL_CATCH_TYPE_GEN\ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types> \ + struct TestNameClass{\ + TestNameClass(){\ + int index = 0; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ + using expander = int[];\ + (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ + return 0;\ + }();\ + }\ + }\ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\ + CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS\ + INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ + void test();\ + };\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\ + INTERNAL_CATCH_TYPE_GEN \ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types>\ + struct TestNameClass{\ + void reg_tests(){\ + int index = 0;\ + using expander = int[];\ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ + constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ + constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + using TestInit = decltype(create<TestNameClass, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>(TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>{}));\ + TestInit t;\ + t.reg_tests();\ + return 0;\ + }(); \ + }\ + }\ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ + template<typename TestType> \ + void TestName<TestType>::test() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ + void test();\ + };\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \ + INTERNAL_CATCH_TYPE_GEN\ + template<typename...Types>\ + struct TestNameClass{\ + void reg_tests(){\ + int index = 0;\ + using expander = int[];\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + using TestInit = decltype(convert<TestNameClass>(TmplList {}));\ + TestInit t;\ + t.reg_tests();\ + return 0;\ + }(); \ + }}\ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + template<typename TestType> \ + void TestName<TestType>::test() + +#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \ + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, TmplList ) + +// end catch_test_registry.h +// start catch_capture.hpp + +// start catch_assertionhandler.h + +// start catch_assertioninfo.h + +// start catch_result_type.h + +namespace Catch { + + // ResultWas::OfType enum + struct ResultWas { enum OfType { + Unknown = -1, + Ok = 0, + Info = 1, + Warning = 2, + + FailureBit = 0x10, + + ExpressionFailed = FailureBit | 1, + ExplicitFailure = FailureBit | 2, + + Exception = 0x100 | FailureBit, + + ThrewException = Exception | 1, + DidntThrowException = Exception | 2, + + FatalErrorCondition = 0x200 | FailureBit + + }; }; + + bool isOk( ResultWas::OfType resultType ); + bool isJustInfo( int flags ); + + // ResultDisposition::Flags enum + struct ResultDisposition { enum Flags { + Normal = 0x01, + + ContinueOnFailure = 0x02, // Failures fail test, but execution continues + FalseTest = 0x04, // Prefix expression with ! + SuppressFail = 0x08 // Failures are reported but do not fail the test + }; }; + + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); + + bool shouldContinueOnFailure( int flags ); + inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } + bool shouldSuppressFailure( int flags ); + +} // end namespace Catch + +// end catch_result_type.h +namespace Catch { + + struct AssertionInfo + { + StringRef macroName; + SourceLineInfo lineInfo; + StringRef capturedExpression; + ResultDisposition::Flags resultDisposition; + + // We want to delete this constructor but a compiler bug in 4.8 means + // the struct is then treated as non-aggregate + //AssertionInfo() = delete; + }; + +} // end namespace Catch + +// end catch_assertioninfo.h +// start catch_decomposer.h + +// start catch_tostring.h + +#include <vector> +#include <cstddef> +#include <type_traits> +#include <string> +// start catch_stream.h + +#include <iosfwd> +#include <cstddef> +#include <ostream> + +namespace Catch { + + std::ostream& cout(); + std::ostream& cerr(); + std::ostream& clog(); + + class StringRef; + + struct IStream { + virtual ~IStream(); + virtual std::ostream& stream() const = 0; + }; + + auto makeStream( StringRef const &filename ) -> IStream const*; + + class ReusableStringStream { + std::size_t m_index; + std::ostream* m_oss; + public: + ReusableStringStream(); + ~ReusableStringStream(); + + auto str() const -> std::string; + + template<typename T> + auto operator << ( T const& value ) -> ReusableStringStream& { + *m_oss << value; + return *this; + } + auto get() -> std::ostream& { return *m_oss; } + }; +} + +// end catch_stream.h +// start catch_interfaces_enum_values_registry.h + +#include <vector> + +namespace Catch { + + namespace Detail { + struct EnumInfo { + StringRef m_name; + std::vector<std::pair<int, std::string>> m_values; + + ~EnumInfo(); + + StringRef lookup( int value ) const; + }; + } // namespace Detail + + struct IMutableEnumValuesRegistry { + virtual ~IMutableEnumValuesRegistry(); + + virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0; + + template<typename E> + Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) { + std::vector<int> intValues; + intValues.reserve( values.size() ); + for( auto enumValue : values ) + intValues.push_back( static_cast<int>( enumValue ) ); + return registerEnum( enumName, allEnums, intValues ); + } + }; + +} // Catch + +// end catch_interfaces_enum_values_registry.h + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +#include <string_view> +#endif + +#ifdef __OBJC__ +// start catch_objc_arc.hpp + +#import <Foundation/Foundation.h> + +#ifdef __has_feature +#define CATCH_ARC_ENABLED __has_feature(objc_arc) +#else +#define CATCH_ARC_ENABLED 0 +#endif + +void arcSafeRelease( NSObject* obj ); +id performOptionalSelector( id obj, SEL sel ); + +#if !CATCH_ARC_ENABLED +inline void arcSafeRelease( NSObject* obj ) { + [obj release]; +} +inline id performOptionalSelector( id obj, SEL sel ) { + if( [obj respondsToSelector: sel] ) + return [obj performSelector: sel]; + return nil; +} +#define CATCH_UNSAFE_UNRETAINED +#define CATCH_ARC_STRONG +#else +inline void arcSafeRelease( NSObject* ){} +inline id performOptionalSelector( id obj, SEL sel ) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" +#endif + if( [obj respondsToSelector: sel] ) + return [obj performSelector: sel]; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + return nil; +} +#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained +#define CATCH_ARC_STRONG __strong +#endif + +// end catch_objc_arc.hpp +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless +#endif + +namespace Catch { + namespace Detail { + + extern const std::string unprintableString; + + std::string rawMemoryToString( const void *object, std::size_t size ); + + template<typename T> + std::string rawMemoryToString( const T& object ) { + return rawMemoryToString( &object, sizeof(object) ); + } + + template<typename T> + class IsStreamInsertable { + template<typename SS, typename TT> + static auto test(int) + -> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type()); + + template<typename, typename> + static auto test(...)->std::false_type; + + public: + static const bool value = decltype(test<std::ostream, const T&>(0))::value; + }; + + template<typename E> + std::string convertUnknownEnumToString( E e ); + + template<typename T> + typename std::enable_if< + !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value, + std::string>::type convertUnstreamable( T const& ) { + return Detail::unprintableString; + } + template<typename T> + typename std::enable_if< + !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value, + std::string>::type convertUnstreamable(T const& ex) { + return ex.what(); + } + + template<typename T> + typename std::enable_if< + std::is_enum<T>::value + , std::string>::type convertUnstreamable( T const& value ) { + return convertUnknownEnumToString( value ); + } + +#if defined(_MANAGED) + //! Convert a CLR string to a utf8 std::string + template<typename T> + std::string clrReferenceToString( T^ ref ) { + if (ref == nullptr) + return std::string("null"); + auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString()); + cli::pin_ptr<System::Byte> p = &bytes[0]; + return std::string(reinterpret_cast<char const *>(p), bytes->Length); + } +#endif + + } // namespace Detail + + // If we decide for C++14, change these to enable_if_ts + template <typename T, typename = void> + struct StringMaker { + template <typename Fake = T> + static + typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type + convert(const Fake& value) { + ReusableStringStream rss; + // NB: call using the function-like syntax to avoid ambiguity with + // user-defined templated operator<< under clang. + rss.operator<<(value); + return rss.str(); + } + + template <typename Fake = T> + static + typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type + convert( const Fake& value ) { +#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) + return Detail::convertUnstreamable(value); +#else + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); +#endif + } + }; + + namespace Detail { + + // This function dispatches all stringification requests inside of Catch. + // Should be preferably called fully qualified, like ::Catch::Detail::stringify + template <typename T> + std::string stringify(const T& e) { + return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e); + } + + template<typename E> + std::string convertUnknownEnumToString( E e ) { + return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e)); + } + +#if defined(_MANAGED) + template <typename T> + std::string stringify( T^ e ) { + return ::Catch::StringMaker<T^>::convert(e); + } +#endif + + } // namespace Detail + + // Some predefined specializations + + template<> + struct StringMaker<std::string> { + static std::string convert(const std::string& str); + }; + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker<std::string_view> { + static std::string convert(std::string_view str); + }; +#endif + + template<> + struct StringMaker<char const *> { + static std::string convert(char const * str); + }; + template<> + struct StringMaker<char *> { + static std::string convert(char * str); + }; + +#ifdef CATCH_CONFIG_WCHAR + template<> + struct StringMaker<std::wstring> { + static std::string convert(const std::wstring& wstr); + }; + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker<std::wstring_view> { + static std::string convert(std::wstring_view str); + }; +# endif + + template<> + struct StringMaker<wchar_t const *> { + static std::string convert(wchar_t const * str); + }; + template<> + struct StringMaker<wchar_t *> { + static std::string convert(wchar_t * str); + }; +#endif + + // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, + // while keeping string semantics? + template<int SZ> + struct StringMaker<char[SZ]> { + static std::string convert(char const* str) { + return ::Catch::Detail::stringify(std::string{ str }); + } + }; + template<int SZ> + struct StringMaker<signed char[SZ]> { + static std::string convert(signed char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) }); + } + }; + template<int SZ> + struct StringMaker<unsigned char[SZ]> { + static std::string convert(unsigned char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) }); + } + }; + + template<> + struct StringMaker<int> { + static std::string convert(int value); + }; + template<> + struct StringMaker<long> { + static std::string convert(long value); + }; + template<> + struct StringMaker<long long> { + static std::string convert(long long value); + }; + template<> + struct StringMaker<unsigned int> { + static std::string convert(unsigned int value); + }; + template<> + struct StringMaker<unsigned long> { + static std::string convert(unsigned long value); + }; + template<> + struct StringMaker<unsigned long long> { + static std::string convert(unsigned long long value); + }; + + template<> + struct StringMaker<bool> { + static std::string convert(bool b); + }; + + template<> + struct StringMaker<char> { + static std::string convert(char c); + }; + template<> + struct StringMaker<signed char> { + static std::string convert(signed char c); + }; + template<> + struct StringMaker<unsigned char> { + static std::string convert(unsigned char c); + }; + + template<> + struct StringMaker<std::nullptr_t> { + static std::string convert(std::nullptr_t); + }; + + template<> + struct StringMaker<float> { + static std::string convert(float value); + static int precision; + }; + + template<> + struct StringMaker<double> { + static std::string convert(double value); + static int precision; + }; + + template <typename T> + struct StringMaker<T*> { + template <typename U> + static std::string convert(U* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } + } + }; + + template <typename R, typename C> + struct StringMaker<R C::*> { + static std::string convert(R C::* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } + } + }; + +#if defined(_MANAGED) + template <typename T> + struct StringMaker<T^> { + static std::string convert( T^ ref ) { + return ::Catch::Detail::clrReferenceToString(ref); + } + }; +#endif + + namespace Detail { + template<typename InputIterator> + std::string rangeToString(InputIterator first, InputIterator last) { + ReusableStringStream rss; + rss << "{ "; + if (first != last) { + rss << ::Catch::Detail::stringify(*first); + for (++first; first != last; ++first) + rss << ", " << ::Catch::Detail::stringify(*first); + } + rss << " }"; + return rss.str(); + } + } + +#ifdef __OBJC__ + template<> + struct StringMaker<NSString*> { + static std::string convert(NSString * nsstring) { + if (!nsstring) + return "nil"; + return std::string("@") + [nsstring UTF8String]; + } + }; + template<> + struct StringMaker<NSObject*> { + static std::string convert(NSObject* nsObject) { + return ::Catch::Detail::stringify([nsObject description]); + } + + }; + namespace Detail { + inline std::string stringify( NSString* nsstring ) { + return StringMaker<NSString*>::convert( nsstring ); + } + + } // namespace Detail +#endif // __OBJC__ + +} // namespace Catch + +////////////////////////////////////////////////////// +// Separate std-lib types stringification, so it can be selectively enabled +// This means that we do not bring in + +#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS) +# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER +# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER +# define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +# define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER +#endif + +// Separate std::pair specialization +#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER) +#include <utility> +namespace Catch { + template<typename T1, typename T2> + struct StringMaker<std::pair<T1, T2> > { + static std::string convert(const std::pair<T1, T2>& pair) { + ReusableStringStream rss; + rss << "{ " + << ::Catch::Detail::stringify(pair.first) + << ", " + << ::Catch::Detail::stringify(pair.second) + << " }"; + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER + +#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL) +#include <optional> +namespace Catch { + template<typename T> + struct StringMaker<std::optional<T> > { + static std::string convert(const std::optional<T>& optional) { + ReusableStringStream rss; + if (optional.has_value()) { + rss << ::Catch::Detail::stringify(*optional); + } else { + rss << "{ }"; + } + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER + +// Separate std::tuple specialization +#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER) +#include <tuple> +namespace Catch { + namespace Detail { + template< + typename Tuple, + std::size_t N = 0, + bool = (N < std::tuple_size<Tuple>::value) + > + struct TupleElementPrinter { + static void print(const Tuple& tuple, std::ostream& os) { + os << (N ? ", " : " ") + << ::Catch::Detail::stringify(std::get<N>(tuple)); + TupleElementPrinter<Tuple, N + 1>::print(tuple, os); + } + }; + + template< + typename Tuple, + std::size_t N + > + struct TupleElementPrinter<Tuple, N, false> { + static void print(const Tuple&, std::ostream&) {} + }; + + } + + template<typename ...Types> + struct StringMaker<std::tuple<Types...>> { + static std::string convert(const std::tuple<Types...>& tuple) { + ReusableStringStream rss; + rss << '{'; + Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get()); + rss << " }"; + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER + +#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT) +#include <variant> +namespace Catch { + template<> + struct StringMaker<std::monostate> { + static std::string convert(const std::monostate&) { + return "{ }"; + } + }; + + template<typename... Elements> + struct StringMaker<std::variant<Elements...>> { + static std::string convert(const std::variant<Elements...>& variant) { + if (variant.valueless_by_exception()) { + return "{valueless variant}"; + } else { + return std::visit( + [](const auto& value) { + return ::Catch::Detail::stringify(value); + }, + variant + ); + } + } + }; +} +#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER + +namespace Catch { + struct not_this_one {}; // Tag type for detecting which begin/ end are being selected + + // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace + using std::begin; + using std::end; + + not_this_one begin( ... ); + not_this_one end( ... ); + + template <typename T> + struct is_range { + static const bool value = + !std::is_same<decltype(begin(std::declval<T>())), not_this_one>::value && + !std::is_same<decltype(end(std::declval<T>())), not_this_one>::value; + }; + +#if defined(_MANAGED) // Managed types are never ranges + template <typename T> + struct is_range<T^> { + static const bool value = false; + }; +#endif + + template<typename Range> + std::string rangeToString( Range const& range ) { + return ::Catch::Detail::rangeToString( begin( range ), end( range ) ); + } + + // Handle vector<bool> specially + template<typename Allocator> + std::string rangeToString( std::vector<bool, Allocator> const& v ) { + ReusableStringStream rss; + rss << "{ "; + bool first = true; + for( bool b : v ) { + if( first ) + first = false; + else + rss << ", "; + rss << ::Catch::Detail::stringify( b ); + } + rss << " }"; + return rss.str(); + } + + template<typename R> + struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> { + static std::string convert( R const& range ) { + return rangeToString( range ); + } + }; + + template <typename T, int SZ> + struct StringMaker<T[SZ]> { + static std::string convert(T const(&arr)[SZ]) { + return rangeToString(arr); + } + }; + +} // namespace Catch + +// Separate std::chrono::duration specialization +#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#include <ctime> +#include <ratio> +#include <chrono> + +namespace Catch { + +template <class Ratio> +struct ratio_string { + static std::string symbol(); +}; + +template <class Ratio> +std::string ratio_string<Ratio>::symbol() { + Catch::ReusableStringStream rss; + rss << '[' << Ratio::num << '/' + << Ratio::den << ']'; + return rss.str(); +} +template <> +struct ratio_string<std::atto> { + static std::string symbol(); +}; +template <> +struct ratio_string<std::femto> { + static std::string symbol(); +}; +template <> +struct ratio_string<std::pico> { + static std::string symbol(); +}; +template <> +struct ratio_string<std::nano> { + static std::string symbol(); +}; +template <> +struct ratio_string<std::micro> { + static std::string symbol(); +}; +template <> +struct ratio_string<std::milli> { + static std::string symbol(); +}; + + //////////// + // std::chrono::duration specializations + template<typename Value, typename Ratio> + struct StringMaker<std::chrono::duration<Value, Ratio>> { + static std::string convert(std::chrono::duration<Value, Ratio> const& duration) { + ReusableStringStream rss; + rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's'; + return rss.str(); + } + }; + template<typename Value> + struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> { + static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " s"; + return rss.str(); + } + }; + template<typename Value> + struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> { + static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " m"; + return rss.str(); + } + }; + template<typename Value> + struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> { + static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " h"; + return rss.str(); + } + }; + + //////////// + // std::chrono::time_point specialization + // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock> + template<typename Clock, typename Duration> + struct StringMaker<std::chrono::time_point<Clock, Duration>> { + static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) { + return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch"; + } + }; + // std::chrono::time_point<system_clock> specialization + template<typename Duration> + struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> { + static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) { + auto converted = std::chrono::system_clock::to_time_t(time_point); + +#ifdef _MSC_VER + std::tm timeInfo = {}; + gmtime_s(&timeInfo, &converted); +#else + std::tm* timeInfo = std::gmtime(&converted); +#endif + + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + +#ifdef _MSC_VER + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); +#else + std::strftime(timeStamp, timeStampSize, fmt, timeInfo); +#endif + return std::string(timeStamp); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER + +#define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \ +namespace Catch { \ + template<> struct StringMaker<enumName> { \ + static std::string convert( enumName value ) { \ + static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \ + return enumInfo.lookup( static_cast<int>( value ) ); \ + } \ + }; \ +} + +#define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ ) + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +// end catch_tostring.h +#include <iosfwd> + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4389) // '==' : signed/unsigned mismatch +#pragma warning(disable:4018) // more "signed/unsigned mismatch" +#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform) +#pragma warning(disable:4180) // qualifier applied to function type has no meaning +#pragma warning(disable:4800) // Forcing result to true or false +#endif + +namespace Catch { + + struct ITransientExpression { + auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } + auto getResult() const -> bool { return m_result; } + virtual void streamReconstructedExpression( std::ostream &os ) const = 0; + + ITransientExpression( bool isBinaryExpression, bool result ) + : m_isBinaryExpression( isBinaryExpression ), + m_result( result ) + {} + + // We don't actually need a virtual destructor, but many static analysers + // complain if it's not here :-( + virtual ~ITransientExpression(); + + bool m_isBinaryExpression; + bool m_result; + + }; + + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); + + template<typename LhsT, typename RhsT> + class BinaryExpr : public ITransientExpression { + LhsT m_lhs; + StringRef m_op; + RhsT m_rhs; + + void streamReconstructedExpression( std::ostream &os ) const override { + formatReconstructedExpression + ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) ); + } + + public: + BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs ) + : ITransientExpression{ true, comparisonResult }, + m_lhs( lhs ), + m_op( op ), + m_rhs( rhs ) + {} + + template<typename T> + auto operator && ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator || ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator == ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator != ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator > ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator < ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator >= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator <= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + }; + + template<typename LhsT> + class UnaryExpr : public ITransientExpression { + LhsT m_lhs; + + void streamReconstructedExpression( std::ostream &os ) const override { + os << Catch::Detail::stringify( m_lhs ); + } + + public: + explicit UnaryExpr( LhsT lhs ) + : ITransientExpression{ false, static_cast<bool>(lhs) }, + m_lhs( lhs ) + {} + }; + + // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) + template<typename LhsT, typename RhsT> + auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); } + template<typename T> + auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); } + template<typename T> + auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); } + template<typename T> + auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; } + template<typename T> + auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; } + + template<typename LhsT, typename RhsT> + auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); } + template<typename T> + auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); } + template<typename T> + auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); } + template<typename T> + auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; } + template<typename T> + auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; } + + template<typename LhsT> + class ExprLhs { + LhsT m_lhs; + public: + explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} + + template<typename RhsT> + auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs }; + } + auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const { + return { m_lhs == rhs, m_lhs, "==", rhs }; + } + + template<typename RhsT> + auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs }; + } + auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const { + return { m_lhs != rhs, m_lhs, "!=", rhs }; + } + + template<typename RhsT> + auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs }; + } + template<typename RhsT> + auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs }; + } + template<typename RhsT> + auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs }; + } + template<typename RhsT> + auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs }; + } + + template<typename RhsT> + auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<RhsT>::value, + "operator&& is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename RhsT> + auto operator || ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<RhsT>::value, + "operator|| is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + auto makeUnaryExpr() const -> UnaryExpr<LhsT> { + return UnaryExpr<LhsT>{ m_lhs }; + } + }; + + void handleExpression( ITransientExpression const& expr ); + + template<typename T> + void handleExpression( ExprLhs<T> const& expr ) { + handleExpression( expr.makeUnaryExpr() ); + } + + struct Decomposer { + template<typename T> + auto operator <= ( T const& lhs ) -> ExprLhs<T const&> { + return ExprLhs<T const&>{ lhs }; + } + + auto operator <=( bool value ) -> ExprLhs<bool> { + return ExprLhs<bool>{ value }; + } + }; + +} // end namespace Catch + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +// end catch_decomposer.h +// start catch_interfaces_capture.h + +#include <string> +#include <chrono> + +namespace Catch { + + class AssertionResult; + struct AssertionInfo; + struct SectionInfo; + struct SectionEndInfo; + struct MessageInfo; + struct MessageBuilder; + struct Counts; + struct AssertionReaction; + struct SourceLineInfo; + + struct ITransientExpression; + struct IGeneratorTracker; + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + struct BenchmarkInfo; + template <typename Duration = std::chrono::duration<double, std::nano>> + struct BenchmarkStats; +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + struct IResultCapture { + + virtual ~IResultCapture(); + + virtual bool sectionStarted( SectionInfo const& sectionInfo, + Counts& assertions ) = 0; + virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; + virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; + + virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + virtual void benchmarkPreparing( std::string const& name ) = 0; + virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; + virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0; + virtual void benchmarkFailed( std::string const& error ) = 0; +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + virtual void pushScopedMessage( MessageInfo const& message ) = 0; + virtual void popScopedMessage( MessageInfo const& message ) = 0; + + virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0; + + virtual void handleFatalErrorCondition( StringRef message ) = 0; + + virtual void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) = 0; + virtual void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) = 0; + virtual void handleIncomplete + ( AssertionInfo const& info ) = 0; + virtual void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) = 0; + + virtual bool lastAssertionPassed() = 0; + virtual void assertionPassed() = 0; + + // Deprecated, do not use: + virtual std::string getCurrentTestName() const = 0; + virtual const AssertionResult* getLastResult() const = 0; + virtual void exceptionEarlyReported() = 0; + }; + + IResultCapture& getResultCapture(); +} + +// end catch_interfaces_capture.h +namespace Catch { + + struct TestFailureException{}; + struct AssertionResultData; + struct IResultCapture; + class RunContext; + + class LazyExpression { + friend class AssertionHandler; + friend struct AssertionStats; + friend class RunContext; + + ITransientExpression const* m_transientExpression = nullptr; + bool m_isNegated; + public: + LazyExpression( bool isNegated ); + LazyExpression( LazyExpression const& other ); + LazyExpression& operator = ( LazyExpression const& ) = delete; + + explicit operator bool() const; + + friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; + }; + + struct AssertionReaction { + bool shouldDebugBreak = false; + bool shouldThrow = false; + }; + + class AssertionHandler { + AssertionInfo m_assertionInfo; + AssertionReaction m_reaction; + bool m_completed = false; + IResultCapture& m_resultCapture; + + public: + AssertionHandler + ( StringRef const& macroName, + SourceLineInfo const& lineInfo, + StringRef capturedExpression, + ResultDisposition::Flags resultDisposition ); + ~AssertionHandler() { + if ( !m_completed ) { + m_resultCapture.handleIncomplete( m_assertionInfo ); + } + } + + template<typename T> + void handleExpr( ExprLhs<T> const& expr ) { + handleExpr( expr.makeUnaryExpr() ); + } + void handleExpr( ITransientExpression const& expr ); + + void handleMessage(ResultWas::OfType resultType, StringRef const& message); + + void handleExceptionThrownAsExpected(); + void handleUnexpectedExceptionNotThrown(); + void handleExceptionNotThrownAsExpected(); + void handleThrowingCallSkipped(); + void handleUnexpectedInflightException(); + + void complete(); + void setCompleted(); + + // query + auto allowThrows() const -> bool; + }; + + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ); + +} // namespace Catch + +// end catch_assertionhandler.h +// start catch_message.h + +#include <string> +#include <vector> + +namespace Catch { + + struct MessageInfo { + MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); + + StringRef macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; + + bool operator == ( MessageInfo const& other ) const; + bool operator < ( MessageInfo const& other ) const; + private: + static unsigned int globalCount; + }; + + struct MessageStream { + + template<typename T> + MessageStream& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + ReusableStringStream m_stream; + }; + + struct MessageBuilder : MessageStream { + MessageBuilder( StringRef const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ); + + template<typename T> + MessageBuilder& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + MessageInfo m_info; + }; + + class ScopedMessage { + public: + explicit ScopedMessage( MessageBuilder const& builder ); + ScopedMessage( ScopedMessage& duplicate ) = delete; + ScopedMessage( ScopedMessage&& old ); + ~ScopedMessage(); + + MessageInfo m_info; + bool m_moved; + }; + + class Capturer { + std::vector<MessageInfo> m_messages; + IResultCapture& m_resultCapture = getResultCapture(); + size_t m_captured = 0; + public: + Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); + ~Capturer(); + + void captureValue( size_t index, std::string const& value ); + + template<typename T> + void captureValues( size_t index, T const& value ) { + captureValue( index, Catch::Detail::stringify( value ) ); + } + + template<typename T, typename... Ts> + void captureValues( size_t index, T const& value, Ts const&... values ) { + captureValue( index, Catch::Detail::stringify(value) ); + captureValues( index+1, values... ); + } + }; + +} // end namespace Catch + +// end catch_message.h +#if !defined(CATCH_CONFIG_DISABLE) + +#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) + #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ +#else + #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" +#endif + +#if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + +/////////////////////////////////////////////////////////////////////////////// +// Another way to speed-up compilation is to omit local try-catch for REQUIRE* +// macros. +#define INTERNAL_CATCH_TRY +#define INTERNAL_CATCH_CATCH( capturer ) + +#else // CATCH_CONFIG_FAST_COMPILE + +#define INTERNAL_CATCH_TRY try +#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); } + +#endif + +#define INTERNAL_CATCH_REACT( handler ) handler.complete(); + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \ + CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look + // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ + INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ + if( Catch::getResultCapture().lastAssertionPassed() ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \ + INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ + if( !Catch::getResultCapture().lastAssertionPassed() ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + try { \ + static_cast<void>(__VA_ARGS__); \ + catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast<void>(__VA_ARGS__); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleExceptionThrownAsExpected(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast<void>(expr); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( exceptionType const& ) { \ + catchAssertionHandler.handleExceptionThrownAsExpected(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \ + catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \ + auto varName = Catch::Capturer( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \ + varName.captureValues( 0, __VA_ARGS__ ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_INFO( macroName, log ) \ + Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ); + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \ + Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) + +/////////////////////////////////////////////////////////////////////////////// +// Although this is matcher-based, it can be used with just a string +#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast<void>(__VA_ARGS__); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( ... ) { \ + Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +#endif // CATCH_CONFIG_DISABLE + +// end catch_capture.hpp +// start catch_section.h + +// start catch_section_info.h + +// start catch_totals.h + +#include <cstddef> + +namespace Catch { + + struct Counts { + Counts operator - ( Counts const& other ) const; + Counts& operator += ( Counts const& other ); + + std::size_t total() const; + bool allPassed() const; + bool allOk() const; + + std::size_t passed = 0; + std::size_t failed = 0; + std::size_t failedButOk = 0; + }; + + struct Totals { + + Totals operator - ( Totals const& other ) const; + Totals& operator += ( Totals const& other ); + + Totals delta( Totals const& prevTotals ) const; + + int error = 0; + Counts assertions; + Counts testCases; + }; +} + +// end catch_totals.h +#include <string> + +namespace Catch { + + struct SectionInfo { + SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name ); + + // Deprecated + SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name, + std::string const& ) : SectionInfo( _lineInfo, _name ) {} + + std::string name; + std::string description; // !Deprecated: this will always be empty + SourceLineInfo lineInfo; + }; + + struct SectionEndInfo { + SectionInfo sectionInfo; + Counts prevAssertions; + double durationInSeconds; + }; + +} // end namespace Catch + +// end catch_section_info.h +// start catch_timer.h + +#include <cstdint> + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t; + auto getEstimatedClockResolution() -> uint64_t; + + class Timer { + uint64_t m_nanoseconds = 0; + public: + void start(); + auto getElapsedNanoseconds() const -> uint64_t; + auto getElapsedMicroseconds() const -> uint64_t; + auto getElapsedMilliseconds() const -> unsigned int; + auto getElapsedSeconds() const -> double; + }; + +} // namespace Catch + +// end catch_timer.h +#include <string> + +namespace Catch { + + class Section : NonCopyable { + public: + Section( SectionInfo const& info ); + ~Section(); + + // This indicates whether the section should be executed or not + explicit operator bool() const; + + private: + SectionInfo m_info; + + std::string m_name; + Counts m_assertions; + bool m_sectionIncluded; + Timer m_timer; + }; + +} // end namespace Catch + +#define INTERNAL_CATCH_SECTION( ... ) \ + CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ + CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS + +#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ + CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \ + CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS + +// end catch_section.h +// start catch_interfaces_exception.h + +// start catch_interfaces_registry_hub.h + +#include <string> +#include <memory> + +namespace Catch { + + class TestCase; + struct ITestCaseRegistry; + struct IExceptionTranslatorRegistry; + struct IExceptionTranslator; + struct IReporterRegistry; + struct IReporterFactory; + struct ITagAliasRegistry; + struct IMutableEnumValuesRegistry; + + class StartupExceptionRegistry; + + using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>; + + struct IRegistryHub { + virtual ~IRegistryHub(); + + virtual IReporterRegistry const& getReporterRegistry() const = 0; + virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; + virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; + virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0; + + virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; + }; + + struct IMutableRegistryHub { + virtual ~IMutableRegistryHub(); + virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; + virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; + virtual void registerTest( TestCase const& testInfo ) = 0; + virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; + virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; + virtual void registerStartupException() noexcept = 0; + virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0; + }; + + IRegistryHub const& getRegistryHub(); + IMutableRegistryHub& getMutableRegistryHub(); + void cleanUp(); + std::string translateActiveException(); + +} + +// end catch_interfaces_registry_hub.h +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ + static std::string translatorName( signature ) +#endif + +#include <exception> +#include <string> +#include <vector> + +namespace Catch { + using exceptionTranslateFunction = std::string(*)(); + + struct IExceptionTranslator; + using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>; + + struct IExceptionTranslator { + virtual ~IExceptionTranslator(); + virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; + }; + + struct IExceptionTranslatorRegistry { + virtual ~IExceptionTranslatorRegistry(); + + virtual std::string translateActiveException() const = 0; + }; + + class ExceptionTranslatorRegistrar { + template<typename T> + class ExceptionTranslator : public IExceptionTranslator { + public: + + ExceptionTranslator( std::string(*translateFunction)( T& ) ) + : m_translateFunction( translateFunction ) + {} + + std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { + try { + if( it == itEnd ) + std::rethrow_exception(std::current_exception()); + else + return (*it)->translate( it+1, itEnd ); + } + catch( T& ex ) { + return m_translateFunction( ex ); + } + } + + protected: + std::string(*m_translateFunction)( T& ); + }; + + public: + template<typename T> + ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { + getMutableRegistryHub().registerTranslator + ( new ExceptionTranslator<T>( translateFunction ) ); + } + }; +} + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ + static std::string translatorName( signature ); \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + static std::string translatorName( signature ) + +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +// end catch_interfaces_exception.h +// start catch_approx.h + +#include <type_traits> + +namespace Catch { +namespace Detail { + + class Approx { + private: + bool equalityComparisonImpl(double other) const; + // Validates the new margin (margin >= 0) + // out-of-line to avoid including stdexcept in the header + void setMargin(double margin); + // Validates the new epsilon (0 < epsilon < 1) + // out-of-line to avoid including stdexcept in the header + void setEpsilon(double epsilon); + + public: + explicit Approx ( double value ); + + static Approx custom(); + + Approx operator-() const; + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + Approx operator()( T const& value ) { + Approx approx( static_cast<double>(value) ); + approx.m_epsilon = m_epsilon; + approx.m_margin = m_margin; + approx.m_scale = m_scale; + return approx; + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + explicit Approx( T const& value ): Approx(static_cast<double>(value)) + {} + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator == ( const T& lhs, Approx const& rhs ) { + auto lhs_v = static_cast<double>(lhs); + return rhs.equalityComparisonImpl(lhs_v); + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator == ( Approx const& lhs, const T& rhs ) { + return operator==( rhs, lhs ); + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator != ( T const& lhs, Approx const& rhs ) { + return !operator==( lhs, rhs ); + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator != ( Approx const& lhs, T const& rhs ) { + return !operator==( rhs, lhs ); + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator <= ( T const& lhs, Approx const& rhs ) { + return static_cast<double>(lhs) < rhs.m_value || lhs == rhs; + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator <= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value < static_cast<double>(rhs) || lhs == rhs; + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator >= ( T const& lhs, Approx const& rhs ) { + return static_cast<double>(lhs) > rhs.m_value || lhs == rhs; + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + friend bool operator >= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value > static_cast<double>(rhs) || lhs == rhs; + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + Approx& epsilon( T const& newEpsilon ) { + double epsilonAsDouble = static_cast<double>(newEpsilon); + setEpsilon(epsilonAsDouble); + return *this; + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + Approx& margin( T const& newMargin ) { + double marginAsDouble = static_cast<double>(newMargin); + setMargin(marginAsDouble); + return *this; + } + + template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + Approx& scale( T const& newScale ) { + m_scale = static_cast<double>(newScale); + return *this; + } + + std::string toString() const; + + private: + double m_epsilon; + double m_margin; + double m_scale; + double m_value; + }; +} // end namespace Detail + +namespace literals { + Detail::Approx operator "" _a(long double val); + Detail::Approx operator "" _a(unsigned long long val); +} // end namespace literals + +template<> +struct StringMaker<Catch::Detail::Approx> { + static std::string convert(Catch::Detail::Approx const& value); +}; + +} // end namespace Catch + +// end catch_approx.h +// start catch_string_manip.h + +#include <string> +#include <iosfwd> +#include <vector> + +namespace Catch { + + bool startsWith( std::string const& s, std::string const& prefix ); + bool startsWith( std::string const& s, char prefix ); + bool endsWith( std::string const& s, std::string const& suffix ); + bool endsWith( std::string const& s, char suffix ); + bool contains( std::string const& s, std::string const& infix ); + void toLowerInPlace( std::string& s ); + std::string toLower( std::string const& s ); + std::string trim( std::string const& str ); + + // !!! Be aware, returns refs into original string - make sure original string outlives them + std::vector<StringRef> splitStringRef( StringRef str, char delimiter ); + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); + + struct pluralise { + pluralise( std::size_t count, std::string const& label ); + + friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); + + std::size_t m_count; + std::string m_label; + }; +} + +// end catch_string_manip.h +#ifndef CATCH_CONFIG_DISABLE_MATCHERS +// start catch_capture_matchers.h + +// start catch_matchers.h + +#include <string> +#include <vector> + +namespace Catch { +namespace Matchers { + namespace Impl { + + template<typename ArgT> struct MatchAllOf; + template<typename ArgT> struct MatchAnyOf; + template<typename ArgT> struct MatchNotOf; + + class MatcherUntypedBase { + public: + MatcherUntypedBase() = default; + MatcherUntypedBase ( MatcherUntypedBase const& ) = default; + MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete; + std::string toString() const; + + protected: + virtual ~MatcherUntypedBase(); + virtual std::string describe() const = 0; + mutable std::string m_cachedToString; + }; + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + + template<typename ObjectT> + struct MatcherMethod { + virtual bool match( ObjectT const& arg ) const = 0; + }; + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + + template<typename T> + struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> { + + MatchAllOf<T> operator && ( MatcherBase const& other ) const; + MatchAnyOf<T> operator || ( MatcherBase const& other ) const; + MatchNotOf<T> operator ! () const; + }; + + template<typename ArgT> + struct MatchAllOf : MatcherBase<ArgT> { + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (!matcher->match(arg)) + return false; + } + return true; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " and "; + description += matcher->toString(); + } + description += " )"; + return description; + } + + MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) { + m_matchers.push_back( &other ); + return *this; + } + + std::vector<MatcherBase<ArgT> const*> m_matchers; + }; + template<typename ArgT> + struct MatchAnyOf : MatcherBase<ArgT> { + + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (matcher->match(arg)) + return true; + } + return false; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " or "; + description += matcher->toString(); + } + description += " )"; + return description; + } + + MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) { + m_matchers.push_back( &other ); + return *this; + } + + std::vector<MatcherBase<ArgT> const*> m_matchers; + }; + + template<typename ArgT> + struct MatchNotOf : MatcherBase<ArgT> { + + MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} + + bool match( ArgT const& arg ) const override { + return !m_underlyingMatcher.match( arg ); + } + + std::string describe() const override { + return "not " + m_underlyingMatcher.toString(); + } + MatcherBase<ArgT> const& m_underlyingMatcher; + }; + + template<typename T> + MatchAllOf<T> MatcherBase<T>::operator && ( MatcherBase const& other ) const { + return MatchAllOf<T>() && *this && other; + } + template<typename T> + MatchAnyOf<T> MatcherBase<T>::operator || ( MatcherBase const& other ) const { + return MatchAnyOf<T>() || *this || other; + } + template<typename T> + MatchNotOf<T> MatcherBase<T>::operator ! () const { + return MatchNotOf<T>( *this ); + } + + } // namespace Impl + +} // namespace Matchers + +using namespace Matchers; +using Matchers::Impl::MatcherBase; + +} // namespace Catch + +// end catch_matchers.h +// start catch_matchers_floating.h + +#include <type_traits> +#include <cmath> + +namespace Catch { +namespace Matchers { + + namespace Floating { + + enum class FloatingPointKind : uint8_t; + + struct WithinAbsMatcher : MatcherBase<double> { + WithinAbsMatcher(double target, double margin); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + double m_margin; + }; + + struct WithinUlpsMatcher : MatcherBase<double> { + WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + int m_ulps; + FloatingPointKind m_type; + }; + + } // namespace Floating + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff); + Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff); + Floating::WithinAbsMatcher WithinAbs(double target, double margin); + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_floating.h +// start catch_matchers_generic.hpp + +#include <functional> +#include <string> + +namespace Catch { +namespace Matchers { +namespace Generic { + +namespace Detail { + std::string finalizeDescription(const std::string& desc); +} + +template <typename T> +class PredicateMatcher : public MatcherBase<T> { + std::function<bool(T const&)> m_predicate; + std::string m_description; +public: + + PredicateMatcher(std::function<bool(T const&)> const& elem, std::string const& descr) + :m_predicate(std::move(elem)), + m_description(Detail::finalizeDescription(descr)) + {} + + bool match( T const& item ) const override { + return m_predicate(item); + } + + std::string describe() const override { + return m_description; + } +}; + +} // namespace Generic + + // The following functions create the actual matcher objects. + // The user has to explicitly specify type to the function, because + // inferring std::function<bool(T const&)> is hard (but possible) and + // requires a lot of TMP. + template<typename T> + Generic::PredicateMatcher<T> Predicate(std::function<bool(T const&)> const& predicate, std::string const& description = "") { + return Generic::PredicateMatcher<T>(predicate, description); + } + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_generic.hpp +// start catch_matchers_string.h + +#include <string> + +namespace Catch { +namespace Matchers { + + namespace StdString { + + struct CasedString + { + CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ); + std::string adjustString( std::string const& str ) const; + std::string caseSensitivitySuffix() const; + + CaseSensitive::Choice m_caseSensitivity; + std::string m_str; + }; + + struct StringMatcherBase : MatcherBase<std::string> { + StringMatcherBase( std::string const& operation, CasedString const& comparator ); + std::string describe() const override; + + CasedString m_comparator; + std::string m_operation; + }; + + struct EqualsMatcher : StringMatcherBase { + EqualsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct ContainsMatcher : StringMatcherBase { + ContainsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StartsWithMatcher : StringMatcherBase { + StartsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct EndsWithMatcher : StringMatcherBase { + EndsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + + struct RegexMatcher : MatcherBase<std::string> { + RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity ); + bool match( std::string const& matchee ) const override; + std::string describe() const override; + + private: + std::string m_regex; + CaseSensitive::Choice m_caseSensitivity; + }; + + } // namespace StdString + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_string.h +// start catch_matchers_vector.h + +#include <algorithm> + +namespace Catch { +namespace Matchers { + + namespace Vector { + template<typename T> + struct ContainsElementMatcher : MatcherBase<std::vector<T>> { + + ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} + + bool match(std::vector<T> const &v) const override { + for (auto const& el : v) { + if (el == m_comparator) { + return true; + } + } + return false; + } + + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } + + T const& m_comparator; + }; + + template<typename T> + struct ContainsMatcher : MatcherBase<std::vector<T>> { + + ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} + + bool match(std::vector<T> const &v) const override { + // !TBD: see note in EqualsMatcher + if (m_comparator.size() > v.size()) + return false; + for (auto const& comparator : m_comparator) { + auto present = false; + for (const auto& el : v) { + if (el == comparator) { + present = true; + break; + } + } + if (!present) { + return false; + } + } + return true; + } + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } + + std::vector<T> const& m_comparator; + }; + + template<typename T> + struct EqualsMatcher : MatcherBase<std::vector<T>> { + + EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} + + bool match(std::vector<T> const &v) const override { + // !TBD: This currently works if all elements can be compared using != + // - a more general approach would be via a compare template that defaults + // to using !=. but could be specialised for, e.g. std::vector<T> etc + // - then just call that directly + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != v[i]) + return false; + return true; + } + std::string describe() const override { + return "Equals: " + ::Catch::Detail::stringify( m_comparator ); + } + std::vector<T> const& m_comparator; + }; + + template<typename T> + struct ApproxMatcher : MatcherBase<std::vector<T>> { + + ApproxMatcher(std::vector<T> const& comparator) : m_comparator( comparator ) {} + + bool match(std::vector<T> const &v) const override { + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != approx(v[i])) + return false; + return true; + } + std::string describe() const override { + return "is approx: " + ::Catch::Detail::stringify( m_comparator ); + } + template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + ApproxMatcher& epsilon( T const& newEpsilon ) { + approx.epsilon(newEpsilon); + return *this; + } + template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + ApproxMatcher& margin( T const& newMargin ) { + approx.margin(newMargin); + return *this; + } + template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + ApproxMatcher& scale( T const& newScale ) { + approx.scale(newScale); + return *this; + } + + std::vector<T> const& m_comparator; + mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom(); + }; + + template<typename T> + struct UnorderedEqualsMatcher : MatcherBase<std::vector<T>> { + UnorderedEqualsMatcher(std::vector<T> const& target) : m_target(target) {} + bool match(std::vector<T> const& vec) const override { + // Note: This is a reimplementation of std::is_permutation, + // because I don't want to include <algorithm> inside the common path + if (m_target.size() != vec.size()) { + return false; + } + return std::is_permutation(m_target.begin(), m_target.end(), vec.begin()); + } + + std::string describe() const override { + return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); + } + private: + std::vector<T> const& m_target; + }; + + } // namespace Vector + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + template<typename T> + Vector::ContainsMatcher<T> Contains( std::vector<T> const& comparator ) { + return Vector::ContainsMatcher<T>( comparator ); + } + + template<typename T> + Vector::ContainsElementMatcher<T> VectorContains( T const& comparator ) { + return Vector::ContainsElementMatcher<T>( comparator ); + } + + template<typename T> + Vector::EqualsMatcher<T> Equals( std::vector<T> const& comparator ) { + return Vector::EqualsMatcher<T>( comparator ); + } + + template<typename T> + Vector::ApproxMatcher<T> Approx( std::vector<T> const& comparator ) { + return Vector::ApproxMatcher<T>( comparator ); + } + + template<typename T> + Vector::UnorderedEqualsMatcher<T> UnorderedEquals(std::vector<T> const& target) { + return Vector::UnorderedEqualsMatcher<T>(target); + } + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_vector.h +namespace Catch { + + template<typename ArgT, typename MatcherT> + class MatchExpr : public ITransientExpression { + ArgT const& m_arg; + MatcherT m_matcher; + StringRef m_matcherString; + public: + MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) + : ITransientExpression{ true, matcher.match( arg ) }, + m_arg( arg ), + m_matcher( matcher ), + m_matcherString( matcherString ) + {} + + void streamReconstructedExpression( std::ostream &os ) const override { + auto matcherAsString = m_matcher.toString(); + os << Catch::Detail::stringify( m_arg ) << ' '; + if( matcherAsString == Detail::unprintableString ) + os << m_matcherString; + else + os << matcherAsString; + } + }; + + using StringMatcher = Matchers::Impl::MatcherBase<std::string>; + + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); + + template<typename ArgT, typename MatcherT> + auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr<ArgT, MatcherT> { + return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString ); + } + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast<void>(__VA_ARGS__ ); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( exceptionType const& ex ) { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher##_catch_sr ) ); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +// end catch_capture_matchers.h +#endif +// start catch_generators.hpp + +// start catch_interfaces_generatortracker.h + + +#include <memory> + +namespace Catch { + + namespace Generators { + class GeneratorUntypedBase { + public: + GeneratorUntypedBase() = default; + virtual ~GeneratorUntypedBase(); + // Attempts to move the generator to the next element + // + // Returns true iff the move succeeded (and a valid element + // can be retrieved). + virtual bool next() = 0; + }; + using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>; + + } // namespace Generators + + struct IGeneratorTracker { + virtual ~IGeneratorTracker(); + virtual auto hasGenerator() const -> bool = 0; + virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; + virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; + }; + +} // namespace Catch + +// end catch_interfaces_generatortracker.h +// start catch_enforce.h + +#include <exception> + +namespace Catch { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + template <typename Ex> + [[noreturn]] + void throw_exception(Ex const& e) { + throw e; + } +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + [[noreturn]] + void throw_exception(std::exception const& e); +#endif + + [[noreturn]] + void throw_logic_error(std::string const& msg); + [[noreturn]] + void throw_domain_error(std::string const& msg); + [[noreturn]] + void throw_runtime_error(std::string const& msg); + +} // namespace Catch; + +#define CATCH_MAKE_MSG(...) \ + (Catch::ReusableStringStream() << __VA_ARGS__).str() + +#define CATCH_INTERNAL_ERROR(...) \ + Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << ": Internal Catch2 error: " << __VA_ARGS__)); + +#define CATCH_ERROR(...) \ + Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ )); + +#define CATCH_RUNTIME_ERROR(...) \ + Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ )); + +#define CATCH_ENFORCE( condition, ... ) \ + do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false) + +// end catch_enforce.h +#include <memory> +#include <vector> +#include <cassert> + +#include <utility> +#include <exception> + +namespace Catch { + +class GeneratorException : public std::exception { + const char* const m_msg = ""; + +public: + GeneratorException(const char* msg): + m_msg(msg) + {} + + const char* what() const noexcept override final; +}; + +namespace Generators { + + // !TBD move this into its own location? + namespace pf{ + template<typename T, typename... Args> + std::unique_ptr<T> make_unique( Args&&... args ) { + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); + } + } + + template<typename T> + struct IGenerator : GeneratorUntypedBase { + virtual ~IGenerator() = default; + + // Returns the current element of the generator + // + // \Precondition The generator is either freshly constructed, + // or the last call to `next()` returned true + virtual T const& get() const = 0; + using type = T; + }; + + template<typename T> + class SingleValueGenerator final : public IGenerator<T> { + T m_value; + public: + SingleValueGenerator(T const& value) : m_value( value ) {} + SingleValueGenerator(T&& value) : m_value(std::move(value)) {} + + T const& get() const override { + return m_value; + } + bool next() override { + return false; + } + }; + + template<typename T> + class FixedValuesGenerator final : public IGenerator<T> { + std::vector<T> m_values; + size_t m_idx = 0; + public: + FixedValuesGenerator( std::initializer_list<T> values ) : m_values( values ) {} + + T const& get() const override { + return m_values[m_idx]; + } + bool next() override { + ++m_idx; + return m_idx < m_values.size(); + } + }; + + template <typename T> + class GeneratorWrapper final { + std::unique_ptr<IGenerator<T>> m_generator; + public: + GeneratorWrapper(std::unique_ptr<IGenerator<T>> generator): + m_generator(std::move(generator)) + {} + T const& get() const { + return m_generator->get(); + } + bool next() { + return m_generator->next(); + } + }; + + template <typename T> + GeneratorWrapper<T> value(T&& value) { + return GeneratorWrapper<T>(pf::make_unique<SingleValueGenerator<T>>(std::forward<T>(value))); + } + template <typename T> + GeneratorWrapper<T> values(std::initializer_list<T> values) { + return GeneratorWrapper<T>(pf::make_unique<FixedValuesGenerator<T>>(values)); + } + + template<typename T> + class Generators : public IGenerator<T> { + std::vector<GeneratorWrapper<T>> m_generators; + size_t m_current = 0; + + void populate(GeneratorWrapper<T>&& generator) { + m_generators.emplace_back(std::move(generator)); + } + void populate(T&& val) { + m_generators.emplace_back(value(std::move(val))); + } + template<typename U> + void populate(U&& val) { + populate(T(std::move(val))); + } + template<typename U, typename... Gs> + void populate(U&& valueOrGenerator, Gs... moreGenerators) { + populate(std::forward<U>(valueOrGenerator)); + populate(std::forward<Gs>(moreGenerators)...); + } + + public: + template <typename... Gs> + Generators(Gs... moreGenerators) { + m_generators.reserve(sizeof...(Gs)); + populate(std::forward<Gs>(moreGenerators)...); + } + + T const& get() const override { + return m_generators[m_current].get(); + } + + bool next() override { + if (m_current >= m_generators.size()) { + return false; + } + const bool current_status = m_generators[m_current].next(); + if (!current_status) { + ++m_current; + } + return m_current < m_generators.size(); + } + }; + + template<typename... Ts> + GeneratorWrapper<std::tuple<Ts...>> table( std::initializer_list<std::tuple<typename std::decay<Ts>::type...>> tuples ) { + return values<std::tuple<Ts...>>( tuples ); + } + + // Tag type to signal that a generator sequence should convert arguments to a specific type + template <typename T> + struct as {}; + + template<typename T, typename... Gs> + auto makeGenerators( GeneratorWrapper<T>&& generator, Gs... moreGenerators ) -> Generators<T> { + return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...); + } + template<typename T> + auto makeGenerators( GeneratorWrapper<T>&& generator ) -> Generators<T> { + return Generators<T>(std::move(generator)); + } + template<typename T, typename... Gs> + auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators<T> { + return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... ); + } + template<typename T, typename U, typename... Gs> + auto makeGenerators( as<T>, U&& val, Gs... moreGenerators ) -> Generators<T> { + return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... ); + } + + auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; + + template<typename L> + // Note: The type after -> is weird, because VS2015 cannot parse + // the expression used in the typedef inside, when it is in + // return type. Yeah. + auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) { + using UnderlyingType = typename decltype(generatorExpression())::type; + + IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo ); + if (!tracker.hasGenerator()) { + tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression())); + } + + auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() ); + return generator.get(); + } + +} // namespace Generators +} // namespace Catch + +#define GENERATE( ... ) \ + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) +#define GENERATE_COPY( ... ) \ + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) +#define GENERATE_REF( ... ) \ + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + +// end catch_generators.hpp +// start catch_generators_generic.hpp + +namespace Catch { +namespace Generators { + + template <typename T> + class TakeGenerator : public IGenerator<T> { + GeneratorWrapper<T> m_generator; + size_t m_returned = 0; + size_t m_target; + public: + TakeGenerator(size_t target, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_target(target) + { + assert(target != 0 && "Empty generators are not allowed"); + } + T const& get() const override { + return m_generator.get(); + } + bool next() override { + ++m_returned; + if (m_returned >= m_target) { + return false; + } + + const auto success = m_generator.next(); + // If the underlying generator does not contain enough values + // then we cut short as well + if (!success) { + m_returned = m_target; + } + return success; + } + }; + + template <typename T> + GeneratorWrapper<T> take(size_t target, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(pf::make_unique<TakeGenerator<T>>(target, std::move(generator))); + } + + template <typename T, typename Predicate> + class FilterGenerator : public IGenerator<T> { + GeneratorWrapper<T> m_generator; + Predicate m_predicate; + public: + template <typename P = Predicate> + FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_predicate(std::forward<P>(pred)) + { + if (!m_predicate(m_generator.get())) { + // It might happen that there are no values that pass the + // filter. In that case we throw an exception. + auto has_initial_value = next(); + if (!has_initial_value) { + Catch::throw_exception(GeneratorException("No valid value found in filtered generator")); + } + } + } + + T const& get() const override { + return m_generator.get(); + } + + bool next() override { + bool success = m_generator.next(); + if (!success) { + return false; + } + while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true); + return success; + } + }; + + template <typename T, typename Predicate> + GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(std::unique_ptr<IGenerator<T>>(pf::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator)))); + } + + template <typename T> + class RepeatGenerator : public IGenerator<T> { + GeneratorWrapper<T> m_generator; + mutable std::vector<T> m_returned; + size_t m_target_repeats; + size_t m_current_repeat = 0; + size_t m_repeat_index = 0; + public: + RepeatGenerator(size_t repeats, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_target_repeats(repeats) + { + assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); + } + + T const& get() const override { + if (m_current_repeat == 0) { + m_returned.push_back(m_generator.get()); + return m_returned.back(); + } + return m_returned[m_repeat_index]; + } + + bool next() override { + // There are 2 basic cases: + // 1) We are still reading the generator + // 2) We are reading our own cache + + // In the first case, we need to poke the underlying generator. + // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache + if (m_current_repeat == 0) { + const auto success = m_generator.next(); + if (!success) { + ++m_current_repeat; + } + return m_current_repeat < m_target_repeats; + } + + // In the second case, we need to move indices forward and check that we haven't run up against the end + ++m_repeat_index; + if (m_repeat_index == m_returned.size()) { + m_repeat_index = 0; + ++m_current_repeat; + } + return m_current_repeat < m_target_repeats; + } + }; + + template <typename T> + GeneratorWrapper<T> repeat(size_t repeats, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(pf::make_unique<RepeatGenerator<T>>(repeats, std::move(generator))); + } + + template <typename T, typename U, typename Func> + class MapGenerator : public IGenerator<T> { + // TBD: provide static assert for mapping function, for friendly error message + GeneratorWrapper<U> m_generator; + Func m_function; + // To avoid returning dangling reference, we have to save the values + T m_cache; + public: + template <typename F2 = Func> + MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) : + m_generator(std::move(generator)), + m_function(std::forward<F2>(function)), + m_cache(m_function(m_generator.get())) + {} + + T const& get() const override { + return m_cache; + } + bool next() override { + const auto success = m_generator.next(); + if (success) { + m_cache = m_function(m_generator.get()); + } + return success; + } + }; + +#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 + // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is + // replaced with std::invoke_result here. Also *_t format is preferred over + // typename *::type format. + template <typename Func, typename U> + using MapFunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U>>>; +#else + template <typename Func, typename U> + using MapFunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type; +#endif + + template <typename Func, typename U, typename T = MapFunctionReturnType<Func, U>> + GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) { + return GeneratorWrapper<T>( + pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator)) + ); + } + + template <typename T, typename U, typename Func> + GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) { + return GeneratorWrapper<T>( + pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator)) + ); + } + + template <typename T> + class ChunkGenerator final : public IGenerator<std::vector<T>> { + std::vector<T> m_chunk; + size_t m_chunk_size; + GeneratorWrapper<T> m_generator; + bool m_used_up = false; + public: + ChunkGenerator(size_t size, GeneratorWrapper<T> generator) : + m_chunk_size(size), m_generator(std::move(generator)) + { + m_chunk.reserve(m_chunk_size); + m_chunk.push_back(m_generator.get()); + for (size_t i = 1; i < m_chunk_size; ++i) { + if (!m_generator.next()) { + Catch::throw_exception(GeneratorException("Not enough values to initialize the first chunk")); + } + m_chunk.push_back(m_generator.get()); + } + } + std::vector<T> const& get() const override { + return m_chunk; + } + bool next() override { + m_chunk.clear(); + for (size_t idx = 0; idx < m_chunk_size; ++idx) { + if (!m_generator.next()) { + return false; + } + m_chunk.push_back(m_generator.get()); + } + return true; + } + }; + + template <typename T> + GeneratorWrapper<std::vector<T>> chunk(size_t size, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<std::vector<T>>( + pf::make_unique<ChunkGenerator<T>>(size, std::move(generator)) + ); + } + +} // namespace Generators +} // namespace Catch + +// end catch_generators_generic.hpp +// start catch_generators_specific.hpp + +// start catch_context.h + +#include <memory> + +namespace Catch { + + struct IResultCapture; + struct IRunner; + struct IConfig; + struct IMutableContext; + + using IConfigPtr = std::shared_ptr<IConfig const>; + + struct IContext + { + virtual ~IContext(); + + virtual IResultCapture* getResultCapture() = 0; + virtual IRunner* getRunner() = 0; + virtual IConfigPtr const& getConfig() const = 0; + }; + + struct IMutableContext : IContext + { + virtual ~IMutableContext(); + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setRunner( IRunner* runner ) = 0; + virtual void setConfig( IConfigPtr const& config ) = 0; + + private: + static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); + }; + + inline IMutableContext& getCurrentMutableContext() + { + if( !IMutableContext::currentContext ) + IMutableContext::createContext(); + return *IMutableContext::currentContext; + } + + inline IContext& getCurrentContext() + { + return getCurrentMutableContext(); + } + + void cleanUpContext(); +} + +// end catch_context.h +// start catch_interfaces_config.h + +// start catch_option.hpp + +namespace Catch { + + // An optional type + template<typename T> + class Option { + public: + Option() : nullableValue( nullptr ) {} + Option( T const& _value ) + : nullableValue( new( storage ) T( _value ) ) + {} + Option( Option const& _other ) + : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) + {} + + ~Option() { + reset(); + } + + Option& operator= ( Option const& _other ) { + if( &_other != this ) { + reset(); + if( _other ) + nullableValue = new( storage ) T( *_other ); + } + return *this; + } + Option& operator = ( T const& _value ) { + reset(); + nullableValue = new( storage ) T( _value ); + return *this; + } + + void reset() { + if( nullableValue ) + nullableValue->~T(); + nullableValue = nullptr; + } + + T& operator*() { return *nullableValue; } + T const& operator*() const { return *nullableValue; } + T* operator->() { return nullableValue; } + const T* operator->() const { return nullableValue; } + + T valueOr( T const& defaultValue ) const { + return nullableValue ? *nullableValue : defaultValue; + } + + bool some() const { return nullableValue != nullptr; } + bool none() const { return nullableValue == nullptr; } + + bool operator !() const { return nullableValue == nullptr; } + explicit operator bool() const { + return some(); + } + + private: + T *nullableValue; + alignas(alignof(T)) char storage[sizeof(T)]; + }; + +} // end namespace Catch + +// end catch_option.hpp +#include <iosfwd> +#include <string> +#include <vector> +#include <memory> + +namespace Catch { + + enum class Verbosity { + Quiet = 0, + Normal, + High + }; + + struct WarnAbout { enum What { + Nothing = 0x00, + NoAssertions = 0x01, + NoTests = 0x02 + }; }; + + struct ShowDurations { enum OrNot { + DefaultForReporter, + Always, + Never + }; }; + struct RunTests { enum InWhatOrder { + InDeclarationOrder, + InLexicographicalOrder, + InRandomOrder + }; }; + struct UseColour { enum YesOrNo { + Auto, + Yes, + No + }; }; + struct WaitForKeypress { enum When { + Never, + BeforeStart = 1, + BeforeExit = 2, + BeforeStartAndExit = BeforeStart | BeforeExit + }; }; + + class TestSpec; + + struct IConfig : NonCopyable { + + virtual ~IConfig(); + + virtual bool allowThrows() const = 0; + virtual std::ostream& stream() const = 0; + virtual std::string name() const = 0; + virtual bool includeSuccessfulResults() const = 0; + virtual bool shouldDebugBreak() const = 0; + virtual bool warnAboutMissingAssertions() const = 0; + virtual bool warnAboutNoTests() const = 0; + virtual int abortAfter() const = 0; + virtual bool showInvisibles() const = 0; + virtual ShowDurations::OrNot showDurations() const = 0; + virtual TestSpec const& testSpec() const = 0; + virtual bool hasTestFilters() const = 0; + virtual std::vector<std::string> const& getTestsOrTags() const = 0; + virtual RunTests::InWhatOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; + virtual UseColour::YesOrNo useColour() const = 0; + virtual std::vector<std::string> const& getSectionsToRun() const = 0; + virtual Verbosity verbosity() const = 0; + + virtual bool benchmarkNoAnalysis() const = 0; + virtual int benchmarkSamples() const = 0; + virtual double benchmarkConfidenceInterval() const = 0; + virtual unsigned int benchmarkResamples() const = 0; + }; + + using IConfigPtr = std::shared_ptr<IConfig const>; +} + +// end catch_interfaces_config.h +#include <random> + +namespace Catch { +namespace Generators { + +template <typename Float> +class RandomFloatingGenerator final : public IGenerator<Float> { + // FIXME: What is the right seed? + std::minstd_rand m_rand; + std::uniform_real_distribution<Float> m_dist; + Float m_current_number; +public: + + RandomFloatingGenerator(Float a, Float b): + m_rand(getCurrentContext().getConfig()->rngSeed()), + m_dist(a, b) { + static_cast<void>(next()); + } + + Float const& get() const override { + return m_current_number; + } + bool next() override { + m_current_number = m_dist(m_rand); + return true; + } +}; + +template <typename Integer> +class RandomIntegerGenerator final : public IGenerator<Integer> { + std::minstd_rand m_rand; + std::uniform_int_distribution<Integer> m_dist; + Integer m_current_number; +public: + + RandomIntegerGenerator(Integer a, Integer b): + m_rand(getCurrentContext().getConfig()->rngSeed()), + m_dist(a, b) { + static_cast<void>(next()); + } + + Integer const& get() const override { + return m_current_number; + } + bool next() override { + m_current_number = m_dist(m_rand); + return true; + } +}; + +// TODO: Ideally this would be also constrained against the various char types, +// but I don't expect users to run into that in practice. +template <typename T> +typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, +GeneratorWrapper<T>>::type +random(T a, T b) { + return GeneratorWrapper<T>( + pf::make_unique<RandomIntegerGenerator<T>>(a, b) + ); +} + +template <typename T> +typename std::enable_if<std::is_floating_point<T>::value, +GeneratorWrapper<T>>::type +random(T a, T b) { + return GeneratorWrapper<T>( + pf::make_unique<RandomFloatingGenerator<T>>(a, b) + ); +} + +template <typename T> +class RangeGenerator final : public IGenerator<T> { + T m_current; + T m_end; + T m_step; + bool m_positive; + +public: + RangeGenerator(T const& start, T const& end, T const& step): + m_current(start), + m_end(end), + m_step(step), + m_positive(m_step > T(0)) + { + assert(m_current != m_end && "Range start and end cannot be equal"); + assert(m_step != T(0) && "Step size cannot be zero"); + assert(((m_positive && m_current <= m_end) || (!m_positive && m_current >= m_end)) && "Step moves away from end"); + } + + RangeGenerator(T const& start, T const& end): + RangeGenerator(start, end, (start < end) ? T(1) : T(-1)) + {} + + T const& get() const override { + return m_current; + } + + bool next() override { + m_current += m_step; + return (m_positive) ? (m_current < m_end) : (m_current > m_end); + } +}; + +template <typename T> +GeneratorWrapper<T> range(T const& start, T const& end, T const& step) { + static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer"); + return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end, step)); +} + +template <typename T> +GeneratorWrapper<T> range(T const& start, T const& end) { + static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer"); + return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end)); +} + +} // namespace Generators +} // namespace Catch + +// end catch_generators_specific.hpp + +// These files are included here so the single_include script doesn't put them +// in the conditionally compiled sections +// start catch_test_case_info.h + +#include <string> +#include <vector> +#include <memory> + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace Catch { + + struct ITestInvoker; + + struct TestCaseInfo { + enum SpecialProperties{ + None = 0, + IsHidden = 1 << 1, + ShouldFail = 1 << 2, + MayFail = 1 << 3, + Throws = 1 << 4, + NonPortable = 1 << 5, + Benchmark = 1 << 6 + }; + + TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector<std::string> const& _tags, + SourceLineInfo const& _lineInfo ); + + friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ); + + bool isHidden() const; + bool throws() const; + bool okToFail() const; + bool expectedToFail() const; + + std::string tagsAsString() const; + + std::string name; + std::string className; + std::string description; + std::vector<std::string> tags; + std::vector<std::string> lcaseTags; + SourceLineInfo lineInfo; + SpecialProperties properties; + }; + + class TestCase : public TestCaseInfo { + public: + + TestCase( ITestInvoker* testCase, TestCaseInfo&& info ); + + TestCase withName( std::string const& _newName ) const; + + void invoke() const; + + TestCaseInfo const& getTestCaseInfo() const; + + bool operator == ( TestCase const& other ) const; + bool operator < ( TestCase const& other ) const; + + private: + std::shared_ptr<ITestInvoker> test; + }; + + TestCase makeTestCase( ITestInvoker* testCase, + std::string const& className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_case_info.h +// start catch_interfaces_runner.h + +namespace Catch { + + struct IRunner { + virtual ~IRunner(); + virtual bool aborting() const = 0; + }; +} + +// end catch_interfaces_runner.h + +#ifdef __OBJC__ +// start catch_objc.hpp + +#import <objc/runtime.h> + +#include <string> + +// NB. Any general catch headers included here must be included +// in catch.hpp first to make sure they are included by the single +// header for non obj-usage + +/////////////////////////////////////////////////////////////////////////////// +// This protocol is really only here for (self) documenting purposes, since +// all its methods are optional. +@protocol OcFixture + +@optional + +-(void) setUp; +-(void) tearDown; + +@end + +namespace Catch { + + class OcMethod : public ITestInvoker { + + public: + OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {} + + virtual void invoke() const { + id obj = [[m_cls alloc] init]; + + performOptionalSelector( obj, @selector(setUp) ); + performOptionalSelector( obj, m_sel ); + performOptionalSelector( obj, @selector(tearDown) ); + + arcSafeRelease( obj ); + } + private: + virtual ~OcMethod() {} + + Class m_cls; + SEL m_sel; + }; + + namespace Detail{ + + inline std::string getAnnotation( Class cls, + std::string const& annotationName, + std::string const& testCaseName ) { + NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()]; + SEL sel = NSSelectorFromString( selStr ); + arcSafeRelease( selStr ); + id value = performOptionalSelector( cls, sel ); + if( value ) + return [(NSString*)value UTF8String]; + return ""; + } + } + + inline std::size_t registerTestMethods() { + std::size_t noTestMethods = 0; + int noClasses = objc_getClassList( nullptr, 0 ); + + Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); + objc_getClassList( classes, noClasses ); + + for( int c = 0; c < noClasses; c++ ) { + Class cls = classes[c]; + { + u_int count; + Method* methods = class_copyMethodList( cls, &count ); + for( u_int m = 0; m < count ; m++ ) { + SEL selector = method_getName(methods[m]); + std::string methodName = sel_getName(selector); + if( startsWith( methodName, "Catch_TestCase_" ) ) { + std::string testCaseName = methodName.substr( 15 ); + std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); + std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); + const char* className = class_getName( cls ); + + getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) ); + noTestMethods++; + } + } + free(methods); + } + } + return noTestMethods; + } + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) + + namespace Matchers { + namespace Impl { + namespace NSStringMatchers { + + struct StringHolder : MatcherBase<NSString*>{ + StringHolder( NSString* substr ) : m_substr( [substr copy] ){} + StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){} + StringHolder() { + arcSafeRelease( m_substr ); + } + + bool match( NSString* const& str ) const override { + return false; + } + + NSString* CATCH_ARC_STRONG m_substr; + }; + + struct Equals : StringHolder { + Equals( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* const& str ) const override { + return (str != nil || m_substr == nil ) && + [str isEqualToString:m_substr]; + } + + std::string describe() const override { + return "equals string: " + Catch::Detail::stringify( m_substr ); + } + }; + + struct Contains : StringHolder { + Contains( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* const& str ) const override { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location != NSNotFound; + } + + std::string describe() const override { + return "contains string: " + Catch::Detail::stringify( m_substr ); + } + }; + + struct StartsWith : StringHolder { + StartsWith( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* const& str ) const override { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location == 0; + } + + std::string describe() const override { + return "starts with: " + Catch::Detail::stringify( m_substr ); + } + }; + struct EndsWith : StringHolder { + EndsWith( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* const& str ) const override { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location == [str length] - [m_substr length]; + } + + std::string describe() const override { + return "ends with: " + Catch::Detail::stringify( m_substr ); + } + }; + + } // namespace NSStringMatchers + } // namespace Impl + + inline Impl::NSStringMatchers::Equals + Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); } + + inline Impl::NSStringMatchers::Contains + Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); } + + inline Impl::NSStringMatchers::StartsWith + StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); } + + inline Impl::NSStringMatchers::EndsWith + EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); } + + } // namespace Matchers + + using namespace Matchers; + +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix +#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \ ++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \ +{ \ +return @ name; \ +} \ ++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \ +{ \ +return @ desc; \ +} \ +-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix ) + +#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ ) + +// end catch_objc.hpp +#endif + +// Benchmarking needs the externally-facing parts of reporters to work +#if defined(CATCH_CONFIG_EXTERNAL_INTERFACES) || defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +// start catch_external_interfaces.h + +// start catch_reporter_bases.hpp + +// start catch_interfaces_reporter.h + +// start catch_config.hpp + +// start catch_test_spec_parser.h + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +// start catch_test_spec.h + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +// start catch_wildcard_pattern.h + +namespace Catch +{ + class WildcardPattern { + enum WildcardPosition { + NoWildcard = 0, + WildcardAtStart = 1, + WildcardAtEnd = 2, + WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd + }; + + public: + + WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); + virtual ~WildcardPattern() = default; + virtual bool matches( std::string const& str ) const; + + private: + std::string adjustCase( std::string const& str ) const; + CaseSensitive::Choice m_caseSensitivity; + WildcardPosition m_wildcard = NoWildcard; + std::string m_pattern; + }; +} + +// end catch_wildcard_pattern.h +#include <string> +#include <vector> +#include <memory> + +namespace Catch { + + class TestSpec { + struct Pattern { + virtual ~Pattern(); + virtual bool matches( TestCaseInfo const& testCase ) const = 0; + }; + using PatternPtr = std::shared_ptr<Pattern>; + + class NamePattern : public Pattern { + public: + NamePattern( std::string const& name ); + virtual ~NamePattern(); + bool matches( TestCaseInfo const& testCase ) const override; + private: + WildcardPattern m_wildcardPattern; + }; + + class TagPattern : public Pattern { + public: + TagPattern( std::string const& tag ); + virtual ~TagPattern(); + bool matches( TestCaseInfo const& testCase ) const override; + private: + std::string m_tag; + }; + + class ExcludedPattern : public Pattern { + public: + ExcludedPattern( PatternPtr const& underlyingPattern ); + virtual ~ExcludedPattern(); + bool matches( TestCaseInfo const& testCase ) const override; + private: + PatternPtr m_underlyingPattern; + }; + + struct Filter { + std::vector<PatternPtr> m_patterns; + + bool matches( TestCaseInfo const& testCase ) const; + }; + + public: + bool hasFilters() const; + bool matches( TestCaseInfo const& testCase ) const; + + private: + std::vector<Filter> m_filters; + + friend class TestSpecParser; + }; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_spec.h +// start catch_interfaces_tag_alias_registry.h + +#include <string> + +namespace Catch { + + struct TagAlias; + + struct ITagAliasRegistry { + virtual ~ITagAliasRegistry(); + // Nullptr if not present + virtual TagAlias const* find( std::string const& alias ) const = 0; + virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; + + static ITagAliasRegistry const& get(); + }; + +} // end namespace Catch + +// end catch_interfaces_tag_alias_registry.h +namespace Catch { + + class TestSpecParser { + enum Mode{ None, Name, QuotedName, Tag, EscapedName }; + Mode m_mode = None; + bool m_exclusion = false; + std::size_t m_start = std::string::npos, m_pos = 0; + std::string m_arg; + std::vector<std::size_t> m_escapeChars; + TestSpec::Filter m_currentFilter; + TestSpec m_testSpec; + ITagAliasRegistry const* m_tagAliases = nullptr; + + public: + TestSpecParser( ITagAliasRegistry const& tagAliases ); + + TestSpecParser& parse( std::string const& arg ); + TestSpec testSpec(); + + private: + void visitChar( char c ); + void startNewMode( Mode mode, std::size_t start ); + void escape(); + std::string subString() const; + + template<typename T> + void addPattern() { + std::string token = subString(); + for( std::size_t i = 0; i < m_escapeChars.size(); ++i ) + token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 ); + m_escapeChars.clear(); + if( startsWith( token, "exclude:" ) ) { + m_exclusion = true; + token = token.substr( 8 ); + } + if( !token.empty() ) { + TestSpec::PatternPtr pattern = std::make_shared<T>( token ); + if( m_exclusion ) + pattern = std::make_shared<TestSpec::ExcludedPattern>( pattern ); + m_currentFilter.m_patterns.push_back( pattern ); + } + m_exclusion = false; + m_mode = None; + } + + void addFilter(); + }; + TestSpec parseTestSpec( std::string const& arg ); + +} // namespace Catch + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_spec_parser.h +// Libstdc++ doesn't like incomplete classes for unique_ptr + +#include <memory> +#include <vector> +#include <string> + +#ifndef CATCH_CONFIG_CONSOLE_WIDTH +#define CATCH_CONFIG_CONSOLE_WIDTH 80 +#endif + +namespace Catch { + + struct IStream; + + struct ConfigData { + bool listTests = false; + bool listTags = false; + bool listReporters = false; + bool listTestNamesOnly = false; + + bool showSuccessfulTests = false; + bool shouldDebugBreak = false; + bool noThrow = false; + bool showHelp = false; + bool showInvisibles = false; + bool filenamesAsTags = false; + bool libIdentify = false; + + int abortAfter = -1; + unsigned int rngSeed = 0; + + bool benchmarkNoAnalysis = false; + unsigned int benchmarkSamples = 100; + double benchmarkConfidenceInterval = 0.95; + unsigned int benchmarkResamples = 100000; + + Verbosity verbosity = Verbosity::Normal; + WarnAbout::What warnings = WarnAbout::Nothing; + ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter; + RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder; + UseColour::YesOrNo useColour = UseColour::Auto; + WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; + + std::string outputFilename; + std::string name; + std::string processName; +#ifndef CATCH_CONFIG_DEFAULT_REPORTER +#define CATCH_CONFIG_DEFAULT_REPORTER "console" +#endif + std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; +#undef CATCH_CONFIG_DEFAULT_REPORTER + + std::vector<std::string> testsOrTags; + std::vector<std::string> sectionsToRun; + }; + + class Config : public IConfig { + public: + + Config() = default; + Config( ConfigData const& data ); + virtual ~Config() = default; + + std::string const& getFilename() const; + + bool listTests() const; + bool listTestNamesOnly() const; + bool listTags() const; + bool listReporters() const; + + std::string getProcessName() const; + std::string const& getReporterName() const; + + std::vector<std::string> const& getTestsOrTags() const override; + std::vector<std::string> const& getSectionsToRun() const override; + + TestSpec const& testSpec() const override; + bool hasTestFilters() const override; + + bool showHelp() const; + + // IConfig interface + bool allowThrows() const override; + std::ostream& stream() const override; + std::string name() const override; + bool includeSuccessfulResults() const override; + bool warnAboutMissingAssertions() const override; + bool warnAboutNoTests() const override; + ShowDurations::OrNot showDurations() const override; + RunTests::InWhatOrder runOrder() const override; + unsigned int rngSeed() const override; + UseColour::YesOrNo useColour() const override; + bool shouldDebugBreak() const override; + int abortAfter() const override; + bool showInvisibles() const override; + Verbosity verbosity() const override; + bool benchmarkNoAnalysis() const override; + int benchmarkSamples() const override; + double benchmarkConfidenceInterval() const override; + unsigned int benchmarkResamples() const override; + + private: + + IStream const* openStream(); + ConfigData m_data; + + std::unique_ptr<IStream const> m_stream; + TestSpec m_testSpec; + bool m_hasTestFilters = false; + }; + +} // end namespace Catch + +// end catch_config.hpp +// start catch_assertionresult.h + +#include <string> + +namespace Catch { + + struct AssertionResultData + { + AssertionResultData() = delete; + + AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); + + std::string message; + mutable std::string reconstructedExpression; + LazyExpression lazyExpression; + ResultWas::OfType resultType; + + std::string reconstructExpression() const; + }; + + class AssertionResult { + public: + AssertionResult() = delete; + AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); + + bool isOk() const; + bool succeeded() const; + ResultWas::OfType getResultType() const; + bool hasExpression() const; + bool hasMessage() const; + std::string getExpression() const; + std::string getExpressionInMacro() const; + bool hasExpandedExpression() const; + std::string getExpandedExpression() const; + std::string getMessage() const; + SourceLineInfo getSourceInfo() const; + StringRef getTestMacroName() const; + + //protected: + AssertionInfo m_info; + AssertionResultData m_resultData; + }; + +} // end namespace Catch + +// end catch_assertionresult.h +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +// start catch_estimate.hpp + + // Statistics estimates + + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct Estimate { + Duration point; + Duration lower_bound; + Duration upper_bound; + double confidence_interval; + + template <typename Duration2> + operator Estimate<Duration2>() const { + return { point, lower_bound, upper_bound, confidence_interval }; + } + }; + } // namespace Benchmark +} // namespace Catch + +// end catch_estimate.hpp +// start catch_outlier_classification.hpp + +// Outlier information + +namespace Catch { + namespace Benchmark { + struct OutlierClassification { + int samples_seen = 0; + int low_severe = 0; // more than 3 times IQR below Q1 + int low_mild = 0; // 1.5 to 3 times IQR below Q1 + int high_mild = 0; // 1.5 to 3 times IQR above Q3 + int high_severe = 0; // more than 3 times IQR above Q3 + + int total() const { + return low_severe + low_mild + high_mild + high_severe; + } + }; + } // namespace Benchmark +} // namespace Catch + +// end catch_outlier_classification.hpp +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + +#include <string> +#include <iosfwd> +#include <map> +#include <set> +#include <memory> +#include <algorithm> + +namespace Catch { + + struct ReporterConfig { + explicit ReporterConfig( IConfigPtr const& _fullConfig ); + + ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ); + + std::ostream& stream() const; + IConfigPtr fullConfig() const; + + private: + std::ostream* m_stream; + IConfigPtr m_fullConfig; + }; + + struct ReporterPreferences { + bool shouldRedirectStdOut = false; + bool shouldReportAllAssertions = false; + }; + + template<typename T> + struct LazyStat : Option<T> { + LazyStat& operator=( T const& _value ) { + Option<T>::operator=( _value ); + used = false; + return *this; + } + void reset() { + Option<T>::reset(); + used = false; + } + bool used = false; + }; + + struct TestRunInfo { + TestRunInfo( std::string const& _name ); + std::string name; + }; + struct GroupInfo { + GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ); + + std::string name; + std::size_t groupIndex; + std::size_t groupsCounts; + }; + + struct AssertionStats { + AssertionStats( AssertionResult const& _assertionResult, + std::vector<MessageInfo> const& _infoMessages, + Totals const& _totals ); + + AssertionStats( AssertionStats const& ) = default; + AssertionStats( AssertionStats && ) = default; + AssertionStats& operator = ( AssertionStats const& ) = delete; + AssertionStats& operator = ( AssertionStats && ) = delete; + virtual ~AssertionStats(); + + AssertionResult assertionResult; + std::vector<MessageInfo> infoMessages; + Totals totals; + }; + + struct SectionStats { + SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ); + SectionStats( SectionStats const& ) = default; + SectionStats( SectionStats && ) = default; + SectionStats& operator = ( SectionStats const& ) = default; + SectionStats& operator = ( SectionStats && ) = default; + virtual ~SectionStats(); + + SectionInfo sectionInfo; + Counts assertions; + double durationInSeconds; + bool missingAssertions; + }; + + struct TestCaseStats { + TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ); + + TestCaseStats( TestCaseStats const& ) = default; + TestCaseStats( TestCaseStats && ) = default; + TestCaseStats& operator = ( TestCaseStats const& ) = default; + TestCaseStats& operator = ( TestCaseStats && ) = default; + virtual ~TestCaseStats(); + + TestCaseInfo testInfo; + Totals totals; + std::string stdOut; + std::string stdErr; + bool aborting; + }; + + struct TestGroupStats { + TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ); + TestGroupStats( GroupInfo const& _groupInfo ); + + TestGroupStats( TestGroupStats const& ) = default; + TestGroupStats( TestGroupStats && ) = default; + TestGroupStats& operator = ( TestGroupStats const& ) = default; + TestGroupStats& operator = ( TestGroupStats && ) = default; + virtual ~TestGroupStats(); + + GroupInfo groupInfo; + Totals totals; + bool aborting; + }; + + struct TestRunStats { + TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ); + + TestRunStats( TestRunStats const& ) = default; + TestRunStats( TestRunStats && ) = default; + TestRunStats& operator = ( TestRunStats const& ) = default; + TestRunStats& operator = ( TestRunStats && ) = default; + virtual ~TestRunStats(); + + TestRunInfo runInfo; + Totals totals; + bool aborting; + }; + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + struct BenchmarkInfo { + std::string name; + double estimatedDuration; + int iterations; + int samples; + unsigned int resamples; + double clockResolution; + double clockCost; + }; + + template <class Duration> + struct BenchmarkStats { + BenchmarkInfo info; + + std::vector<Duration> samples; + Benchmark::Estimate<Duration> mean; + Benchmark::Estimate<Duration> standardDeviation; + Benchmark::OutlierClassification outliers; + double outlierVariance; + + template <typename Duration2> + operator BenchmarkStats<Duration2>() const { + std::vector<Duration2> samples2; + samples2.reserve(samples.size()); + std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); + return { + info, + std::move(samples2), + mean, + standardDeviation, + outliers, + outlierVariance, + }; + } + }; +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + struct IStreamingReporter { + virtual ~IStreamingReporter() = default; + + // Implementing class must also provide the following static methods: + // static std::string getDescription(); + // static std::set<Verbosity> getSupportedVerbosities() + + virtual ReporterPreferences getPreferences() const = 0; + + virtual void noMatchingTestCases( std::string const& spec ) = 0; + + virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; + virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; + + virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; + virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + virtual void benchmarkPreparing( std::string const& ) {} + virtual void benchmarkStarting( BenchmarkInfo const& ) {} + virtual void benchmarkEnded( BenchmarkStats<> const& ) {} + virtual void benchmarkFailed( std::string const& ) {} +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; + + // The return value indicates if the messages buffer should be cleared: + virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; + + virtual void sectionEnded( SectionStats const& sectionStats ) = 0; + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; + virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + + virtual void skipTest( TestCaseInfo const& testInfo ) = 0; + + // Default empty implementation provided + virtual void fatalErrorEncountered( StringRef name ); + + virtual bool isMulti() const; + }; + using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>; + + struct IReporterFactory { + virtual ~IReporterFactory(); + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0; + virtual std::string getDescription() const = 0; + }; + using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>; + + struct IReporterRegistry { + using FactoryMap = std::map<std::string, IReporterFactoryPtr>; + using Listeners = std::vector<IReporterFactoryPtr>; + + virtual ~IReporterRegistry(); + virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0; + virtual FactoryMap const& getFactories() const = 0; + virtual Listeners const& getListeners() const = 0; + }; + +} // end namespace Catch + +// end catch_interfaces_reporter.h +#include <algorithm> +#include <cstring> +#include <cfloat> +#include <cstdio> +#include <cassert> +#include <memory> +#include <ostream> + +namespace Catch { + void prepareExpandedExpression(AssertionResult& result); + + // Returns double formatted as %.3f (format expected on output) + std::string getFormattedDuration( double duration ); + + std::string serializeFilters( std::vector<std::string> const& container ); + + template<typename DerivedT> + struct StreamingReporterBase : IStreamingReporter { + + StreamingReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + CATCH_ERROR( "Verbosity level not supported by this reporter" ); + } + + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } + + static std::set<Verbosity> getSupportedVerbosities() { + return { Verbosity::Normal }; + } + + ~StreamingReporterBase() override = default; + + void noMatchingTestCases(std::string const&) override {} + + void testRunStarting(TestRunInfo const& _testRunInfo) override { + currentTestRunInfo = _testRunInfo; + } + + void testGroupStarting(GroupInfo const& _groupInfo) override { + currentGroupInfo = _groupInfo; + } + + void testCaseStarting(TestCaseInfo const& _testInfo) override { + currentTestCaseInfo = _testInfo; + } + void sectionStarting(SectionInfo const& _sectionInfo) override { + m_sectionStack.push_back(_sectionInfo); + } + + void sectionEnded(SectionStats const& /* _sectionStats */) override { + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { + currentTestCaseInfo.reset(); + } + void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override { + currentGroupInfo.reset(); + } + void testRunEnded(TestRunStats const& /* _testRunStats */) override { + currentTestCaseInfo.reset(); + currentGroupInfo.reset(); + currentTestRunInfo.reset(); + } + + void skipTest(TestCaseInfo const&) override { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + + IConfigPtr m_config; + std::ostream& stream; + + LazyStat<TestRunInfo> currentTestRunInfo; + LazyStat<GroupInfo> currentGroupInfo; + LazyStat<TestCaseInfo> currentTestCaseInfo; + + std::vector<SectionInfo> m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; + + template<typename DerivedT> + struct CumulativeReporterBase : IStreamingReporter { + template<typename T, typename ChildNodeT> + struct Node { + explicit Node( T const& _value ) : value( _value ) {} + virtual ~Node() {} + + using ChildNodes = std::vector<std::shared_ptr<ChildNodeT>>; + T value; + ChildNodes children; + }; + struct SectionNode { + explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} + virtual ~SectionNode() = default; + + bool operator == (SectionNode const& other) const { + return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; + } + bool operator == (std::shared_ptr<SectionNode> const& other) const { + return operator==(*other); + } + + SectionStats stats; + using ChildSections = std::vector<std::shared_ptr<SectionNode>>; + using Assertions = std::vector<AssertionStats>; + ChildSections childSections; + Assertions assertions; + std::string stdOut; + std::string stdErr; + }; + + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ) : m_other( other ) {} + BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {} + bool operator() (std::shared_ptr<SectionNode> const& node) const { + return ((node->stats.sectionInfo.name == m_other.name) && + (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); + } + void operator=(BySectionInfo const&) = delete; + + private: + SectionInfo const& m_other; + }; + + using TestCaseNode = Node<TestCaseStats, SectionNode>; + using TestGroupNode = Node<TestGroupStats, TestCaseNode>; + using TestRunNode = Node<TestRunStats, TestGroupNode>; + + CumulativeReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + CATCH_ERROR( "Verbosity level not supported by this reporter" ); + } + ~CumulativeReporterBase() override = default; + + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } + + static std::set<Verbosity> getSupportedVerbosities() { + return { Verbosity::Normal }; + } + + void testRunStarting( TestRunInfo const& ) override {} + void testGroupStarting( GroupInfo const& ) override {} + + void testCaseStarting( TestCaseInfo const& ) override {} + + void sectionStarting( SectionInfo const& sectionInfo ) override { + SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); + std::shared_ptr<SectionNode> node; + if( m_sectionStack.empty() ) { + if( !m_rootSection ) + m_rootSection = std::make_shared<SectionNode>( incompleteStats ); + node = m_rootSection; + } + else { + SectionNode& parentNode = *m_sectionStack.back(); + auto it = + std::find_if( parentNode.childSections.begin(), + parentNode.childSections.end(), + BySectionInfo( sectionInfo ) ); + if( it == parentNode.childSections.end() ) { + node = std::make_shared<SectionNode>( incompleteStats ); + parentNode.childSections.push_back( node ); + } + else + node = *it; + } + m_sectionStack.push_back( node ); + m_deepestSection = std::move(node); + } + + void assertionStarting(AssertionInfo const&) override {} + + bool assertionEnded(AssertionStats const& assertionStats) override { + assert(!m_sectionStack.empty()); + // AssertionResult holds a pointer to a temporary DecomposedExpression, + // which getExpandedExpression() calls to build the expression string. + // Our section stack copy of the assertionResult will likely outlive the + // temporary, so it must be expanded or discarded now to avoid calling + // a destroyed object later. + prepareExpandedExpression(const_cast<AssertionResult&>( assertionStats.assertionResult ) ); + SectionNode& sectionNode = *m_sectionStack.back(); + sectionNode.assertions.push_back(assertionStats); + return true; + } + void sectionEnded(SectionStats const& sectionStats) override { + assert(!m_sectionStack.empty()); + SectionNode& node = *m_sectionStack.back(); + node.stats = sectionStats; + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& testCaseStats) override { + auto node = std::make_shared<TestCaseNode>(testCaseStats); + assert(m_sectionStack.size() == 0); + node->children.push_back(m_rootSection); + m_testCases.push_back(node); + m_rootSection.reset(); + + assert(m_deepestSection); + m_deepestSection->stdOut = testCaseStats.stdOut; + m_deepestSection->stdErr = testCaseStats.stdErr; + } + void testGroupEnded(TestGroupStats const& testGroupStats) override { + auto node = std::make_shared<TestGroupNode>(testGroupStats); + node->children.swap(m_testCases); + m_testGroups.push_back(node); + } + void testRunEnded(TestRunStats const& testRunStats) override { + auto node = std::make_shared<TestRunNode>(testRunStats); + node->children.swap(m_testGroups); + m_testRuns.push_back(node); + testRunEndedCumulative(); + } + virtual void testRunEndedCumulative() = 0; + + void skipTest(TestCaseInfo const&) override {} + + IConfigPtr m_config; + std::ostream& stream; + std::vector<AssertionStats> m_assertions; + std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections; + std::vector<std::shared_ptr<TestCaseNode>> m_testCases; + std::vector<std::shared_ptr<TestGroupNode>> m_testGroups; + + std::vector<std::shared_ptr<TestRunNode>> m_testRuns; + + std::shared_ptr<SectionNode> m_rootSection; + std::shared_ptr<SectionNode> m_deepestSection; + std::vector<std::shared_ptr<SectionNode>> m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; + + template<char C> + char const* getLineOfChars() { + static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; + if( !*line ) { + std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); + line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; + } + return line; + } + + struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> { + TestEventListenerBase( ReporterConfig const& _config ); + + static std::set<Verbosity> getSupportedVerbosities(); + + void assertionStarting(AssertionInfo const&) override; + bool assertionEnded(AssertionStats const&) override; + }; + +} // end namespace Catch + +// end catch_reporter_bases.hpp +// start catch_console_colour.h + +namespace Catch { + + struct Colour { + enum Code { + None = 0, + + White, + Red, + Green, + Blue, + Cyan, + Yellow, + Grey, + + Bright = 0x10, + + BrightRed = Bright | Red, + BrightGreen = Bright | Green, + LightGrey = Bright | Grey, + BrightWhite = Bright | White, + BrightYellow = Bright | Yellow, + + // By intention + FileName = LightGrey, + Warning = BrightYellow, + ResultError = BrightRed, + ResultSuccess = BrightGreen, + ResultExpectedFailure = Warning, + + Error = BrightRed, + Success = Green, + + OriginalExpression = Cyan, + ReconstructedExpression = BrightYellow, + + SecondaryText = LightGrey, + Headers = White + }; + + // Use constructed object for RAII guard + Colour( Code _colourCode ); + Colour( Colour&& other ) noexcept; + Colour& operator=( Colour&& other ) noexcept; + ~Colour(); + + // Use static method for one-shot changes + static void use( Code _colourCode ); + + private: + bool m_moved = false; + }; + + std::ostream& operator << ( std::ostream& os, Colour const& ); + +} // end namespace Catch + +// end catch_console_colour.h +// start catch_reporter_registrars.hpp + + +namespace Catch { + + template<typename T> + class ReporterRegistrar { + + class ReporterFactory : public IReporterFactory { + + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr<T>( new T( config ) ); + } + + std::string getDescription() const override { + return T::getDescription(); + } + }; + + public: + + explicit ReporterRegistrar( std::string const& name ) { + getMutableRegistryHub().registerReporter( name, std::make_shared<ReporterFactory>() ); + } + }; + + template<typename T> + class ListenerRegistrar { + + class ListenerFactory : public IReporterFactory { + + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr<T>( new T( config ) ); + } + std::string getDescription() const override { + return std::string(); + } + }; + + public: + + ListenerRegistrar() { + getMutableRegistryHub().registerListener( std::make_shared<ListenerFactory>() ); + } + }; +} + +#if !defined(CATCH_CONFIG_DISABLE) + +#define CATCH_REGISTER_REPORTER( name, reporterType ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + +#define CATCH_REGISTER_LISTENER( listenerType ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#else // CATCH_CONFIG_DISABLE + +#define CATCH_REGISTER_REPORTER(name, reporterType) +#define CATCH_REGISTER_LISTENER(listenerType) + +#endif // CATCH_CONFIG_DISABLE + +// end catch_reporter_registrars.hpp +// Allow users to base their work off existing reporters +// start catch_reporter_compact.h + +namespace Catch { + + struct CompactReporter : StreamingReporterBase<CompactReporter> { + + using StreamingReporterBase::StreamingReporterBase; + + ~CompactReporter() override; + + static std::string getDescription(); + + ReporterPreferences getPreferences() const override; + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void sectionEnded(SectionStats const& _sectionStats) override; + + void testRunEnded(TestRunStats const& _testRunStats) override; + + }; + +} // end namespace Catch + +// end catch_reporter_compact.h +// start catch_reporter_console.h + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + // Fwd decls + struct SummaryColumn; + class TablePrinter; + + struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> { + std::unique_ptr<TablePrinter> m_tablePrinter; + + ConsoleReporter(ReporterConfig const& config); + ~ConsoleReporter() override; + static std::string getDescription(); + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void sectionStarting(SectionInfo const& _sectionInfo) override; + void sectionEnded(SectionStats const& _sectionStats) override; + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + void benchmarkPreparing(std::string const& name) override; + void benchmarkStarting(BenchmarkInfo const& info) override; + void benchmarkEnded(BenchmarkStats<> const& stats) override; + void benchmarkFailed(std::string const& error) override; +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + void testGroupEnded(TestGroupStats const& _testGroupStats) override; + void testRunEnded(TestRunStats const& _testRunStats) override; + void testRunStarting(TestRunInfo const& _testRunInfo) override; + private: + + void lazyPrint(); + + void lazyPrintWithoutClosingBenchmarkTable(); + void lazyPrintRunInfo(); + void lazyPrintGroupInfo(); + void printTestCaseAndSectionHeader(); + + void printClosedHeader(std::string const& _name); + void printOpenHeader(std::string const& _name); + + // if string has a : in first line will set indent to follow it on + // subsequent lines + void printHeaderString(std::string const& _string, std::size_t indent = 0); + + void printTotals(Totals const& totals); + void printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row); + + void printTotalsDivider(Totals const& totals); + void printSummaryDivider(); + void printTestFilters(); + + private: + bool m_headerPrinted = false; + }; + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +// end catch_reporter_console.h +// start catch_reporter_junit.h + +// start catch_xmlwriter.h + +#include <vector> + +namespace Catch { + + class XmlEncode { + public: + enum ForWhat { ForTextNodes, ForAttributes }; + + XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ); + + void encodeTo( std::ostream& os ) const; + + friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ); + + private: + std::string m_str; + ForWhat m_forWhat; + }; + + class XmlWriter { + public: + + class ScopedElement { + public: + ScopedElement( XmlWriter* writer ); + + ScopedElement( ScopedElement&& other ) noexcept; + ScopedElement& operator=( ScopedElement&& other ) noexcept; + + ~ScopedElement(); + + ScopedElement& writeText( std::string const& text, bool indent = true ); + + template<typename T> + ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { + m_writer->writeAttribute( name, attribute ); + return *this; + } + + private: + mutable XmlWriter* m_writer = nullptr; + }; + + XmlWriter( std::ostream& os = Catch::cout() ); + ~XmlWriter(); + + XmlWriter( XmlWriter const& ) = delete; + XmlWriter& operator=( XmlWriter const& ) = delete; + + XmlWriter& startElement( std::string const& name ); + + ScopedElement scopedElement( std::string const& name ); + + XmlWriter& endElement(); + + XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ); + + XmlWriter& writeAttribute( std::string const& name, bool attribute ); + + template<typename T> + XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { + ReusableStringStream rss; + rss << attribute; + return writeAttribute( name, rss.str() ); + } + + XmlWriter& writeText( std::string const& text, bool indent = true ); + + XmlWriter& writeComment( std::string const& text ); + + void writeStylesheetRef( std::string const& url ); + + XmlWriter& writeBlankLine(); + + void ensureTagClosed(); + + private: + + void writeDeclaration(); + + void newlineIfNecessary(); + + bool m_tagIsOpen = false; + bool m_needsNewline = false; + std::vector<std::string> m_tags; + std::string m_indent; + std::ostream& m_os; + }; + +} + +// end catch_xmlwriter.h +namespace Catch { + + class JunitReporter : public CumulativeReporterBase<JunitReporter> { + public: + JunitReporter(ReporterConfig const& _config); + + ~JunitReporter() override; + + static std::string getDescription(); + + void noMatchingTestCases(std::string const& /*spec*/) override; + + void testRunStarting(TestRunInfo const& runInfo) override; + + void testGroupStarting(GroupInfo const& groupInfo) override; + + void testCaseStarting(TestCaseInfo const& testCaseInfo) override; + bool assertionEnded(AssertionStats const& assertionStats) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEndedCumulative() override; + + void writeGroup(TestGroupNode const& groupNode, double suiteTime); + + void writeTestCase(TestCaseNode const& testCaseNode); + + void writeSection(std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode); + + void writeAssertions(SectionNode const& sectionNode); + void writeAssertion(AssertionStats const& stats); + + XmlWriter xml; + Timer suiteTimer; + std::string stdOutForSuite; + std::string stdErrForSuite; + unsigned int unexpectedExceptions = 0; + bool m_okToFail = false; + }; + +} // end namespace Catch + +// end catch_reporter_junit.h +// start catch_reporter_xml.h + +namespace Catch { + class XmlReporter : public StreamingReporterBase<XmlReporter> { + public: + XmlReporter(ReporterConfig const& _config); + + ~XmlReporter() override; + + static std::string getDescription(); + + virtual std::string getStylesheetRef() const; + + void writeSourceInfo(SourceLineInfo const& sourceInfo); + + public: // StreamingReporterBase + + void noMatchingTestCases(std::string const& s) override; + + void testRunStarting(TestRunInfo const& testInfo) override; + + void testGroupStarting(GroupInfo const& groupInfo) override; + + void testCaseStarting(TestCaseInfo const& testInfo) override; + + void sectionStarting(SectionInfo const& sectionInfo) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& assertionStats) override; + + void sectionEnded(SectionStats const& sectionStats) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEnded(TestRunStats const& testRunStats) override; + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + void benchmarkStarting(BenchmarkInfo const&) override; + void benchmarkEnded(BenchmarkStats<> const&) override; + void benchmarkFailed(std::string const&) override; +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + private: + Timer m_testCaseTimer; + XmlWriter m_xml; + int m_sectionDepth = 0; + }; + +} // end namespace Catch + +// end catch_reporter_xml.h + +// end catch_external_interfaces.h +#endif + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +// start catch_benchmark.hpp + + // Benchmark + +// start catch_chronometer.hpp + +// User-facing chronometer + + +// start catch_clock.hpp + +// Clocks + + +#include <chrono> +#include <ratio> + +namespace Catch { + namespace Benchmark { + template <typename Clock> + using ClockDuration = typename Clock::duration; + template <typename Clock> + using FloatDuration = std::chrono::duration<double, typename Clock::period>; + + template <typename Clock> + using TimePoint = typename Clock::time_point; + + using default_clock = std::chrono::steady_clock; + + template <typename Clock> + struct now { + TimePoint<Clock> operator()() const { + return Clock::now(); + } + }; + + using fp_seconds = std::chrono::duration<double, std::ratio<1>>; + } // namespace Benchmark +} // namespace Catch + +// end catch_clock.hpp +// start catch_optimizer.hpp + + // Hinting the optimizer + + +#if defined(_MSC_VER) +# include <atomic> // atomic_thread_fence +#endif + +namespace Catch { + namespace Benchmark { +#if defined(__GNUC__) || defined(__clang__) + template <typename T> + inline void keep_memory(T* p) { + asm volatile("" : : "g"(p) : "memory"); + } + inline void keep_memory() { + asm volatile("" : : : "memory"); + } + + namespace Detail { + inline void optimizer_barrier() { keep_memory(); } + } // namespace Detail +#elif defined(_MSC_VER) + +#pragma optimize("", off) + template <typename T> + inline void keep_memory(T* p) { + // thanks @milleniumbug + *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p); + } + // TODO equivalent keep_memory() +#pragma optimize("", on) + + namespace Detail { + inline void optimizer_barrier() { + std::atomic_thread_fence(std::memory_order_seq_cst); + } + } // namespace Detail + +#endif + + template <typename T> + inline void deoptimize_value(T&& x) { + keep_memory(&x); + } + + template <typename Fn, typename... Args> + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<!std::is_same<void, decltype(fn(args...))>::value>::type { + deoptimize_value(std::forward<Fn>(fn) (std::forward<Args...>(args...))); + } + + template <typename Fn, typename... Args> + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<std::is_same<void, decltype(fn(args...))>::value>::type { + std::forward<Fn>(fn) (std::forward<Args...>(args...)); + } + } // namespace Benchmark +} // namespace Catch + +// end catch_optimizer.hpp +// start catch_complete_invoke.hpp + +// Invoke with a special case for void + + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T> + struct CompleteType { using type = T; }; + template <> + struct CompleteType<void> { struct type {}; }; + + template <typename T> + using CompleteType_t = typename CompleteType<T>::type; + + template <typename Result> + struct CompleteInvoker { + template <typename Fun, typename... Args> + static Result invoke(Fun&& fun, Args&&... args) { + return std::forward<Fun>(fun)(std::forward<Args>(args)...); + } + }; + template <> + struct CompleteInvoker<void> { + template <typename Fun, typename... Args> + static CompleteType_t<void> invoke(Fun&& fun, Args&&... args) { + std::forward<Fun>(fun)(std::forward<Args>(args)...); + return {}; + } + }; + template <typename Sig> + using ResultOf_t = typename std::result_of<Sig>::type; + + // invoke and not return void :( + template <typename Fun, typename... Args> + CompleteType_t<ResultOf_t<Fun(Args...)>> complete_invoke(Fun&& fun, Args&&... args) { + return CompleteInvoker<ResultOf_t<Fun(Args...)>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...); + } + + const std::string benchmarkErrorMsg = "a benchmark failed to run successfully"; + } // namespace Detail + + template <typename Fun> + Detail::CompleteType_t<Detail::ResultOf_t<Fun()>> user_code(Fun&& fun) { + CATCH_TRY{ + return Detail::complete_invoke(std::forward<Fun>(fun)); + } CATCH_CATCH_ALL{ + getResultCapture().benchmarkFailed(translateActiveException()); + CATCH_RUNTIME_ERROR(Detail::benchmarkErrorMsg); + } + } + } // namespace Benchmark +} // namespace Catch + +// end catch_complete_invoke.hpp +namespace Catch { + namespace Benchmark { + namespace Detail { + struct ChronometerConcept { + virtual void start() = 0; + virtual void finish() = 0; + virtual ~ChronometerConcept() = default; + }; + template <typename Clock> + struct ChronometerModel final : public ChronometerConcept { + void start() override { started = Clock::now(); } + void finish() override { finished = Clock::now(); } + + ClockDuration<Clock> elapsed() const { return finished - started; } + + TimePoint<Clock> started; + TimePoint<Clock> finished; + }; + } // namespace Detail + + struct Chronometer { + public: + template <typename Fun> + void measure(Fun&& fun) { measure(std::forward<Fun>(fun), is_callable<Fun(int)>()); } + + int runs() const { return k; } + + Chronometer(Detail::ChronometerConcept& meter, int k) + : impl(&meter) + , k(k) {} + + private: + template <typename Fun> + void measure(Fun&& fun, std::false_type) { + measure([&fun](int) { return fun(); }, std::true_type()); + } + + template <typename Fun> + void measure(Fun&& fun, std::true_type) { + Detail::optimizer_barrier(); + impl->start(); + for (int i = 0; i < k; ++i) invoke_deoptimized(fun, i); + impl->finish(); + Detail::optimizer_barrier(); + } + + Detail::ChronometerConcept* impl; + int k; + }; + } // namespace Benchmark +} // namespace Catch + +// end catch_chronometer.hpp +// start catch_environment.hpp + +// Environment information + + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct EnvironmentEstimate { + Duration mean; + OutlierClassification outliers; + + template <typename Duration2> + operator EnvironmentEstimate<Duration2>() const { + return { mean, outliers }; + } + }; + template <typename Clock> + struct Environment { + using clock_type = Clock; + EnvironmentEstimate<FloatDuration<Clock>> clock_resolution; + EnvironmentEstimate<FloatDuration<Clock>> clock_cost; + }; + } // namespace Benchmark +} // namespace Catch + +// end catch_environment.hpp +// start catch_execution_plan.hpp + + // Execution plan + + +// start catch_benchmark_function.hpp + + // Dumb std::function implementation for consistent call overhead + + +#include <cassert> +#include <type_traits> +#include <utility> +#include <memory> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T> + using Decay = typename std::decay<T>::type; + template <typename T, typename U> + struct is_related + : std::is_same<Decay<T>, Decay<U>> {}; + + /// We need to reinvent std::function because every piece of code that might add overhead + /// in a measurement context needs to have consistent performance characteristics so that we + /// can account for it in the measurement. + /// Implementations of std::function with optimizations that aren't always applicable, like + /// small buffer optimizations, are not uncommon. + /// This is effectively an implementation of std::function without any such optimizations; + /// it may be slow, but it is consistently slow. + struct BenchmarkFunction { + private: + struct callable { + virtual void call(Chronometer meter) const = 0; + virtual callable* clone() const = 0; + virtual ~callable() = default; + }; + template <typename Fun> + struct model : public callable { + model(Fun&& fun) : fun(std::move(fun)) {} + model(Fun const& fun) : fun(fun) {} + + model<Fun>* clone() const override { return new model<Fun>(*this); } + + void call(Chronometer meter) const override { + call(meter, is_callable<Fun(Chronometer)>()); + } + void call(Chronometer meter, std::true_type) const { + fun(meter); + } + void call(Chronometer meter, std::false_type) const { + meter.measure(fun); + } + + Fun fun; + }; + + struct do_nothing { void operator()() const {} }; + + template <typename T> + BenchmarkFunction(model<T>* c) : f(c) {} + + public: + BenchmarkFunction() + : f(new model<do_nothing>{ {} }) {} + + template <typename Fun, + typename std::enable_if<!is_related<Fun, BenchmarkFunction>::value, int>::type = 0> + BenchmarkFunction(Fun&& fun) + : f(new model<typename std::decay<Fun>::type>(std::forward<Fun>(fun))) {} + + BenchmarkFunction(BenchmarkFunction&& that) + : f(std::move(that.f)) {} + + BenchmarkFunction(BenchmarkFunction const& that) + : f(that.f->clone()) {} + + BenchmarkFunction& operator=(BenchmarkFunction&& that) { + f = std::move(that.f); + return *this; + } + + BenchmarkFunction& operator=(BenchmarkFunction const& that) { + f.reset(that.f->clone()); + return *this; + } + + void operator()(Chronometer meter) const { f->call(meter); } + + private: + std::unique_ptr<callable> f; + }; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +// end catch_benchmark_function.hpp +// start catch_repeat.hpp + +// repeat algorithm + + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Fun> + struct repeater { + void operator()(int k) const { + for (int i = 0; i < k; ++i) { + fun(); + } + } + Fun fun; + }; + template <typename Fun> + repeater<typename std::decay<Fun>::type> repeat(Fun&& fun) { + return { std::forward<Fun>(fun) }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +// end catch_repeat.hpp +// start catch_run_for_at_least.hpp + +// Run a function for a minimum amount of time + + +// start catch_measure.hpp + +// Measure + + +// start catch_timing.hpp + +// Timing + + +#include <tuple> +#include <type_traits> + +namespace Catch { + namespace Benchmark { + template <typename Duration, typename Result> + struct Timing { + Duration elapsed; + Result result; + int iterations; + }; + template <typename Clock, typename Sig> + using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<Detail::ResultOf_t<Sig>>>; + } // namespace Benchmark +} // namespace Catch + +// end catch_timing.hpp +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock, typename Fun, typename... Args> + TimingOf<Clock, Fun(Args...)> measure(Fun&& fun, Args&&... args) { + auto start = Clock::now(); + auto&& r = Detail::complete_invoke(fun, std::forward<Args>(args)...); + auto end = Clock::now(); + auto delta = end - start; + return { delta, std::forward<decltype(r)>(r), 1 }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +// end catch_measure.hpp +#include <utility> +#include <type_traits> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock, typename Fun> + TimingOf<Clock, Fun(int)> measure_one(Fun&& fun, int iters, std::false_type) { + return Detail::measure<Clock>(fun, iters); + } + template <typename Clock, typename Fun> + TimingOf<Clock, Fun(Chronometer)> measure_one(Fun&& fun, int iters, std::true_type) { + Detail::ChronometerModel<Clock> meter; + auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters)); + + return { meter.elapsed(), std::move(result), iters }; + } + + template <typename Clock, typename Fun> + using run_for_at_least_argument_t = typename std::conditional<is_callable<Fun(Chronometer)>::value, Chronometer, int>::type; + + struct optimized_away_error : std::exception { + const char* what() const noexcept override { + return "could not measure benchmark, maybe it was optimized away"; + } + }; + + template <typename Clock, typename Fun> + TimingOf<Clock, Fun(run_for_at_least_argument_t<Clock, Fun>)> run_for_at_least(ClockDuration<Clock> how_long, int seed, Fun&& fun) { + auto iters = seed; + while (iters < (1 << 30)) { + auto&& Timing = measure_one<Clock>(fun, iters, is_callable<Fun(Chronometer)>()); + + if (Timing.elapsed >= how_long) { + return { Timing.elapsed, std::move(Timing.result), iters }; + } + iters *= 2; + } + throw optimized_away_error{}; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +// end catch_run_for_at_least.hpp +#include <algorithm> + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct ExecutionPlan { + int iterations_per_sample; + Duration estimated_duration; + Detail::BenchmarkFunction benchmark; + Duration warmup_time; + int warmup_iterations; + + template <typename Duration2> + operator ExecutionPlan<Duration2>() const { + return { iterations_per_sample, estimated_duration, benchmark, warmup_time, warmup_iterations }; + } + + template <typename Clock> + std::vector<FloatDuration<Clock>> run(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { + // warmup a bit + Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_iterations, Detail::repeat(now<Clock>{})); + + std::vector<FloatDuration<Clock>> times; + times.reserve(cfg.benchmarkSamples()); + std::generate_n(std::back_inserter(times), cfg.benchmarkSamples(), [this, env] { + Detail::ChronometerModel<Clock> model; + this->benchmark(Chronometer(model, iterations_per_sample)); + auto sample_time = model.elapsed() - env.clock_cost.mean; + if (sample_time < FloatDuration<Clock>::zero()) sample_time = FloatDuration<Clock>::zero(); + return sample_time / iterations_per_sample; + }); + return times; + } + }; + } // namespace Benchmark +} // namespace Catch + +// end catch_execution_plan.hpp +// start catch_estimate_clock.hpp + + // Environment measurement + + +// start catch_stats.hpp + +// Statistical analysis tools + + +#include <algorithm> +#include <functional> +#include <vector> +#include <numeric> +#include <tuple> +#include <cmath> +#include <utility> +#include <cstddef> + +namespace Catch { + namespace Benchmark { + namespace Detail { + using sample = std::vector<double>; + + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last); + + template <typename Iterator> + OutlierClassification classify_outliers(Iterator first, Iterator last) { + std::vector<double> copy(first, last); + + auto q1 = weighted_average_quantile(1, 4, copy.begin(), copy.end()); + auto q3 = weighted_average_quantile(3, 4, copy.begin(), copy.end()); + auto iqr = q3 - q1; + auto los = q1 - (iqr * 3.); + auto lom = q1 - (iqr * 1.5); + auto him = q3 + (iqr * 1.5); + auto his = q3 + (iqr * 3.); + + OutlierClassification o; + for (; first != last; ++first) { + auto&& t = *first; + if (t < los) ++o.low_severe; + else if (t < lom) ++o.low_mild; + else if (t > his) ++o.high_severe; + else if (t > him) ++o.high_mild; + ++o.samples_seen; + } + return o; + } + + template <typename Iterator> + double mean(Iterator first, Iterator last) { + auto count = last - first; + double sum = std::accumulate(first, last, 0.); + return sum / count; + } + + template <typename URng, typename Iterator, typename Estimator> + sample resample(URng& rng, int resamples, Iterator first, Iterator last, Estimator& estimator) { + auto n = last - first; + std::uniform_int_distribution<decltype(n)> dist(0, n - 1); + + sample out; + out.reserve(resamples); + std::generate_n(std::back_inserter(out), resamples, [n, first, &estimator, &dist, &rng] { + std::vector<double> resampled; + resampled.reserve(n); + std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[dist(rng)]; }); + return estimator(resampled.begin(), resampled.end()); + }); + std::sort(out.begin(), out.end()); + return out; + } + + template <typename Estimator, typename Iterator> + sample jackknife(Estimator&& estimator, Iterator first, Iterator last) { + auto n = last - first; + auto second = std::next(first); + sample results; + results.reserve(n); + + for (auto it = first; it != last; ++it) { + std::iter_swap(it, first); + results.push_back(estimator(second, last)); + } + + return results; + } + + inline double normal_cdf(double x) { + return std::erfc(-x / std::sqrt(2.0)) / 2.0; + } + + double erfc_inv(double x); + + double normal_quantile(double p); + + template <typename Iterator, typename Estimator> + Estimate<double> bootstrap(double confidence_level, Iterator first, Iterator last, sample const& resample, Estimator&& estimator) { + auto n_samples = last - first; + + double point = estimator(first, last); + // Degenerate case with a single sample + if (n_samples == 1) return { point, point, point, confidence_level }; + + sample jack = jackknife(estimator, first, last); + double jack_mean = mean(jack.begin(), jack.end()); + double sum_squares, sum_cubes; + std::tie(sum_squares, sum_cubes) = std::accumulate(jack.begin(), jack.end(), std::make_pair(0., 0.), [jack_mean](std::pair<double, double> sqcb, double x) -> std::pair<double, double> { + auto d = jack_mean - x; + auto d2 = d * d; + auto d3 = d2 * d; + return { sqcb.first + d2, sqcb.second + d3 }; + }); + + double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5)); + int n = static_cast<int>(resample.size()); + double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / (double)n; + // degenerate case with uniform samples + if (prob_n == 0) return { point, point, point, confidence_level }; + + double bias = normal_quantile(prob_n); + double z1 = normal_quantile((1. - confidence_level) / 2.); + + auto cumn = [n](double x) -> int { + return std::lround(normal_cdf(x) * n); }; + auto a = [bias, accel](double b) { return bias + b / (1. - accel * b); }; + double b1 = bias + z1; + double b2 = bias - z1; + double a1 = a(b1); + double a2 = a(b2); + auto lo = std::max(cumn(a1), 0); + auto hi = std::min(cumn(a2), n - 1); + + return { point, resample[lo], resample[hi], confidence_level }; + } + + double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n); + + struct bootstrap_analysis { + Estimate<double> mean; + Estimate<double> standard_deviation; + double outlier_variance; + }; + + bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +// end catch_stats.hpp +#include <algorithm> +#include <iterator> +#include <tuple> +#include <vector> +#include <cmath> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock> + std::vector<double> resolution(int k) { + std::vector<TimePoint<Clock>> times; + times.reserve(k + 1); + std::generate_n(std::back_inserter(times), k + 1, now<Clock>{}); + + std::vector<double> deltas; + deltas.reserve(k); + std::transform(std::next(times.begin()), times.end(), times.begin(), + std::back_inserter(deltas), + [](TimePoint<Clock> a, TimePoint<Clock> b) { return static_cast<double>((a - b).count()); }); + + return deltas; + } + + const auto warmup_iterations = 10000; + const auto warmup_time = std::chrono::milliseconds(100); + const auto minimum_ticks = 1000; + const auto warmup_seed = 10000; + const auto clock_resolution_estimation_time = std::chrono::milliseconds(500); + const auto clock_cost_estimation_time_limit = std::chrono::seconds(1); + const auto clock_cost_estimation_tick_limit = 100000; + const auto clock_cost_estimation_time = std::chrono::milliseconds(10); + const auto clock_cost_estimation_iterations = 10000; + + template <typename Clock> + int warmup() { + return run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_seed, &resolution<Clock>) + .iterations; + } + template <typename Clock> + EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_resolution(int iterations) { + auto r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_resolution_estimation_time), iterations, &resolution<Clock>) + .result; + return { + FloatDuration<Clock>(mean(r.begin(), r.end())), + classify_outliers(r.begin(), r.end()), + }; + } + template <typename Clock> + EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_cost(FloatDuration<Clock> resolution) { + auto time_limit = std::min(resolution * clock_cost_estimation_tick_limit, FloatDuration<Clock>(clock_cost_estimation_time_limit)); + auto time_clock = [](int k) { + return Detail::measure<Clock>([k] { + for (int i = 0; i < k; ++i) { + volatile auto ignored = Clock::now(); + (void)ignored; + } + }).elapsed; + }; + time_clock(1); + int iters = clock_cost_estimation_iterations; + auto&& r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_cost_estimation_time), iters, time_clock); + std::vector<double> times; + int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed)); + times.reserve(nsamples); + std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] { + return static_cast<double>((time_clock(r.iterations) / r.iterations).count()); + }); + return { + FloatDuration<Clock>(mean(times.begin(), times.end())), + classify_outliers(times.begin(), times.end()), + }; + } + + template <typename Clock> + Environment<FloatDuration<Clock>> measure_environment() { + static Environment<FloatDuration<Clock>>* env = nullptr; + if (env) { + return *env; + } + + auto iters = Detail::warmup<Clock>(); + auto resolution = Detail::estimate_clock_resolution<Clock>(iters); + auto cost = Detail::estimate_clock_cost<Clock>(resolution.mean); + + env = new Environment<FloatDuration<Clock>>{ resolution, cost }; + return *env; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +// end catch_estimate_clock.hpp +// start catch_analyse.hpp + + // Run and analyse one benchmark + + +// start catch_sample_analysis.hpp + +// Benchmark results + + +#include <algorithm> +#include <vector> +#include <string> +#include <iterator> + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct SampleAnalysis { + std::vector<Duration> samples; + Estimate<Duration> mean; + Estimate<Duration> standard_deviation; + OutlierClassification outliers; + double outlier_variance; + + template <typename Duration2> + operator SampleAnalysis<Duration2>() const { + std::vector<Duration2> samples2; + samples2.reserve(samples.size()); + std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); + return { + std::move(samples2), + mean, + standard_deviation, + outliers, + outlier_variance, + }; + } + }; + } // namespace Benchmark +} // namespace Catch + +// end catch_sample_analysis.hpp +#include <algorithm> +#include <iterator> +#include <vector> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Duration, typename Iterator> + SampleAnalysis<Duration> analyse(const IConfig &cfg, Environment<Duration>, Iterator first, Iterator last) { + if (!cfg.benchmarkNoAnalysis()) { + std::vector<double> samples; + samples.reserve(last - first); + std::transform(first, last, std::back_inserter(samples), [](Duration d) { return d.count(); }); + + auto analysis = Catch::Benchmark::Detail::analyse_samples(cfg.benchmarkConfidenceInterval(), cfg.benchmarkResamples(), samples.begin(), samples.end()); + auto outliers = Catch::Benchmark::Detail::classify_outliers(samples.begin(), samples.end()); + + auto wrap_estimate = [](Estimate<double> e) { + return Estimate<Duration> { + Duration(e.point), + Duration(e.lower_bound), + Duration(e.upper_bound), + e.confidence_interval, + }; + }; + std::vector<Duration> samples2; + samples2.reserve(samples.size()); + std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); }); + return { + std::move(samples2), + wrap_estimate(analysis.mean), + wrap_estimate(analysis.standard_deviation), + outliers, + analysis.outlier_variance, + }; + } else { + std::vector<Duration> samples; + samples.reserve(last - first); + + Duration mean = Duration(0); + int i = 0; + for (auto it = first; it < last; ++it, ++i) { + samples.push_back(Duration(*it)); + mean += Duration(*it); + } + mean /= i; + + return { + std::move(samples), + Estimate<Duration>{mean, mean, mean, 0.0}, + Estimate<Duration>{Duration(0), Duration(0), Duration(0), 0.0}, + OutlierClassification{}, + 0.0 + }; + } + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +// end catch_analyse.hpp +#include <algorithm> +#include <functional> +#include <string> +#include <vector> +#include <cmath> + +namespace Catch { + namespace Benchmark { + struct Benchmark { + Benchmark(std::string &&name) + : name(std::move(name)) {} + + template <class FUN> + Benchmark(std::string &&name, FUN &&func) + : fun(std::move(func)), name(std::move(name)) {} + + template <typename Clock> + ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { + auto min_time = env.clock_resolution.mean * Detail::minimum_ticks; + auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(Detail::warmup_time)); + auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(run_time), 1, fun); + int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed)); + return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(Detail::warmup_time), Detail::warmup_iterations }; + } + + template <typename Clock = default_clock> + void run() { + IConfigPtr cfg = getCurrentContext().getConfig(); + + auto env = Detail::measure_environment<Clock>(); + + getResultCapture().benchmarkPreparing(name); + CATCH_TRY{ + auto plan = user_code([&] { + return prepare<Clock>(*cfg, env); + }); + + BenchmarkInfo info { + name, + plan.estimated_duration.count(), + plan.iterations_per_sample, + cfg->benchmarkSamples(), + cfg->benchmarkResamples(), + env.clock_resolution.mean.count(), + env.clock_cost.mean.count() + }; + + getResultCapture().benchmarkStarting(info); + + auto samples = user_code([&] { + return plan.template run<Clock>(*cfg, env); + }); + + auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end()); + BenchmarkStats<std::chrono::duration<double, std::nano>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; + getResultCapture().benchmarkEnded(stats); + + } CATCH_CATCH_ALL{ + if (translateActiveException() != Detail::benchmarkErrorMsg) // benchmark errors have been reported, otherwise rethrow. + std::rethrow_exception(std::current_exception()); + } + } + + // sets lambda to be used in fun *and* executes benchmark! + template <typename Fun, + typename std::enable_if<!Detail::is_related<Fun, Benchmark>::value, int>::type = 0> + Benchmark & operator=(Fun func) { + fun = Detail::BenchmarkFunction(func); + run(); + return *this; + } + + explicit operator bool() { + return true; + } + + private: + Detail::BenchmarkFunction fun; + std::string name; + }; + } +} // namespace Catch + +#define INTERNAL_CATCH_GET_1_ARG(arg1, arg2, ...) arg1 +#define INTERNAL_CATCH_GET_2_ARG(arg1, arg2, ...) arg2 + +#define INTERNAL_CATCH_BENCHMARK(BenchmarkName, name, benchmarkIndex)\ + if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \ + BenchmarkName = [&](int benchmarkIndex) + +#define INTERNAL_CATCH_BENCHMARK_ADVANCED(BenchmarkName, name)\ + if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \ + BenchmarkName = [&] + +// end catch_benchmark.hpp +#endif + +#endif // ! CATCH_CONFIG_IMPL_ONLY + +#ifdef CATCH_IMPL +// start catch_impl.hpp + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +// Keep these here for external reporters +// start catch_test_case_tracker.h + +#include <string> +#include <vector> +#include <memory> + +namespace Catch { +namespace TestCaseTracking { + + struct NameAndLocation { + std::string name; + SourceLineInfo location; + + NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); + }; + + struct ITracker; + + using ITrackerPtr = std::shared_ptr<ITracker>; + + struct ITracker { + virtual ~ITracker(); + + // static queries + virtual NameAndLocation const& nameAndLocation() const = 0; + + // dynamic queries + virtual bool isComplete() const = 0; // Successfully completed or failed + virtual bool isSuccessfullyCompleted() const = 0; + virtual bool isOpen() const = 0; // Started but not complete + virtual bool hasChildren() const = 0; + + virtual ITracker& parent() = 0; + + // actions + virtual void close() = 0; // Successfully complete + virtual void fail() = 0; + virtual void markAsNeedingAnotherRun() = 0; + + virtual void addChild( ITrackerPtr const& child ) = 0; + virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0; + virtual void openChild() = 0; + + // Debug/ checking + virtual bool isSectionTracker() const = 0; + virtual bool isGeneratorTracker() const = 0; + }; + + class TrackerContext { + + enum RunState { + NotStarted, + Executing, + CompletedCycle + }; + + ITrackerPtr m_rootTracker; + ITracker* m_currentTracker = nullptr; + RunState m_runState = NotStarted; + + public: + + ITracker& startRun(); + void endRun(); + + void startCycle(); + void completeCycle(); + + bool completedCycle() const; + ITracker& currentTracker(); + void setCurrentTracker( ITracker* tracker ); + }; + + class TrackerBase : public ITracker { + protected: + enum CycleState { + NotStarted, + Executing, + ExecutingChildren, + NeedsAnotherRun, + CompletedSuccessfully, + Failed + }; + + using Children = std::vector<ITrackerPtr>; + NameAndLocation m_nameAndLocation; + TrackerContext& m_ctx; + ITracker* m_parent; + Children m_children; + CycleState m_runState = NotStarted; + + public: + TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + NameAndLocation const& nameAndLocation() const override; + bool isComplete() const override; + bool isSuccessfullyCompleted() const override; + bool isOpen() const override; + bool hasChildren() const override; + + void addChild( ITrackerPtr const& child ) override; + + ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override; + ITracker& parent() override; + + void openChild() override; + + bool isSectionTracker() const override; + bool isGeneratorTracker() const override; + + void open(); + + void close() override; + void fail() override; + void markAsNeedingAnotherRun() override; + + private: + void moveToParent(); + void moveToThis(); + }; + + class SectionTracker : public TrackerBase { + std::vector<std::string> m_filters; + public: + SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isSectionTracker() const override; + + bool isComplete() const override; + + static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); + + void tryOpen(); + + void addInitialFilters( std::vector<std::string> const& filters ); + void addNextFilters( std::vector<std::string> const& filters ); + }; + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; + +} // namespace Catch + +// end catch_test_case_tracker.h + +// start catch_leak_detector.h + +namespace Catch { + + struct LeakDetector { + LeakDetector(); + ~LeakDetector(); + }; + +} +// end catch_leak_detector.h +// Cpp files will be included in the single-header file here +// start catch_stats.cpp + +// Statistical analysis tools + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + +#include <cassert> +#include <random> + +#if defined(CATCH_CONFIG_USE_ASYNC) +#include <future> +#endif + +namespace { + double erf_inv(double x) { + // Code accompanying the article "Approximating the erfinv function" in GPU Computing Gems, Volume 2 + double w, p; + + w = -log((1.0 - x) * (1.0 + x)); + + if (w < 6.250000) { + w = w - 3.125000; + p = -3.6444120640178196996e-21; + p = -1.685059138182016589e-19 + p * w; + p = 1.2858480715256400167e-18 + p * w; + p = 1.115787767802518096e-17 + p * w; + p = -1.333171662854620906e-16 + p * w; + p = 2.0972767875968561637e-17 + p * w; + p = 6.6376381343583238325e-15 + p * w; + p = -4.0545662729752068639e-14 + p * w; + p = -8.1519341976054721522e-14 + p * w; + p = 2.6335093153082322977e-12 + p * w; + p = -1.2975133253453532498e-11 + p * w; + p = -5.4154120542946279317e-11 + p * w; + p = 1.051212273321532285e-09 + p * w; + p = -4.1126339803469836976e-09 + p * w; + p = -2.9070369957882005086e-08 + p * w; + p = 4.2347877827932403518e-07 + p * w; + p = -1.3654692000834678645e-06 + p * w; + p = -1.3882523362786468719e-05 + p * w; + p = 0.0001867342080340571352 + p * w; + p = -0.00074070253416626697512 + p * w; + p = -0.0060336708714301490533 + p * w; + p = 0.24015818242558961693 + p * w; + p = 1.6536545626831027356 + p * w; + } else if (w < 16.000000) { + w = sqrt(w) - 3.250000; + p = 2.2137376921775787049e-09; + p = 9.0756561938885390979e-08 + p * w; + p = -2.7517406297064545428e-07 + p * w; + p = 1.8239629214389227755e-08 + p * w; + p = 1.5027403968909827627e-06 + p * w; + p = -4.013867526981545969e-06 + p * w; + p = 2.9234449089955446044e-06 + p * w; + p = 1.2475304481671778723e-05 + p * w; + p = -4.7318229009055733981e-05 + p * w; + p = 6.8284851459573175448e-05 + p * w; + p = 2.4031110387097893999e-05 + p * w; + p = -0.0003550375203628474796 + p * w; + p = 0.00095328937973738049703 + p * w; + p = -0.0016882755560235047313 + p * w; + p = 0.0024914420961078508066 + p * w; + p = -0.0037512085075692412107 + p * w; + p = 0.005370914553590063617 + p * w; + p = 1.0052589676941592334 + p * w; + p = 3.0838856104922207635 + p * w; + } else { + w = sqrt(w) - 5.000000; + p = -2.7109920616438573243e-11; + p = -2.5556418169965252055e-10 + p * w; + p = 1.5076572693500548083e-09 + p * w; + p = -3.7894654401267369937e-09 + p * w; + p = 7.6157012080783393804e-09 + p * w; + p = -1.4960026627149240478e-08 + p * w; + p = 2.9147953450901080826e-08 + p * w; + p = -6.7711997758452339498e-08 + p * w; + p = 2.2900482228026654717e-07 + p * w; + p = -9.9298272942317002539e-07 + p * w; + p = 4.5260625972231537039e-06 + p * w; + p = -1.9681778105531670567e-05 + p * w; + p = 7.5995277030017761139e-05 + p * w; + p = -0.00021503011930044477347 + p * w; + p = -0.00013871931833623122026 + p * w; + p = 1.0103004648645343977 + p * w; + p = 4.8499064014085844221 + p * w; + } + return p * x; + } + + double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) { + auto m = Catch::Benchmark::Detail::mean(first, last); + double variance = std::accumulate(first, last, 0., [m](double a, double b) { + double diff = b - m; + return a + diff * diff; + }) / (last - first); + return std::sqrt(variance); + } + +} + +namespace Catch { + namespace Benchmark { + namespace Detail { + + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last) { + auto count = last - first; + double idx = (count - 1) * k / static_cast<double>(q); + int j = static_cast<int>(idx); + double g = idx - j; + std::nth_element(first, first + j, last); + auto xj = first[j]; + if (g == 0) return xj; + + auto xj1 = *std::min_element(first + (j + 1), last); + return xj + g * (xj1 - xj); + } + + double erfc_inv(double x) { + return erf_inv(1.0 - x); + } + + double normal_quantile(double p) { + static const double ROOT_TWO = std::sqrt(2.0); + + double result = 0.0; + assert(p >= 0 && p <= 1); + if (p < 0 || p > 1) { + return result; + } + + result = -erfc_inv(2.0 * p); + // result *= normal distribution standard deviation (1.0) * sqrt(2) + result *= /*sd * */ ROOT_TWO; + // result += normal disttribution mean (0) + return result; + } + + double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n) { + double sb = stddev.point; + double mn = mean.point / n; + double mg_min = mn / 2.; + double sg = std::min(mg_min / 4., sb / std::sqrt(n)); + double sg2 = sg * sg; + double sb2 = sb * sb; + + auto c_max = [n, mn, sb2, sg2](double x) -> double { + double k = mn - x; + double d = k * k; + double nd = n * d; + double k0 = -n * nd; + double k1 = sb2 - n * sg2 + nd; + double det = k1 * k1 - 4 * sg2 * k0; + return (int)(-2. * k0 / (k1 + std::sqrt(det))); + }; + + auto var_out = [n, sb2, sg2](double c) { + double nc = n - c; + return (nc / n) * (sb2 - nc * sg2); + }; + + return std::min(var_out(1), var_out(std::min(c_max(0.), c_max(mg_min)))) / sb2; + } + + bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) { + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + static std::random_device entropy; + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + + auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++ + + auto mean = &Detail::mean<std::vector<double>::iterator>; + auto stddev = &standard_deviation; + +#if defined(CATCH_CONFIG_USE_ASYNC) + auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto seed = entropy(); + return std::async(std::launch::async, [=] { + std::mt19937 rng(seed); + auto resampled = resample(rng, n_resamples, first, last, f); + return bootstrap(confidence_level, first, last, resampled, f); + }); + }; + + auto mean_future = Estimate(mean); + auto stddev_future = Estimate(stddev); + + auto mean_estimate = mean_future.get(); + auto stddev_estimate = stddev_future.get(); +#else + auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto seed = entropy(); + std::mt19937 rng(seed); + auto resampled = resample(rng, n_resamples, first, last, f); + return bootstrap(confidence_level, first, last, resampled, f); + }; + + auto mean_estimate = Estimate(mean); + auto stddev_estimate = Estimate(stddev); +#endif // CATCH_USE_ASYNC + + double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n); + + return { mean_estimate, stddev_estimate, outlier_variance }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING +// end catch_stats.cpp +// start catch_approx.cpp + +#include <cmath> +#include <limits> + +namespace { + +// Performs equivalent check of std::fabs(lhs - rhs) <= margin +// But without the subtraction to allow for INFINITY in comparison +bool marginComparison(double lhs, double rhs, double margin) { + return (lhs + margin >= rhs) && (rhs + margin >= lhs); +} + +} + +namespace Catch { +namespace Detail { + + Approx::Approx ( double value ) + : m_epsilon( std::numeric_limits<float>::epsilon()*100 ), + m_margin( 0.0 ), + m_scale( 0.0 ), + m_value( value ) + {} + + Approx Approx::custom() { + return Approx( 0 ); + } + + Approx Approx::operator-() const { + auto temp(*this); + temp.m_value = -temp.m_value; + return temp; + } + + std::string Approx::toString() const { + ReusableStringStream rss; + rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )"; + return rss.str(); + } + + bool Approx::equalityComparisonImpl(const double other) const { + // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value + // Thanks to Richard Harris for his help refining the scaled margin value + return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value))); + } + + void Approx::setMargin(double newMargin) { + CATCH_ENFORCE(newMargin >= 0, + "Invalid Approx::margin: " << newMargin << '.' + << " Approx::Margin has to be non-negative."); + m_margin = newMargin; + } + + void Approx::setEpsilon(double newEpsilon) { + CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0, + "Invalid Approx::epsilon: " << newEpsilon << '.' + << " Approx::epsilon has to be in [0, 1]"); + m_epsilon = newEpsilon; + } + +} // end namespace Detail + +namespace literals { + Detail::Approx operator "" _a(long double val) { + return Detail::Approx(val); + } + Detail::Approx operator "" _a(unsigned long long val) { + return Detail::Approx(val); + } +} // end namespace literals + +std::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) { + return value.toString(); +} + +} // end namespace Catch +// end catch_approx.cpp +// start catch_assertionhandler.cpp + +// start catch_debugger.h + +namespace Catch { + bool isDebuggerActive(); +} + +#ifdef CATCH_PLATFORM_MAC + + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + +#elif defined(CATCH_PLATFORM_LINUX) + // If we can use inline assembler, do it because this allows us to break + // directly at the location of the failing check instead of breaking inside + // raise() called from it, i.e. one stack frame below. + #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) + #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */ + #else // Fall back to the generic way. + #include <signal.h> + + #define CATCH_TRAP() raise(SIGTRAP) + #endif +#elif defined(_MSC_VER) + #define CATCH_TRAP() __debugbreak() +#elif defined(__MINGW32__) + extern "C" __declspec(dllimport) void __stdcall DebugBreak(); + #define CATCH_TRAP() DebugBreak() +#endif + +#ifdef CATCH_TRAP + #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() +#else + #define CATCH_BREAK_INTO_DEBUGGER() []{}() +#endif + +// end catch_debugger.h +// start catch_run_context.h + +// start catch_fatal_condition.h + +// start catch_windows_h_proxy.h + + +#if defined(CATCH_PLATFORM_WINDOWS) + +#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) +# define CATCH_DEFINED_NOMINMAX +# define NOMINMAX +#endif +#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN) +# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif + +#ifdef __AFXDLL +#include <AfxWin.h> +#else +#include <windows.h> +#endif + +#ifdef CATCH_DEFINED_NOMINMAX +# undef NOMINMAX +#endif +#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN +# undef WIN32_LEAN_AND_MEAN +#endif + +#endif // defined(CATCH_PLATFORM_WINDOWS) + +// end catch_windows_h_proxy.h +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + + struct FatalConditionHandler { + + static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo); + FatalConditionHandler(); + static void reset(); + ~FatalConditionHandler(); + + private: + static bool isSet; + static ULONG guaranteeSize; + static PVOID exceptionHandlerHandle; + }; + +} // namespace Catch + +#elif defined ( CATCH_CONFIG_POSIX_SIGNALS ) + +#include <signal.h> + +namespace Catch { + + struct FatalConditionHandler { + + static bool isSet; + static struct sigaction oldSigActions[]; + static stack_t oldSigStack; + static char altStackMem[]; + + static void handleSignal( int sig ); + + FatalConditionHandler(); + ~FatalConditionHandler(); + static void reset(); + }; + +} // namespace Catch + +#else + +namespace Catch { + struct FatalConditionHandler { + void reset(); + }; +} + +#endif + +// end catch_fatal_condition.h +#include <string> + +namespace Catch { + + struct IMutableContext; + + /////////////////////////////////////////////////////////////////////////// + + class RunContext : public IResultCapture, public IRunner { + + public: + RunContext( RunContext const& ) = delete; + RunContext& operator =( RunContext const& ) = delete; + + explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter ); + + ~RunContext() override; + + void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ); + void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ); + + Totals runTest(TestCase const& testCase); + + IConfigPtr config() const; + IStreamingReporter& reporter() const; + + public: // IResultCapture + + // Assertion handlers + void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) override; + void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) override; + void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) override; + void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) override; + void handleIncomplete + ( AssertionInfo const& info ) override; + void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) override; + + bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; + + void sectionEnded( SectionEndInfo const& endInfo ) override; + void sectionEndedEarly( SectionEndInfo const& endInfo ) override; + + auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + void benchmarkPreparing( std::string const& name ) override; + void benchmarkStarting( BenchmarkInfo const& info ) override; + void benchmarkEnded( BenchmarkStats<> const& stats ) override; + void benchmarkFailed( std::string const& error ) override; +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + void pushScopedMessage( MessageInfo const& message ) override; + void popScopedMessage( MessageInfo const& message ) override; + + void emplaceUnscopedMessage( MessageBuilder const& builder ) override; + + std::string getCurrentTestName() const override; + + const AssertionResult* getLastResult() const override; + + void exceptionEarlyReported() override; + + void handleFatalErrorCondition( StringRef message ) override; + + bool lastAssertionPassed() override; + + void assertionPassed() override; + + public: + // !TBD We need to do this another way! + bool aborting() const final; + + private: + + void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ); + void invokeActiveTestCase(); + + void resetAssertionInfo(); + bool testForMissingAssertions( Counts& assertions ); + + void assertionEnded( AssertionResult const& result ); + void reportExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ); + + void populateReaction( AssertionReaction& reaction ); + + private: + + void handleUnfinishedSections(); + + TestRunInfo m_runInfo; + IMutableContext& m_context; + TestCase const* m_activeTestCase = nullptr; + ITracker* m_testCaseTracker = nullptr; + Option<AssertionResult> m_lastResult; + + IConfigPtr m_config; + Totals m_totals; + IStreamingReporterPtr m_reporter; + std::vector<MessageInfo> m_messages; + std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */ + AssertionInfo m_lastAssertionInfo; + std::vector<SectionEndInfo> m_unfinishedSections; + std::vector<ITracker*> m_activeSections; + TrackerContext m_trackerContext; + bool m_lastAssertionPassed = false; + bool m_shouldReportUnexpected = true; + bool m_includeSuccessfulResults; + }; + +} // end namespace Catch + +// end catch_run_context.h +namespace Catch { + + namespace { + auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { + expr.streamReconstructedExpression( os ); + return os; + } + } + + LazyExpression::LazyExpression( bool isNegated ) + : m_isNegated( isNegated ) + {} + + LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {} + + LazyExpression::operator bool() const { + return m_transientExpression != nullptr; + } + + auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& { + if( lazyExpr.m_isNegated ) + os << "!"; + + if( lazyExpr ) { + if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() ) + os << "(" << *lazyExpr.m_transientExpression << ")"; + else + os << *lazyExpr.m_transientExpression; + } + else { + os << "{** error - unchecked empty expression requested **}"; + } + return os; + } + + AssertionHandler::AssertionHandler + ( StringRef const& macroName, + SourceLineInfo const& lineInfo, + StringRef capturedExpression, + ResultDisposition::Flags resultDisposition ) + : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition }, + m_resultCapture( getResultCapture() ) + {} + + void AssertionHandler::handleExpr( ITransientExpression const& expr ) { + m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); + } + void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) { + m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction ); + } + + auto AssertionHandler::allowThrows() const -> bool { + return getCurrentContext().getConfig()->allowThrows(); + } + + void AssertionHandler::complete() { + setCompleted(); + if( m_reaction.shouldDebugBreak ) { + + // If you find your debugger stopping you here then go one level up on the + // call-stack for the code that caused it (typically a failed assertion) + + // (To go back to the test and change execution, jump over the throw, next) + CATCH_BREAK_INTO_DEBUGGER(); + } + if (m_reaction.shouldThrow) { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + throw Catch::TestFailureException(); +#else + CATCH_ERROR( "Test failure requires aborting test!" ); +#endif + } + } + void AssertionHandler::setCompleted() { + m_completed = true; + } + + void AssertionHandler::handleUnexpectedInflightException() { + m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction ); + } + + void AssertionHandler::handleExceptionThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + void AssertionHandler::handleExceptionNotThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + + void AssertionHandler::handleUnexpectedExceptionNotThrown() { + m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction ); + } + + void AssertionHandler::handleThrowingCallSkipped() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + + // This is the overload that takes a string and infers the Equals matcher from it + // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + } + +} // namespace Catch +// end catch_assertionhandler.cpp +// start catch_assertionresult.cpp + +namespace Catch { + AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression): + lazyExpression(_lazyExpression), + resultType(_resultType) {} + + std::string AssertionResultData::reconstructExpression() const { + + if( reconstructedExpression.empty() ) { + if( lazyExpression ) { + ReusableStringStream rss; + rss << lazyExpression; + reconstructedExpression = rss.str(); + } + } + return reconstructedExpression; + } + + AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) + : m_info( info ), + m_resultData( data ) + {} + + // Result was a success + bool AssertionResult::succeeded() const { + return Catch::isOk( m_resultData.resultType ); + } + + // Result was a success, or failure is suppressed + bool AssertionResult::isOk() const { + return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition ); + } + + ResultWas::OfType AssertionResult::getResultType() const { + return m_resultData.resultType; + } + + bool AssertionResult::hasExpression() const { + return m_info.capturedExpression[0] != 0; + } + + bool AssertionResult::hasMessage() const { + return !m_resultData.message.empty(); + } + + std::string AssertionResult::getExpression() const { + if( isFalseTest( m_info.resultDisposition ) ) + return "!(" + m_info.capturedExpression + ")"; + else + return m_info.capturedExpression; + } + + std::string AssertionResult::getExpressionInMacro() const { + std::string expr; + if( m_info.macroName[0] == 0 ) + expr = m_info.capturedExpression; + else { + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + expr += " )"; + } + return expr; + } + + bool AssertionResult::hasExpandedExpression() const { + return hasExpression() && getExpandedExpression() != getExpression(); + } + + std::string AssertionResult::getExpandedExpression() const { + std::string expr = m_resultData.reconstructExpression(); + return expr.empty() + ? getExpression() + : expr; + } + + std::string AssertionResult::getMessage() const { + return m_resultData.message; + } + SourceLineInfo AssertionResult::getSourceInfo() const { + return m_info.lineInfo; + } + + StringRef AssertionResult::getTestMacroName() const { + return m_info.macroName; + } + +} // end namespace Catch +// end catch_assertionresult.cpp +// start catch_capture_matchers.cpp + +namespace Catch { + + using StringMatcher = Matchers::Impl::MatcherBase<std::string>; + + // This is the general overload that takes a any string matcher + // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers + // the Equals matcher (so the header does not mention matchers) + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString ); + handler.handleExpr( expr ); + } + +} // namespace Catch +// end catch_capture_matchers.cpp +// start catch_commandline.cpp + +// start catch_commandline.h + +// start catch_clara.h + +// Use Catch's value for console width (store Clara's off to the side, if present) +#ifdef CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#endif +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1 + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#pragma clang diagnostic ignored "-Wexit-time-destructors" +#pragma clang diagnostic ignored "-Wshadow" +#endif + +// start clara.hpp +// Copyright 2017 Two Blue Cubes Ltd. All rights reserved. +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See https://github.com/philsquared/Clara for more details + +// Clara v1.1.5 + + +#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80 +#endif + +#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH +#endif + +#ifndef CLARA_CONFIG_OPTIONAL_TYPE +#ifdef __has_include +#if __has_include(<optional>) && __cplusplus >= 201703L +#include <optional> +#define CLARA_CONFIG_OPTIONAL_TYPE std::optional +#endif +#endif +#endif + +// ----------- #included from clara_textflow.hpp ----------- + +// TextFlowCpp +// +// A single-header library for wrapping and laying out basic text, by Phil Nash +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This project is hosted at https://github.com/philsquared/textflowcpp + + +#include <cassert> +#include <ostream> +#include <sstream> +#include <vector> + +#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80 +#endif + +namespace Catch { +namespace clara { +namespace TextFlow { + +inline auto isWhitespace(char c) -> bool { + static std::string chars = " \t\n\r"; + return chars.find(c) != std::string::npos; +} +inline auto isBreakableBefore(char c) -> bool { + static std::string chars = "[({<|"; + return chars.find(c) != std::string::npos; +} +inline auto isBreakableAfter(char c) -> bool { + static std::string chars = "])}>.,:;*+-=&/\\"; + return chars.find(c) != std::string::npos; +} + +class Columns; + +class Column { + std::vector<std::string> m_strings; + size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; + size_t m_indent = 0; + size_t m_initialIndent = std::string::npos; + +public: + class iterator { + friend Column; + + Column const& m_column; + size_t m_stringIndex = 0; + size_t m_pos = 0; + + size_t m_len = 0; + size_t m_end = 0; + bool m_suffix = false; + + iterator(Column const& column, size_t stringIndex) + : m_column(column), + m_stringIndex(stringIndex) {} + + auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; } + + auto isBoundary(size_t at) const -> bool { + assert(at > 0); + assert(at <= line().size()); + + return at == line().size() || + (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) || + isBreakableBefore(line()[at]) || + isBreakableAfter(line()[at - 1]); + } + + void calcLength() { + assert(m_stringIndex < m_column.m_strings.size()); + + m_suffix = false; + auto width = m_column.m_width - indent(); + m_end = m_pos; + if (line()[m_pos] == '\n') { + ++m_end; + } + while (m_end < line().size() && line()[m_end] != '\n') + ++m_end; + + if (m_end < m_pos + width) { + m_len = m_end - m_pos; + } else { + size_t len = width; + while (len > 0 && !isBoundary(m_pos + len)) + --len; + while (len > 0 && isWhitespace(line()[m_pos + len - 1])) + --len; + + if (len > 0) { + m_len = len; + } else { + m_suffix = true; + m_len = width - 1; + } + } + } + + auto indent() const -> size_t { + auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos; + return initial == std::string::npos ? m_column.m_indent : initial; + } + + auto addIndentAndSuffix(std::string const &plain) const -> std::string { + return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain); + } + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type * ; + using reference = value_type & ; + using iterator_category = std::forward_iterator_tag; + + explicit iterator(Column const& column) : m_column(column) { + assert(m_column.m_width > m_column.m_indent); + assert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent); + calcLength(); + if (m_len == 0) + m_stringIndex++; // Empty string + } + + auto operator *() const -> std::string { + assert(m_stringIndex < m_column.m_strings.size()); + assert(m_pos <= m_end); + return addIndentAndSuffix(line().substr(m_pos, m_len)); + } + + auto operator ++() -> iterator& { + m_pos += m_len; + if (m_pos < line().size() && line()[m_pos] == '\n') + m_pos += 1; + else + while (m_pos < line().size() && isWhitespace(line()[m_pos])) + ++m_pos; + + if (m_pos == line().size()) { + m_pos = 0; + ++m_stringIndex; + } + if (m_stringIndex < m_column.m_strings.size()) + calcLength(); + return *this; + } + auto operator ++(int) -> iterator { + iterator prev(*this); + operator++(); + return prev; + } + + auto operator ==(iterator const& other) const -> bool { + return + m_pos == other.m_pos && + m_stringIndex == other.m_stringIndex && + &m_column == &other.m_column; + } + auto operator !=(iterator const& other) const -> bool { + return !operator==(other); + } + }; + using const_iterator = iterator; + + explicit Column(std::string const& text) { m_strings.push_back(text); } + + auto width(size_t newWidth) -> Column& { + assert(newWidth > 0); + m_width = newWidth; + return *this; + } + auto indent(size_t newIndent) -> Column& { + m_indent = newIndent; + return *this; + } + auto initialIndent(size_t newIndent) -> Column& { + m_initialIndent = newIndent; + return *this; + } + + auto width() const -> size_t { return m_width; } + auto begin() const -> iterator { return iterator(*this); } + auto end() const -> iterator { return { *this, m_strings.size() }; } + + inline friend std::ostream& operator << (std::ostream& os, Column const& col) { + bool first = true; + for (auto line : col) { + if (first) + first = false; + else + os << "\n"; + os << line; + } + return os; + } + + auto operator + (Column const& other)->Columns; + + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } +}; + +class Spacer : public Column { + +public: + explicit Spacer(size_t spaceWidth) : Column("") { + width(spaceWidth); + } +}; + +class Columns { + std::vector<Column> m_columns; + +public: + + class iterator { + friend Columns; + struct EndTag {}; + + std::vector<Column> const& m_columns; + std::vector<Column::iterator> m_iterators; + size_t m_activeIterators; + + iterator(Columns const& columns, EndTag) + : m_columns(columns.m_columns), + m_activeIterators(0) { + m_iterators.reserve(m_columns.size()); + + for (auto const& col : m_columns) + m_iterators.push_back(col.end()); + } + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type * ; + using reference = value_type & ; + using iterator_category = std::forward_iterator_tag; + + explicit iterator(Columns const& columns) + : m_columns(columns.m_columns), + m_activeIterators(m_columns.size()) { + m_iterators.reserve(m_columns.size()); + + for (auto const& col : m_columns) + m_iterators.push_back(col.begin()); + } + + auto operator ==(iterator const& other) const -> bool { + return m_iterators == other.m_iterators; + } + auto operator !=(iterator const& other) const -> bool { + return m_iterators != other.m_iterators; + } + auto operator *() const -> std::string { + std::string row, padding; + + for (size_t i = 0; i < m_columns.size(); ++i) { + auto width = m_columns[i].width(); + if (m_iterators[i] != m_columns[i].end()) { + std::string col = *m_iterators[i]; + row += padding + col; + if (col.size() < width) + padding = std::string(width - col.size(), ' '); + else + padding = ""; + } else { + padding += std::string(width, ' '); + } + } + return row; + } + auto operator ++() -> iterator& { + for (size_t i = 0; i < m_columns.size(); ++i) { + if (m_iterators[i] != m_columns[i].end()) + ++m_iterators[i]; + } + return *this; + } + auto operator ++(int) -> iterator { + iterator prev(*this); + operator++(); + return prev; + } + }; + using const_iterator = iterator; + + auto begin() const -> iterator { return iterator(*this); } + auto end() const -> iterator { return { *this, iterator::EndTag() }; } + + auto operator += (Column const& col) -> Columns& { + m_columns.push_back(col); + return *this; + } + auto operator + (Column const& col) -> Columns { + Columns combined = *this; + combined += col; + return combined; + } + + inline friend std::ostream& operator << (std::ostream& os, Columns const& cols) { + + bool first = true; + for (auto line : cols) { + if (first) + first = false; + else + os << "\n"; + os << line; + } + return os; + } + + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } +}; + +inline auto Column::operator + (Column const& other) -> Columns { + Columns cols; + cols += *this; + cols += other; + return cols; +} +} + +} +} + +// ----------- end of #include from clara_textflow.hpp ----------- +// ........... back in clara.hpp + +#include <cctype> +#include <string> +#include <memory> +#include <set> +#include <algorithm> + +#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) ) +#define CATCH_PLATFORM_WINDOWS +#endif + +namespace Catch { namespace clara { +namespace detail { + + // Traits for extracting arg and return type of lambdas (for single argument lambdas) + template<typename L> + struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {}; + + template<typename ClassT, typename ReturnT, typename... Args> + struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> { + static const bool isValid = false; + }; + + template<typename ClassT, typename ReturnT, typename ArgT> + struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> { + static const bool isValid = true; + using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type; + using ReturnType = ReturnT; + }; + + class TokenStream; + + // Transport for raw args (copied from main args, or supplied via init list for testing) + class Args { + friend TokenStream; + std::string m_exeName; + std::vector<std::string> m_args; + + public: + Args( int argc, char const* const* argv ) + : m_exeName(argv[0]), + m_args(argv + 1, argv + argc) {} + + Args( std::initializer_list<std::string> args ) + : m_exeName( *args.begin() ), + m_args( args.begin()+1, args.end() ) + {} + + auto exeName() const -> std::string { + return m_exeName; + } + }; + + // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string + // may encode an option + its argument if the : or = form is used + enum class TokenType { + Option, Argument + }; + struct Token { + TokenType type; + std::string token; + }; + + inline auto isOptPrefix( char c ) -> bool { + return c == '-' +#ifdef CATCH_PLATFORM_WINDOWS + || c == '/' +#endif + ; + } + + // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled + class TokenStream { + using Iterator = std::vector<std::string>::const_iterator; + Iterator it; + Iterator itEnd; + std::vector<Token> m_tokenBuffer; + + void loadBuffer() { + m_tokenBuffer.resize( 0 ); + + // Skip any empty strings + while( it != itEnd && it->empty() ) + ++it; + + if( it != itEnd ) { + auto const &next = *it; + if( isOptPrefix( next[0] ) ) { + auto delimiterPos = next.find_first_of( " :=" ); + if( delimiterPos != std::string::npos ) { + m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } ); + m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } ); + } else { + if( next[1] != '-' && next.size() > 2 ) { + std::string opt = "- "; + for( size_t i = 1; i < next.size(); ++i ) { + opt[1] = next[i]; + m_tokenBuffer.push_back( { TokenType::Option, opt } ); + } + } else { + m_tokenBuffer.push_back( { TokenType::Option, next } ); + } + } + } else { + m_tokenBuffer.push_back( { TokenType::Argument, next } ); + } + } + } + + public: + explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {} + + TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) { + loadBuffer(); + } + + explicit operator bool() const { + return !m_tokenBuffer.empty() || it != itEnd; + } + + auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); } + + auto operator*() const -> Token { + assert( !m_tokenBuffer.empty() ); + return m_tokenBuffer.front(); + } + + auto operator->() const -> Token const * { + assert( !m_tokenBuffer.empty() ); + return &m_tokenBuffer.front(); + } + + auto operator++() -> TokenStream & { + if( m_tokenBuffer.size() >= 2 ) { + m_tokenBuffer.erase( m_tokenBuffer.begin() ); + } else { + if( it != itEnd ) + ++it; + loadBuffer(); + } + return *this; + } + }; + + class ResultBase { + public: + enum Type { + Ok, LogicError, RuntimeError + }; + + protected: + ResultBase( Type type ) : m_type( type ) {} + virtual ~ResultBase() = default; + + virtual void enforceOk() const = 0; + + Type m_type; + }; + + template<typename T> + class ResultValueBase : public ResultBase { + public: + auto value() const -> T const & { + enforceOk(); + return m_value; + } + + protected: + ResultValueBase( Type type ) : ResultBase( type ) {} + + ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) { + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + } + + ResultValueBase( Type, T const &value ) : ResultBase( Ok ) { + new( &m_value ) T( value ); + } + + auto operator=( ResultValueBase const &other ) -> ResultValueBase & { + if( m_type == ResultBase::Ok ) + m_value.~T(); + ResultBase::operator=(other); + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + return *this; + } + + ~ResultValueBase() override { + if( m_type == Ok ) + m_value.~T(); + } + + union { + T m_value; + }; + }; + + template<> + class ResultValueBase<void> : public ResultBase { + protected: + using ResultBase::ResultBase; + }; + + template<typename T = void> + class BasicResult : public ResultValueBase<T> { + public: + template<typename U> + explicit BasicResult( BasicResult<U> const &other ) + : ResultValueBase<T>( other.type() ), + m_errorMessage( other.errorMessage() ) + { + assert( type() != ResultBase::Ok ); + } + + template<typename U> + static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; } + static auto ok() -> BasicResult { return { ResultBase::Ok }; } + static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; } + static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; } + + explicit operator bool() const { return m_type == ResultBase::Ok; } + auto type() const -> ResultBase::Type { return m_type; } + auto errorMessage() const -> std::string { return m_errorMessage; } + + protected: + void enforceOk() const override { + + // Errors shouldn't reach this point, but if they do + // the actual error message will be in m_errorMessage + assert( m_type != ResultBase::LogicError ); + assert( m_type != ResultBase::RuntimeError ); + if( m_type != ResultBase::Ok ) + std::abort(); + } + + std::string m_errorMessage; // Only populated if resultType is an error + + BasicResult( ResultBase::Type type, std::string const &message ) + : ResultValueBase<T>(type), + m_errorMessage(message) + { + assert( m_type != ResultBase::Ok ); + } + + using ResultValueBase<T>::ResultValueBase; + using ResultBase::m_type; + }; + + enum class ParseResultType { + Matched, NoMatch, ShortCircuitAll, ShortCircuitSame + }; + + class ParseState { + public: + + ParseState( ParseResultType type, TokenStream const &remainingTokens ) + : m_type(type), + m_remainingTokens( remainingTokens ) + {} + + auto type() const -> ParseResultType { return m_type; } + auto remainingTokens() const -> TokenStream { return m_remainingTokens; } + + private: + ParseResultType m_type; + TokenStream m_remainingTokens; + }; + + using Result = BasicResult<void>; + using ParserResult = BasicResult<ParseResultType>; + using InternalParseResult = BasicResult<ParseState>; + + struct HelpColumns { + std::string left; + std::string right; + }; + + template<typename T> + inline auto convertInto( std::string const &source, T& target ) -> ParserResult { + std::stringstream ss; + ss << source; + ss >> target; + if( ss.fail() ) + return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult { + target = source; + return ParserResult::ok( ParseResultType::Matched ); + } + inline auto convertInto( std::string const &source, bool &target ) -> ParserResult { + std::string srcLC = source; + std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } ); + if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on") + target = true; + else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off") + target = false; + else + return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + } +#ifdef CLARA_CONFIG_OPTIONAL_TYPE + template<typename T> + inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) -> ParserResult { + T temp; + auto result = convertInto( source, temp ); + if( result ) + target = std::move(temp); + return result; + } +#endif // CLARA_CONFIG_OPTIONAL_TYPE + + struct NonCopyable { + NonCopyable() = default; + NonCopyable( NonCopyable const & ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable &operator=( NonCopyable const & ) = delete; + NonCopyable &operator=( NonCopyable && ) = delete; + }; + + struct BoundRef : NonCopyable { + virtual ~BoundRef() = default; + virtual auto isContainer() const -> bool { return false; } + virtual auto isFlag() const -> bool { return false; } + }; + struct BoundValueRefBase : BoundRef { + virtual auto setValue( std::string const &arg ) -> ParserResult = 0; + }; + struct BoundFlagRefBase : BoundRef { + virtual auto setFlag( bool flag ) -> ParserResult = 0; + virtual auto isFlag() const -> bool { return true; } + }; + + template<typename T> + struct BoundValueRef : BoundValueRefBase { + T &m_ref; + + explicit BoundValueRef( T &ref ) : m_ref( ref ) {} + + auto setValue( std::string const &arg ) -> ParserResult override { + return convertInto( arg, m_ref ); + } + }; + + template<typename T> + struct BoundValueRef<std::vector<T>> : BoundValueRefBase { + std::vector<T> &m_ref; + + explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {} + + auto isContainer() const -> bool override { return true; } + + auto setValue( std::string const &arg ) -> ParserResult override { + T temp; + auto result = convertInto( arg, temp ); + if( result ) + m_ref.push_back( temp ); + return result; + } + }; + + struct BoundFlagRef : BoundFlagRefBase { + bool &m_ref; + + explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {} + + auto setFlag( bool flag ) -> ParserResult override { + m_ref = flag; + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + template<typename ReturnType> + struct LambdaInvoker { + static_assert( std::is_same<ReturnType, ParserResult>::value, "Lambda must return void or clara::ParserResult" ); + + template<typename L, typename ArgType> + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + return lambda( arg ); + } + }; + + template<> + struct LambdaInvoker<void> { + template<typename L, typename ArgType> + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + lambda( arg ); + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + template<typename ArgType, typename L> + inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult { + ArgType temp{}; + auto result = convertInto( arg, temp ); + return !result + ? result + : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp ); + } + + template<typename L> + struct BoundLambda : BoundValueRefBase { + L m_lambda; + + static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" ); + explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {} + + auto setValue( std::string const &arg ) -> ParserResult override { + return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg ); + } + }; + + template<typename L> + struct BoundFlagLambda : BoundFlagRefBase { + L m_lambda; + + static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" ); + static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, "flags must be boolean" ); + + explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {} + + auto setFlag( bool flag ) -> ParserResult override { + return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag ); + } + }; + + enum class Optionality { Optional, Required }; + + struct Parser; + + class ParserBase { + public: + virtual ~ParserBase() = default; + virtual auto validate() const -> Result { return Result::ok(); } + virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; + virtual auto cardinality() const -> size_t { return 1; } + + auto parse( Args const &args ) const -> InternalParseResult { + return parse( args.exeName(), TokenStream( args ) ); + } + }; + + template<typename DerivedT> + class ComposableParserImpl : public ParserBase { + public: + template<typename T> + auto operator|( T const &other ) const -> Parser; + + template<typename T> + auto operator+( T const &other ) const -> Parser; + }; + + // Common code and state for Args and Opts + template<typename DerivedT> + class ParserRefImpl : public ComposableParserImpl<DerivedT> { + protected: + Optionality m_optionality = Optionality::Optional; + std::shared_ptr<BoundRef> m_ref; + std::string m_hint; + std::string m_description; + + explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {} + + public: + template<typename T> + ParserRefImpl( T &ref, std::string const &hint ) + : m_ref( std::make_shared<BoundValueRef<T>>( ref ) ), + m_hint( hint ) + {} + + template<typename LambdaT> + ParserRefImpl( LambdaT const &ref, std::string const &hint ) + : m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ), + m_hint(hint) + {} + + auto operator()( std::string const &description ) -> DerivedT & { + m_description = description; + return static_cast<DerivedT &>( *this ); + } + + auto optional() -> DerivedT & { + m_optionality = Optionality::Optional; + return static_cast<DerivedT &>( *this ); + }; + + auto required() -> DerivedT & { + m_optionality = Optionality::Required; + return static_cast<DerivedT &>( *this ); + }; + + auto isOptional() const -> bool { + return m_optionality == Optionality::Optional; + } + + auto cardinality() const -> size_t override { + if( m_ref->isContainer() ) + return 0; + else + return 1; + } + + auto hint() const -> std::string { return m_hint; } + }; + + class ExeName : public ComposableParserImpl<ExeName> { + std::shared_ptr<std::string> m_name; + std::shared_ptr<BoundValueRefBase> m_ref; + + template<typename LambdaT> + static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> { + return std::make_shared<BoundLambda<LambdaT>>( lambda) ; + } + + public: + ExeName() : m_name( std::make_shared<std::string>( "<executable>" ) ) {} + + explicit ExeName( std::string &ref ) : ExeName() { + m_ref = std::make_shared<BoundValueRef<std::string>>( ref ); + } + + template<typename LambdaT> + explicit ExeName( LambdaT const& lambda ) : ExeName() { + m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda ); + } + + // The exe name is not parsed out of the normal tokens, but is handled specially + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + } + + auto name() const -> std::string { return *m_name; } + auto set( std::string const& newName ) -> ParserResult { + + auto lastSlash = newName.find_last_of( "\\/" ); + auto filename = ( lastSlash == std::string::npos ) + ? newName + : newName.substr( lastSlash+1 ); + + *m_name = filename; + if( m_ref ) + return m_ref->setValue( filename ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + class Arg : public ParserRefImpl<Arg> { + public: + using ParserRefImpl::ParserRefImpl; + + auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); + + auto remainingTokens = tokens; + auto const &token = *remainingTokens; + if( token.type != TokenType::Argument ) + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); + + assert( !m_ref->isFlag() ); + auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() ); + + auto result = valueRef->setValue( remainingTokens->token ); + if( !result ) + return InternalParseResult( result ); + else + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); + } + }; + + inline auto normaliseOpt( std::string const &optName ) -> std::string { +#ifdef CATCH_PLATFORM_WINDOWS + if( optName[0] == '/' ) + return "-" + optName.substr( 1 ); + else +#endif + return optName; + } + + class Opt : public ParserRefImpl<Opt> { + protected: + std::vector<std::string> m_optNames; + + public: + template<typename LambdaT> + explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {} + + explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {} + + template<typename LambdaT> + Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + template<typename T> + Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + auto operator[]( std::string const &optName ) -> Opt & { + m_optNames.push_back( optName ); + return *this; + } + + auto getHelpColumns() const -> std::vector<HelpColumns> { + std::ostringstream oss; + bool first = true; + for( auto const &opt : m_optNames ) { + if (first) + first = false; + else + oss << ", "; + oss << opt; + } + if( !m_hint.empty() ) + oss << " <" << m_hint << ">"; + return { { oss.str(), m_description } }; + } + + auto isMatch( std::string const &optToken ) const -> bool { + auto normalisedToken = normaliseOpt( optToken ); + for( auto const &name : m_optNames ) { + if( normaliseOpt( name ) == normalisedToken ) + return true; + } + return false; + } + + using ParserBase::parse; + + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); + + auto remainingTokens = tokens; + if( remainingTokens && remainingTokens->type == TokenType::Option ) { + auto const &token = *remainingTokens; + if( isMatch(token.token ) ) { + if( m_ref->isFlag() ) { + auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() ); + auto result = flagRef->setFlag( true ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } else { + auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() ); + ++remainingTokens; + if( !remainingTokens ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto const &argToken = *remainingTokens; + if( argToken.type != TokenType::Argument ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto result = valueRef->setValue( argToken.token ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); + } + } + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); + } + + auto validate() const -> Result override { + if( m_optNames.empty() ) + return Result::logicError( "No options supplied to Opt" ); + for( auto const &name : m_optNames ) { + if( name.empty() ) + return Result::logicError( "Option name cannot be empty" ); +#ifdef CATCH_PLATFORM_WINDOWS + if( name[0] != '-' && name[0] != '/' ) + return Result::logicError( "Option name must begin with '-' or '/'" ); +#else + if( name[0] != '-' ) + return Result::logicError( "Option name must begin with '-'" ); +#endif + } + return ParserRefImpl::validate(); + } + }; + + struct Help : Opt { + Help( bool &showHelpFlag ) + : Opt([&]( bool flag ) { + showHelpFlag = flag; + return ParserResult::ok( ParseResultType::ShortCircuitAll ); + }) + { + static_cast<Opt &>( *this ) + ("display usage information") + ["-?"]["-h"]["--help"] + .optional(); + } + }; + + struct Parser : ParserBase { + + mutable ExeName m_exeName; + std::vector<Opt> m_options; + std::vector<Arg> m_args; + + auto operator|=( ExeName const &exeName ) -> Parser & { + m_exeName = exeName; + return *this; + } + + auto operator|=( Arg const &arg ) -> Parser & { + m_args.push_back(arg); + return *this; + } + + auto operator|=( Opt const &opt ) -> Parser & { + m_options.push_back(opt); + return *this; + } + + auto operator|=( Parser const &other ) -> Parser & { + m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end()); + m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end()); + return *this; + } + + template<typename T> + auto operator|( T const &other ) const -> Parser { + return Parser( *this ) |= other; + } + + // Forward deprecated interface with '+' instead of '|' + template<typename T> + auto operator+=( T const &other ) -> Parser & { return operator|=( other ); } + template<typename T> + auto operator+( T const &other ) const -> Parser { return operator|( other ); } + + auto getHelpColumns() const -> std::vector<HelpColumns> { + std::vector<HelpColumns> cols; + for (auto const &o : m_options) { + auto childCols = o.getHelpColumns(); + cols.insert( cols.end(), childCols.begin(), childCols.end() ); + } + return cols; + } + + void writeToStream( std::ostream &os ) const { + if (!m_exeName.name().empty()) { + os << "usage:\n" << " " << m_exeName.name() << " "; + bool required = true, first = true; + for( auto const &arg : m_args ) { + if (first) + first = false; + else + os << " "; + if( arg.isOptional() && required ) { + os << "["; + required = false; + } + os << "<" << arg.hint() << ">"; + if( arg.cardinality() == 0 ) + os << " ... "; + } + if( !required ) + os << "]"; + if( !m_options.empty() ) + os << " options"; + os << "\n\nwhere options are:" << std::endl; + } + + auto rows = getHelpColumns(); + size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH; + size_t optWidth = 0; + for( auto const &cols : rows ) + optWidth = (std::max)(optWidth, cols.left.size() + 2); + + optWidth = (std::min)(optWidth, consoleWidth/2); + + for( auto const &cols : rows ) { + auto row = + TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) + + TextFlow::Spacer(4) + + TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth ); + os << row << std::endl; + } + } + + friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& { + parser.writeToStream( os ); + return os; + } + + auto validate() const -> Result override { + for( auto const &opt : m_options ) { + auto result = opt.validate(); + if( !result ) + return result; + } + for( auto const &arg : m_args ) { + auto result = arg.validate(); + if( !result ) + return result; + } + return Result::ok(); + } + + using ParserBase::parse; + + auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override { + + struct ParserInfo { + ParserBase const* parser = nullptr; + size_t count = 0; + }; + const size_t totalParsers = m_options.size() + m_args.size(); + assert( totalParsers < 512 ); + // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do + ParserInfo parseInfos[512]; + + { + size_t i = 0; + for (auto const &opt : m_options) parseInfos[i++].parser = &opt; + for (auto const &arg : m_args) parseInfos[i++].parser = &arg; + } + + m_exeName.set( exeName ); + + auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + while( result.value().remainingTokens() ) { + bool tokenParsed = false; + + for( size_t i = 0; i < totalParsers; ++i ) { + auto& parseInfo = parseInfos[i]; + if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) { + result = parseInfo.parser->parse(exeName, result.value().remainingTokens()); + if (!result) + return result; + if (result.value().type() != ParseResultType::NoMatch) { + tokenParsed = true; + ++parseInfo.count; + break; + } + } + } + + if( result.value().type() == ParseResultType::ShortCircuitAll ) + return result; + if( !tokenParsed ) + return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token ); + } + // !TBD Check missing required options + return result; + } + }; + + template<typename DerivedT> + template<typename T> + auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser { + return Parser() | static_cast<DerivedT const &>( *this ) | other; + } +} // namespace detail + +// A Combined parser +using detail::Parser; + +// A parser for options +using detail::Opt; + +// A parser for arguments +using detail::Arg; + +// Wrapper for argc, argv from main() +using detail::Args; + +// Specifies the name of the executable +using detail::ExeName; + +// Convenience wrapper for option parser that specifies the help option +using detail::Help; + +// enum of result types from a parse +using detail::ParseResultType; + +// Result type for parser operation +using detail::ParserResult; + +}} // namespace Catch::clara + +// end clara.hpp +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// Restore Clara's value for console width, if present +#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#endif + +// end catch_clara.h +namespace Catch { + + clara::Parser makeCommandLineParser( ConfigData& config ); + +} // end namespace Catch + +// end catch_commandline.h +#include <fstream> +#include <ctime> + +namespace Catch { + + clara::Parser makeCommandLineParser( ConfigData& config ) { + + using namespace clara; + + auto const setWarning = [&]( std::string const& warning ) { + auto warningSet = [&]() { + if( warning == "NoAssertions" ) + return WarnAbout::NoAssertions; + + if ( warning == "NoTests" ) + return WarnAbout::NoTests; + + return WarnAbout::Nothing; + }(); + + if (warningSet == WarnAbout::Nothing) + return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); + config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const loadTestNamesFromFile = [&]( std::string const& filename ) { + std::ifstream f( filename.c_str() ); + if( !f.is_open() ) + return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" ); + + std::string line; + while( std::getline( f, line ) ) { + line = trim(line); + if( !line.empty() && !startsWith( line, '#' ) ) { + if( !startsWith( line, '"' ) ) + line = '"' + line + '"'; + config.testsOrTags.push_back( line + ',' ); + } + } + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setTestOrder = [&]( std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = RunTests::InDeclarationOrder; + else if( startsWith( "lexical", order ) ) + config.runOrder = RunTests::InLexicographicalOrder; + else if( startsWith( "random", order ) ) + config.runOrder = RunTests::InRandomOrder; + else + return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setRngSeed = [&]( std::string const& seed ) { + if( seed != "time" ) + return clara::detail::convertInto( seed, config.rngSeed ); + config.rngSeed = static_cast<unsigned int>( std::time(nullptr) ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setColourUsage = [&]( std::string const& useColour ) { + auto mode = toLower( useColour ); + + if( mode == "yes" ) + config.useColour = UseColour::Yes; + else if( mode == "no" ) + config.useColour = UseColour::No; + else if( mode == "auto" ) + config.useColour = UseColour::Auto; + else + return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setWaitForKeypress = [&]( std::string const& keypress ) { + auto keypressLc = toLower( keypress ); + if( keypressLc == "start" ) + config.waitForKeypress = WaitForKeypress::BeforeStart; + else if( keypressLc == "exit" ) + config.waitForKeypress = WaitForKeypress::BeforeExit; + else if( keypressLc == "both" ) + config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; + else + return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setVerbosity = [&]( std::string const& verbosity ) { + auto lcVerbosity = toLower( verbosity ); + if( lcVerbosity == "quiet" ) + config.verbosity = Verbosity::Quiet; + else if( lcVerbosity == "normal" ) + config.verbosity = Verbosity::Normal; + else if( lcVerbosity == "high" ) + config.verbosity = Verbosity::High; + else + return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setReporter = [&]( std::string const& reporter ) { + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + + auto lcReporter = toLower( reporter ); + auto result = factories.find( lcReporter ); + + if( factories.end() != result ) + config.reporterName = lcReporter; + else + return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + + auto cli + = ExeName( config.processName ) + | Help( config.showHelp ) + | Opt( config.listTests ) + ["-l"]["--list-tests"] + ( "list all/matching test cases" ) + | Opt( config.listTags ) + ["-t"]["--list-tags"] + ( "list all/matching tags" ) + | Opt( config.showSuccessfulTests ) + ["-s"]["--success"] + ( "include successful tests in output" ) + | Opt( config.shouldDebugBreak ) + ["-b"]["--break"] + ( "break into debugger on failure" ) + | Opt( config.noThrow ) + ["-e"]["--nothrow"] + ( "skip exception tests" ) + | Opt( config.showInvisibles ) + ["-i"]["--invisibles"] + ( "show invisibles (tabs, newlines)" ) + | Opt( config.outputFilename, "filename" ) + ["-o"]["--out"] + ( "output filename" ) + | Opt( setReporter, "name" ) + ["-r"]["--reporter"] + ( "reporter to use (defaults to console)" ) + | Opt( config.name, "name" ) + ["-n"]["--name"] + ( "suite name" ) + | Opt( [&]( bool ){ config.abortAfter = 1; } ) + ["-a"]["--abort"] + ( "abort at first failure" ) + | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) + ["-x"]["--abortx"] + ( "abort after x failures" ) + | Opt( setWarning, "warning name" ) + ["-w"]["--warn"] + ( "enable warnings" ) + | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) + ["-d"]["--durations"] + ( "show test durations" ) + | Opt( loadTestNamesFromFile, "filename" ) + ["-f"]["--input-file"] + ( "load test names to run from a file" ) + | Opt( config.filenamesAsTags ) + ["-#"]["--filenames-as-tags"] + ( "adds a tag for the filename" ) + | Opt( config.sectionsToRun, "section name" ) + ["-c"]["--section"] + ( "specify section to run" ) + | Opt( setVerbosity, "quiet|normal|high" ) + ["-v"]["--verbosity"] + ( "set output verbosity" ) + | Opt( config.listTestNamesOnly ) + ["--list-test-names-only"] + ( "list all/matching test cases names only" ) + | Opt( config.listReporters ) + ["--list-reporters"] + ( "list all reporters" ) + | Opt( setTestOrder, "decl|lex|rand" ) + ["--order"] + ( "test case order (defaults to decl)" ) + | Opt( setRngSeed, "'time'|number" ) + ["--rng-seed"] + ( "set a specific seed for random numbers" ) + | Opt( setColourUsage, "yes|no" ) + ["--use-colour"] + ( "should output be colourised" ) + | Opt( config.libIdentify ) + ["--libidentify"] + ( "report name and version according to libidentify standard" ) + | Opt( setWaitForKeypress, "start|exit|both" ) + ["--wait-for-keypress"] + ( "waits for a keypress before exiting" ) + | Opt( config.benchmarkSamples, "samples" ) + ["--benchmark-samples"] + ( "number of samples to collect (default: 100)" ) + | Opt( config.benchmarkResamples, "resamples" ) + ["--benchmark-resamples"] + ( "number of resamples for the bootstrap (default: 100000)" ) + | Opt( config.benchmarkConfidenceInterval, "confidence interval" ) + ["--benchmark-confidence-interval"] + ( "confidence interval for the bootstrap (between 0 and 1, default: 0.95)" ) + | Opt( config.benchmarkNoAnalysis ) + ["--benchmark-no-analysis"] + ( "perform only measurements; do not perform any analysis" ) + | Arg( config.testsOrTags, "test name|pattern|tags" ) + ( "which test or tests to use" ); + + return cli; + } + +} // end namespace Catch +// end catch_commandline.cpp +// start catch_common.cpp + +#include <cstring> +#include <ostream> + +namespace Catch { + + bool SourceLineInfo::empty() const noexcept { + return file[0] == '\0'; + } + bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { + return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); + } + bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { + // We can assume that the same file will usually have the same pointer. + // Thus, if the pointers are the same, there is no point in calling the strcmp + return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); + } + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { +#ifndef __GNUG__ + os << info.file << '(' << info.line << ')'; +#else + os << info.file << ':' << info.line; +#endif + return os; + } + + std::string StreamEndStop::operator+() const { + return std::string(); + } + + NonCopyable::NonCopyable() = default; + NonCopyable::~NonCopyable() = default; + +} +// end catch_common.cpp +// start catch_config.cpp + +namespace Catch { + + Config::Config( ConfigData const& data ) + : m_data( data ), + m_stream( openStream() ) + { + TestSpecParser parser(ITagAliasRegistry::get()); + if (!data.testsOrTags.empty()) { + m_hasTestFilters = true; + for( auto const& testOrTags : data.testsOrTags ) + parser.parse( testOrTags ); + } + m_testSpec = parser.testSpec(); + } + + std::string const& Config::getFilename() const { + return m_data.outputFilename ; + } + + bool Config::listTests() const { return m_data.listTests; } + bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; } + bool Config::listTags() const { return m_data.listTags; } + bool Config::listReporters() const { return m_data.listReporters; } + + std::string Config::getProcessName() const { return m_data.processName; } + std::string const& Config::getReporterName() const { return m_data.reporterName; } + + std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; } + std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + + TestSpec const& Config::testSpec() const { return m_testSpec; } + bool Config::hasTestFilters() const { return m_hasTestFilters; } + + bool Config::showHelp() const { return m_data.showHelp; } + + // IConfig interface + bool Config::allowThrows() const { return !m_data.noThrow; } + std::ostream& Config::stream() const { return m_stream->stream(); } + std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } + bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; } + bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); } + bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } + ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; } + RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; } + unsigned int Config::rngSeed() const { return m_data.rngSeed; } + UseColour::YesOrNo Config::useColour() const { return m_data.useColour; } + bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; } + int Config::abortAfter() const { return m_data.abortAfter; } + bool Config::showInvisibles() const { return m_data.showInvisibles; } + Verbosity Config::verbosity() const { return m_data.verbosity; } + + bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } + int Config::benchmarkSamples() const { return m_data.benchmarkSamples; } + double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; } + unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; } + + IStream const* Config::openStream() { + return Catch::makeStream(m_data.outputFilename); + } + +} // end namespace Catch +// end catch_config.cpp +// start catch_console_colour.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +// start catch_errno_guard.h + +namespace Catch { + + class ErrnoGuard { + public: + ErrnoGuard(); + ~ErrnoGuard(); + private: + int m_oldErrno; + }; + +} + +// end catch_errno_guard.h +#include <sstream> + +namespace Catch { + namespace { + + struct IColourImpl { + virtual ~IColourImpl() = default; + virtual void use( Colour::Code _colourCode ) = 0; + }; + + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) {} + + static IColourImpl* instance() { + static NoColourImpl s_instance; + return &s_instance; + } + }; + + } // anon namespace +} // namespace Catch + +#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) +# ifdef CATCH_PLATFORM_WINDOWS +# define CATCH_CONFIG_COLOUR_WINDOWS +# else +# define CATCH_CONFIG_COLOUR_ANSI +# endif +#endif + +#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// + +namespace Catch { +namespace { + + class Win32ColourImpl : public IColourImpl { + public: + Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) + { + CONSOLE_SCREEN_BUFFER_INFO csbiInfo; + GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo ); + originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY ); + originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY ); + } + + void use( Colour::Code _colourCode ) override { + switch( _colourCode ) { + case Colour::None: return setTextAttribute( originalForegroundAttributes ); + case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); + case Colour::Red: return setTextAttribute( FOREGROUND_RED ); + case Colour::Green: return setTextAttribute( FOREGROUND_GREEN ); + case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE ); + case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN ); + case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN ); + case Colour::Grey: return setTextAttribute( 0 ); + + case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY ); + case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED ); + case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN ); + case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); + case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN ); + + case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); + + default: + CATCH_ERROR( "Unknown colour requested" ); + } + } + + private: + void setTextAttribute( WORD _textAttribute ) { + SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes ); + } + HANDLE stdoutHandle; + WORD originalForegroundAttributes; + WORD originalBackgroundAttributes; + }; + + IColourImpl* platformColourInstance() { + static Win32ColourImpl s_instance; + + IConfigPtr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = UseColour::Yes; + return colourMode == UseColour::Yes + ? &s_instance + : NoColourImpl::instance(); + } + +} // end anon namespace +} // end namespace Catch + +#elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// + +#include <unistd.h> + +namespace Catch { +namespace { + + // use POSIX/ ANSI console terminal codes + // Thanks to Adam Strzelecki for original contribution + // (http://github.com/nanoant) + // https://github.com/philsquared/Catch/pull/131 + class PosixColourImpl : public IColourImpl { + public: + void use( Colour::Code _colourCode ) override { + switch( _colourCode ) { + case Colour::None: + case Colour::White: return setColour( "[0m" ); + case Colour::Red: return setColour( "[0;31m" ); + case Colour::Green: return setColour( "[0;32m" ); + case Colour::Blue: return setColour( "[0;34m" ); + case Colour::Cyan: return setColour( "[0;36m" ); + case Colour::Yellow: return setColour( "[0;33m" ); + case Colour::Grey: return setColour( "[1;30m" ); + + case Colour::LightGrey: return setColour( "[0;37m" ); + case Colour::BrightRed: return setColour( "[1;31m" ); + case Colour::BrightGreen: return setColour( "[1;32m" ); + case Colour::BrightWhite: return setColour( "[1;37m" ); + case Colour::BrightYellow: return setColour( "[1;33m" ); + + case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); + default: CATCH_INTERNAL_ERROR( "Unknown colour requested" ); + } + } + static IColourImpl* instance() { + static PosixColourImpl s_instance; + return &s_instance; + } + + private: + void setColour( const char* _escapeCode ) { + getCurrentContext().getConfig()->stream() + << '\033' << _escapeCode; + } + }; + + bool useColourOnPlatform() { + return +#ifdef CATCH_PLATFORM_MAC + !isDebuggerActive() && +#endif +#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) + isatty(STDOUT_FILENO) +#else + false +#endif + ; + } + IColourImpl* platformColourInstance() { + ErrnoGuard guard; + IConfigPtr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = useColourOnPlatform() + ? UseColour::Yes + : UseColour::No; + return colourMode == UseColour::Yes + ? PosixColourImpl::instance() + : NoColourImpl::instance(); + } + +} // end anon namespace +} // end namespace Catch + +#else // not Windows or ANSI /////////////////////////////////////////////// + +namespace Catch { + + static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); } + +} // end namespace Catch + +#endif // Windows/ ANSI/ None + +namespace Catch { + + Colour::Colour( Code _colourCode ) { use( _colourCode ); } + Colour::Colour( Colour&& rhs ) noexcept { + m_moved = rhs.m_moved; + rhs.m_moved = true; + } + Colour& Colour::operator=( Colour&& rhs ) noexcept { + m_moved = rhs.m_moved; + rhs.m_moved = true; + return *this; + } + + Colour::~Colour(){ if( !m_moved ) use( None ); } + + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = platformColourInstance(); + // Strictly speaking, this cannot possibly happen. + // However, under some conditions it does happen (see #1626), + // and this change is small enough that we can let practicality + // triumph over purity in this case. + if (impl != NULL) { + impl->use( _colourCode ); + } + } + + std::ostream& operator << ( std::ostream& os, Colour const& ) { + return os; + } + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +// end catch_console_colour.cpp +// start catch_context.cpp + +namespace Catch { + + class Context : public IMutableContext, NonCopyable { + + public: // IContext + IResultCapture* getResultCapture() override { + return m_resultCapture; + } + IRunner* getRunner() override { + return m_runner; + } + + IConfigPtr const& getConfig() const override { + return m_config; + } + + ~Context() override; + + public: // IMutableContext + void setResultCapture( IResultCapture* resultCapture ) override { + m_resultCapture = resultCapture; + } + void setRunner( IRunner* runner ) override { + m_runner = runner; + } + void setConfig( IConfigPtr const& config ) override { + m_config = config; + } + + friend IMutableContext& getCurrentMutableContext(); + + private: + IConfigPtr m_config; + IRunner* m_runner = nullptr; + IResultCapture* m_resultCapture = nullptr; + }; + + IMutableContext *IMutableContext::currentContext = nullptr; + + void IMutableContext::createContext() + { + currentContext = new Context(); + } + + void cleanUpContext() { + delete IMutableContext::currentContext; + IMutableContext::currentContext = nullptr; + } + IContext::~IContext() = default; + IMutableContext::~IMutableContext() = default; + Context::~Context() = default; +} +// end catch_context.cpp +// start catch_debug_console.cpp + +// start catch_debug_console.h + +#include <string> + +namespace Catch { + void writeToDebugConsole( std::string const& text ); +} + +// end catch_debug_console.h +#ifdef CATCH_PLATFORM_WINDOWS + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + ::OutputDebugStringA( text.c_str() ); + } + } + +#else + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + // !TBD: Need a version for Mac/ XCode and other IDEs + Catch::cout() << text; + } + } + +#endif // Platform +// end catch_debug_console.cpp +// start catch_debugger.cpp + +#ifdef CATCH_PLATFORM_MAC + +# include <assert.h> +# include <stdbool.h> +# include <sys/types.h> +# include <unistd.h> +# include <cstddef> +# include <ostream> + +#ifdef __apple_build_version__ + // These headers will only compile with AppleClang (XCode) + // For other compilers (Clang, GCC, ... ) we need to exclude them +# include <sys/sysctl.h> +#endif + + namespace Catch { + #ifdef __apple_build_version__ + // The following function is taken directly from the following technical note: + // https://developer.apple.com/library/archive/qa/qa1361/_index.html + + // Returns true if the current process is being debugged (either + // running under the debugger or has a debugger attached post facto). + bool isDebuggerActive(){ + int mib[4]; + struct kinfo_proc info; + std::size_t size; + + // Initialize the flags so that, if sysctl fails for some bizarre + // reason, we get a predictable result. + + info.kp_proc.p_flag = 0; + + // Initialize mib, which tells sysctl the info we want, in this case + // we're looking for information about a specific process ID. + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + + // Call sysctl. + + size = sizeof(info); + if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) { + Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; + return false; + } + + // We're being debugged if the P_TRACED flag is set. + + return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); + } + #else + bool isDebuggerActive() { + // We need to find another way to determine this for non-appleclang compilers on macOS + return false; + } + #endif + } // namespace Catch + +#elif defined(CATCH_PLATFORM_LINUX) + #include <fstream> + #include <string> + + namespace Catch{ + // The standard POSIX way of detecting a debugger is to attempt to + // ptrace() the process, but this needs to be done from a child and not + // this process itself to still allow attaching to this process later + // if wanted, so is rather heavy. Under Linux we have the PID of the + // "debugger" (which doesn't need to be gdb, of course, it could also + // be strace, for example) in /proc/$PID/status, so just get it from + // there instead. + bool isDebuggerActive(){ + // Libstdc++ has a bug, where std::ifstream sets errno to 0 + // This way our users can properly assert over errno values + ErrnoGuard guard; + std::ifstream in("/proc/self/status"); + for( std::string line; std::getline(in, line); ) { + static const int PREFIX_LEN = 11; + if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) { + // We're traced if the PID is not 0 and no other PID starts + // with 0 digit, so it's enough to check for just a single + // character. + return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0'; + } + } + + return false; + } + } // namespace Catch +#elif defined(_MSC_VER) + extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); + namespace Catch { + bool isDebuggerActive() { + return IsDebuggerPresent() != 0; + } + } +#elif defined(__MINGW32__) + extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); + namespace Catch { + bool isDebuggerActive() { + return IsDebuggerPresent() != 0; + } + } +#else + namespace Catch { + bool isDebuggerActive() { return false; } + } +#endif // Platform +// end catch_debugger.cpp +// start catch_decomposer.cpp + +namespace Catch { + + ITransientExpression::~ITransientExpression() = default; + + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { + if( lhs.size() + rhs.size() < 40 && + lhs.find('\n') == std::string::npos && + rhs.find('\n') == std::string::npos ) + os << lhs << " " << op << " " << rhs; + else + os << lhs << "\n" << op << "\n" << rhs; + } +} +// end catch_decomposer.cpp +// start catch_enforce.cpp + +#include <stdexcept> + +namespace Catch { +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) + [[noreturn]] + void throw_exception(std::exception const& e) { + Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" + << "The message was: " << e.what() << '\n'; + std::terminate(); + } +#endif + + [[noreturn]] + void throw_logic_error(std::string const& msg) { + throw_exception(std::logic_error(msg)); + } + + [[noreturn]] + void throw_domain_error(std::string const& msg) { + throw_exception(std::domain_error(msg)); + } + + [[noreturn]] + void throw_runtime_error(std::string const& msg) { + throw_exception(std::runtime_error(msg)); + } + +} // namespace Catch; +// end catch_enforce.cpp +// start catch_enum_values_registry.cpp +// start catch_enum_values_registry.h + +#include <vector> +#include <memory> + +namespace Catch { + + namespace Detail { + + std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ); + + class EnumValuesRegistry : public IMutableEnumValuesRegistry { + + std::vector<std::unique_ptr<EnumInfo>> m_enumInfos; + + EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values) override; + }; + + std::vector<std::string> parseEnums( StringRef enums ); + + } // Detail + +} // Catch + +// end catch_enum_values_registry.h + +#include <map> +#include <cassert> + +namespace Catch { + + IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {} + + namespace Detail { + + std::vector<std::string> parseEnums( StringRef enums ) { + auto enumValues = splitStringRef( enums, ',' ); + std::vector<std::string> parsed; + parsed.reserve( enumValues.size() ); + for( auto const& enumValue : enumValues ) { + auto identifiers = splitStringRef( enumValue, ':' ); + parsed.push_back( Catch::trim( identifiers.back() ) ); + } + return parsed; + } + + EnumInfo::~EnumInfo() {} + + StringRef EnumInfo::lookup( int value ) const { + for( auto const& valueToName : m_values ) { + if( valueToName.first == value ) + return valueToName.second; + } + return "{** unexpected enum value **}"; + } + + std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) { + std::unique_ptr<EnumInfo> enumInfo( new EnumInfo ); + enumInfo->m_name = enumName; + enumInfo->m_values.reserve( values.size() ); + + const auto valueNames = Catch::Detail::parseEnums( allValueNames ); + assert( valueNames.size() == values.size() ); + std::size_t i = 0; + for( auto value : values ) + enumInfo->m_values.push_back({ value, valueNames[i++] }); + + return enumInfo; + } + + EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) { + auto enumInfo = makeEnumInfo( enumName, allValueNames, values ); + EnumInfo* raw = enumInfo.get(); + m_enumInfos.push_back( std::move( enumInfo ) ); + return *raw; + } + + } // Detail +} // Catch + +// end catch_enum_values_registry.cpp +// start catch_errno_guard.cpp + +#include <cerrno> + +namespace Catch { + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } +} +// end catch_errno_guard.cpp +// start catch_exception_translator_registry.cpp + +// start catch_exception_translator_registry.h + +#include <vector> +#include <string> +#include <memory> + +namespace Catch { + + class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { + public: + ~ExceptionTranslatorRegistry(); + virtual void registerTranslator( const IExceptionTranslator* translator ); + std::string translateActiveException() const override; + std::string tryTranslators() const; + + private: + std::vector<std::unique_ptr<IExceptionTranslator const>> m_translators; + }; +} + +// end catch_exception_translator_registry.h +#ifdef __OBJC__ +#import "Foundation/Foundation.h" +#endif + +namespace Catch { + + ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { + } + + void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { + m_translators.push_back( std::unique_ptr<const IExceptionTranslator>( translator ) ); + } + +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + std::string ExceptionTranslatorRegistry::translateActiveException() const { + try { +#ifdef __OBJC__ + // In Objective-C try objective-c exceptions first + @try { + return tryTranslators(); + } + @catch (NSException *exception) { + return Catch::Detail::stringify( [exception description] ); + } +#else + // Compiling a mixed mode project with MSVC means that CLR + // exceptions will be caught in (...) as well. However, these + // do not fill-in std::current_exception and thus lead to crash + // when attempting rethrow. + // /EHa switch also causes structured exceptions to be caught + // here, but they fill-in current_exception properly, so + // at worst the output should be a little weird, instead of + // causing a crash. + if (std::current_exception() == nullptr) { + return "Non C++ exception. Possibly a CLR exception."; + } + return tryTranslators(); +#endif + } + catch( TestFailureException& ) { + std::rethrow_exception(std::current_exception()); + } + catch( std::exception& ex ) { + return ex.what(); + } + catch( std::string& msg ) { + return msg; + } + catch( const char* msg ) { + return msg; + } + catch(...) { + return "Unknown exception"; + } + } + + std::string ExceptionTranslatorRegistry::tryTranslators() const { + if (m_translators.empty()) { + std::rethrow_exception(std::current_exception()); + } else { + return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end()); + } + } + +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + std::string ExceptionTranslatorRegistry::translateActiveException() const { + CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + } + + std::string ExceptionTranslatorRegistry::tryTranslators() const { + CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + } +#endif + +} +// end catch_exception_translator_registry.cpp +// start catch_fatal_condition.cpp + +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace { + // Report the error condition + void reportFatal( char const * const message ) { + Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); + } +} + +#endif // signals/SEH handling + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + struct SignalDefs { DWORD id; const char* name; }; + + // There is no 1-1 mapping between signals and windows exceptions. + // Windows can easily distinguish between SO and SigSegV, + // but SigInt, SigTerm, etc are handled differently. + static SignalDefs signalDefs[] = { + { static_cast<DWORD>(EXCEPTION_ILLEGAL_INSTRUCTION), "SIGILL - Illegal instruction signal" }, + { static_cast<DWORD>(EXCEPTION_STACK_OVERFLOW), "SIGSEGV - Stack overflow" }, + { static_cast<DWORD>(EXCEPTION_ACCESS_VIOLATION), "SIGSEGV - Segmentation violation signal" }, + { static_cast<DWORD>(EXCEPTION_INT_DIVIDE_BY_ZERO), "Divide by zero error" }, + }; + + LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { + for (auto const& def : signalDefs) { + if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) { + reportFatal(def.name); + } + } + // If its not an exception we care about, pass it along. + // This stops us from eating debugger breaks etc. + return EXCEPTION_CONTINUE_SEARCH; + } + + FatalConditionHandler::FatalConditionHandler() { + isSet = true; + // 32k seems enough for Catch to handle stack overflow, + // but the value was found experimentally, so there is no strong guarantee + guaranteeSize = 32 * 1024; + exceptionHandlerHandle = nullptr; + // Register as first handler in current chain + exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); + // Pass in guarantee size to be filled + SetThreadStackGuarantee(&guaranteeSize); + } + + void FatalConditionHandler::reset() { + if (isSet) { + RemoveVectoredExceptionHandler(exceptionHandlerHandle); + SetThreadStackGuarantee(&guaranteeSize); + exceptionHandlerHandle = nullptr; + isSet = false; + } + } + + FatalConditionHandler::~FatalConditionHandler() { + reset(); + } + +bool FatalConditionHandler::isSet = false; +ULONG FatalConditionHandler::guaranteeSize = 0; +PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; + +} // namespace Catch + +#elif defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace Catch { + + struct SignalDefs { + int id; + const char* name; + }; + + // 32kb for the alternate stack seems to be sufficient. However, this value + // is experimentally determined, so that's not guaranteed. + constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; + + static SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { SIGILL, "SIGILL - Illegal instruction signal" }, + { SIGFPE, "SIGFPE - Floating point error signal" }, + { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, + { SIGTERM, "SIGTERM - Termination request signal" }, + { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } + }; + + void FatalConditionHandler::handleSignal( int sig ) { + char const * name = "<unknown signal>"; + for (auto const& def : signalDefs) { + if (sig == def.id) { + name = def.name; + break; + } + } + reset(); + reportFatal(name); + raise( sig ); + } + + FatalConditionHandler::FatalConditionHandler() { + isSet = true; + stack_t sigStack; + sigStack.ss_sp = altStackMem; + sigStack.ss_size = sigStackSize; + sigStack.ss_flags = 0; + sigaltstack(&sigStack, &oldSigStack); + struct sigaction sa = { }; + + sa.sa_handler = handleSignal; + sa.sa_flags = SA_ONSTACK; + for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) { + sigaction(signalDefs[i].id, &sa, &oldSigActions[i]); + } + } + + FatalConditionHandler::~FatalConditionHandler() { + reset(); + } + + void FatalConditionHandler::reset() { + if( isSet ) { + // Set signals back to previous values -- hopefully nobody overwrote them in the meantime + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { + sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); + } + // Return the old stack + sigaltstack(&oldSigStack, nullptr); + isSet = false; + } + } + + bool FatalConditionHandler::isSet = false; + struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; + char FatalConditionHandler::altStackMem[sigStackSize] = {}; + +} // namespace Catch + +#else + +namespace Catch { + void FatalConditionHandler::reset() {} +} + +#endif // signals/SEH handling + +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif +// end catch_fatal_condition.cpp +// start catch_generators.cpp + +// start catch_random_number_generator.h + +#include <algorithm> +#include <random> + +namespace Catch { + + struct IConfig; + + std::mt19937& rng(); + void seedRng( IConfig const& config ); + unsigned int rngSeed(); + +} + +// end catch_random_number_generator.h +#include <limits> +#include <set> + +namespace Catch { + +IGeneratorTracker::~IGeneratorTracker() {} + +const char* GeneratorException::what() const noexcept { + return m_msg; +} + +namespace Generators { + + GeneratorUntypedBase::~GeneratorUntypedBase() {} + + auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + return getResultCapture().acquireGeneratorTracker( lineInfo ); + } + +} // namespace Generators +} // namespace Catch +// end catch_generators.cpp +// start catch_interfaces_capture.cpp + +namespace Catch { + IResultCapture::~IResultCapture() = default; +} +// end catch_interfaces_capture.cpp +// start catch_interfaces_config.cpp + +namespace Catch { + IConfig::~IConfig() = default; +} +// end catch_interfaces_config.cpp +// start catch_interfaces_exception.cpp + +namespace Catch { + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; +} +// end catch_interfaces_exception.cpp +// start catch_interfaces_registry_hub.cpp + +namespace Catch { + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; +} +// end catch_interfaces_registry_hub.cpp +// start catch_interfaces_reporter.cpp + +// start catch_reporter_listening.h + +namespace Catch { + + class ListeningReporter : public IStreamingReporter { + using Reporters = std::vector<IStreamingReporterPtr>; + Reporters m_listeners; + IStreamingReporterPtr m_reporter = nullptr; + ReporterPreferences m_preferences; + + public: + ListeningReporter(); + + void addListener( IStreamingReporterPtr&& listener ); + void addReporter( IStreamingReporterPtr&& reporter ); + + public: // IStreamingReporter + + ReporterPreferences getPreferences() const override; + + void noMatchingTestCases( std::string const& spec ) override; + + static std::set<Verbosity> getSupportedVerbosities(); + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + void benchmarkPreparing(std::string const& name) override; + void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; + void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; + void benchmarkFailed(std::string const&) override; +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + void testRunStarting( TestRunInfo const& testRunInfo ) override; + void testGroupStarting( GroupInfo const& groupInfo ) override; + void testCaseStarting( TestCaseInfo const& testInfo ) override; + void sectionStarting( SectionInfo const& sectionInfo ) override; + void assertionStarting( AssertionInfo const& assertionInfo ) override; + + // The return value indicates if the messages buffer should be cleared: + bool assertionEnded( AssertionStats const& assertionStats ) override; + void sectionEnded( SectionStats const& sectionStats ) override; + void testCaseEnded( TestCaseStats const& testCaseStats ) override; + void testGroupEnded( TestGroupStats const& testGroupStats ) override; + void testRunEnded( TestRunStats const& testRunStats ) override; + + void skipTest( TestCaseInfo const& testInfo ) override; + bool isMulti() const override; + + }; + +} // end namespace Catch + +// end catch_reporter_listening.h +namespace Catch { + + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig ) + : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ) + : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} + + std::ostream& ReporterConfig::stream() const { return *m_stream; } + IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; } + + TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {} + + GroupInfo::GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ) + : name( _name ), + groupIndex( _groupIndex ), + groupsCounts( _groupsCount ) + {} + + AssertionStats::AssertionStats( AssertionResult const& _assertionResult, + std::vector<MessageInfo> const& _infoMessages, + Totals const& _totals ) + : assertionResult( _assertionResult ), + infoMessages( _infoMessages ), + totals( _totals ) + { + assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression; + + if( assertionResult.hasMessage() ) { + // Copy message into messages list. + // !TBD This should have been done earlier, somewhere + MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); + builder << assertionResult.getMessage(); + builder.m_info.message = builder.m_stream.str(); + + infoMessages.push_back( builder.m_info ); + } + } + + AssertionStats::~AssertionStats() = default; + + SectionStats::SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ) + : sectionInfo( _sectionInfo ), + assertions( _assertions ), + durationInSeconds( _durationInSeconds ), + missingAssertions( _missingAssertions ) + {} + + SectionStats::~SectionStats() = default; + + TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ) + : testInfo( _testInfo ), + totals( _totals ), + stdOut( _stdOut ), + stdErr( _stdErr ), + aborting( _aborting ) + {} + + TestCaseStats::~TestCaseStats() = default; + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ) + : groupInfo( _groupInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo ) + : groupInfo( _groupInfo ), + aborting( false ) + {} + + TestGroupStats::~TestGroupStats() = default; + + TestRunStats::TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ) + : runInfo( _runInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestRunStats::~TestRunStats() = default; + + void IStreamingReporter::fatalErrorEncountered( StringRef ) {} + bool IStreamingReporter::isMulti() const { return false; } + + IReporterFactory::~IReporterFactory() = default; + IReporterRegistry::~IReporterRegistry() = default; + +} // end namespace Catch +// end catch_interfaces_reporter.cpp +// start catch_interfaces_runner.cpp + +namespace Catch { + IRunner::~IRunner() = default; +} +// end catch_interfaces_runner.cpp +// start catch_interfaces_testcase.cpp + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} +// end catch_interfaces_testcase.cpp +// start catch_leak_detector.cpp + +#ifdef CATCH_CONFIG_WINDOWS_CRTDBG +#include <crtdbg.h> + +namespace Catch { + + LeakDetector::LeakDetector() { + int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + flag |= _CRTDBG_LEAK_CHECK_DF; + flag |= _CRTDBG_ALLOC_MEM_DF; + _CrtSetDbgFlag(flag); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + // Change this to leaking allocation's number to break there + _CrtSetBreakAlloc(-1); + } +} + +#else + + Catch::LeakDetector::LeakDetector() {} + +#endif + +Catch::LeakDetector::~LeakDetector() { + Catch::cleanUp(); +} +// end catch_leak_detector.cpp +// start catch_list.cpp + +// start catch_list.h + +#include <set> + +namespace Catch { + + std::size_t listTests( Config const& config ); + + std::size_t listTestsNamesOnly( Config const& config ); + + struct TagInfo { + void add( std::string const& spelling ); + std::string all() const; + + std::set<std::string> spellings; + std::size_t count = 0; + }; + + std::size_t listTags( Config const& config ); + + std::size_t listReporters(); + + Option<std::size_t> list( std::shared_ptr<Config> const& config ); + +} // end namespace Catch + +// end catch_list.h +// start catch_text.h + +namespace Catch { + using namespace clara::TextFlow; +} + +// end catch_text.h +#include <limits> +#include <algorithm> +#include <iomanip> + +namespace Catch { + + std::size_t listTests( Config const& config ) { + TestSpec testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Matching test cases:\n"; + else { + Catch::cout() << "All available test cases:\n"; + } + + auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + Colour::Code colour = testCaseInfo.isHidden() + ? Colour::SecondaryText + : Colour::None; + Colour colourGuard( colour ); + + Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; + if( config.verbosity() >= Verbosity::High ) { + Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; + std::string description = testCaseInfo.description; + if( description.empty() ) + description = "(NO DESCRIPTION)"; + Catch::cout() << Column( description ).indent(4) << std::endl; + } + if( !testCaseInfo.tags.empty() ) + Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; + } + + if( !config.hasTestFilters() ) + Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; + else + Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; + return matchedTestCases.size(); + } + + std::size_t listTestsNamesOnly( Config const& config ) { + TestSpec testSpec = config.testSpec(); + std::size_t matchedTests = 0; + std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + matchedTests++; + if( startsWith( testCaseInfo.name, '#' ) ) + Catch::cout() << '"' << testCaseInfo.name << '"'; + else + Catch::cout() << testCaseInfo.name; + if ( config.verbosity() >= Verbosity::High ) + Catch::cout() << "\t@" << testCaseInfo.lineInfo; + Catch::cout() << std::endl; + } + return matchedTests; + } + + void TagInfo::add( std::string const& spelling ) { + ++count; + spellings.insert( spelling ); + } + + std::string TagInfo::all() const { + std::string out; + for( auto const& spelling : spellings ) + out += "[" + spelling + "]"; + return out; + } + + std::size_t listTags( Config const& config ) { + TestSpec testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Tags for matching test cases:\n"; + else { + Catch::cout() << "All available tags:\n"; + } + + std::map<std::string, TagInfo> tagCounts; + + std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCase : matchedTestCases ) { + for( auto const& tagName : testCase.getTestCaseInfo().tags ) { + std::string lcaseTagName = toLower( tagName ); + auto countIt = tagCounts.find( lcaseTagName ); + if( countIt == tagCounts.end() ) + countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first; + countIt->second.add( tagName ); + } + } + + for( auto const& tagCount : tagCounts ) { + ReusableStringStream rss; + rss << " " << std::setw(2) << tagCount.second.count << " "; + auto str = rss.str(); + auto wrapper = Column( tagCount.second.all() ) + .initialIndent( 0 ) + .indent( str.size() ) + .width( CATCH_CONFIG_CONSOLE_WIDTH-10 ); + Catch::cout() << str << wrapper << '\n'; + } + Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; + return tagCounts.size(); + } + + std::size_t listReporters() { + Catch::cout() << "Available reporters:\n"; + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + std::size_t maxNameLen = 0; + for( auto const& factoryKvp : factories ) + maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() ); + + for( auto const& factoryKvp : factories ) { + Catch::cout() + << Column( factoryKvp.first + ":" ) + .indent(2) + .width( 5+maxNameLen ) + + Column( factoryKvp.second->getDescription() ) + .initialIndent(0) + .indent(2) + .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) + << "\n"; + } + Catch::cout() << std::endl; + return factories.size(); + } + + Option<std::size_t> list( std::shared_ptr<Config> const& config ) { + Option<std::size_t> listedCount; + getCurrentMutableContext().setConfig( config ); + if( config->listTests() ) + listedCount = listedCount.valueOr(0) + listTests( *config ); + if( config->listTestNamesOnly() ) + listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config ); + if( config->listTags() ) + listedCount = listedCount.valueOr(0) + listTags( *config ); + if( config->listReporters() ) + listedCount = listedCount.valueOr(0) + listReporters(); + return listedCount; + } + +} // end namespace Catch +// end catch_list.cpp +// start catch_matchers.cpp + +namespace Catch { +namespace Matchers { + namespace Impl { + + std::string MatcherUntypedBase::toString() const { + if( m_cachedToString.empty() ) + m_cachedToString = describe(); + return m_cachedToString; + } + + MatcherUntypedBase::~MatcherUntypedBase() = default; + + } // namespace Impl +} // namespace Matchers + +using namespace Matchers; +using Matchers::Impl::MatcherBase; + +} // namespace Catch +// end catch_matchers.cpp +// start catch_matchers_floating.cpp + +// start catch_polyfills.hpp + +namespace Catch { + bool isnan(float f); + bool isnan(double d); +} + +// end catch_polyfills.hpp +// start catch_to_string.hpp + +#include <string> + +namespace Catch { + template <typename T> + std::string to_string(T const& t) { +#if defined(CATCH_CONFIG_CPP11_TO_STRING) + return std::to_string(t); +#else + ReusableStringStream rss; + rss << t; + return rss.str(); +#endif + } +} // end namespace Catch + +// end catch_to_string.hpp +#include <cstdlib> +#include <cstdint> +#include <cstring> +#include <sstream> +#include <iomanip> +#include <limits> + +namespace Catch { +namespace Matchers { +namespace Floating { +enum class FloatingPointKind : uint8_t { + Float, + Double +}; +} +} +} + +namespace { + +template <typename T> +struct Converter; + +template <> +struct Converter<float> { + static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); + Converter(float f) { + std::memcpy(&i, &f, sizeof(f)); + } + int32_t i; +}; + +template <> +struct Converter<double> { + static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); + Converter(double d) { + std::memcpy(&i, &d, sizeof(d)); + } + int64_t i; +}; + +template <typename T> +auto convert(T t) -> Converter<T> { + return Converter<T>(t); +} + +template <typename FP> +bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) { + // Comparison with NaN should always be false. + // This way we can rule it out before getting into the ugly details + if (Catch::isnan(lhs) || Catch::isnan(rhs)) { + return false; + } + + auto lc = convert(lhs); + auto rc = convert(rhs); + + if ((lc.i < 0) != (rc.i < 0)) { + // Potentially we can have +0 and -0 + return lhs == rhs; + } + + auto ulpDiff = std::abs(lc.i - rc.i); + return ulpDiff <= maxUlpDiff; +} + +template <typename FP> +FP step(FP start, FP direction, int steps) { + for (int i = 0; i < steps; ++i) { + start = std::nextafter(start, direction); + } + return start; +} + +} // end anonymous namespace + +namespace Catch { +namespace Matchers { +namespace Floating { + WithinAbsMatcher::WithinAbsMatcher(double target, double margin) + :m_target{ target }, m_margin{ margin } { + CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.' + << " Margin has to be non-negative."); + } + + // Performs equivalent check of std::fabs(lhs - rhs) <= margin + // But without the subtraction to allow for INFINITY in comparison + bool WithinAbsMatcher::match(double const& matchee) const { + return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee); + } + + std::string WithinAbsMatcher::describe() const { + return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); + } + + WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType) + :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { + CATCH_ENFORCE(ulps >= 0, "Invalid ULP setting: " << ulps << '.' + << " ULPs have to be non-negative."); + } + +#if defined(__clang__) +#pragma clang diagnostic push +// Clang <3.5 reports on the default branch in the switch below +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif + + bool WithinUlpsMatcher::match(double const& matchee) const { + switch (m_type) { + case FloatingPointKind::Float: + return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps); + case FloatingPointKind::Double: + return almostEqualUlps<double>(matchee, m_target, m_ulps); + default: + CATCH_INTERNAL_ERROR( "Unknown FloatingPointKind value" ); + } + } + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + + std::string WithinUlpsMatcher::describe() const { + std::stringstream ret; + + ret << "is within " << m_ulps << " ULPs of " << ::Catch::Detail::stringify(m_target); + + if (m_type == FloatingPointKind::Float) { + ret << 'f'; + } + + ret << " (["; + ret << std::fixed << std::setprecision(std::numeric_limits<double>::max_digits10); + if (m_type == FloatingPointKind::Double) { + ret << step(m_target, static_cast<double>(-INFINITY), m_ulps) + << ", " + << step(m_target, static_cast<double>(INFINITY), m_ulps); + } else { + ret << step<float>(static_cast<float>(m_target), -INFINITY, m_ulps) + << ", " + << step<float>(static_cast<float>(m_target), INFINITY, m_ulps); + } + ret << "])"; + + return ret.str(); + //return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : ""); + } + +}// namespace Floating + +Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) { + return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double); +} + +Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) { + return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float); +} + +Floating::WithinAbsMatcher WithinAbs(double target, double margin) { + return Floating::WithinAbsMatcher(target, margin); +} + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_floating.cpp +// start catch_matchers_generic.cpp + +std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) { + if (desc.empty()) { + return "matches undescribed predicate"; + } else { + return "matches predicate: \"" + desc + '"'; + } +} +// end catch_matchers_generic.cpp +// start catch_matchers_string.cpp + +#include <regex> + +namespace Catch { +namespace Matchers { + + namespace StdString { + + CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_str( adjustString( str ) ) + {} + std::string CasedString::adjustString( std::string const& str ) const { + return m_caseSensitivity == CaseSensitive::No + ? toLower( str ) + : str; + } + std::string CasedString::caseSensitivitySuffix() const { + return m_caseSensitivity == CaseSensitive::No + ? " (case insensitive)" + : std::string(); + } + + StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) + : m_comparator( comparator ), + m_operation( operation ) { + } + + std::string StringMatcherBase::describe() const { + std::string description; + description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + + m_comparator.caseSensitivitySuffix().size()); + description += m_operation; + description += ": \""; + description += m_comparator.m_str; + description += "\""; + description += m_comparator.caseSensitivitySuffix(); + return description; + } + + EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + + bool EqualsMatcher::match( std::string const& source ) const { + return m_comparator.adjustString( source ) == m_comparator.m_str; + } + + ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} + + bool ContainsMatcher::match( std::string const& source ) const { + return contains( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {} + + bool StartsWithMatcher::match( std::string const& source ) const { + return startsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {} + + bool EndsWithMatcher::match( std::string const& source ) const { + return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} + + bool RegexMatcher::match(std::string const& matchee) const { + auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway + if (m_caseSensitivity == CaseSensitive::Choice::No) { + flags |= std::regex::icase; + } + auto reg = std::regex(m_regex, flags); + return std::regex_match(matchee, reg); + } + + std::string RegexMatcher::describe() const { + return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively"); + } + + } // namespace StdString + + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } + + StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) { + return StdString::RegexMatcher(regex, caseSensitivity); + } + +} // namespace Matchers +} // namespace Catch +// end catch_matchers_string.cpp +// start catch_message.cpp + +// start catch_uncaught_exceptions.h + +namespace Catch { + bool uncaught_exceptions(); +} // end namespace Catch + +// end catch_uncaught_exceptions.h +#include <cassert> +#include <stack> + +namespace Catch { + + MessageInfo::MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ) + : macroName( _macroName ), + lineInfo( _lineInfo ), + type( _type ), + sequence( ++globalCount ) + {} + + bool MessageInfo::operator==( MessageInfo const& other ) const { + return sequence == other.sequence; + } + + bool MessageInfo::operator<( MessageInfo const& other ) const { + return sequence < other.sequence; + } + + // This may need protecting if threading support is added + unsigned int MessageInfo::globalCount = 0; + + //////////////////////////////////////////////////////////////////////////// + + Catch::MessageBuilder::MessageBuilder( StringRef const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ) + :m_info(macroName, lineInfo, type) {} + + //////////////////////////////////////////////////////////////////////////// + + ScopedMessage::ScopedMessage( MessageBuilder const& builder ) + : m_info( builder.m_info ), m_moved() + { + m_info.message = builder.m_stream.str(); + getResultCapture().pushScopedMessage( m_info ); + } + + ScopedMessage::ScopedMessage( ScopedMessage&& old ) + : m_info( old.m_info ), m_moved() + { + old.m_moved = true; + } + + ScopedMessage::~ScopedMessage() { + if ( !uncaught_exceptions() && !m_moved ){ + getResultCapture().popScopedMessage(m_info); + } + } + + Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { + auto trimmed = [&] (size_t start, size_t end) { + while (names[start] == ',' || isspace(names[start])) { + ++start; + } + while (names[end] == ',' || isspace(names[end])) { + --end; + } + return names.substr(start, end - start + 1); + }; + auto skipq = [&] (size_t start, char quote) { + for (auto i = start + 1; i < names.size() ; ++i) { + if (names[i] == quote) + return i; + if (names[i] == '\\') + ++i; + } + CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote"); + }; + + size_t start = 0; + std::stack<char> openings; + for (size_t pos = 0; pos < names.size(); ++pos) { + char c = names[pos]; + switch (c) { + case '[': + case '{': + case '(': + // It is basically impossible to disambiguate between + // comparison and start of template args in this context +// case '<': + openings.push(c); + break; + case ']': + case '}': + case ')': +// case '>': + openings.pop(); + break; + case '"': + case '\'': + pos = skipq(pos, c); + break; + case ',': + if (start != pos && openings.size() == 0) { + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = trimmed(start, pos); + m_messages.back().message += " := "; + start = pos; + } + } + } + assert(openings.size() == 0 && "Mismatched openings"); + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = trimmed(start, names.size() - 1); + m_messages.back().message += " := "; + } + Capturer::~Capturer() { + if ( !uncaught_exceptions() ){ + assert( m_captured == m_messages.size() ); + for( size_t i = 0; i < m_captured; ++i ) + m_resultCapture.popScopedMessage( m_messages[i] ); + } + } + + void Capturer::captureValue( size_t index, std::string const& value ) { + assert( index < m_messages.size() ); + m_messages[index].message += value; + m_resultCapture.pushScopedMessage( m_messages[index] ); + m_captured++; + } + +} // end namespace Catch +// end catch_message.cpp +// start catch_output_redirect.cpp + +// start catch_output_redirect.h +#ifndef TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H +#define TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H + +#include <cstdio> +#include <iosfwd> +#include <string> + +namespace Catch { + + class RedirectedStream { + std::ostream& m_originalStream; + std::ostream& m_redirectionStream; + std::streambuf* m_prevBuf; + + public: + RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ); + ~RedirectedStream(); + }; + + class RedirectedStdOut { + ReusableStringStream m_rss; + RedirectedStream m_cout; + public: + RedirectedStdOut(); + auto str() const -> std::string; + }; + + // StdErr has two constituent streams in C++, std::cerr and std::clog + // This means that we need to redirect 2 streams into 1 to keep proper + // order of writes + class RedirectedStdErr { + ReusableStringStream m_rss; + RedirectedStream m_cerr; + RedirectedStream m_clog; + public: + RedirectedStdErr(); + auto str() const -> std::string; + }; + + class RedirectedStreams { + public: + RedirectedStreams(RedirectedStreams const&) = delete; + RedirectedStreams& operator=(RedirectedStreams const&) = delete; + RedirectedStreams(RedirectedStreams&&) = delete; + RedirectedStreams& operator=(RedirectedStreams&&) = delete; + + RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr); + ~RedirectedStreams(); + private: + std::string& m_redirectedCout; + std::string& m_redirectedCerr; + RedirectedStdOut m_redirectedStdOut; + RedirectedStdErr m_redirectedStdErr; + }; + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + + // Windows's implementation of std::tmpfile is terrible (it tries + // to create a file inside system folder, thus requiring elevated + // privileges for the binary), so we have to use tmpnam(_s) and + // create the file ourselves there. + class TempFile { + public: + TempFile(TempFile const&) = delete; + TempFile& operator=(TempFile const&) = delete; + TempFile(TempFile&&) = delete; + TempFile& operator=(TempFile&&) = delete; + + TempFile(); + ~TempFile(); + + std::FILE* getFile(); + std::string getContents(); + + private: + std::FILE* m_file = nullptr; + #if defined(_MSC_VER) + char m_buffer[L_tmpnam] = { 0 }; + #endif + }; + + class OutputRedirect { + public: + OutputRedirect(OutputRedirect const&) = delete; + OutputRedirect& operator=(OutputRedirect const&) = delete; + OutputRedirect(OutputRedirect&&) = delete; + OutputRedirect& operator=(OutputRedirect&&) = delete; + + OutputRedirect(std::string& stdout_dest, std::string& stderr_dest); + ~OutputRedirect(); + + private: + int m_originalStdout = -1; + int m_originalStderr = -1; + TempFile m_stdoutFile; + TempFile m_stderrFile; + std::string& m_stdoutDest; + std::string& m_stderrDest; + }; + +#endif + +} // end namespace Catch + +#endif // TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H +// end catch_output_redirect.h +#include <cstdio> +#include <cstring> +#include <fstream> +#include <sstream> +#include <stdexcept> + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #include <io.h> //_dup and _dup2 + #define dup _dup + #define dup2 _dup2 + #define fileno _fileno + #else + #include <unistd.h> // dup and dup2 + #endif +#endif + +namespace Catch { + + RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ) + : m_originalStream( originalStream ), + m_redirectionStream( redirectionStream ), + m_prevBuf( m_originalStream.rdbuf() ) + { + m_originalStream.rdbuf( m_redirectionStream.rdbuf() ); + } + + RedirectedStream::~RedirectedStream() { + m_originalStream.rdbuf( m_prevBuf ); + } + + RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} + auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); } + + RedirectedStdErr::RedirectedStdErr() + : m_cerr( Catch::cerr(), m_rss.get() ), + m_clog( Catch::clog(), m_rss.get() ) + {} + auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); } + + RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr) + : m_redirectedCout(redirectedCout), + m_redirectedCerr(redirectedCerr) + {} + + RedirectedStreams::~RedirectedStreams() { + m_redirectedCout += m_redirectedStdOut.str(); + m_redirectedCerr += m_redirectedStdErr.str(); + } + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + +#if defined(_MSC_VER) + TempFile::TempFile() { + if (tmpnam_s(m_buffer)) { + CATCH_RUNTIME_ERROR("Could not get a temp filename"); + } + if (fopen_s(&m_file, m_buffer, "w")) { + char buffer[100]; + if (strerror_s(buffer, errno)) { + CATCH_RUNTIME_ERROR("Could not translate errno to a string"); + } + CATCH_RUNTIME_ERROR("Could not open the temp file: '" << m_buffer << "' because: " << buffer); + } + } +#else + TempFile::TempFile() { + m_file = std::tmpfile(); + if (!m_file) { + CATCH_RUNTIME_ERROR("Could not create a temp file."); + } + } + +#endif + + TempFile::~TempFile() { + // TBD: What to do about errors here? + std::fclose(m_file); + // We manually create the file on Windows only, on Linux + // it will be autodeleted +#if defined(_MSC_VER) + std::remove(m_buffer); +#endif + } + + FILE* TempFile::getFile() { + return m_file; + } + + std::string TempFile::getContents() { + std::stringstream sstr; + char buffer[100] = {}; + std::rewind(m_file); + while (std::fgets(buffer, sizeof(buffer), m_file)) { + sstr << buffer; + } + return sstr.str(); + } + + OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) : + m_originalStdout(dup(1)), + m_originalStderr(dup(2)), + m_stdoutDest(stdout_dest), + m_stderrDest(stderr_dest) { + dup2(fileno(m_stdoutFile.getFile()), 1); + dup2(fileno(m_stderrFile.getFile()), 2); + } + + OutputRedirect::~OutputRedirect() { + Catch::cout() << std::flush; + fflush(stdout); + // Since we support overriding these streams, we flush cerr + // even though std::cerr is unbuffered + Catch::cerr() << std::flush; + Catch::clog() << std::flush; + fflush(stderr); + + dup2(m_originalStdout, 1); + dup2(m_originalStderr, 2); + + m_stdoutDest += m_stdoutFile.getContents(); + m_stderrDest += m_stderrFile.getContents(); + } + +#endif // CATCH_CONFIG_NEW_CAPTURE + +} // namespace Catch + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #undef dup + #undef dup2 + #undef fileno + #endif +#endif +// end catch_output_redirect.cpp +// start catch_polyfills.cpp + +#include <cmath> + +namespace Catch { + +#if !defined(CATCH_CONFIG_POLYFILL_ISNAN) + bool isnan(float f) { + return std::isnan(f); + } + bool isnan(double d) { + return std::isnan(d); + } +#else + // For now we only use this for embarcadero + bool isnan(float f) { + return std::_isnan(f); + } + bool isnan(double d) { + return std::_isnan(d); + } +#endif + +} // end namespace Catch +// end catch_polyfills.cpp +// start catch_random_number_generator.cpp + +namespace Catch { + + std::mt19937& rng() { + static std::mt19937 s_rng; + return s_rng; + } + + void seedRng( IConfig const& config ) { + if( config.rngSeed() != 0 ) { + std::srand( config.rngSeed() ); + rng().seed( config.rngSeed() ); + } + } + + unsigned int rngSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } +} +// end catch_random_number_generator.cpp +// start catch_registry_hub.cpp + +// start catch_test_case_registry_impl.h + +#include <vector> +#include <set> +#include <algorithm> +#include <ios> + +namespace Catch { + + class TestCase; + struct IConfig; + + std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ); + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + + void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ); + + std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ); + + class TestRegistry : public ITestCaseRegistry { + public: + virtual ~TestRegistry() = default; + + virtual void registerTest( TestCase const& testCase ); + + std::vector<TestCase> const& getAllTests() const override; + std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override; + + private: + std::vector<TestCase> m_functions; + mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder; + mutable std::vector<TestCase> m_sortedFunctions; + std::size_t m_unnamedCount = 0; + std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised + }; + + /////////////////////////////////////////////////////////////////////////// + + class TestInvokerAsFunction : public ITestInvoker { + void(*m_testAsFunction)(); + public: + TestInvokerAsFunction( void(*testAsFunction)() ) noexcept; + + void invoke() const override; + }; + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ); + + /////////////////////////////////////////////////////////////////////////// + +} // end namespace Catch + +// end catch_test_case_registry_impl.h +// start catch_reporter_registry.h + +#include <map> + +namespace Catch { + + class ReporterRegistry : public IReporterRegistry { + + public: + + ~ReporterRegistry() override; + + IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; + + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); + void registerListener( IReporterFactoryPtr const& factory ); + + FactoryMap const& getFactories() const override; + Listeners const& getListeners() const override; + + private: + FactoryMap m_factories; + Listeners m_listeners; + }; +} + +// end catch_reporter_registry.h +// start catch_tag_alias_registry.h + +// start catch_tag_alias.h + +#include <string> + +namespace Catch { + + struct TagAlias { + TagAlias(std::string const& _tag, SourceLineInfo _lineInfo); + + std::string tag; + SourceLineInfo lineInfo; + }; + +} // end namespace Catch + +// end catch_tag_alias.h +#include <map> + +namespace Catch { + + class TagAliasRegistry : public ITagAliasRegistry { + public: + ~TagAliasRegistry() override; + TagAlias const* find( std::string const& alias ) const override; + std::string expandAliases( std::string const& unexpandedTestSpec ) const override; + void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); + + private: + std::map<std::string, TagAlias> m_registry; + }; + +} // end namespace Catch + +// end catch_tag_alias_registry.h +// start catch_startup_exception_registry.h + +#include <vector> +#include <exception> + +namespace Catch { + + class StartupExceptionRegistry { + public: + void add(std::exception_ptr const& exception) noexcept; + std::vector<std::exception_ptr> const& getExceptions() const noexcept; + private: + std::vector<std::exception_ptr> m_exceptions; + }; + +} // end namespace Catch + +// end catch_startup_exception_registry.h +// start catch_singletons.hpp + +namespace Catch { + + struct ISingleton { + virtual ~ISingleton(); + }; + + void addSingleton( ISingleton* singleton ); + void cleanupSingletons(); + + template<typename SingletonImplT, typename InterfaceT = SingletonImplT, typename MutableInterfaceT = InterfaceT> + class Singleton : SingletonImplT, public ISingleton { + + static auto getInternal() -> Singleton* { + static Singleton* s_instance = nullptr; + if( !s_instance ) { + s_instance = new Singleton; + addSingleton( s_instance ); + } + return s_instance; + } + + public: + static auto get() -> InterfaceT const& { + return *getInternal(); + } + static auto getMutable() -> MutableInterfaceT& { + return *getInternal(); + } + }; + +} // namespace Catch + +// end catch_singletons.hpp +namespace Catch { + + namespace { + + class RegistryHub : public IRegistryHub, public IMutableRegistryHub, + private NonCopyable { + + public: // IRegistryHub + RegistryHub() = default; + IReporterRegistry const& getReporterRegistry() const override { + return m_reporterRegistry; + } + ITestCaseRegistry const& getTestCaseRegistry() const override { + return m_testCaseRegistry; + } + IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override { + return m_exceptionTranslatorRegistry; + } + ITagAliasRegistry const& getTagAliasRegistry() const override { + return m_tagAliasRegistry; + } + StartupExceptionRegistry const& getStartupExceptionRegistry() const override { + return m_exceptionRegistry; + } + + public: // IMutableRegistryHub + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerReporter( name, factory ); + } + void registerListener( IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerListener( factory ); + } + void registerTest( TestCase const& testInfo ) override { + m_testCaseRegistry.registerTest( testInfo ); + } + void registerTranslator( const IExceptionTranslator* translator ) override { + m_exceptionTranslatorRegistry.registerTranslator( translator ); + } + void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { + m_tagAliasRegistry.add( alias, tag, lineInfo ); + } + void registerStartupException() noexcept override { + m_exceptionRegistry.add(std::current_exception()); + } + IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override { + return m_enumValuesRegistry; + } + + private: + TestRegistry m_testCaseRegistry; + ReporterRegistry m_reporterRegistry; + ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; + TagAliasRegistry m_tagAliasRegistry; + StartupExceptionRegistry m_exceptionRegistry; + Detail::EnumValuesRegistry m_enumValuesRegistry; + }; + } + + using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>; + + IRegistryHub const& getRegistryHub() { + return RegistryHubSingleton::get(); + } + IMutableRegistryHub& getMutableRegistryHub() { + return RegistryHubSingleton::getMutable(); + } + void cleanUp() { + cleanupSingletons(); + cleanUpContext(); + } + std::string translateActiveException() { + return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); + } + +} // end namespace Catch +// end catch_registry_hub.cpp +// start catch_reporter_registry.cpp + +namespace Catch { + + ReporterRegistry::~ReporterRegistry() = default; + + IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { + auto it = m_factories.find( name ); + if( it == m_factories.end() ) + return nullptr; + return it->second->create( ReporterConfig( config ) ); + } + + void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { + m_factories.emplace(name, factory); + } + void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { + m_listeners.push_back( factory ); + } + + IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { + return m_factories; + } + IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { + return m_listeners; + } + +} +// end catch_reporter_registry.cpp +// start catch_result_type.cpp + +namespace Catch { + + bool isOk( ResultWas::OfType resultType ) { + return ( resultType & ResultWas::FailureBit ) == 0; + } + bool isJustInfo( int flags ) { + return flags == ResultWas::Info; + } + + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { + return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) ); + } + + bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } + bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } + +} // end namespace Catch +// end catch_result_type.cpp +// start catch_run_context.cpp + +#include <cassert> +#include <algorithm> +#include <sstream> + +namespace Catch { + + namespace Generators { + struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { + GeneratorBasePtr m_generator; + + GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ) + {} + ~GeneratorTracker(); + + static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { + std::shared_ptr<GeneratorTracker> tracker; + + ITracker& currentTracker = ctx.currentTracker(); + if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isGeneratorTracker() ); + tracker = std::static_pointer_cast<GeneratorTracker>( childTracker ); + } + else { + tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( tracker ); + } + + if( !ctx.completedCycle() && !tracker->isComplete() ) { + tracker->open(); + } + + return *tracker; + } + + // TrackerBase interface + bool isGeneratorTracker() const override { return true; } + auto hasGenerator() const -> bool override { + return !!m_generator; + } + void close() override { + TrackerBase::close(); + // Generator interface only finds out if it has another item on atual move + if (m_runState == CompletedSuccessfully && m_generator->next()) { + m_children.clear(); + m_runState = Executing; + } + } + + // IGeneratorTracker interface + auto getGenerator() const -> GeneratorBasePtr const& override { + return m_generator; + } + void setGenerator( GeneratorBasePtr&& generator ) override { + m_generator = std::move( generator ); + } + }; + GeneratorTracker::~GeneratorTracker() {} + } + + RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) + : m_runInfo(_config->name()), + m_context(getCurrentMutableContext()), + m_config(_config), + m_reporter(std::move(reporter)), + m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, + m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) + { + m_context.setRunner(this); + m_context.setConfig(m_config); + m_context.setResultCapture(this); + m_reporter->testRunStarting(m_runInfo); + } + + RunContext::~RunContext() { + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting())); + } + + void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount)); + } + + void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting())); + } + + Totals RunContext::runTest(TestCase const& testCase) { + Totals prevTotals = m_totals; + + std::string redirectedCout; + std::string redirectedCerr; + + auto const& testInfo = testCase.getTestCaseInfo(); + + m_reporter->testCaseStarting(testInfo); + + m_activeTestCase = &testCase; + + ITracker& rootTracker = m_trackerContext.startRun(); + assert(rootTracker.isSectionTracker()); + static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun()); + do { + m_trackerContext.startCycle(); + m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); + runCurrentTest(redirectedCout, redirectedCerr); + } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); + + Totals deltaTotals = m_totals.delta(prevTotals); + if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) { + deltaTotals.assertions.failed++; + deltaTotals.testCases.passed--; + deltaTotals.testCases.failed++; + } + m_totals.testCases += deltaTotals.testCases; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + redirectedCout, + redirectedCerr, + aborting())); + + m_activeTestCase = nullptr; + m_testCaseTracker = nullptr; + + return deltaTotals; + } + + IConfigPtr RunContext::config() const { + return m_config; + } + + IStreamingReporter& RunContext::reporter() const { + return *m_reporter; + } + + void RunContext::assertionEnded(AssertionResult const & result) { + if (result.getResultType() == ResultWas::Ok) { + m_totals.assertions.passed++; + m_lastAssertionPassed = true; + } else if (!result.isOk()) { + m_lastAssertionPassed = false; + if( m_activeTestCase->getTestCaseInfo().okToFail() ) + m_totals.assertions.failedButOk++; + else + m_totals.assertions.failed++; + } + else { + m_lastAssertionPassed = true; + } + + // We have no use for the return value (whether messages should be cleared), because messages were made scoped + // and should be let to clear themselves out. + static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); + + if (result.getResultType() != ResultWas::Warning) + m_messageScopes.clear(); + + // Reset working state + resetAssertionInfo(); + m_lastResult = result; + } + void RunContext::resetAssertionInfo() { + m_lastAssertionInfo.macroName = StringRef(); + m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; + } + + bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { + ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); + if (!sectionTracker.isOpen()) + return false; + m_activeSections.push_back(§ionTracker); + + m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; + + m_reporter->sectionStarting(sectionInfo); + + assertions = m_totals.assertions; + + return true; + } + auto RunContext::acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + using namespace Generators; + GeneratorTracker& tracker = GeneratorTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( "generator", lineInfo ) ); + assert( tracker.isOpen() ); + m_lastAssertionInfo.lineInfo = lineInfo; + return tracker; + } + + bool RunContext::testForMissingAssertions(Counts& assertions) { + if (assertions.total() != 0) + return false; + if (!m_config->warnAboutMissingAssertions()) + return false; + if (m_trackerContext.currentTracker().hasChildren()) + return false; + m_totals.assertions.failed++; + assertions.failed++; + return true; + } + + void RunContext::sectionEnded(SectionEndInfo const & endInfo) { + Counts assertions = m_totals.assertions - endInfo.prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); + + if (!m_activeSections.empty()) { + m_activeSections.back()->close(); + m_activeSections.pop_back(); + } + + m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); + m_messages.clear(); + m_messageScopes.clear(); + } + + void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { + if (m_unfinishedSections.empty()) + m_activeSections.back()->fail(); + else + m_activeSections.back()->close(); + m_activeSections.pop_back(); + + m_unfinishedSections.push_back(endInfo); + } + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + void RunContext::benchmarkPreparing(std::string const& name) { + m_reporter->benchmarkPreparing(name); + } + void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { + m_reporter->benchmarkStarting( info ); + } + void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) { + m_reporter->benchmarkEnded( stats ); + } + void RunContext::benchmarkFailed(std::string const & error) { + m_reporter->benchmarkFailed(error); + } +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + void RunContext::pushScopedMessage(MessageInfo const & message) { + m_messages.push_back(message); + } + + void RunContext::popScopedMessage(MessageInfo const & message) { + m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); + } + + void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { + m_messageScopes.emplace_back( builder ); + } + + std::string RunContext::getCurrentTestName() const { + return m_activeTestCase + ? m_activeTestCase->getTestCaseInfo().name + : std::string(); + } + + const AssertionResult * RunContext::getLastResult() const { + return &(*m_lastResult); + } + + void RunContext::exceptionEarlyReported() { + m_shouldReportUnexpected = false; + } + + void RunContext::handleFatalErrorCondition( StringRef message ) { + // First notify reporter that bad things happened + m_reporter->fatalErrorEncountered(message); + + // Don't rebuild the result -- the stringification itself can cause more fatal errors + // Instead, fake a result data. + AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); + tempResult.message = message; + AssertionResult result(m_lastAssertionInfo, tempResult); + + assertionEnded(result); + + handleUnfinishedSections(); + + // Recreate section for test case (as we will lose the one that was in scope) + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); + + Counts assertions; + assertions.failed = 1; + SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); + m_reporter->sectionEnded(testCaseSectionStats); + + auto const& testInfo = m_activeTestCase->getTestCaseInfo(); + + Totals deltaTotals; + deltaTotals.testCases.failed = 1; + deltaTotals.assertions.failed = 1; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + std::string(), + std::string(), + false)); + m_totals.testCases.failed++; + testGroupEnded(std::string(), m_totals, 1, 1); + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); + } + + bool RunContext::lastAssertionPassed() { + return m_lastAssertionPassed; + } + + void RunContext::assertionPassed() { + m_lastAssertionPassed = true; + ++m_totals.assertions.passed; + resetAssertionInfo(); + m_messageScopes.clear(); + } + + bool RunContext::aborting() const { + return m_totals.assertions.failed >= static_cast<std::size_t>(m_config->abortAfter()); + } + + void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) { + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); + m_reporter->sectionStarting(testCaseSection); + Counts prevAssertions = m_totals.assertions; + double duration = 0; + m_shouldReportUnexpected = true; + m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; + + seedRng(*m_config); + + Timer timer; + CATCH_TRY { + if (m_reporter->getPreferences().shouldRedirectStdOut) { +#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) + RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr); + + timer.start(); + invokeActiveTestCase(); +#else + OutputRedirect r(redirectedCout, redirectedCerr); + timer.start(); + invokeActiveTestCase(); +#endif + } else { + timer.start(); + invokeActiveTestCase(); + } + duration = timer.getElapsedSeconds(); + } CATCH_CATCH_ANON (TestFailureException&) { + // This just means the test was aborted due to failure + } CATCH_CATCH_ALL { + // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions + // are reported without translation at the point of origin. + if( m_shouldReportUnexpected ) { + AssertionReaction dummyReaction; + handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); + } + } + Counts assertions = m_totals.assertions - prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); + + m_testCaseTracker->close(); + handleUnfinishedSections(); + m_messages.clear(); + m_messageScopes.clear(); + + SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + m_reporter->sectionEnded(testCaseSectionStats); + } + + void RunContext::invokeActiveTestCase() { + FatalConditionHandler fatalConditionHandler; // Handle signals + m_activeTestCase->invoke(); + fatalConditionHandler.reset(); + } + + void RunContext::handleUnfinishedSections() { + // If sections ended prematurely due to an exception we stored their + // infos here so we can tear them down outside the unwind process. + for (auto it = m_unfinishedSections.rbegin(), + itEnd = m_unfinishedSections.rend(); + it != itEnd; + ++it) + sectionEnded(*it); + m_unfinishedSections.clear(); + } + + void RunContext::handleExpr( + AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction + ) { + m_reporter->assertionStarting( info ); + + bool negated = isFalseTest( info.resultDisposition ); + bool result = expr.getResult() != negated; + + if( result ) { + if (!m_includeSuccessfulResults) { + assertionPassed(); + } + else { + reportExpr(info, ResultWas::Ok, &expr, negated); + } + } + else { + reportExpr(info, ResultWas::ExpressionFailed, &expr, negated ); + populateReaction( reaction ); + } + } + void RunContext::reportExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ) { + + m_lastAssertionInfo = info; + AssertionResultData data( resultType, LazyExpression( negated ) ); + + AssertionResult assertionResult{ info, data }; + assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; + + assertionEnded( assertionResult ); + } + + void RunContext::handleMessage( + AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction + ) { + m_reporter->assertionStarting( info ); + + m_lastAssertionInfo = info; + + AssertionResultData data( resultType, LazyExpression( false ) ); + data.message = message; + AssertionResult assertionResult{ m_lastAssertionInfo, data }; + assertionEnded( assertionResult ); + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } + void RunContext::handleUnexpectedExceptionNotThrown( + AssertionInfo const& info, + AssertionReaction& reaction + ) { + handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction); + } + + void RunContext::handleUnexpectedInflightException( + AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = message; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + populateReaction( reaction ); + } + + void RunContext::populateReaction( AssertionReaction& reaction ) { + reaction.shouldDebugBreak = m_config->shouldDebugBreak(); + reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal); + } + + void RunContext::handleIncomplete( + AssertionInfo const& info + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + } + void RunContext::handleNonExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( resultType, LazyExpression( false ) ); + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } + + IResultCapture& getResultCapture() { + if (auto* capture = getCurrentContext().getResultCapture()) + return *capture; + else + CATCH_INTERNAL_ERROR("No result capture instance"); + } +} +// end catch_run_context.cpp +// start catch_section.cpp + +namespace Catch { + + Section::Section( SectionInfo const& info ) + : m_info( info ), + m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) + { + m_timer.start(); + } + + Section::~Section() { + if( m_sectionIncluded ) { + SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; + if( uncaught_exceptions() ) + getResultCapture().sectionEndedEarly( endInfo ); + else + getResultCapture().sectionEnded( endInfo ); + } + } + + // This indicates whether the section should be executed or not + Section::operator bool() const { + return m_sectionIncluded; + } + +} // end namespace Catch +// end catch_section.cpp +// start catch_section_info.cpp + +namespace Catch { + + SectionInfo::SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name ) + : name( _name ), + lineInfo( _lineInfo ) + {} + +} // end namespace Catch +// end catch_section_info.cpp +// start catch_session.cpp + +// start catch_session.h + +#include <memory> + +namespace Catch { + + class Session : NonCopyable { + public: + + Session(); + ~Session() override; + + void showHelp() const; + void libIdentify(); + + int applyCommandLine( int argc, char const * const * argv ); + #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) + int applyCommandLine( int argc, wchar_t const * const * argv ); + #endif + + void useConfigData( ConfigData const& configData ); + + template<typename CharT> + int run(int argc, CharT const * const argv[]) { + if (m_startupExceptions) + return 1; + int returnCode = applyCommandLine(argc, argv); + if (returnCode == 0) + returnCode = run(); + return returnCode; + } + + int run(); + + clara::Parser const& cli() const; + void cli( clara::Parser const& newParser ); + ConfigData& configData(); + Config& config(); + private: + int runInternal(); + + clara::Parser m_cli; + ConfigData m_configData; + std::shared_ptr<Config> m_config; + bool m_startupExceptions = false; + }; + +} // end namespace Catch + +// end catch_session.h +// start catch_version.h + +#include <iosfwd> + +namespace Catch { + + // Versioning information + struct Version { + Version( Version const& ) = delete; + Version& operator=( Version const& ) = delete; + Version( unsigned int _majorVersion, + unsigned int _minorVersion, + unsigned int _patchNumber, + char const * const _branchName, + unsigned int _buildNumber ); + + unsigned int const majorVersion; + unsigned int const minorVersion; + unsigned int const patchNumber; + + // buildNumber is only used if branchName is not null + char const * const branchName; + unsigned int const buildNumber; + + friend std::ostream& operator << ( std::ostream& os, Version const& version ); + }; + + Version const& libraryVersion(); +} + +// end catch_version.h +#include <cstdlib> +#include <iomanip> + +namespace Catch { + + namespace { + const int MaxExitCode = 255; + + IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); + CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); + + return reporter; + } + + IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) { + if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) { + return createReporter(config->getReporterName(), config); + } + + // On older platforms, returning std::unique_ptr<ListeningReporter> + // when the return type is std::unique_ptr<IStreamingReporter> + // doesn't compile without a std::move call. However, this causes + // a warning on newer platforms. Thus, we have to work around + // it a bit and downcast the pointer manually. + auto ret = std::unique_ptr<IStreamingReporter>(new ListeningReporter); + auto& multi = static_cast<ListeningReporter&>(*ret); + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); + for (auto const& listener : listeners) { + multi.addListener(listener->create(Catch::ReporterConfig(config))); + } + multi.addReporter(createReporter(config->getReporterName(), config)); + return ret; + } + + Catch::Totals runTests(std::shared_ptr<Config> const& config) { + auto reporter = makeReporter(config); + + RunContext context(config, std::move(reporter)); + + Totals totals; + + context.testGroupStarting(config->name(), 1, 1); + + TestSpec testSpec = config->testSpec(); + + auto const& allTestCases = getAllTestCasesSorted(*config); + for (auto const& testCase : allTestCases) { + bool matching = (!testSpec.hasFilters() && !testCase.isHidden()) || + (testSpec.hasFilters() && matchTest(testCase, testSpec, *config)); + + if (!context.aborting() && matching) + totals += context.runTest(testCase); + else + context.reporter().skipTest(testCase); + } + + if (config->warnAboutNoTests() && totals.testCases.total() == 0) { + ReusableStringStream testConfig; + + bool first = true; + for (const auto& input : config->getTestsOrTags()) { + if (!first) { testConfig << ' '; } + first = false; + testConfig << input; + } + + context.reporter().noMatchingTestCases(testConfig.str()); + totals.error = -1; + } + + context.testGroupEnded(config->name(), totals, 1, 1); + return totals; + } + + void applyFilenamesAsTags(Catch::IConfig const& config) { + auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config)); + for (auto& testCase : tests) { + auto tags = testCase.tags; + + std::string filename = testCase.lineInfo.file; + auto lastSlash = filename.find_last_of("\\/"); + if (lastSlash != std::string::npos) { + filename.erase(0, lastSlash); + filename[0] = '#'; + } + + auto lastDot = filename.find_last_of('.'); + if (lastDot != std::string::npos) { + filename.erase(lastDot); + } + + tags.push_back(std::move(filename)); + setTags(testCase, tags); + } + } + + } // anon namespace + + Session::Session() { + static bool alreadyInstantiated = false; + if( alreadyInstantiated ) { + CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } + CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); } + } + + // There cannot be exceptions at startup in no-exception mode. +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); + if ( !exceptions.empty() ) { + config(); + getCurrentMutableContext().setConfig(m_config); + + m_startupExceptions = true; + Colour colourGuard( Colour::Red ); + Catch::cerr() << "Errors occurred during startup!" << '\n'; + // iterate over all exceptions and notify user + for ( const auto& ex_ptr : exceptions ) { + try { + std::rethrow_exception(ex_ptr); + } catch ( std::exception const& ex ) { + Catch::cerr() << Column( ex.what() ).indent(2) << '\n'; + } + } + } +#endif + + alreadyInstantiated = true; + m_cli = makeCommandLineParser( m_configData ); + } + Session::~Session() { + Catch::cleanUp(); + } + + void Session::showHelp() const { + Catch::cout() + << "\nCatch v" << libraryVersion() << "\n" + << m_cli << std::endl + << "For more detailed usage please see the project docs\n" << std::endl; + } + void Session::libIdentify() { + Catch::cout() + << std::left << std::setw(16) << "description: " << "A Catch test executable\n" + << std::left << std::setw(16) << "category: " << "testframework\n" + << std::left << std::setw(16) << "framework: " << "Catch Test\n" + << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; + } + + int Session::applyCommandLine( int argc, char const * const * argv ) { + if( m_startupExceptions ) + return 1; + + auto result = m_cli.parse( clara::Args( argc, argv ) ); + if( !result ) { + config(); + getCurrentMutableContext().setConfig(m_config); + Catch::cerr() + << Colour( Colour::Red ) + << "\nError(s) in input:\n" + << Column( result.errorMessage() ).indent( 2 ) + << "\n\n"; + Catch::cerr() << "Run with -? for usage\n" << std::endl; + return MaxExitCode; + } + + if( m_configData.showHelp ) + showHelp(); + if( m_configData.libIdentify ) + libIdentify(); + m_config.reset(); + return 0; + } + +#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) + int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { + + char **utf8Argv = new char *[ argc ]; + + for ( int i = 0; i < argc; ++i ) { + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); + + utf8Argv[ i ] = new char[ bufSize ]; + + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); + } + + int returnCode = applyCommandLine( argc, utf8Argv ); + + for ( int i = 0; i < argc; ++i ) + delete [] utf8Argv[ i ]; + + delete [] utf8Argv; + + return returnCode; + } +#endif + + void Session::useConfigData( ConfigData const& configData ) { + m_configData = configData; + m_config.reset(); + } + + int Session::run() { + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before starting" << std::endl; + static_cast<void>(std::getchar()); + } + int exitCode = runInternal(); + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl; + static_cast<void>(std::getchar()); + } + return exitCode; + } + + clara::Parser const& Session::cli() const { + return m_cli; + } + void Session::cli( clara::Parser const& newParser ) { + m_cli = newParser; + } + ConfigData& Session::configData() { + return m_configData; + } + Config& Session::config() { + if( !m_config ) + m_config = std::make_shared<Config>( m_configData ); + return *m_config; + } + + int Session::runInternal() { + if( m_startupExceptions ) + return 1; + + if (m_configData.showHelp || m_configData.libIdentify) { + return 0; + } + + CATCH_TRY { + config(); // Force config to be constructed + + seedRng( *m_config ); + + if( m_configData.filenamesAsTags ) + applyFilenamesAsTags( *m_config ); + + // Handle list request + if( Option<std::size_t> listed = list( m_config ) ) + return static_cast<int>( *listed ); + + auto totals = runTests( m_config ); + // Note that on unices only the lower 8 bits are usually used, clamping + // the return value to 255 prevents false negative when some multiple + // of 256 tests has failed + return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast<int>(totals.assertions.failed))); + } +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + catch( std::exception& ex ) { + Catch::cerr() << ex.what() << std::endl; + return MaxExitCode; + } +#endif + } + +} // end namespace Catch +// end catch_session.cpp +// start catch_singletons.cpp + +#include <vector> + +namespace Catch { + + namespace { + static auto getSingletons() -> std::vector<ISingleton*>*& { + static std::vector<ISingleton*>* g_singletons = nullptr; + if( !g_singletons ) + g_singletons = new std::vector<ISingleton*>(); + return g_singletons; + } + } + + ISingleton::~ISingleton() {} + + void addSingleton(ISingleton* singleton ) { + getSingletons()->push_back( singleton ); + } + void cleanupSingletons() { + auto& singletons = getSingletons(); + for( auto singleton : *singletons ) + delete singleton; + delete singletons; + singletons = nullptr; + } + +} // namespace Catch +// end catch_singletons.cpp +// start catch_startup_exception_registry.cpp + +namespace Catch { +void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { + CATCH_TRY { + m_exceptions.push_back(exception); + } CATCH_CATCH_ALL { + // If we run out of memory during start-up there's really not a lot more we can do about it + std::terminate(); + } + } + + std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept { + return m_exceptions; + } + +} // end namespace Catch +// end catch_startup_exception_registry.cpp +// start catch_stream.cpp + +#include <cstdio> +#include <iostream> +#include <fstream> +#include <sstream> +#include <vector> +#include <memory> + +namespace Catch { + + Catch::IStream::~IStream() = default; + + namespace Detail { namespace { + template<typename WriterF, std::size_t bufferSize=256> + class StreamBufImpl : public std::streambuf { + char data[bufferSize]; + WriterF m_writer; + + public: + StreamBufImpl() { + setp( data, data + sizeof(data) ); + } + + ~StreamBufImpl() noexcept { + StreamBufImpl::sync(); + } + + private: + int overflow( int c ) override { + sync(); + + if( c != EOF ) { + if( pbase() == epptr() ) + m_writer( std::string( 1, static_cast<char>( c ) ) ); + else + sputc( static_cast<char>( c ) ); + } + return 0; + } + + int sync() override { + if( pbase() != pptr() ) { + m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) ); + setp( pbase(), epptr() ); + } + return 0; + } + }; + + /////////////////////////////////////////////////////////////////////////// + + struct OutputDebugWriter { + + void operator()( std::string const&str ) { + writeToDebugConsole( str ); + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class FileStream : public IStream { + mutable std::ofstream m_ofs; + public: + FileStream( StringRef filename ) { + m_ofs.open( filename.c_str() ); + CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); + } + ~FileStream() override = default; + public: // IStream + std::ostream& stream() const override { + return m_ofs; + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class CoutStream : public IStream { + mutable std::ostream m_os; + public: + // Store the streambuf from cout up-front because + // cout may get redirected when running tests + CoutStream() : m_os( Catch::cout().rdbuf() ) {} + ~CoutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + /////////////////////////////////////////////////////////////////////////// + + class DebugOutStream : public IStream { + std::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf; + mutable std::ostream m_os; + public: + DebugOutStream() + : m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ), + m_os( m_streamBuf.get() ) + {} + + ~DebugOutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + }} // namespace anon::detail + + /////////////////////////////////////////////////////////////////////////// + + auto makeStream( StringRef const &filename ) -> IStream const* { + if( filename.empty() ) + return new Detail::CoutStream(); + else if( filename[0] == '%' ) { + if( filename == "%debug" ) + return new Detail::DebugOutStream(); + else + CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); + } + else + return new Detail::FileStream( filename ); + } + + // This class encapsulates the idea of a pool of ostringstreams that can be reused. + struct StringStreams { + std::vector<std::unique_ptr<std::ostringstream>> m_streams; + std::vector<std::size_t> m_unused; + std::ostringstream m_referenceStream; // Used for copy state/ flags from + + auto add() -> std::size_t { + if( m_unused.empty() ) { + m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) ); + return m_streams.size()-1; + } + else { + auto index = m_unused.back(); + m_unused.pop_back(); + return index; + } + } + + void release( std::size_t index ) { + m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state + m_unused.push_back(index); + } + }; + + ReusableStringStream::ReusableStringStream() + : m_index( Singleton<StringStreams>::getMutable().add() ), + m_oss( Singleton<StringStreams>::getMutable().m_streams[m_index].get() ) + {} + + ReusableStringStream::~ReusableStringStream() { + static_cast<std::ostringstream*>( m_oss )->str(""); + m_oss->clear(); + Singleton<StringStreams>::getMutable().release( m_index ); + } + + auto ReusableStringStream::str() const -> std::string { + return static_cast<std::ostringstream*>( m_oss )->str(); + } + + /////////////////////////////////////////////////////////////////////////// + +#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions + std::ostream& cout() { return std::cout; } + std::ostream& cerr() { return std::cerr; } + std::ostream& clog() { return std::clog; } +#endif +} +// end catch_stream.cpp +// start catch_string_manip.cpp + +#include <algorithm> +#include <ostream> +#include <cstring> +#include <cctype> +#include <vector> + +namespace Catch { + + namespace { + char toLowerCh(char c) { + return static_cast<char>( std::tolower( c ) ); + } + } + + bool startsWith( std::string const& s, std::string const& prefix ) { + return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); + } + bool startsWith( std::string const& s, char prefix ) { + return !s.empty() && s[0] == prefix; + } + bool endsWith( std::string const& s, std::string const& suffix ) { + return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); + } + bool endsWith( std::string const& s, char suffix ) { + return !s.empty() && s[s.size()-1] == suffix; + } + bool contains( std::string const& s, std::string const& infix ) { + return s.find( infix ) != std::string::npos; + } + void toLowerInPlace( std::string& s ) { + std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); + } + std::string toLower( std::string const& s ) { + std::string lc = s; + toLowerInPlace( lc ); + return lc; + } + std::string trim( std::string const& str ) { + static char const* whitespaceChars = "\n\r\t "; + std::string::size_type start = str.find_first_not_of( whitespaceChars ); + std::string::size_type end = str.find_last_not_of( whitespaceChars ); + + return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); + } + + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { + bool replaced = false; + std::size_t i = str.find( replaceThis ); + while( i != std::string::npos ) { + replaced = true; + str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); + if( i < str.size()-withThis.size() ) + i = str.find( replaceThis, i+withThis.size() ); + else + i = std::string::npos; + } + return replaced; + } + + std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) { + std::vector<StringRef> subStrings; + std::size_t start = 0; + for(std::size_t pos = 0; pos < str.size(); ++pos ) { + if( str[pos] == delimiter ) { + if( pos - start > 1 ) + subStrings.push_back( str.substr( start, pos-start ) ); + start = pos+1; + } + } + if( start < str.size() ) + subStrings.push_back( str.substr( start, str.size()-start ) ); + return subStrings; + } + + pluralise::pluralise( std::size_t count, std::string const& label ) + : m_count( count ), + m_label( label ) + {} + + std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { + os << pluraliser.m_count << ' ' << pluraliser.m_label; + if( pluraliser.m_count != 1 ) + os << 's'; + return os; + } + +} +// end catch_string_manip.cpp +// start catch_stringref.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +#include <ostream> +#include <cstring> +#include <cstdint> + +namespace { + const uint32_t byte_2_lead = 0xC0; + const uint32_t byte_3_lead = 0xE0; + const uint32_t byte_4_lead = 0xF0; +} + +namespace Catch { + StringRef::StringRef( char const* rawChars ) noexcept + : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) + {} + + StringRef::operator std::string() const { + return std::string( m_start, m_size ); + } + + void StringRef::swap( StringRef& other ) noexcept { + std::swap( m_start, other.m_start ); + std::swap( m_size, other.m_size ); + std::swap( m_data, other.m_data ); + } + + auto StringRef::c_str() const -> char const* { + if( !isSubstring() ) + return m_start; + + const_cast<StringRef *>( this )->takeOwnership(); + return m_data; + } + auto StringRef::currentData() const noexcept -> char const* { + return m_start; + } + + auto StringRef::isOwned() const noexcept -> bool { + return m_data != nullptr; + } + auto StringRef::isSubstring() const noexcept -> bool { + return m_start[m_size] != '\0'; + } + + void StringRef::takeOwnership() { + if( !isOwned() ) { + m_data = new char[m_size+1]; + memcpy( m_data, m_start, m_size ); + m_data[m_size] = '\0'; + } + } + auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { + if( start < m_size ) + return StringRef( m_start+start, size ); + else + return StringRef(); + } + auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { + return + size() == other.size() && + (std::strncmp( m_start, other.m_start, size() ) == 0); + } + auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool { + return !operator==( other ); + } + + auto StringRef::operator[](size_type index) const noexcept -> char { + return m_start[index]; + } + + auto StringRef::numberOfCharacters() const noexcept -> size_type { + size_type noChars = m_size; + // Make adjustments for uft encodings + for( size_type i=0; i < m_size; ++i ) { + char c = m_start[i]; + if( ( c & byte_2_lead ) == byte_2_lead ) { + noChars--; + if (( c & byte_3_lead ) == byte_3_lead ) + noChars--; + if( ( c & byte_4_lead ) == byte_4_lead ) + noChars--; + } + } + return noChars; + } + + auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string { + std::string str; + str.reserve( lhs.size() + rhs.size() ); + str += lhs; + str += rhs; + return str; + } + auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string { + return std::string( lhs ) + std::string( rhs ); + } + auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string { + return std::string( lhs ) + std::string( rhs ); + } + + auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { + return os.write(str.currentData(), str.size()); + } + + auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + lhs.append(rhs.currentData(), rhs.size()); + return lhs; + } + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_stringref.cpp +// start catch_tag_alias.cpp + +namespace Catch { + TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {} +} +// end catch_tag_alias.cpp +// start catch_tag_alias_autoregistrar.cpp + +namespace Catch { + + RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { + CATCH_TRY { + getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + +} +// end catch_tag_alias_autoregistrar.cpp +// start catch_tag_alias_registry.cpp + +#include <sstream> + +namespace Catch { + + TagAliasRegistry::~TagAliasRegistry() {} + + TagAlias const* TagAliasRegistry::find( std::string const& alias ) const { + auto it = m_registry.find( alias ); + if( it != m_registry.end() ) + return &(it->second); + else + return nullptr; + } + + std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const { + std::string expandedTestSpec = unexpandedTestSpec; + for( auto const& registryKvp : m_registry ) { + std::size_t pos = expandedTestSpec.find( registryKvp.first ); + if( pos != std::string::npos ) { + expandedTestSpec = expandedTestSpec.substr( 0, pos ) + + registryKvp.second.tag + + expandedTestSpec.substr( pos + registryKvp.first.size() ); + } + } + return expandedTestSpec; + } + + void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) { + CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'), + "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo ); + + CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second, + "error: tag alias, '" << alias << "' already registered.\n" + << "\tFirst seen at: " << find(alias)->lineInfo << "\n" + << "\tRedefined at: " << lineInfo ); + } + + ITagAliasRegistry::~ITagAliasRegistry() {} + + ITagAliasRegistry const& ITagAliasRegistry::get() { + return getRegistryHub().getTagAliasRegistry(); + } + +} // end namespace Catch +// end catch_tag_alias_registry.cpp +// start catch_test_case_info.cpp + +#include <cctype> +#include <exception> +#include <algorithm> +#include <sstream> + +namespace Catch { + + namespace { + TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { + if( startsWith( tag, '.' ) || + tag == "!hide" ) + return TestCaseInfo::IsHidden; + else if( tag == "!throws" ) + return TestCaseInfo::Throws; + else if( tag == "!shouldfail" ) + return TestCaseInfo::ShouldFail; + else if( tag == "!mayfail" ) + return TestCaseInfo::MayFail; + else if( tag == "!nonportable" ) + return TestCaseInfo::NonPortable; + else if( tag == "!benchmark" ) + return static_cast<TestCaseInfo::SpecialProperties>( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden ); + else + return TestCaseInfo::None; + } + bool isReservedTag( std::string const& tag ) { + return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) ); + } + void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { + CATCH_ENFORCE( !isReservedTag(tag), + "Tag name: [" << tag << "] is not allowed.\n" + << "Tag names starting with non alphanumeric characters are reserved\n" + << _lineInfo ); + } + } + + TestCase makeTestCase( ITestInvoker* _testCase, + std::string const& _className, + NameAndTags const& nameAndTags, + SourceLineInfo const& _lineInfo ) + { + bool isHidden = false; + + // Parse out tags + std::vector<std::string> tags; + std::string desc, tag; + bool inTag = false; + std::string _descOrTags = nameAndTags.tags; + for (char c : _descOrTags) { + if( !inTag ) { + if( c == '[' ) + inTag = true; + else + desc += c; + } + else { + if( c == ']' ) { + TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); + if( ( prop & TestCaseInfo::IsHidden ) != 0 ) + isHidden = true; + else if( prop == TestCaseInfo::None ) + enforceNotReservedTag( tag, _lineInfo ); + + // Merged hide tags like `[.approvals]` should be added as + // `[.][approvals]`. The `[.]` is added at later point, so + // we only strip the prefix + if (startsWith(tag, '.') && tag.size() > 1) { + tag.erase(0, 1); + } + tags.push_back( tag ); + tag.clear(); + inTag = false; + } + else + tag += c; + } + } + if( isHidden ) { + tags.push_back( "." ); + } + + TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo ); + return TestCase( _testCase, std::move(info) ); + } + + void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) { + std::sort(begin(tags), end(tags)); + tags.erase(std::unique(begin(tags), end(tags)), end(tags)); + testCaseInfo.lcaseTags.clear(); + + for( auto const& tag : tags ) { + std::string lcaseTag = toLower( tag ); + testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); + testCaseInfo.lcaseTags.push_back( lcaseTag ); + } + testCaseInfo.tags = std::move(tags); + } + + TestCaseInfo::TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector<std::string> const& _tags, + SourceLineInfo const& _lineInfo ) + : name( _name ), + className( _className ), + description( _description ), + lineInfo( _lineInfo ), + properties( None ) + { + setTags( *this, _tags ); + } + + bool TestCaseInfo::isHidden() const { + return ( properties & IsHidden ) != 0; + } + bool TestCaseInfo::throws() const { + return ( properties & Throws ) != 0; + } + bool TestCaseInfo::okToFail() const { + return ( properties & (ShouldFail | MayFail ) ) != 0; + } + bool TestCaseInfo::expectedToFail() const { + return ( properties & (ShouldFail ) ) != 0; + } + + std::string TestCaseInfo::tagsAsString() const { + std::string ret; + // '[' and ']' per tag + std::size_t full_size = 2 * tags.size(); + for (const auto& tag : tags) { + full_size += tag.size(); + } + ret.reserve(full_size); + for (const auto& tag : tags) { + ret.push_back('['); + ret.append(tag); + ret.push_back(']'); + } + + return ret; + } + + TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {} + + TestCase TestCase::withName( std::string const& _newName ) const { + TestCase other( *this ); + other.name = _newName; + return other; + } + + void TestCase::invoke() const { + test->invoke(); + } + + bool TestCase::operator == ( TestCase const& other ) const { + return test.get() == other.test.get() && + name == other.name && + className == other.className; + } + + bool TestCase::operator < ( TestCase const& other ) const { + return name < other.name; + } + + TestCaseInfo const& TestCase::getTestCaseInfo() const + { + return *this; + } + +} // end namespace Catch +// end catch_test_case_info.cpp +// start catch_test_case_registry_impl.cpp + +#include <sstream> + +namespace Catch { + + std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) { + + std::vector<TestCase> sorted = unsortedTestCases; + + switch( config.runOrder() ) { + case RunTests::InLexicographicalOrder: + std::sort( sorted.begin(), sorted.end() ); + break; + case RunTests::InRandomOrder: + seedRng( config ); + std::shuffle( sorted.begin(), sorted.end(), rng() ); + break; + case RunTests::InDeclarationOrder: + // already in declaration order + break; + } + return sorted; + } + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { + return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() ); + } + + void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) { + std::set<TestCase> seenFunctions; + for( auto const& function : functions ) { + auto prev = seenFunctions.insert( function ); + CATCH_ENFORCE( prev.second, + "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); + } + } + + std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) { + std::vector<TestCase> filtered; + filtered.reserve( testCases.size() ); + for (auto const& testCase : testCases) { + if ((!testSpec.hasFilters() && !testCase.isHidden()) || + (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) { + filtered.push_back(testCase); + } + } + return filtered; + } + std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) { + return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); + } + + void TestRegistry::registerTest( TestCase const& testCase ) { + std::string name = testCase.getTestCaseInfo().name; + if( name.empty() ) { + ReusableStringStream rss; + rss << "Anonymous test case " << ++m_unnamedCount; + return registerTest( testCase.withName( rss.str() ) ); + } + m_functions.push_back( testCase ); + } + + std::vector<TestCase> const& TestRegistry::getAllTests() const { + return m_functions; + } + std::vector<TestCase> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { + if( m_sortedFunctions.empty() ) + enforceNoDuplicateTestCases( m_functions ); + + if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { + m_sortedFunctions = sortTests( config, m_functions ); + m_currentSortOrder = config.runOrder(); + } + return m_sortedFunctions; + } + + /////////////////////////////////////////////////////////////////////////// + TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {} + + void TestInvokerAsFunction::invoke() const { + m_testAsFunction(); + } + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ) { + std::string className = classOrQualifiedMethodName; + if( startsWith( className, '&' ) ) + { + std::size_t lastColons = className.rfind( "::" ); + std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); + if( penultimateColons == std::string::npos ) + penultimateColons = 1; + className = className.substr( penultimateColons, lastColons-penultimateColons ); + } + return className; + } + +} // end namespace Catch +// end catch_test_case_registry_impl.cpp +// start catch_test_case_tracker.cpp + +#include <algorithm> +#include <cassert> +#include <stdexcept> +#include <memory> +#include <sstream> + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +namespace Catch { +namespace TestCaseTracking { + + NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) + : name( _name ), + location( _location ) + {} + + ITracker::~ITracker() = default; + + ITracker& TrackerContext::startRun() { + m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr ); + m_currentTracker = nullptr; + m_runState = Executing; + return *m_rootTracker; + } + + void TrackerContext::endRun() { + m_rootTracker.reset(); + m_currentTracker = nullptr; + m_runState = NotStarted; + } + + void TrackerContext::startCycle() { + m_currentTracker = m_rootTracker.get(); + m_runState = Executing; + } + void TrackerContext::completeCycle() { + m_runState = CompletedCycle; + } + + bool TrackerContext::completedCycle() const { + return m_runState == CompletedCycle; + } + ITracker& TrackerContext::currentTracker() { + return *m_currentTracker; + } + void TrackerContext::setCurrentTracker( ITracker* tracker ) { + m_currentTracker = tracker; + } + + TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : m_nameAndLocation( nameAndLocation ), + m_ctx( ctx ), + m_parent( parent ) + {} + + NameAndLocation const& TrackerBase::nameAndLocation() const { + return m_nameAndLocation; + } + bool TrackerBase::isComplete() const { + return m_runState == CompletedSuccessfully || m_runState == Failed; + } + bool TrackerBase::isSuccessfullyCompleted() const { + return m_runState == CompletedSuccessfully; + } + bool TrackerBase::isOpen() const { + return m_runState != NotStarted && !isComplete(); + } + bool TrackerBase::hasChildren() const { + return !m_children.empty(); + } + + void TrackerBase::addChild( ITrackerPtr const& child ) { + m_children.push_back( child ); + } + + ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) { + auto it = std::find_if( m_children.begin(), m_children.end(), + [&nameAndLocation]( ITrackerPtr const& tracker ){ + return + tracker->nameAndLocation().location == nameAndLocation.location && + tracker->nameAndLocation().name == nameAndLocation.name; + } ); + return( it != m_children.end() ) + ? *it + : nullptr; + } + ITracker& TrackerBase::parent() { + assert( m_parent ); // Should always be non-null except for root + return *m_parent; + } + + void TrackerBase::openChild() { + if( m_runState != ExecutingChildren ) { + m_runState = ExecutingChildren; + if( m_parent ) + m_parent->openChild(); + } + } + + bool TrackerBase::isSectionTracker() const { return false; } + bool TrackerBase::isGeneratorTracker() const { return false; } + + void TrackerBase::open() { + m_runState = Executing; + moveToThis(); + if( m_parent ) + m_parent->openChild(); + } + + void TrackerBase::close() { + + // Close any still open children (e.g. generators) + while( &m_ctx.currentTracker() != this ) + m_ctx.currentTracker().close(); + + switch( m_runState ) { + case NeedsAnotherRun: + break; + + case Executing: + m_runState = CompletedSuccessfully; + break; + case ExecutingChildren: + if( m_children.empty() || m_children.back()->isComplete() ) + m_runState = CompletedSuccessfully; + break; + + case NotStarted: + case CompletedSuccessfully: + case Failed: + CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState ); + + default: + CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState ); + } + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::fail() { + m_runState = Failed; + if( m_parent ) + m_parent->markAsNeedingAnotherRun(); + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::markAsNeedingAnotherRun() { + m_runState = NeedsAnotherRun; + } + + void TrackerBase::moveToParent() { + assert( m_parent ); + m_ctx.setCurrentTracker( m_parent ); + } + void TrackerBase::moveToThis() { + m_ctx.setCurrentTracker( this ); + } + + SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ) + { + if( parent ) { + while( !parent->isSectionTracker() ) + parent = &parent->parent(); + + SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); + addNextFilters( parentSection.m_filters ); + } + } + + bool SectionTracker::isComplete() const { + bool complete = true; + + if ((m_filters.empty() || m_filters[0] == "") || + std::find(m_filters.begin(), m_filters.end(), + m_nameAndLocation.name) != m_filters.end()) + complete = TrackerBase::isComplete(); + return complete; + + } + + bool SectionTracker::isSectionTracker() const { return true; } + + SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { + std::shared_ptr<SectionTracker> section; + + ITracker& currentTracker = ctx.currentTracker(); + if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isSectionTracker() ); + section = std::static_pointer_cast<SectionTracker>( childTracker ); + } + else { + section = std::make_shared<SectionTracker>( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( section ); + } + if( !ctx.completedCycle() ) + section->tryOpen(); + return *section; + } + + void SectionTracker::tryOpen() { + if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) ) + open(); + } + + void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) { + if( !filters.empty() ) { + m_filters.push_back(""); // Root - should never be consulted + m_filters.push_back(""); // Test Case - not a section filter + m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); + } + } + void SectionTracker::addNextFilters( std::vector<std::string> const& filters ) { + if( filters.size() > 1 ) + m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() ); + } + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_test_case_tracker.cpp +// start catch_test_registry.cpp + +namespace Catch { + + auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { + return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); + } + + NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} + + AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { + CATCH_TRY { + getMutableRegistryHub() + .registerTest( + makeTestCase( + invoker, + extractClassName( classOrMethod ), + nameAndTags, + lineInfo)); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + + AutoReg::~AutoReg() = default; +} +// end catch_test_registry.cpp +// start catch_test_spec.cpp + +#include <algorithm> +#include <string> +#include <vector> +#include <memory> + +namespace Catch { + + TestSpec::Pattern::~Pattern() = default; + TestSpec::NamePattern::~NamePattern() = default; + TestSpec::TagPattern::~TagPattern() = default; + TestSpec::ExcludedPattern::~ExcludedPattern() = default; + + TestSpec::NamePattern::NamePattern( std::string const& name ) + : m_wildcardPattern( toLower( name ), CaseSensitive::No ) + {} + bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { + return m_wildcardPattern.matches( toLower( testCase.name ) ); + } + + TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {} + bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { + return std::find(begin(testCase.lcaseTags), + end(testCase.lcaseTags), + m_tag) != end(testCase.lcaseTags); + } + + TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {} + bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); } + + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { + // All patterns in a filter must match for the filter to be a match + for( auto const& pattern : m_patterns ) { + if( !pattern->matches( testCase ) ) + return false; + } + return true; + } + + bool TestSpec::hasFilters() const { + return !m_filters.empty(); + } + bool TestSpec::matches( TestCaseInfo const& testCase ) const { + // A TestSpec matches if any filter matches + for( auto const& filter : m_filters ) + if( filter.matches( testCase ) ) + return true; + return false; + } +} +// end catch_test_spec.cpp +// start catch_test_spec_parser.cpp + +namespace Catch { + + TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} + + TestSpecParser& TestSpecParser::parse( std::string const& arg ) { + m_mode = None; + m_exclusion = false; + m_start = std::string::npos; + m_arg = m_tagAliases->expandAliases( arg ); + m_escapeChars.clear(); + for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) + visitChar( m_arg[m_pos] ); + if( m_mode == Name ) + addPattern<TestSpec::NamePattern>(); + return *this; + } + TestSpec TestSpecParser::testSpec() { + addFilter(); + return m_testSpec; + } + + void TestSpecParser::visitChar( char c ) { + if( m_mode == None ) { + switch( c ) { + case ' ': return; + case '~': m_exclusion = true; return; + case '[': return startNewMode( Tag, ++m_pos ); + case '"': return startNewMode( QuotedName, ++m_pos ); + case '\\': return escape(); + default: startNewMode( Name, m_pos ); break; + } + } + if( m_mode == Name ) { + if( c == ',' ) { + addPattern<TestSpec::NamePattern>(); + addFilter(); + } + else if( c == '[' ) { + if( subString() == "exclude:" ) + m_exclusion = true; + else + addPattern<TestSpec::NamePattern>(); + startNewMode( Tag, ++m_pos ); + } + else if( c == '\\' ) + escape(); + } + else if( m_mode == EscapedName ) + m_mode = Name; + else if( m_mode == QuotedName && c == '"' ) + addPattern<TestSpec::NamePattern>(); + else if( m_mode == Tag && c == ']' ) + addPattern<TestSpec::TagPattern>(); + } + void TestSpecParser::startNewMode( Mode mode, std::size_t start ) { + m_mode = mode; + m_start = start; + } + void TestSpecParser::escape() { + if( m_mode == None ) + m_start = m_pos; + m_mode = EscapedName; + m_escapeChars.push_back( m_pos ); + } + std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); } + + void TestSpecParser::addFilter() { + if( !m_currentFilter.m_patterns.empty() ) { + m_testSpec.m_filters.push_back( m_currentFilter ); + m_currentFilter = TestSpec::Filter(); + } + } + + TestSpec parseTestSpec( std::string const& arg ) { + return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); + } + +} // namespace Catch +// end catch_test_spec_parser.cpp +// start catch_timer.cpp + +#include <chrono> + +static const uint64_t nanosecondsInSecond = 1000000000; + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); + } + + namespace { + auto estimateClockResolution() -> uint64_t { + uint64_t sum = 0; + static const uint64_t iterations = 1000000; + + auto startTime = getCurrentNanosecondsSinceEpoch(); + + for( std::size_t i = 0; i < iterations; ++i ) { + + uint64_t ticks; + uint64_t baseTicks = getCurrentNanosecondsSinceEpoch(); + do { + ticks = getCurrentNanosecondsSinceEpoch(); + } while( ticks == baseTicks ); + + auto delta = ticks - baseTicks; + sum += delta; + + // If we have been calibrating for over 3 seconds -- the clock + // is terrible and we should move on. + // TBD: How to signal that the measured resolution is probably wrong? + if (ticks > startTime + 3 * nanosecondsInSecond) { + return sum / ( i + 1u ); + } + } + + // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers + // - and potentially do more iterations if there's a high variance. + return sum/iterations; + } + } + auto getEstimatedClockResolution() -> uint64_t { + static auto s_resolution = estimateClockResolution(); + return s_resolution; + } + + void Timer::start() { + m_nanoseconds = getCurrentNanosecondsSinceEpoch(); + } + auto Timer::getElapsedNanoseconds() const -> uint64_t { + return getCurrentNanosecondsSinceEpoch() - m_nanoseconds; + } + auto Timer::getElapsedMicroseconds() const -> uint64_t { + return getElapsedNanoseconds()/1000; + } + auto Timer::getElapsedMilliseconds() const -> unsigned int { + return static_cast<unsigned int>(getElapsedMicroseconds()/1000); + } + auto Timer::getElapsedSeconds() const -> double { + return getElapsedMicroseconds()/1000000.0; + } + +} // namespace Catch +// end catch_timer.cpp +// start catch_tostring.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + +// Enable specific decls locally +#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif + +#include <cmath> +#include <iomanip> + +namespace Catch { + +namespace Detail { + + const std::string unprintableString = "{?}"; + + namespace { + const int hexThreshold = 255; + + struct Endianness { + enum Arch { Big, Little }; + + static Arch which() { + union _{ + int asInt; + char asChar[sizeof (int)]; + } u; + + u.asInt = 1; + return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little; + } + }; + } + + std::string rawMemoryToString( const void *object, std::size_t size ) { + // Reverse order for little endian architectures + int i = 0, end = static_cast<int>( size ), inc = 1; + if( Endianness::which() == Endianness::Little ) { + i = end-1; + end = inc = -1; + } + + unsigned char const *bytes = static_cast<unsigned char const *>(object); + ReusableStringStream rss; + rss << "0x" << std::setfill('0') << std::hex; + for( ; i != end; i += inc ) + rss << std::setw(2) << static_cast<unsigned>(bytes[i]); + return rss.str(); + } +} + +template<typename T> +std::string fpToString( T value, int precision ) { + if (Catch::isnan(value)) { + return "nan"; + } + + ReusableStringStream rss; + rss << std::setprecision( precision ) + << std::fixed + << value; + std::string d = rss.str(); + std::size_t i = d.find_last_not_of( '0' ); + if( i != std::string::npos && i != d.size()-1 ) { + if( d[i] == '.' ) + i++; + d = d.substr( 0, i+1 ); + } + return d; +} + +//// ======================================================= //// +// +// Out-of-line defs for full specialization of StringMaker +// +//// ======================================================= //// + +std::string StringMaker<std::string>::convert(const std::string& str) { + if (!getCurrentContext().getConfig()->showInvisibles()) { + return '"' + str + '"'; + } + + std::string s("\""); + for (char c : str) { + switch (c) { + case '\n': + s.append("\\n"); + break; + case '\t': + s.append("\\t"); + break; + default: + s.push_back(c); + break; + } + } + s.append("\""); + return s; +} + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker<std::string_view>::convert(std::string_view str) { + return ::Catch::Detail::stringify(std::string{ str }); +} +#endif + +std::string StringMaker<char const*>::convert(char const* str) { + if (str) { + return ::Catch::Detail::stringify(std::string{ str }); + } else { + return{ "{null string}" }; + } +} +std::string StringMaker<char*>::convert(char* str) { + if (str) { + return ::Catch::Detail::stringify(std::string{ str }); + } else { + return{ "{null string}" }; + } +} + +#ifdef CATCH_CONFIG_WCHAR +std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) { + std::string s; + s.reserve(wstr.size()); + for (auto c : wstr) { + s += (c <= 0xff) ? static_cast<char>(c) : '?'; + } + return ::Catch::Detail::stringify(s); +} + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker<std::wstring_view>::convert(std::wstring_view str) { + return StringMaker<std::wstring>::convert(std::wstring(str)); +} +# endif + +std::string StringMaker<wchar_t const*>::convert(wchar_t const * str) { + if (str) { + return ::Catch::Detail::stringify(std::wstring{ str }); + } else { + return{ "{null string}" }; + } +} +std::string StringMaker<wchar_t *>::convert(wchar_t * str) { + if (str) { + return ::Catch::Detail::stringify(std::wstring{ str }); + } else { + return{ "{null string}" }; + } +} +#endif + +std::string StringMaker<int>::convert(int value) { + return ::Catch::Detail::stringify(static_cast<long long>(value)); +} +std::string StringMaker<long>::convert(long value) { + return ::Catch::Detail::stringify(static_cast<long long>(value)); +} +std::string StringMaker<long long>::convert(long long value) { + ReusableStringStream rss; + rss << value; + if (value > Detail::hexThreshold) { + rss << " (0x" << std::hex << value << ')'; + } + return rss.str(); +} + +std::string StringMaker<unsigned int>::convert(unsigned int value) { + return ::Catch::Detail::stringify(static_cast<unsigned long long>(value)); +} +std::string StringMaker<unsigned long>::convert(unsigned long value) { + return ::Catch::Detail::stringify(static_cast<unsigned long long>(value)); +} +std::string StringMaker<unsigned long long>::convert(unsigned long long value) { + ReusableStringStream rss; + rss << value; + if (value > Detail::hexThreshold) { + rss << " (0x" << std::hex << value << ')'; + } + return rss.str(); +} + +std::string StringMaker<bool>::convert(bool b) { + return b ? "true" : "false"; +} + +std::string StringMaker<signed char>::convert(signed char value) { + if (value == '\r') { + return "'\\r'"; + } else if (value == '\f') { + return "'\\f'"; + } else if (value == '\n') { + return "'\\n'"; + } else if (value == '\t') { + return "'\\t'"; + } else if ('\0' <= value && value < ' ') { + return ::Catch::Detail::stringify(static_cast<unsigned int>(value)); + } else { + char chstr[] = "' '"; + chstr[1] = value; + return chstr; + } +} +std::string StringMaker<char>::convert(char c) { + return ::Catch::Detail::stringify(static_cast<signed char>(c)); +} +std::string StringMaker<unsigned char>::convert(unsigned char c) { + return ::Catch::Detail::stringify(static_cast<char>(c)); +} + +std::string StringMaker<std::nullptr_t>::convert(std::nullptr_t) { + return "nullptr"; +} + +int StringMaker<float>::precision = 5; + +std::string StringMaker<float>::convert(float value) { + return fpToString(value, precision) + 'f'; +} + +int StringMaker<double>::precision = 10; + +std::string StringMaker<double>::convert(double value) { + return fpToString(value, precision); +} + +std::string ratio_string<std::atto>::symbol() { return "a"; } +std::string ratio_string<std::femto>::symbol() { return "f"; } +std::string ratio_string<std::pico>::symbol() { return "p"; } +std::string ratio_string<std::nano>::symbol() { return "n"; } +std::string ratio_string<std::micro>::symbol() { return "u"; } +std::string ratio_string<std::milli>::symbol() { return "m"; } + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +// end catch_tostring.cpp +// start catch_totals.cpp + +namespace Catch { + + Counts Counts::operator - ( Counts const& other ) const { + Counts diff; + diff.passed = passed - other.passed; + diff.failed = failed - other.failed; + diff.failedButOk = failedButOk - other.failedButOk; + return diff; + } + + Counts& Counts::operator += ( Counts const& other ) { + passed += other.passed; + failed += other.failed; + failedButOk += other.failedButOk; + return *this; + } + + std::size_t Counts::total() const { + return passed + failed + failedButOk; + } + bool Counts::allPassed() const { + return failed == 0 && failedButOk == 0; + } + bool Counts::allOk() const { + return failed == 0; + } + + Totals Totals::operator - ( Totals const& other ) const { + Totals diff; + diff.assertions = assertions - other.assertions; + diff.testCases = testCases - other.testCases; + return diff; + } + + Totals& Totals::operator += ( Totals const& other ) { + assertions += other.assertions; + testCases += other.testCases; + return *this; + } + + Totals Totals::delta( Totals const& prevTotals ) const { + Totals diff = *this - prevTotals; + if( diff.assertions.failed > 0 ) + ++diff.testCases.failed; + else if( diff.assertions.failedButOk > 0 ) + ++diff.testCases.failedButOk; + else + ++diff.testCases.passed; + return diff; + } + +} +// end catch_totals.cpp +// start catch_uncaught_exceptions.cpp + +#include <exception> + +namespace Catch { + bool uncaught_exceptions() { +#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + return std::uncaught_exceptions() > 0; +#else + return std::uncaught_exception(); +#endif + } +} // end namespace Catch +// end catch_uncaught_exceptions.cpp +// start catch_version.cpp + +#include <ostream> + +namespace Catch { + + Version::Version + ( unsigned int _majorVersion, + unsigned int _minorVersion, + unsigned int _patchNumber, + char const * const _branchName, + unsigned int _buildNumber ) + : majorVersion( _majorVersion ), + minorVersion( _minorVersion ), + patchNumber( _patchNumber ), + branchName( _branchName ), + buildNumber( _buildNumber ) + {} + + std::ostream& operator << ( std::ostream& os, Version const& version ) { + os << version.majorVersion << '.' + << version.minorVersion << '.' + << version.patchNumber; + // branchName is never null -> 0th char is \0 if it is empty + if (version.branchName[0]) { + os << '-' << version.branchName + << '.' << version.buildNumber; + } + return os; + } + + Version const& libraryVersion() { + static Version version( 2, 9, 1, "", 0 ); + return version; + } + +} +// end catch_version.cpp +// start catch_wildcard_pattern.cpp + +#include <sstream> + +namespace Catch { + + WildcardPattern::WildcardPattern( std::string const& pattern, + CaseSensitive::Choice caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_pattern( adjustCase( pattern ) ) + { + if( startsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 1 ); + m_wildcard = WildcardAtStart; + } + if( endsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); + m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd ); + } + } + + bool WildcardPattern::matches( std::string const& str ) const { + switch( m_wildcard ) { + case NoWildcard: + return m_pattern == adjustCase( str ); + case WildcardAtStart: + return endsWith( adjustCase( str ), m_pattern ); + case WildcardAtEnd: + return startsWith( adjustCase( str ), m_pattern ); + case WildcardAtBothEnds: + return contains( adjustCase( str ), m_pattern ); + default: + CATCH_INTERNAL_ERROR( "Unknown enum" ); + } + } + + std::string WildcardPattern::adjustCase( std::string const& str ) const { + return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str; + } +} +// end catch_wildcard_pattern.cpp +// start catch_xmlwriter.cpp + +#include <iomanip> + +using uchar = unsigned char; + +namespace Catch { + +namespace { + + size_t trailingBytes(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return 2; + } + if ((c & 0xF0) == 0xE0) { + return 3; + } + if ((c & 0xF8) == 0xF0) { + return 4; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + uint32_t headerValue(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return c & 0x1F; + } + if ((c & 0xF0) == 0xE0) { + return c & 0x0F; + } + if ((c & 0xF8) == 0xF0) { + return c & 0x07; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + void hexEscapeChar(std::ostream& os, unsigned char c) { + std::ios_base::fmtflags f(os.flags()); + os << "\\x" + << std::uppercase << std::hex << std::setfill('0') << std::setw(2) + << static_cast<int>(c); + os.flags(f); + } + +} // anonymous namespace + + XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) + : m_str( str ), + m_forWhat( forWhat ) + {} + + void XmlEncode::encodeTo( std::ostream& os ) const { + // Apostrophe escaping not necessary if we always use " to write attributes + // (see: http://www.w3.org/TR/xml/#syntax) + + for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) { + uchar c = m_str[idx]; + switch (c) { + case '<': os << "<"; break; + case '&': os << "&"; break; + + case '>': + // See: http://www.w3.org/TR/xml/#syntax + if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']') + os << ">"; + else + os << c; + break; + + case '\"': + if (m_forWhat == ForAttributes) + os << """; + else + os << c; + break; + + default: + // Check for control characters and invalid utf-8 + + // Escape control characters in standard ascii + // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0 + if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) { + hexEscapeChar(os, c); + break; + } + + // Plain ASCII: Write it to stream + if (c < 0x7F) { + os << c; + break; + } + + // UTF-8 territory + // Check if the encoding is valid and if it is not, hex escape bytes. + // Important: We do not check the exact decoded values for validity, only the encoding format + // First check that this bytes is a valid lead byte: + // This means that it is not encoded as 1111 1XXX + // Or as 10XX XXXX + if (c < 0xC0 || + c >= 0xF8) { + hexEscapeChar(os, c); + break; + } + + auto encBytes = trailingBytes(c); + // Are there enough bytes left to avoid accessing out-of-bounds memory? + if (idx + encBytes - 1 >= m_str.size()) { + hexEscapeChar(os, c); + break; + } + // The header is valid, check data + // The next encBytes bytes must together be a valid utf-8 + // This means: bitpattern 10XX XXXX and the extracted value is sane (ish) + bool valid = true; + uint32_t value = headerValue(c); + for (std::size_t n = 1; n < encBytes; ++n) { + uchar nc = m_str[idx + n]; + valid &= ((nc & 0xC0) == 0x80); + value = (value << 6) | (nc & 0x3F); + } + + if ( + // Wrong bit pattern of following bytes + (!valid) || + // Overlong encodings + (value < 0x80) || + (0x80 <= value && value < 0x800 && encBytes > 2) || + (0x800 < value && value < 0x10000 && encBytes > 3) || + // Encoded value out of range + (value >= 0x110000) + ) { + hexEscapeChar(os, c); + break; + } + + // If we got here, this is in fact a valid(ish) utf-8 sequence + for (std::size_t n = 0; n < encBytes; ++n) { + os << m_str[idx + n]; + } + idx += encBytes - 1; + break; + } + } + } + + std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { + xmlEncode.encodeTo( os ); + return os; + } + + XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer ) + : m_writer( writer ) + {} + + XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept + : m_writer( other.m_writer ){ + other.m_writer = nullptr; + } + XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { + if ( m_writer ) { + m_writer->endElement(); + } + m_writer = other.m_writer; + other.m_writer = nullptr; + return *this; + } + + XmlWriter::ScopedElement::~ScopedElement() { + if( m_writer ) + m_writer->endElement(); + } + + XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) { + m_writer->writeText( text, indent ); + return *this; + } + + XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) + { + writeDeclaration(); + } + + XmlWriter::~XmlWriter() { + while( !m_tags.empty() ) + endElement(); + } + + XmlWriter& XmlWriter::startElement( std::string const& name ) { + ensureTagClosed(); + newlineIfNecessary(); + m_os << m_indent << '<' << name; + m_tags.push_back( name ); + m_indent += " "; + m_tagIsOpen = true; + return *this; + } + + XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) { + ScopedElement scoped( this ); + startElement( name ); + return scoped; + } + + XmlWriter& XmlWriter::endElement() { + newlineIfNecessary(); + m_indent = m_indent.substr( 0, m_indent.size()-2 ); + if( m_tagIsOpen ) { + m_os << "/>"; + m_tagIsOpen = false; + } + else { + m_os << m_indent << "</" << m_tags.back() << ">"; + } + m_os << std::endl; + m_tags.pop_back(); + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) { + if( !name.empty() && !attribute.empty() ) + m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) { + m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) { + if( !text.empty() ){ + bool tagWasOpen = m_tagIsOpen; + ensureTagClosed(); + if( tagWasOpen && indent ) + m_os << m_indent; + m_os << XmlEncode( text ); + m_needsNewline = true; + } + return *this; + } + + XmlWriter& XmlWriter::writeComment( std::string const& text ) { + ensureTagClosed(); + m_os << m_indent << "<!--" << text << "-->"; + m_needsNewline = true; + return *this; + } + + void XmlWriter::writeStylesheetRef( std::string const& url ) { + m_os << "<?xml-stylesheet type=\"text/xsl\" href=\"" << url << "\"?>\n"; + } + + XmlWriter& XmlWriter::writeBlankLine() { + ensureTagClosed(); + m_os << '\n'; + return *this; + } + + void XmlWriter::ensureTagClosed() { + if( m_tagIsOpen ) { + m_os << ">" << std::endl; + m_tagIsOpen = false; + } + } + + void XmlWriter::writeDeclaration() { + m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + } + + void XmlWriter::newlineIfNecessary() { + if( m_needsNewline ) { + m_os << std::endl; + m_needsNewline = false; + } + } +} +// end catch_xmlwriter.cpp +// start catch_reporter_bases.cpp + +#include <cstring> +#include <cfloat> +#include <cstdio> +#include <cassert> +#include <memory> + +namespace Catch { + void prepareExpandedExpression(AssertionResult& result) { + result.getExpandedExpression(); + } + + // Because formatting using c++ streams is stateful, drop down to C is required + // Alternatively we could use stringstream, but its performance is... not good. + std::string getFormattedDuration( double duration ) { + // Max exponent + 1 is required to represent the whole part + // + 1 for decimal point + // + 3 for the 3 decimal places + // + 1 for null terminator + const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + char buffer[maxDoubleSize]; + + // Save previous errno, to prevent sprintf from overwriting it + ErrnoGuard guard; +#ifdef _MSC_VER + sprintf_s(buffer, "%.3f", duration); +#else + std::sprintf(buffer, "%.3f", duration); +#endif + return std::string(buffer); + } + + std::string serializeFilters( std::vector<std::string> const& container ) { + ReusableStringStream oss; + bool first = true; + for (auto&& filter : container) + { + if (!first) + oss << ' '; + else + first = false; + + oss << filter; + } + return oss.str(); + } + + TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) + :StreamingReporterBase(_config) {} + + std::set<Verbosity> TestEventListenerBase::getSupportedVerbosities() { + return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High }; + } + + void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} + + bool TestEventListenerBase::assertionEnded(AssertionStats const &) { + return false; + } + +} // end namespace Catch +// end catch_reporter_bases.cpp +// start catch_reporter_compact.cpp + +namespace { + +#ifdef CATCH_PLATFORM_MAC + const char* failedString() { return "FAILED"; } + const char* passedString() { return "PASSED"; } +#else + const char* failedString() { return "failed"; } + const char* passedString() { return "passed"; } +#endif + + // Colour::LightGrey + Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } + + std::string bothOrAll( std::size_t count ) { + return count == 1 ? std::string() : + count == 2 ? "both " : "all " ; + } + +} // anon namespace + +namespace Catch { +namespace { +// Colour, message variants: +// - white: No tests ran. +// - red: Failed [both/all] N test cases, failed [both/all] M assertions. +// - white: Passed [both/all] N test cases (no assertions). +// - red: Failed N tests cases, failed M assertions. +// - green: Passed [both/all] N tests cases with M assertions. +void printTotals(std::ostream& out, const Totals& totals) { + if (totals.testCases.total() == 0) { + out << "No tests ran."; + } else if (totals.testCases.failed == totals.testCases.total()) { + Colour colour(Colour::ResultError); + const std::string qualify_assertions_failed = + totals.assertions.failed == totals.assertions.total() ? + bothOrAll(totals.assertions.failed) : std::string(); + out << + "Failed " << bothOrAll(totals.testCases.failed) + << pluralise(totals.testCases.failed, "test case") << ", " + "failed " << qualify_assertions_failed << + pluralise(totals.assertions.failed, "assertion") << '.'; + } else if (totals.assertions.total() == 0) { + out << + "Passed " << bothOrAll(totals.testCases.total()) + << pluralise(totals.testCases.total(), "test case") + << " (no assertions)."; + } else if (totals.assertions.failed) { + Colour colour(Colour::ResultError); + out << + "Failed " << pluralise(totals.testCases.failed, "test case") << ", " + "failed " << pluralise(totals.assertions.failed, "assertion") << '.'; + } else { + Colour colour(Colour::ResultSuccess); + out << + "Passed " << bothOrAll(totals.testCases.passed) + << pluralise(totals.testCases.passed, "test case") << + " with " << pluralise(totals.assertions.passed, "assertion") << '.'; + } +} + +// Implementation of CompactReporter formatting +class AssertionPrinter { +public: + AssertionPrinter& operator= (AssertionPrinter const&) = delete; + AssertionPrinter(AssertionPrinter const&) = delete; + AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + : stream(_stream) + , result(_stats.assertionResult) + , messages(_stats.infoMessages) + , itMessage(_stats.infoMessages.begin()) + , printInfoMessages(_printInfoMessages) {} + + void print() { + printSourceInfo(); + + itMessage = messages.begin(); + + switch (result.getResultType()) { + case ResultWas::Ok: + printResultType(Colour::ResultSuccess, passedString()); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else + printRemainingMessages(); + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) + printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok")); + else + printResultType(Colour::Error, failedString()); + printOriginalExpression(); + printReconstructedExpression(); + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(Colour::Error, failedString()); + printIssue("unexpected exception with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(Colour::Error, failedString()); + printIssue("fatal error condition with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(Colour::Error, failedString()); + printIssue("expected exception, got none"); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType(Colour::None, "info"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType(Colour::None, "warning"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(Colour::Error, failedString()); + printIssue("explicitly"); + printRemainingMessages(Colour::None); + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + printResultType(Colour::Error, "** internal error **"); + break; + } + } + +private: + void printSourceInfo() const { + Colour colourGuard(Colour::FileName); + stream << result.getSourceInfo() << ':'; + } + + void printResultType(Colour::Code colour, std::string const& passOrFail) const { + if (!passOrFail.empty()) { + { + Colour colourGuard(colour); + stream << ' ' << passOrFail; + } + stream << ':'; + } + } + + void printIssue(std::string const& issue) const { + stream << ' ' << issue; + } + + void printExpressionWas() { + if (result.hasExpression()) { + stream << ';'; + { + Colour colour(dimColour()); + stream << " expression was:"; + } + printOriginalExpression(); + } + } + + void printOriginalExpression() const { + if (result.hasExpression()) { + stream << ' ' << result.getExpression(); + } + } + + void printReconstructedExpression() const { + if (result.hasExpandedExpression()) { + { + Colour colour(dimColour()); + stream << " for: "; + } + stream << result.getExpandedExpression(); + } + } + + void printMessage() { + if (itMessage != messages.end()) { + stream << " '" << itMessage->message << '\''; + ++itMessage; + } + } + + void printRemainingMessages(Colour::Code colour = dimColour()) { + if (itMessage == messages.end()) + return; + + // using messages.end() directly yields (or auto) compilation error: + std::vector<MessageInfo>::const_iterator itEnd = messages.end(); + const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd)); + + { + Colour colourGuard(colour); + stream << " with " << pluralise(N, "message") << ':'; + } + + for (; itMessage != itEnd; ) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || itMessage->type != ResultWas::Info) { + stream << " '" << itMessage->message << '\''; + if (++itMessage != itEnd) { + Colour colourGuard(dimColour()); + stream << " and"; + } + } + } + } + +private: + std::ostream& stream; + AssertionResult const& result; + std::vector<MessageInfo> messages; + std::vector<MessageInfo>::const_iterator itMessage; + bool printInfoMessages; +}; + +} // anon namespace + + std::string CompactReporter::getDescription() { + return "Reports test results on a single line, suitable for IDEs"; + } + + ReporterPreferences CompactReporter::getPreferences() const { + return m_reporterPrefs; + } + + void CompactReporter::noMatchingTestCases( std::string const& spec ) { + stream << "No test cases matched '" << spec << '\'' << std::endl; + } + + void CompactReporter::assertionStarting( AssertionInfo const& ) {} + + bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { + AssertionResult const& result = _assertionStats.assertionResult; + + bool printInfoMessages = true; + + // Drop out if result was successful and we're not printing those + if( !m_config->includeSuccessfulResults() && result.isOk() ) { + if( result.getResultType() != ResultWas::Warning ) + return false; + printInfoMessages = false; + } + + AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); + printer.print(); + + stream << std::endl; + return true; + } + + void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { + if (m_config->showDurations() == ShowDurations::Always) { + stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + } + + void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { + printTotals( stream, _testRunStats.totals ); + stream << '\n' << std::endl; + StreamingReporterBase::testRunEnded( _testRunStats ); + } + + CompactReporter::~CompactReporter() {} + + CATCH_REGISTER_REPORTER( "compact", CompactReporter ) + +} // end namespace Catch +// end catch_reporter_compact.cpp +// start catch_reporter_console.cpp + +#include <cfloat> +#include <cstdio> + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled and default is missing) is enabled +#endif + +#if defined(__clang__) +# pragma clang diagnostic push +// For simplicity, benchmarking-only helpers are always enabled +# pragma clang diagnostic ignored "-Wunused-function" +#endif + +namespace Catch { + +namespace { + +// Formatter impl for ConsoleReporter +class ConsoleAssertionPrinter { +public: + ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete; + ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete; + ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + : stream(_stream), + stats(_stats), + result(_stats.assertionResult), + colour(Colour::None), + message(result.getMessage()), + messages(_stats.infoMessages), + printInfoMessages(_printInfoMessages) { + switch (result.getResultType()) { + case ResultWas::Ok: + colour = Colour::Success; + passOrFail = "PASSED"; + //if( result.hasMessage() ) + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) { + colour = Colour::Success; + passOrFail = "FAILED - but was ok"; + } else { + colour = Colour::Error; + passOrFail = "FAILED"; + } + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ThrewException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to unexpected exception with "; + if (_stats.infoMessages.size() == 1) + messageLabel += "message"; + if (_stats.infoMessages.size() > 1) + messageLabel += "messages"; + break; + case ResultWas::FatalErrorCondition: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to a fatal error condition"; + break; + case ResultWas::DidntThrowException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "because no exception was thrown where one was expected"; + break; + case ResultWas::Info: + messageLabel = "info"; + break; + case ResultWas::Warning: + messageLabel = "warning"; + break; + case ResultWas::ExplicitFailure: + passOrFail = "FAILED"; + colour = Colour::Error; + if (_stats.infoMessages.size() == 1) + messageLabel = "explicitly with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "explicitly with messages"; + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + passOrFail = "** internal error **"; + colour = Colour::Error; + break; + } + } + + void print() const { + printSourceInfo(); + if (stats.totals.assertions.total() > 0) { + printResultType(); + printOriginalExpression(); + printReconstructedExpression(); + } else { + stream << '\n'; + } + printMessage(); + } + +private: + void printResultType() const { + if (!passOrFail.empty()) { + Colour colourGuard(colour); + stream << passOrFail << ":\n"; + } + } + void printOriginalExpression() const { + if (result.hasExpression()) { + Colour colourGuard(Colour::OriginalExpression); + stream << " "; + stream << result.getExpressionInMacro(); + stream << '\n'; + } + } + void printReconstructedExpression() const { + if (result.hasExpandedExpression()) { + stream << "with expansion:\n"; + Colour colourGuard(Colour::ReconstructedExpression); + stream << Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } + void printMessage() const { + if (!messageLabel.empty()) + stream << messageLabel << ':' << '\n'; + for (auto const& msg : messages) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || msg.type != ResultWas::Info) + stream << Column(msg.message).indent(2) << '\n'; + } + } + void printSourceInfo() const { + Colour colourGuard(Colour::FileName); + stream << result.getSourceInfo() << ": "; + } + + std::ostream& stream; + AssertionStats const& stats; + AssertionResult const& result; + Colour::Code colour; + std::string passOrFail; + std::string messageLabel; + std::string message; + std::vector<MessageInfo> messages; + bool printInfoMessages; +}; + +std::size_t makeRatio(std::size_t number, std::size_t total) { + std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0; + return (ratio == 0 && number > 0) ? 1 : ratio; +} + +std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) { + if (i > j && i > k) + return i; + else if (j > k) + return j; + else + return k; +} + +struct ColumnInfo { + enum Justification { Left, Right }; + std::string name; + int width; + Justification justification; +}; +struct ColumnBreak {}; +struct RowBreak {}; + +class Duration { + enum class Unit { + Auto, + Nanoseconds, + Microseconds, + Milliseconds, + Seconds, + Minutes + }; + static const uint64_t s_nanosecondsInAMicrosecond = 1000; + static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond; + static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; + static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; + + uint64_t m_inNanoseconds; + Unit m_units; + +public: + explicit Duration(double inNanoseconds, Unit units = Unit::Auto) + : Duration(static_cast<uint64_t>(inNanoseconds), units) { + } + + explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto) + : m_inNanoseconds(inNanoseconds), + m_units(units) { + if (m_units == Unit::Auto) { + if (m_inNanoseconds < s_nanosecondsInAMicrosecond) + m_units = Unit::Nanoseconds; + else if (m_inNanoseconds < s_nanosecondsInAMillisecond) + m_units = Unit::Microseconds; + else if (m_inNanoseconds < s_nanosecondsInASecond) + m_units = Unit::Milliseconds; + else if (m_inNanoseconds < s_nanosecondsInAMinute) + m_units = Unit::Seconds; + else + m_units = Unit::Minutes; + } + + } + + auto value() const -> double { + switch (m_units) { + case Unit::Microseconds: + return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMicrosecond); + case Unit::Milliseconds: + return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMillisecond); + case Unit::Seconds: + return m_inNanoseconds / static_cast<double>(s_nanosecondsInASecond); + case Unit::Minutes: + return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute); + default: + return static_cast<double>(m_inNanoseconds); + } + } + auto unitsAsString() const -> std::string { + switch (m_units) { + case Unit::Nanoseconds: + return "ns"; + case Unit::Microseconds: + return "us"; + case Unit::Milliseconds: + return "ms"; + case Unit::Seconds: + return "s"; + case Unit::Minutes: + return "m"; + default: + return "** internal error **"; + } + + } + friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& { + return os << duration.value() << " " << duration.unitsAsString(); + } +}; +} // end anon namespace + +class TablePrinter { + std::ostream& m_os; + std::vector<ColumnInfo> m_columnInfos; + std::ostringstream m_oss; + int m_currentColumn = -1; + bool m_isOpen = false; + +public: + TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos ) + : m_os( os ), + m_columnInfos( std::move( columnInfos ) ) {} + + auto columnInfos() const -> std::vector<ColumnInfo> const& { + return m_columnInfos; + } + + void open() { + if (!m_isOpen) { + m_isOpen = true; + *this << RowBreak(); + + Columns headerCols; + Spacer spacer(2); + for (auto const& info : m_columnInfos) { + headerCols += Column(info.name).width(static_cast<std::size_t>(info.width - 2)); + headerCols += spacer; + } + m_os << headerCols << "\n"; + + m_os << Catch::getLineOfChars<'-'>() << "\n"; + } + } + void close() { + if (m_isOpen) { + *this << RowBreak(); + m_os << std::endl; + m_isOpen = false; + } + } + + template<typename T> + friend TablePrinter& operator << (TablePrinter& tp, T const& value) { + tp.m_oss << value; + return tp; + } + + friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) { + auto colStr = tp.m_oss.str(); + // This takes account of utf8 encodings + auto strSize = Catch::StringRef(colStr).numberOfCharacters(); + tp.m_oss.str(""); + tp.open(); + if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) { + tp.m_currentColumn = -1; + tp.m_os << "\n"; + } + tp.m_currentColumn++; + + auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; + auto padding = (strSize + 2 < static_cast<std::size_t>(colInfo.width)) + ? std::string(colInfo.width - (strSize + 2), ' ') + : std::string(); + if (colInfo.justification == ColumnInfo::Left) + tp.m_os << colStr << padding << " "; + else + tp.m_os << padding << colStr << " "; + return tp; + } + + friend TablePrinter& operator << (TablePrinter& tp, RowBreak) { + if (tp.m_currentColumn > 0) { + tp.m_os << "\n"; + tp.m_currentColumn = -1; + } + return tp; + } +}; + +ConsoleReporter::ConsoleReporter(ReporterConfig const& config) + : StreamingReporterBase(config), + m_tablePrinter(new TablePrinter(config.stream(), + { + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left }, + { "samples mean std dev", 14, ColumnInfo::Right }, + { "iterations low mean low std dev", 14, ColumnInfo::Right }, + { "estimated high mean high std dev", 14, ColumnInfo::Right } + })) {} +ConsoleReporter::~ConsoleReporter() = default; + +std::string ConsoleReporter::getDescription() { + return "Reports test results as plain lines of text"; +} + +void ConsoleReporter::noMatchingTestCases(std::string const& spec) { + stream << "No test cases matched '" << spec << '\'' << std::endl; +} + +void ConsoleReporter::assertionStarting(AssertionInfo const&) {} + +bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { + AssertionResult const& result = _assertionStats.assertionResult; + + bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); + + // Drop out if result was successful but we're not printing them. + if (!includeResults && result.getResultType() != ResultWas::Warning) + return false; + + lazyPrint(); + + ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults); + printer.print(); + stream << std::endl; + return true; +} + +void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) { + m_tablePrinter->close(); + m_headerPrinted = false; + StreamingReporterBase::sectionStarting(_sectionInfo); +} +void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { + m_tablePrinter->close(); + if (_sectionStats.missingAssertions) { + lazyPrint(); + Colour colour(Colour::ResultError); + if (m_sectionStack.size() > 1) + stream << "\nNo assertions in section"; + else + stream << "\nNo assertions in test case"; + stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; + } + if (m_config->showDurations() == ShowDurations::Always) { + stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + if (m_headerPrinted) { + m_headerPrinted = false; + } + StreamingReporterBase::sectionEnded(_sectionStats); +} + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +void ConsoleReporter::benchmarkPreparing(std::string const& name) { + lazyPrintWithoutClosingBenchmarkTable(); + + auto nameCol = Column(name).width(static_cast<std::size_t>(m_tablePrinter->columnInfos()[0].width - 2)); + + bool firstLine = true; + for (auto line : nameCol) { + if (!firstLine) + (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak(); + else + firstLine = false; + + (*m_tablePrinter) << line << ColumnBreak(); + } +} + +void ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) { + (*m_tablePrinter) << info.samples << ColumnBreak() + << info.iterations << ColumnBreak() + << Duration(info.estimatedDuration) << ColumnBreak(); +} +void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) { + (*m_tablePrinter) << ColumnBreak() + << Duration(stats.mean.point.count()) << ColumnBreak() + << Duration(stats.mean.lower_bound.count()) << ColumnBreak() + << Duration(stats.mean.upper_bound.count()) << ColumnBreak() << ColumnBreak() + << Duration(stats.standardDeviation.point.count()) << ColumnBreak() + << Duration(stats.standardDeviation.lower_bound.count()) << ColumnBreak() + << Duration(stats.standardDeviation.upper_bound.count()) << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak(); +} + +void ConsoleReporter::benchmarkFailed(std::string const& error) { + Colour colour(Colour::Red); + (*m_tablePrinter) + << "Benchmark failed (" << error << ")" + << ColumnBreak() << RowBreak(); +} +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + +void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { + m_tablePrinter->close(); + StreamingReporterBase::testCaseEnded(_testCaseStats); + m_headerPrinted = false; +} +void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) { + if (currentGroupInfo.used) { + printSummaryDivider(); + stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; + printTotals(_testGroupStats.totals); + stream << '\n' << std::endl; + } + StreamingReporterBase::testGroupEnded(_testGroupStats); +} +void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) { + printTotalsDivider(_testRunStats.totals); + printTotals(_testRunStats.totals); + stream << std::endl; + StreamingReporterBase::testRunEnded(_testRunStats); +} +void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) { + StreamingReporterBase::testRunStarting(_testInfo); + printTestFilters(); +} + +void ConsoleReporter::lazyPrint() { + + m_tablePrinter->close(); + lazyPrintWithoutClosingBenchmarkTable(); +} + +void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() { + + if (!currentTestRunInfo.used) + lazyPrintRunInfo(); + if (!currentGroupInfo.used) + lazyPrintGroupInfo(); + + if (!m_headerPrinted) { + printTestCaseAndSectionHeader(); + m_headerPrinted = true; + } +} +void ConsoleReporter::lazyPrintRunInfo() { + stream << '\n' << getLineOfChars<'~'>() << '\n'; + Colour colour(Colour::SecondaryText); + stream << currentTestRunInfo->name + << " is a Catch v" << libraryVersion() << " host application.\n" + << "Run with -? for options\n\n"; + + if (m_config->rngSeed() != 0) + stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; + + currentTestRunInfo.used = true; +} +void ConsoleReporter::lazyPrintGroupInfo() { + if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) { + printClosedHeader("Group: " + currentGroupInfo->name); + currentGroupInfo.used = true; + } +} +void ConsoleReporter::printTestCaseAndSectionHeader() { + assert(!m_sectionStack.empty()); + printOpenHeader(currentTestCaseInfo->name); + + if (m_sectionStack.size() > 1) { + Colour colourGuard(Colour::Headers); + + auto + it = m_sectionStack.begin() + 1, // Skip first section (test case) + itEnd = m_sectionStack.end(); + for (; it != itEnd; ++it) + printHeaderString(it->name, 2); + } + + SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; + + if (!lineInfo.empty()) { + stream << getLineOfChars<'-'>() << '\n'; + Colour colourGuard(Colour::FileName); + stream << lineInfo << '\n'; + } + stream << getLineOfChars<'.'>() << '\n' << std::endl; +} + +void ConsoleReporter::printClosedHeader(std::string const& _name) { + printOpenHeader(_name); + stream << getLineOfChars<'.'>() << '\n'; +} +void ConsoleReporter::printOpenHeader(std::string const& _name) { + stream << getLineOfChars<'-'>() << '\n'; + { + Colour colourGuard(Colour::Headers); + printHeaderString(_name); + } +} + +// if string has a : in first line will set indent to follow it on +// subsequent lines +void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) { + std::size_t i = _string.find(": "); + if (i != std::string::npos) + i += 2; + else + i = 0; + stream << Column(_string).indent(indent + i).initialIndent(indent) << '\n'; +} + +struct SummaryColumn { + + SummaryColumn( std::string _label, Colour::Code _colour ) + : label( std::move( _label ) ), + colour( _colour ) {} + SummaryColumn addRow( std::size_t count ) { + ReusableStringStream rss; + rss << count; + std::string row = rss.str(); + for (auto& oldRow : rows) { + while (oldRow.size() < row.size()) + oldRow = ' ' + oldRow; + while (oldRow.size() > row.size()) + row = ' ' + row; + } + rows.push_back(row); + return *this; + } + + std::string label; + Colour::Code colour; + std::vector<std::string> rows; + +}; + +void ConsoleReporter::printTotals( Totals const& totals ) { + if (totals.testCases.total() == 0) { + stream << Colour(Colour::Warning) << "No tests ran\n"; + } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { + stream << Colour(Colour::ResultSuccess) << "All tests passed"; + stream << " (" + << pluralise(totals.assertions.passed, "assertion") << " in " + << pluralise(totals.testCases.passed, "test case") << ')' + << '\n'; + } else { + + std::vector<SummaryColumn> columns; + columns.push_back(SummaryColumn("", Colour::None) + .addRow(totals.testCases.total()) + .addRow(totals.assertions.total())); + columns.push_back(SummaryColumn("passed", Colour::Success) + .addRow(totals.testCases.passed) + .addRow(totals.assertions.passed)); + columns.push_back(SummaryColumn("failed", Colour::ResultError) + .addRow(totals.testCases.failed) + .addRow(totals.assertions.failed)); + columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) + .addRow(totals.testCases.failedButOk) + .addRow(totals.assertions.failedButOk)); + + printSummaryRow("test cases", columns, 0); + printSummaryRow("assertions", columns, 1); + } +} +void ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) { + for (auto col : cols) { + std::string value = col.rows[row]; + if (col.label.empty()) { + stream << label << ": "; + if (value != "0") + stream << value; + else + stream << Colour(Colour::Warning) << "- none -"; + } else if (value != "0") { + stream << Colour(Colour::LightGrey) << " | "; + stream << Colour(col.colour) + << value << ' ' << col.label; + } + } + stream << '\n'; +} + +void ConsoleReporter::printTotalsDivider(Totals const& totals) { + if (totals.testCases.total() > 0) { + std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total()); + std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total()); + std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total()); + while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio)++; + while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio)--; + + stream << Colour(Colour::Error) << std::string(failedRatio, '='); + stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '='); + if (totals.testCases.allPassed()) + stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '='); + else + stream << Colour(Colour::Success) << std::string(passedRatio, '='); + } else { + stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '='); + } + stream << '\n'; +} +void ConsoleReporter::printSummaryDivider() { + stream << getLineOfChars<'-'>() << '\n'; +} + +void ConsoleReporter::printTestFilters() { + if (m_config->testSpec().hasFilters()) + stream << Colour(Colour::BrightYellow) << "Filters: " << serializeFilters( m_config->getTestsOrTags() ) << '\n'; +} + +CATCH_REGISTER_REPORTER("console", ConsoleReporter) + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_reporter_console.cpp +// start catch_reporter_junit.cpp + +#include <cassert> +#include <sstream> +#include <ctime> +#include <algorithm> + +namespace Catch { + + namespace { + std::string getCurrentTimestamp() { + // Beware, this is not reentrant because of backward compatibility issues + // Also, UTC only, again because of backward compatibility (%z is C++11) + time_t rawtime; + std::time(&rawtime); + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + +#ifdef _MSC_VER + std::tm timeInfo = {}; + gmtime_s(&timeInfo, &rawtime); +#else + std::tm* timeInfo; + timeInfo = std::gmtime(&rawtime); +#endif + + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + +#ifdef _MSC_VER + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); +#else + std::strftime(timeStamp, timeStampSize, fmt, timeInfo); +#endif + return std::string(timeStamp); + } + + std::string fileNameTag(const std::vector<std::string> &tags) { + auto it = std::find_if(begin(tags), + end(tags), + [] (std::string const& tag) {return tag.front() == '#'; }); + if (it != tags.end()) + return it->substr(1); + return std::string(); + } + } // anonymous namespace + + JunitReporter::JunitReporter( ReporterConfig const& _config ) + : CumulativeReporterBase( _config ), + xml( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = true; + m_reporterPrefs.shouldReportAllAssertions = true; + } + + JunitReporter::~JunitReporter() {} + + std::string JunitReporter::getDescription() { + return "Reports test results in an XML format that looks like Ant's junitreport target"; + } + + void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {} + + void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) { + CumulativeReporterBase::testRunStarting( runInfo ); + xml.startElement( "testsuites" ); + } + + void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) { + suiteTimer.start(); + stdOutForSuite.clear(); + stdErrForSuite.clear(); + unexpectedExceptions = 0; + CumulativeReporterBase::testGroupStarting( groupInfo ); + } + + void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) { + m_okToFail = testCaseInfo.okToFail(); + } + + bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) { + if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) + unexpectedExceptions++; + return CumulativeReporterBase::assertionEnded( assertionStats ); + } + + void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + stdOutForSuite += testCaseStats.stdOut; + stdErrForSuite += testCaseStats.stdErr; + CumulativeReporterBase::testCaseEnded( testCaseStats ); + } + + void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + double suiteTime = suiteTimer.getElapsedSeconds(); + CumulativeReporterBase::testGroupEnded( testGroupStats ); + writeGroup( *m_testGroups.back(), suiteTime ); + } + + void JunitReporter::testRunEndedCumulative() { + xml.endElement(); + } + + void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); + + TestGroupStats const& stats = groupNode.value; + xml.writeAttribute( "name", stats.groupInfo.name ); + xml.writeAttribute( "errors", unexpectedExceptions ); + xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions ); + xml.writeAttribute( "tests", stats.totals.assertions.total() ); + xml.writeAttribute( "hostname", "tbd" ); // !TBD + if( m_config->showDurations() == ShowDurations::Never ) + xml.writeAttribute( "time", "" ); + else + xml.writeAttribute( "time", suiteTime ); + xml.writeAttribute( "timestamp", getCurrentTimestamp() ); + + // Write properties if there are any + if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { + auto properties = xml.scopedElement("properties"); + if (m_config->hasTestFilters()) { + xml.scopedElement("property") + .writeAttribute("name", "filters") + .writeAttribute("value", serializeFilters(m_config->getTestsOrTags())); + } + if (m_config->rngSeed() != 0) { + xml.scopedElement("property") + .writeAttribute("name", "random-seed") + .writeAttribute("value", m_config->rngSeed()); + } + } + + // Write test cases + for( auto const& child : groupNode.children ) + writeTestCase( *child ); + + xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false ); + xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false ); + } + + void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) { + TestCaseStats const& stats = testCaseNode.value; + + // All test cases have exactly one section - which represents the + // test case itself. That section may have 0-n nested sections + assert( testCaseNode.children.size() == 1 ); + SectionNode const& rootSection = *testCaseNode.children.front(); + + std::string className = stats.testInfo.className; + + if( className.empty() ) { + className = fileNameTag(stats.testInfo.tags); + if ( className.empty() ) + className = "global"; + } + + if ( !m_config->name().empty() ) + className = m_config->name() + "." + className; + + writeSection( className, "", rootSection ); + } + + void JunitReporter::writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode ) { + std::string name = trim( sectionNode.stats.sectionInfo.name ); + if( !rootName.empty() ) + name = rootName + '/' + name; + + if( !sectionNode.assertions.empty() || + !sectionNode.stdOut.empty() || + !sectionNode.stdErr.empty() ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); + if( className.empty() ) { + xml.writeAttribute( "classname", name ); + xml.writeAttribute( "name", "root" ); + } + else { + xml.writeAttribute( "classname", className ); + xml.writeAttribute( "name", name ); + } + xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); + + writeAssertions( sectionNode ); + + if( !sectionNode.stdOut.empty() ) + xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); + if( !sectionNode.stdErr.empty() ) + xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); + } + for( auto const& childNode : sectionNode.childSections ) + if( className.empty() ) + writeSection( name, "", *childNode ); + else + writeSection( className, name, *childNode ); + } + + void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { + for( auto const& assertion : sectionNode.assertions ) + writeAssertion( assertion ); + } + + void JunitReporter::writeAssertion( AssertionStats const& stats ) { + AssertionResult const& result = stats.assertionResult; + if( !result.isOk() ) { + std::string elementName; + switch( result.getResultType() ) { + case ResultWas::ThrewException: + case ResultWas::FatalErrorCondition: + elementName = "error"; + break; + case ResultWas::ExplicitFailure: + elementName = "failure"; + break; + case ResultWas::ExpressionFailed: + elementName = "failure"; + break; + case ResultWas::DidntThrowException: + elementName = "failure"; + break; + + // We should never see these here: + case ResultWas::Info: + case ResultWas::Warning: + case ResultWas::Ok: + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + elementName = "internalError"; + break; + } + + XmlWriter::ScopedElement e = xml.scopedElement( elementName ); + + xml.writeAttribute( "message", result.getExpandedExpression() ); + xml.writeAttribute( "type", result.getTestMacroName() ); + + ReusableStringStream rss; + if( !result.getMessage().empty() ) + rss << result.getMessage() << '\n'; + for( auto const& msg : stats.infoMessages ) + if( msg.type == ResultWas::Info ) + rss << msg.message << '\n'; + + rss << "at " << result.getSourceInfo(); + xml.writeText( rss.str(), false ); + } + } + + CATCH_REGISTER_REPORTER( "junit", JunitReporter ) + +} // end namespace Catch +// end catch_reporter_junit.cpp +// start catch_reporter_listening.cpp + +#include <cassert> + +namespace Catch { + + ListeningReporter::ListeningReporter() { + // We will assume that listeners will always want all assertions + m_preferences.shouldReportAllAssertions = true; + } + + void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { + m_listeners.push_back( std::move( listener ) ); + } + + void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { + assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); + m_reporter = std::move( reporter ); + m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; + } + + ReporterPreferences ListeningReporter::getPreferences() const { + return m_preferences; + } + + std::set<Verbosity> ListeningReporter::getSupportedVerbosities() { + return std::set<Verbosity>{ }; + } + + void ListeningReporter::noMatchingTestCases( std::string const& spec ) { + for ( auto const& listener : m_listeners ) { + listener->noMatchingTestCases( spec ); + } + m_reporter->noMatchingTestCases( spec ); + } + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + void ListeningReporter::benchmarkPreparing( std::string const& name ) { + for (auto const& listener : m_listeners) { + listener->benchmarkPreparing(name); + } + m_reporter->benchmarkPreparing(name); + } + void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkStarting( benchmarkInfo ); + } + m_reporter->benchmarkStarting( benchmarkInfo ); + } + void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkEnded( benchmarkStats ); + } + m_reporter->benchmarkEnded( benchmarkStats ); + } + + void ListeningReporter::benchmarkFailed( std::string const& error ) { + for (auto const& listener : m_listeners) { + listener->benchmarkFailed(error); + } + m_reporter->benchmarkFailed(error); + } +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testRunStarting( testRunInfo ); + } + m_reporter->testRunStarting( testRunInfo ); + } + + void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupStarting( groupInfo ); + } + m_reporter->testGroupStarting( groupInfo ); + } + + void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseStarting( testInfo ); + } + m_reporter->testCaseStarting( testInfo ); + } + + void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->sectionStarting( sectionInfo ); + } + m_reporter->sectionStarting( sectionInfo ); + } + + void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->assertionStarting( assertionInfo ); + } + m_reporter->assertionStarting( assertionInfo ); + } + + // The return value indicates if the messages buffer should be cleared: + bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { + for( auto const& listener : m_listeners ) { + static_cast<void>( listener->assertionEnded( assertionStats ) ); + } + return m_reporter->assertionEnded( assertionStats ); + } + + void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { + for ( auto const& listener : m_listeners ) { + listener->sectionEnded( sectionStats ); + } + m_reporter->sectionEnded( sectionStats ); + } + + void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseEnded( testCaseStats ); + } + m_reporter->testCaseEnded( testCaseStats ); + } + + void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupEnded( testGroupStats ); + } + m_reporter->testGroupEnded( testGroupStats ); + } + + void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { + for ( auto const& listener : m_listeners ) { + listener->testRunEnded( testRunStats ); + } + m_reporter->testRunEnded( testRunStats ); + } + + void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->skipTest( testInfo ); + } + m_reporter->skipTest( testInfo ); + } + + bool ListeningReporter::isMulti() const { + return true; + } + +} // end namespace Catch +// end catch_reporter_listening.cpp +// start catch_reporter_xml.cpp + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + XmlReporter::XmlReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ), + m_xml(_config.stream()) + { + m_reporterPrefs.shouldRedirectStdOut = true; + m_reporterPrefs.shouldReportAllAssertions = true; + } + + XmlReporter::~XmlReporter() = default; + + std::string XmlReporter::getDescription() { + return "Reports test results as an XML document"; + } + + std::string XmlReporter::getStylesheetRef() const { + return std::string(); + } + + void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) { + m_xml + .writeAttribute( "filename", sourceInfo.file ) + .writeAttribute( "line", sourceInfo.line ); + } + + void XmlReporter::noMatchingTestCases( std::string const& s ) { + StreamingReporterBase::noMatchingTestCases( s ); + } + + void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) { + StreamingReporterBase::testRunStarting( testInfo ); + std::string stylesheetRef = getStylesheetRef(); + if( !stylesheetRef.empty() ) + m_xml.writeStylesheetRef( stylesheetRef ); + m_xml.startElement( "Catch" ); + if( !m_config->name().empty() ) + m_xml.writeAttribute( "name", m_config->name() ); + if (m_config->testSpec().hasFilters()) + m_xml.writeAttribute( "filters", serializeFilters( m_config->getTestsOrTags() ) ); + if( m_config->rngSeed() != 0 ) + m_xml.scopedElement( "Randomness" ) + .writeAttribute( "seed", m_config->rngSeed() ); + } + + void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) { + StreamingReporterBase::testGroupStarting( groupInfo ); + m_xml.startElement( "Group" ) + .writeAttribute( "name", groupInfo.name ); + } + + void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + StreamingReporterBase::testCaseStarting(testInfo); + m_xml.startElement( "TestCase" ) + .writeAttribute( "name", trim( testInfo.name ) ) + .writeAttribute( "description", testInfo.description ) + .writeAttribute( "tags", testInfo.tagsAsString() ); + + writeSourceInfo( testInfo.lineInfo ); + + if ( m_config->showDurations() == ShowDurations::Always ) + m_testCaseTimer.start(); + m_xml.ensureTagClosed(); + } + + void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) { + StreamingReporterBase::sectionStarting( sectionInfo ); + if( m_sectionDepth++ > 0 ) { + m_xml.startElement( "Section" ) + .writeAttribute( "name", trim( sectionInfo.name ) ); + writeSourceInfo( sectionInfo.lineInfo ); + m_xml.ensureTagClosed(); + } + } + + void XmlReporter::assertionStarting( AssertionInfo const& ) { } + + bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { + + AssertionResult const& result = assertionStats.assertionResult; + + bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); + + if( includeResults || result.getResultType() == ResultWas::Warning ) { + // Print any info messages in <Info> tags. + for( auto const& msg : assertionStats.infoMessages ) { + if( msg.type == ResultWas::Info && includeResults ) { + m_xml.scopedElement( "Info" ) + .writeText( msg.message ); + } else if ( msg.type == ResultWas::Warning ) { + m_xml.scopedElement( "Warning" ) + .writeText( msg.message ); + } + } + } + + // Drop out if result was successful but we're not printing them. + if( !includeResults && result.getResultType() != ResultWas::Warning ) + return true; + + // Print the expression if there is one. + if( result.hasExpression() ) { + m_xml.startElement( "Expression" ) + .writeAttribute( "success", result.succeeded() ) + .writeAttribute( "type", result.getTestMacroName() ); + + writeSourceInfo( result.getSourceInfo() ); + + m_xml.scopedElement( "Original" ) + .writeText( result.getExpression() ); + m_xml.scopedElement( "Expanded" ) + .writeText( result.getExpandedExpression() ); + } + + // And... Print a result applicable to each result type. + switch( result.getResultType() ) { + case ResultWas::ThrewException: + m_xml.startElement( "Exception" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::FatalErrorCondition: + m_xml.startElement( "FatalErrorCondition" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::Info: + m_xml.scopedElement( "Info" ) + .writeText( result.getMessage() ); + break; + case ResultWas::Warning: + // Warning will already have been written + break; + case ResultWas::ExplicitFailure: + m_xml.startElement( "Failure" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + default: + break; + } + + if( result.hasExpression() ) + m_xml.endElement(); + + return true; + } + + void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { + StreamingReporterBase::sectionEnded( sectionStats ); + if( --m_sectionDepth > 0 ) { + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes", sectionStats.assertions.passed ); + e.writeAttribute( "failures", sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); + + m_xml.endElement(); + } + } + + void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + StreamingReporterBase::testCaseEnded( testCaseStats ); + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); + e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + + if( !testCaseStats.stdOut.empty() ) + m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false ); + if( !testCaseStats.stdErr.empty() ) + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false ); + + m_xml.endElement(); + } + + void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + StreamingReporterBase::testGroupEnded( testGroupStats ); + // TODO: Check testGroupStats.aborting and act accordingly. + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) + .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + + void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) { + StreamingReporterBase::testRunEnded( testRunStats ); + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testRunStats.totals.assertions.passed ) + .writeAttribute( "failures", testRunStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) + void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) { + m_xml.startElement("BenchmarkResults") + .writeAttribute("name", info.name) + .writeAttribute("samples", info.samples) + .writeAttribute("resamples", info.resamples) + .writeAttribute("iterations", info.iterations) + .writeAttribute("clockResolution", static_cast<uint64_t>(info.clockResolution)) + .writeAttribute("estimatedDuration", static_cast<uint64_t>(info.estimatedDuration)) + .writeComment("All values in nano seconds"); + } + + void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) { + m_xml.startElement("mean") + .writeAttribute("value", static_cast<uint64_t>(benchmarkStats.mean.point.count())) + .writeAttribute("lowerBound", static_cast<uint64_t>(benchmarkStats.mean.lower_bound.count())) + .writeAttribute("upperBound", static_cast<uint64_t>(benchmarkStats.mean.upper_bound.count())) + .writeAttribute("ci", benchmarkStats.mean.confidence_interval); + m_xml.endElement(); + m_xml.startElement("standardDeviation") + .writeAttribute("value", benchmarkStats.standardDeviation.point.count()) + .writeAttribute("lowerBound", benchmarkStats.standardDeviation.lower_bound.count()) + .writeAttribute("upperBound", benchmarkStats.standardDeviation.upper_bound.count()) + .writeAttribute("ci", benchmarkStats.standardDeviation.confidence_interval); + m_xml.endElement(); + m_xml.startElement("outliers") + .writeAttribute("variance", benchmarkStats.outlierVariance) + .writeAttribute("lowMild", benchmarkStats.outliers.low_mild) + .writeAttribute("lowSevere", benchmarkStats.outliers.low_severe) + .writeAttribute("highMild", benchmarkStats.outliers.high_mild) + .writeAttribute("highSevere", benchmarkStats.outliers.high_severe); + m_xml.endElement(); + m_xml.endElement(); + } + + void XmlReporter::benchmarkFailed(std::string const &error) { + m_xml.scopedElement("failed"). + writeAttribute("message", error); + m_xml.endElement(); + } +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + + CATCH_REGISTER_REPORTER( "xml", XmlReporter ) + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +// end catch_reporter_xml.cpp + +namespace Catch { + LeakDetector leakDetector; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_impl.hpp +#endif + +#ifdef CATCH_CONFIG_MAIN +// start catch_default_main.hpp + +#ifndef __OBJC__ + +#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +// Standard C/C++ Win32 Unicode wmain entry point +extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +#else +// Standard C/C++ main entry point +int main (int argc, char * argv[]) { +#endif + + return Catch::Session().run( argc, argv ); +} + +#else // __OBJC__ + +// Objective-C entry point +int main (int argc, char * const argv[]) { +#if !CATCH_ARC_ENABLED + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +#endif + + Catch::registerTestMethods(); + int result = Catch::Session().run( argc, (char**)argv ); + +#if !CATCH_ARC_ENABLED + [pool drain]; +#endif + + return result; +} + +#endif // __OBJC__ + +// end catch_default_main.hpp +#endif + +#if !defined(CATCH_CONFIG_IMPL_ONLY) + +#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED +# undef CLARA_CONFIG_MAIN +#endif + +#if !defined(CATCH_CONFIG_DISABLE) +////// +// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ +#ifdef CATCH_CONFIG_PREFIX_ALL + +#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) + +#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) +#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) +#endif// CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) + +#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) +#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + +#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) +#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) + +#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) +#define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "CATCH_UNSCOPED_INFO", msg ) +#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) +#define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE",__VA_ARGS__ ) + +#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) +#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) +#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) +#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) +#define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) +#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) +#else +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) +#endif + +#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) +#define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ ) +#define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ ) +#else +#define CATCH_STATIC_REQUIRE( ... ) CATCH_REQUIRE( __VA_ARGS__ ) +#define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ ) +#endif + +// "BDD-style" convenience wrappers +#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ ) +#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) +#define CATCH_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) +#define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) +#define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) +#define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) +#define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) +#define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +#define CATCH_BENCHMARK(...) \ + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,)) +#define CATCH_BENCHMARK_ADVANCED(name) \ + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name) +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + +// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required +#else + +#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) + +#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) +#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) + +#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) +#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + +#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) +#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) + +#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) +#define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg ) +#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) +#define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE",__VA_ARGS__ ) + +#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) +#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) +#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) +#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) +#define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) +#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) +#define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__) +#define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#else +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) +#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) ) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) +#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) +#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) +#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) +#define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) ) +#define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) +#endif + +#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) +#define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ ) +#define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" ) +#else +#define STATIC_REQUIRE( ... ) REQUIRE( __VA_ARGS__ ) +#define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ ) +#endif + +#endif + +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) + +// "BDD-style" convenience wrappers +#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ ) +#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) + +#define GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) +#define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) +#define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) +#define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) +#define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) +#define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +#define BENCHMARK(...) \ + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,)) +#define BENCHMARK_ADVANCED(name) \ + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name) +#endif // CATCH_CONFIG_ENABLE_BENCHMARKING + +using Catch::Detail::Approx; + +#else // CATCH_CONFIG_DISABLE + +////// +// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ +#ifdef CATCH_CONFIG_PREFIX_ALL + +#define CATCH_REQUIRE( ... ) (void)(0) +#define CATCH_REQUIRE_FALSE( ... ) (void)(0) + +#define CATCH_REQUIRE_THROWS( ... ) (void)(0) +#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) +#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif// CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0) + +#define CATCH_CHECK( ... ) (void)(0) +#define CATCH_CHECK_FALSE( ... ) (void)(0) +#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__) +#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) +#define CATCH_CHECK_NOFAIL( ... ) (void)(0) + +#define CATCH_CHECK_THROWS( ... ) (void)(0) +#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0) +#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_CHECK_NOTHROW( ... ) (void)(0) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THAT( arg, matcher ) (void)(0) + +#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define CATCH_INFO( msg ) (void)(0) +#define CATCH_UNSCOPED_INFO( msg ) (void)(0) +#define CATCH_WARN( msg ) (void)(0) +#define CATCH_CAPTURE( msg ) (void)(0) + +#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_METHOD_AS_TEST_CASE( method, ... ) +#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) +#define CATCH_SECTION( ... ) +#define CATCH_DYNAMIC_SECTION( ... ) +#define CATCH_FAIL( ... ) (void)(0) +#define CATCH_FAIL_CHECK( ... ) (void)(0) +#define CATCH_SUCCEED( ... ) (void)(0) + +#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) +#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__) +#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#else +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) ) +#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#endif + +// "BDD-style" convenience wrappers +#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) +#define CATCH_GIVEN( desc ) +#define CATCH_AND_GIVEN( desc ) +#define CATCH_WHEN( desc ) +#define CATCH_AND_WHEN( desc ) +#define CATCH_THEN( desc ) +#define CATCH_AND_THEN( desc ) + +#define CATCH_STATIC_REQUIRE( ... ) (void)(0) +#define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) + +// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required +#else + +#define REQUIRE( ... ) (void)(0) +#define REQUIRE_FALSE( ... ) (void)(0) + +#define REQUIRE_THROWS( ... ) (void)(0) +#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) +#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define REQUIRE_NOTHROW( ... ) (void)(0) + +#define CHECK( ... ) (void)(0) +#define CHECK_FALSE( ... ) (void)(0) +#define CHECKED_IF( ... ) if (__VA_ARGS__) +#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) +#define CHECK_NOFAIL( ... ) (void)(0) + +#define CHECK_THROWS( ... ) (void)(0) +#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0) +#define CHECK_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CHECK_NOTHROW( ... ) (void)(0) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THAT( arg, matcher ) (void)(0) + +#define REQUIRE_THAT( arg, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define INFO( msg ) (void)(0) +#define UNSCOPED_INFO( msg ) (void)(0) +#define WARN( msg ) (void)(0) +#define CAPTURE( msg ) (void)(0) + +#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define METHOD_AS_TEST_CASE( method, ... ) +#define REGISTER_TEST_CASE( Function, ... ) (void)(0) +#define SECTION( ... ) +#define DYNAMIC_SECTION( ... ) +#define FAIL( ... ) (void)(0) +#define FAIL_CHECK( ... ) (void)(0) +#define SUCCEED( ... ) (void)(0) +#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) +#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__) +#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#else +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) ) +#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) ) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) ) +#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) ) +#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#endif + +#define STATIC_REQUIRE( ... ) (void)(0) +#define STATIC_REQUIRE_FALSE( ... ) (void)(0) + +#endif + +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +// "BDD-style" convenience wrappers +#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) ) +#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) + +#define GIVEN( desc ) +#define AND_GIVEN( desc ) +#define WHEN( desc ) +#define AND_WHEN( desc ) +#define THEN( desc ) +#define AND_THEN( desc ) + +using Catch::Detail::Approx; + +#endif + +#endif // ! CATCH_CONFIG_IMPL_ONLY + +// start catch_reenable_warnings.h + + +#ifdef __clang__ +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(pop) +# else +# pragma clang diagnostic pop +# endif +#elif defined __GNUC__ +# pragma GCC diagnostic pop +#endif + +// end catch_reenable_warnings.h +// end catch.hpp +#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED + diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h new file mode 100644 index 000000000..8a458a3e5 --- /dev/null +++ b/toolsrc/include/vcpkg-test/util.h @@ -0,0 +1,68 @@ +#include <vcpkg-test/catch.h> +#include <vcpkg/pragmas.h> + +#include <vcpkg/base/files.h> +#include <vcpkg/statusparagraph.h> + +#include <memory> + +#define CHECK_EC(ec) \ + do \ + { \ + if (ec) \ + { \ + FAIL(ec.message()); \ + } \ + } while (0) + +namespace vcpkg::Test +{ + 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"); + + vcpkg::PackageSpec unsafe_pspec(std::string name, vcpkg::Triplet t = vcpkg::Triplet::X86_WINDOWS); + + 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); +} diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 3ea0d6036..e9d3d33bf 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -10,16 +10,91 @@ namespace fs namespace stdfs = std::experimental::filesystem; using stdfs::copy_options; - using stdfs::file_status; - using stdfs::file_type; using stdfs::path; + using stdfs::perms; using stdfs::u8path; - inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } - inline bool is_directory(file_status s) { return stdfs::is_directory(s); } - inline bool is_symlink(file_status s) { return stdfs::is_symlink(s); } +#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; + }; + +#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; + }; + +#endif + + 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 @@ -44,8 +119,14 @@ namespace vcpkg::Files std::error_code& ec) = 0; bool remove(const fs::path& path, LineInfo linfo); virtual bool remove(const fs::path& path, std::error_code& ec) = 0; - virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec) = 0; - virtual bool exists(const fs::path& path) const = 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); + bool exists(const fs::path& path, std::error_code& ec) const; + bool exists(LineInfo li, const fs::path& path) const; + // this should probably not exist, but would require a pass through of + // existing code to fix + bool exists(const fs::path& path) 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; @@ -59,6 +140,10 @@ namespace vcpkg::Files 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 symlink_status(LineInfo li, const fs::path& p) const noexcept; + virtual fs::path canonical(const fs::path& path, std::error_code& ec) const = 0; + fs::path canonical(LineInfo li, const fs::path& path) const; virtual std::vector<fs::path> find_from_PATH(const std::string& name) const = 0; }; diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index d553d1d41..0f25607df 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -5,6 +5,7 @@ #include <vcpkg/base/stringliteral.h> #include <vcpkg/base/stringview.h> #include <vcpkg/base/view.h> +#include <vcpkg/pragmas.h> #include <vector> @@ -184,4 +185,7 @@ namespace vcpkg::Strings 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; } diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index e629ef0b2..90c947aa9 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -3,19 +3,19 @@ #include <algorithm> #include <map> #include <mutex> +#include <type_traits> #include <unordered_map> #include <utility> #include <vector> -#include <type_traits> namespace vcpkg::Util { - template <class T> + template<class T> constexpr std::add_const_t<T>& as_const(T& t) noexcept { return t; } - template <class T> + template<class T> void as_const(const T&&) = delete; template<class Container> diff --git a/toolsrc/include/vcpkg/base/work_queue.h b/toolsrc/include/vcpkg/base/work_queue.h new file mode 100644 index 000000000..a60613a3c --- /dev/null +++ b/toolsrc/include/vcpkg/base/work_queue.h @@ -0,0 +1,140 @@ +#pragma once + +#include <vcpkg/base/checks.h> + +#include <condition_variable> +#include <memory> +#include <vector> + +namespace vcpkg +{ + template<class Action> + struct WorkQueue + { + WorkQueue(LineInfo li) : m_line_info(li) {} + WorkQueue(const WorkQueue&) = delete; + + ~WorkQueue() + { + auto lck = std::unique_lock<std::mutex>(m_mutex, std::try_to_lock); + /* + if we don't own the lock, there isn't much we can do + it is likely a spurious failure + */ + if (lck && m_running_workers != 0) + { + Checks::exit_with_message( + m_line_info, "Internal error -- outstanding workers (%u) at destruct point", m_running_workers); + } + } + + template<class F> + void run_and_join(unsigned num_threads, const F& tld_init) noexcept + { + if (m_actions.empty()) return; + + std::vector<std::thread> threads; + threads.reserve(num_threads); + for (unsigned i = 0; i < num_threads; ++i) + { + threads.emplace_back(Worker<decltype(tld_init())>{this, tld_init()}); + } + + for (auto& thrd : threads) + { + thrd.join(); + } + } + + // useful in the case of errors + // doesn't stop any existing running tasks + // returns immediately, so that one can call this in a task + void cancel() const + { + { + auto lck = std::lock_guard<std::mutex>(m_mutex); + m_cancelled = true; + m_actions.clear(); + } + m_cv.notify_all(); + } + + void enqueue_action(Action a) const + { + { + auto lck = std::lock_guard<std::mutex>(m_mutex); + if (m_cancelled) return; + + m_actions.push_back(std::move(a)); + } + m_cv.notify_one(); + } + + private: + template<class ThreadLocalData> + struct Worker + { + const WorkQueue* work_queue; + ThreadLocalData tld; + + void operator()() + { + auto lck = std::unique_lock<std::mutex>(work_queue->m_mutex); + for (;;) + { + const auto& w = *work_queue; + work_queue->m_cv.wait(lck, [&w] { + if (w.m_cancelled) + return true; + else if (!w.m_actions.empty()) + return true; + else if (w.m_running_workers == 0) + return true; + else + return false; + }); + + if (work_queue->m_cancelled || work_queue->m_actions.empty()) + { + /* + if we've been cancelled, or if the work queue is empty + and there are no other workers, we want to return + immediately; we don't check for the latter condition + since if we're at this point, then either the queue + is not empty, or there are no other workers, or both. + We can't have an empty queue, and other workers, or + we would still be in the wait. + */ + break; + } + + ++work_queue->m_running_workers; + + auto action = std::move(work_queue->m_actions.back()); + work_queue->m_actions.pop_back(); + + lck.unlock(); + work_queue->m_cv.notify_one(); + std::move(action)(tld, *work_queue); + lck.lock(); + + const auto after = --work_queue->m_running_workers; + if (work_queue->m_actions.empty() && after == 0) + { + work_queue->m_cv.notify_all(); + return; + } + } + } + }; + + mutable std::mutex m_mutex{}; + // these are all under m_mutex + mutable bool m_cancelled = false; + mutable std::vector<Action> m_actions{}; + mutable std::condition_variable m_cv{}; + mutable unsigned long m_running_workers = 0; + + LineInfo m_line_info; + }; +} diff --git a/toolsrc/include/vcpkg/binaryparagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h index 3315151c6..7734859f7 100644 --- a/toolsrc/include/vcpkg/binaryparagraph.h +++ b/toolsrc/include/vcpkg/binaryparagraph.h @@ -1,6 +1,7 @@ #pragma once #include <vcpkg/packagespec.h> +#include <vcpkg/parse.h> #include <vcpkg/sourceparagraph.h> #include <unordered_map> @@ -13,7 +14,7 @@ namespace vcpkg struct BinaryParagraph { BinaryParagraph(); - explicit BinaryParagraph(std::unordered_map<std::string, std::string> fields); + explicit BinaryParagraph(Parse::RawParagraph fields); BinaryParagraph(const SourceParagraph& spgh, const Triplet& triplet, const std::string& abi_tag); BinaryParagraph(const SourceParagraph& spgh, const FeatureParagraph& fpgh, const Triplet& triplet); diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index 04cd7cf87..c57cbfad3 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -125,7 +125,9 @@ namespace vcpkg::Build /// <summary> /// Runs the triplet file in a "capture" mode to create a PreBuildInfo /// </summary> - static PreBuildInfo from_triplet_file(const VcpkgPaths& paths, const Triplet& triplet); + static PreBuildInfo from_triplet_file(const VcpkgPaths& paths, + const Triplet& triplet, + Optional<const SourceControlFileLocation&> port = nullopt); std::string triplet_abi_tag; std::string target_architecture; @@ -135,10 +137,34 @@ namespace vcpkg::Build Optional<fs::path> visual_studio_path; Optional<std::string> external_toolchain_file; Optional<ConfigurationType> build_type; + std::vector<std::string> passthrough_env_vars; }; std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset); + enum class VcpkgTripletVar + { + TARGET_ARCHITECTURE = 0, + CMAKE_SYSTEM_NAME, + CMAKE_SYSTEM_VERSION, + PLATFORM_TOOLSET, + VISUAL_STUDIO_PATH, + CHAINLOAD_TOOLCHAIN_FILE, + BUILD_TYPE, + ENV_PASSTHROUGH, + }; + + const std::unordered_map<std::string, VcpkgTripletVar> VCPKG_OPTIONS = { + {"VCPKG_TARGET_ARCHITECTURE", VcpkgTripletVar::TARGET_ARCHITECTURE}, + {"VCPKG_CMAKE_SYSTEM_NAME", VcpkgTripletVar::CMAKE_SYSTEM_NAME}, + {"VCPKG_CMAKE_SYSTEM_VERSION", VcpkgTripletVar::CMAKE_SYSTEM_VERSION}, + {"VCPKG_PLATFORM_TOOLSET", VcpkgTripletVar::PLATFORM_TOOLSET}, + {"VCPKG_VISUAL_STUDIO_PATH", VcpkgTripletVar::VISUAL_STUDIO_PATH}, + {"VCPKG_CHAINLOAD_TOOLCHAIN_FILE", VcpkgTripletVar::CHAINLOAD_TOOLCHAIN_FILE}, + {"VCPKG_BUILD_TYPE", VcpkgTripletVar::BUILD_TYPE}, + {"VCPKG_ENV_PASSTHROUGH", VcpkgTripletVar::ENV_PASSTHROUGH}, + }; + struct ExtendedBuildResult { ExtendedBuildResult(BuildResult code); @@ -152,19 +178,20 @@ namespace vcpkg::Build struct BuildPackageConfig { - BuildPackageConfig(const SourceControlFile& src, + BuildPackageConfig(const SourceControlFileLocation& scfl, const Triplet& triplet, - fs::path&& port_dir, const BuildPackageOptions& build_package_options, const std::set<std::string>& feature_list) - : scf(src) + : scfl(scfl) + , scf(*scfl.source_control_file) , triplet(triplet) - , port_dir(std::move(port_dir)) + , port_dir(scfl.source_location) , build_package_options(build_package_options) , feature_list(feature_list) { } + const SourceControlFileLocation& scfl; const SourceControlFile& scf; const Triplet& triplet; fs::path port_dir; diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 6a94b389a..8a502122e 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -56,7 +56,7 @@ namespace vcpkg::Commands namespace DependInfo { extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); } namespace Search diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 964158026..e9018b1b8 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -145,7 +145,7 @@ namespace vcpkg::Dependencies struct PathsPortFileProvider : Util::ResourceBase, PortFileProvider { - explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, + explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, const std::vector<std::string>* ports_dirs_paths); Optional<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const override; std::vector<const SourceControlFileLocation*> load_all_control_files() const override; @@ -186,9 +186,10 @@ namespace vcpkg::Dependencies std::vector<ExportPlanAction> create_export_plan(const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db); - std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFileLocation>& map, - const std::vector<FeatureSpec>& specs, - const StatusParagraphs& status_db); + std::vector<AnyAction> create_feature_install_plan( + const std::unordered_map<std::string, SourceControlFileLocation>& map, + const std::vector<FeatureSpec>& specs, + const StatusParagraphs& status_db); /// <summary>Figure out which actions are required to install features specifications in `specs`.</summary> /// <param name="provider">Contains the ports of the current environment.</param> @@ -199,7 +200,7 @@ namespace vcpkg::Dependencies const StatusParagraphs& status_db, const CreateInstallPlanOptions& options = {}); - void print_plan(const std::vector<AnyAction>& action_plan, + void print_plan(const std::vector<AnyAction>& action_plan, const bool is_recursive = true, const fs::path& default_ports_dir = ""); } diff --git a/toolsrc/include/vcpkg/logicexpression.h b/toolsrc/include/vcpkg/logicexpression.h new file mode 100644 index 000000000..8795971b9 --- /dev/null +++ b/toolsrc/include/vcpkg/logicexpression.h @@ -0,0 +1,10 @@ +#pragma once
+
+#include <string>
+
+namespace vcpkg
+{
+ // Evaluate simple vcpkg logic expressions. An identifier in the expression is considered 'true'
+ // if it is a substring of the evaluation_context (typically the name of the triplet)
+ bool evaluate_expression(const std::string& expression, const std::string& evaluation_context);
+}
\ No newline at end of file diff --git a/toolsrc/include/vcpkg/paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h index 56f09387a..7e2410aef 100644 --- a/toolsrc/include/vcpkg/paragraphs.h +++ b/toolsrc/include/vcpkg/paragraphs.h @@ -12,7 +12,6 @@ namespace vcpkg::Paragraphs Expected<RawParagraph> get_single_paragraph(const Files::Filesystem& fs, const fs::path& control_path); Expected<std::vector<RawParagraph>> get_paragraphs(const Files::Filesystem& fs, const fs::path& control_path); - Expected<RawParagraph> parse_single_paragraph(const std::string& str); Expected<std::vector<RawParagraph>> parse_paragraphs(const std::string& str); Parse::ParseExpected<SourceControlFile> try_load_port(const Files::Filesystem& fs, const fs::path& control_path); diff --git a/toolsrc/include/vcpkg/pragmas.h b/toolsrc/include/vcpkg/pragmas.h new file mode 100644 index 000000000..fa1039bce --- /dev/null +++ b/toolsrc/include/vcpkg/pragmas.h @@ -0,0 +1,11 @@ +#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(__GNUC__) && __GNUC__ < 7 +// [[nodiscard]] is not recognized before GCC version 7 +#pragma GCC diagnostic ignored "-Wattributes" +#endif diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index 6232a3fd2..95347770a 100644 --- a/toolsrc/include/vcpkg/sourceparagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -23,6 +23,7 @@ namespace vcpkg std::vector<std::string> filter_dependencies(const std::vector<Dependency>& deps, const Triplet& t); std::vector<FeatureSpec> filter_dependencies_to_specs(const std::vector<Dependency>& deps, const Triplet& t); + std::vector<Features> filter_dependencies_to_features(const std::vector<vcpkg::Dependency>& deps, const Triplet& t); // zlib[uwp] becomes Dependency{"zlib", "uwp"} std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends); @@ -69,7 +70,8 @@ namespace vcpkg }; /// <summary> - /// Full metadata of a package: core and other features. As well as the location the SourceControlFile was loaded from. + /// Full metadata of a package: core and other features. As well as the location the SourceControlFile was loaded + /// from. /// </summary> struct SourceControlFileLocation { diff --git a/toolsrc/include/vcpkg/statusparagraph.h b/toolsrc/include/vcpkg/statusparagraph.h index e79c946cc..6e832fe2f 100644 --- a/toolsrc/include/vcpkg/statusparagraph.h +++ b/toolsrc/include/vcpkg/statusparagraph.h @@ -30,7 +30,7 @@ namespace vcpkg struct StatusParagraph { StatusParagraph() noexcept; - explicit StatusParagraph(std::unordered_map<std::string, std::string>&& fields); + explicit StatusParagraph(Parse::RawParagraph&& fields); bool is_installed() const { return want == Want::INSTALL && state == InstallState::INSTALLED; } diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index ce442858b..8107b8201 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -55,7 +55,7 @@ namespace vcpkg fs::path package_dir(const PackageSpec& spec) const; fs::path build_info_file_path(const PackageSpec& spec) const; fs::path listfile_path(const BinaryParagraph& pgh) const; - + bool is_valid_triplet(const Triplet& t) const; const std::vector<std::string>& get_available_triplets() const; const fs::path get_triplet_file_path(const Triplet& triplet) const; diff --git a/toolsrc/src/tests.arguments.cpp b/toolsrc/src/tests.arguments.cpp deleted file mode 100644 index e108b983a..000000000 --- a/toolsrc/src/tests.arguments.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "tests.pch.h"
-
-#if defined(_WIN32)
-#pragma comment(lib, "version")
-#pragma comment(lib, "winhttp")
-#endif
-
-using namespace Microsoft::VisualStudio::CppUnitTestFramework;
-
-using namespace vcpkg;
-
-namespace UnitTest1
-{
- class ArgumentTests : public TestClass<ArgumentTests>
- {
- TEST_METHOD(create_from_arg_sequence_options_lower)
- {
- std::vector<std::string> t = {
- "--vcpkg-root", "C:\\vcpkg",
- "--scripts-root=C:\\scripts",
- "--debug",
- "--sendmetrics",
- "--printmetrics",
- "--overlay-ports=C:\\ports1",
- "--overlay-ports=C:\\ports2",
- "--overlay-triplets=C:\\tripletsA",
- "--overlay-triplets=C:\\tripletsB"
- };
- auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
- Assert::AreEqual("C:\\vcpkg", v.vcpkg_root_dir.get()->c_str());
- Assert::AreEqual("C:\\scripts", v.scripts_root_dir.get()->c_str());
- Assert::IsTrue(v.debug && *v.debug.get());
- Assert::IsTrue(v.sendmetrics && v.sendmetrics.get());
- Assert::IsTrue(v.printmetrics && *v.printmetrics.get());
-
- Assert::IsTrue(v.overlay_ports.get()->size() == 2);
- Assert::AreEqual("C:\\ports1", v.overlay_ports.get()->at(0).c_str());
- Assert::AreEqual("C:\\ports2", v.overlay_ports.get()->at(1).c_str());
-
- Assert::IsTrue(v.overlay_triplets.get()->size() == 2);
- Assert::AreEqual("C:\\tripletsA", v.overlay_triplets.get()->at(0).c_str());
- Assert::AreEqual("C:\\tripletsB", v.overlay_triplets.get()->at(1).c_str());
- }
-
- TEST_METHOD(create_from_arg_sequence_options_upper)
- {
- std::vector<std::string> t = {
- "--VCPKG-ROOT", "C:\\vcpkg",
- "--SCRIPTS-ROOT=C:\\scripts",
- "--DEBUG",
- "--SENDMETRICS",
- "--PRINTMETRICS",
- "--OVERLAY-PORTS=C:\\ports1",
- "--OVERLAY-PORTS=C:\\ports2",
- "--OVERLAY-TRIPLETS=C:\\tripletsA",
- "--OVERLAY-TRIPLETS=C:\\tripletsB"
- };
- auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
- Assert::AreEqual("C:\\vcpkg", v.vcpkg_root_dir.get()->c_str());
- Assert::AreEqual("C:\\scripts", v.scripts_root_dir.get()->c_str());
- Assert::IsTrue(v.debug && *v.debug.get());
- Assert::IsTrue(v.sendmetrics && v.sendmetrics.get());
- Assert::IsTrue(v.printmetrics && *v.printmetrics.get());
-
- Assert::IsTrue(v.overlay_ports.get()->size() == 2);
- Assert::AreEqual("C:\\ports1", v.overlay_ports.get()->at(0).c_str());
- Assert::AreEqual("C:\\ports2", v.overlay_ports.get()->at(1).c_str());
-
- Assert::IsTrue(v.overlay_triplets.get()->size() == 2);
- Assert::AreEqual("C:\\tripletsA", v.overlay_triplets.get()->at(0).c_str());
- Assert::AreEqual("C:\\tripletsB", v.overlay_triplets.get()->at(1).c_str());
- }
-
- TEST_METHOD(create_from_arg_sequence_valued_options)
- {
- std::array<CommandSetting, 1> settings = {{{"--a", ""}}};
- CommandStructure cmdstruct = {"", 0, SIZE_MAX, {{}, settings}, nullptr};
-
- std::vector<std::string> t = {"--a=b", "command", "argument"};
- auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
- auto opts = v.parse_arguments(cmdstruct);
- Assert::AreEqual("b", opts.settings["--a"].c_str());
- Assert::AreEqual(size_t{1}, v.command_arguments.size());
- Assert::AreEqual("argument", v.command_arguments[0].c_str());
- Assert::AreEqual("command", v.command.c_str());
- }
-
- TEST_METHOD(create_from_arg_sequence_valued_options2)
- {
- std::array<CommandSwitch, 2> switches = {{{"--a", ""}, {"--c", ""}}};
- std::array<CommandSetting, 2> settings = {{{"--b", ""}, {"--d", ""}}};
- CommandStructure cmdstruct = {"", 0, SIZE_MAX, {switches, settings}, nullptr};
-
- std::vector<std::string> t = {"--a", "--b=c"};
- auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
- auto opts = v.parse_arguments(cmdstruct);
- Assert::AreEqual("c", opts.settings["--b"].c_str());
- Assert::IsTrue(opts.settings.find("--d") == opts.settings.end());
- Assert::IsTrue(opts.switches.find("--a") != opts.switches.end());
- Assert::IsTrue(opts.settings.find("--c") == opts.settings.end());
- Assert::AreEqual(size_t{0}, v.command_arguments.size());
- }
- };
-}
diff --git a/toolsrc/src/tests.chrono.cpp b/toolsrc/src/tests.chrono.cpp deleted file mode 100644 index 269cdca58..000000000 --- a/toolsrc/src/tests.chrono.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "tests.pch.h" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -namespace Chrono = vcpkg::Chrono; - -namespace UnitTest1 -{ - class ChronoTests : public TestClass<ChronoTests> - { - TEST_METHOD(parse_time) - { - auto timestring = "1990-02-03T04:05:06.0Z"; - auto maybe_time = Chrono::CTime::parse(timestring); - - Assert::IsTrue(maybe_time.has_value()); - - Assert::AreEqual(timestring, maybe_time.get()->to_string().c_str()); - } - - TEST_METHOD(parse_time_blank) - { - auto maybe_time = Chrono::CTime::parse(""); - - Assert::IsFalse(maybe_time.has_value()); - } - - TEST_METHOD(time_difference) - { - auto maybe_time1 = Chrono::CTime::parse("1990-02-03T04:05:06.0Z"); - auto maybe_time2 = Chrono::CTime::parse("1990-02-10T04:05:06.0Z"); - - Assert::IsTrue(maybe_time1.has_value()); - Assert::IsTrue(maybe_time2.has_value()); - - auto delta = maybe_time2.get()->to_time_point() - maybe_time1.get()->to_time_point(); - - Assert::AreEqual(24 * 7, std::chrono::duration_cast<std::chrono::hours>(delta).count()); - } - }; -} diff --git a/toolsrc/src/tests.dependencies.cpp b/toolsrc/src/tests.dependencies.cpp deleted file mode 100644 index 7d8283ed6..000000000 --- a/toolsrc/src/tests.dependencies.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "tests.pch.h" - -#if defined(_WIN32) -#pragma comment(lib, "version") -#pragma comment(lib, "winhttp") -#endif - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -using namespace vcpkg; -using Parse::parse_comma_list; - -namespace UnitTest1 -{ - class DependencyTests : public TestClass<DependencyTests> - { - TEST_METHOD(parse_depends_one) - { - auto v = expand_qualified_dependencies(parse_comma_list("libA (windows)")); - Assert::AreEqual(size_t(1), v.size()); - Assert::AreEqual("libA", v[0].depend.name.c_str()); - Assert::AreEqual("windows", v[0].qualifier.c_str()); - } - - TEST_METHOD(filter_depends) - { - auto deps = expand_qualified_dependencies(parse_comma_list("libA (windows), libB, libC (uwp)")); - auto v = filter_dependencies(deps, Triplet::X64_WINDOWS); - Assert::AreEqual(size_t(2), v.size()); - Assert::AreEqual("libA", v[0].c_str()); - Assert::AreEqual("libB", v[1].c_str()); - - auto v2 = filter_dependencies(deps, Triplet::ARM_UWP); - Assert::AreEqual(size_t(2), v.size()); - Assert::AreEqual("libB", v2[0].c_str()); - Assert::AreEqual("libC", v2[1].c_str()); - } - }; - - class SupportsTests : public TestClass<SupportsTests> - { - TEST_METHOD(parse_supports_all) - { - auto v = Supports::parse({ - "x64", - "x86", - "arm", - "windows", - "uwp", - "v140", - "v141", - "crt-static", - "crt-dynamic", - }); - Assert::AreNotEqual(uintptr_t(0), uintptr_t(v.get())); - - Assert::IsTrue(v.get()->is_supported(System::CPUArchitecture::X64, - Supports::Platform::UWP, - Supports::Linkage::DYNAMIC, - Supports::ToolsetVersion::V140)); - Assert::IsTrue(v.get()->is_supported(System::CPUArchitecture::ARM, - Supports::Platform::WINDOWS, - Supports::Linkage::STATIC, - Supports::ToolsetVersion::V141)); - } - - TEST_METHOD(parse_supports_invalid) - { - auto v = Supports::parse({"arm64"}); - Assert::AreEqual(uintptr_t(0), uintptr_t(v.get())); - Assert::AreEqual(size_t(1), v.error().size()); - Assert::AreEqual("arm64", v.error()[0].c_str()); - } - - TEST_METHOD(parse_supports_case_sensitive) - { - auto v = Supports::parse({"Windows"}); - Assert::AreEqual(uintptr_t(0), uintptr_t(v.get())); - Assert::AreEqual(size_t(1), v.error().size()); - Assert::AreEqual("Windows", v.error()[0].c_str()); - } - - TEST_METHOD(parse_supports_some) - { - auto v = Supports::parse({ - "x64", - "x86", - "windows", - }); - Assert::AreNotEqual(uintptr_t(0), uintptr_t(v.get())); - - Assert::IsTrue(v.get()->is_supported(System::CPUArchitecture::X64, - Supports::Platform::WINDOWS, - Supports::Linkage::DYNAMIC, - Supports::ToolsetVersion::V140)); - Assert::IsFalse(v.get()->is_supported(System::CPUArchitecture::ARM, - Supports::Platform::WINDOWS, - Supports::Linkage::DYNAMIC, - Supports::ToolsetVersion::V140)); - Assert::IsFalse(v.get()->is_supported(System::CPUArchitecture::X64, - Supports::Platform::UWP, - Supports::Linkage::DYNAMIC, - Supports::ToolsetVersion::V140)); - Assert::IsTrue(v.get()->is_supported(System::CPUArchitecture::X64, - Supports::Platform::WINDOWS, - Supports::Linkage::STATIC, - Supports::ToolsetVersion::V141)); - } - }; -} diff --git a/toolsrc/src/tests.packagespec.cpp b/toolsrc/src/tests.packagespec.cpp deleted file mode 100644 index d3bc18c79..000000000 --- a/toolsrc/src/tests.packagespec.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include "tests.pch.h" - -#include <tests.utils.h> - -#if defined(_WIN32) -#pragma comment(lib, "version") -#pragma comment(lib, "winhttp") -#endif - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -namespace UnitTest1 -{ - using namespace vcpkg; - - class SpecifierConversion : public TestClass<SpecifierConversion> - { - TEST_METHOD(full_package_spec_to_feature_specs) - { - auto a_spec = PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); - auto b_spec = PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); - - auto fspecs = FullPackageSpec::to_feature_specs({{a_spec, {"0", "1"}}, {b_spec, {"2", "3"}}}); - - Assert::AreEqual(size_t(6), fspecs.size()); - - std::array<const char*, 6> features = {"", "0", "1", "", "2", "3"}; - std::array<PackageSpec*, 6> specs = {&a_spec, &a_spec, &a_spec, &b_spec, &b_spec, &b_spec}; - - for (size_t i = 0; i < features.size(); ++i) - { - Assert::AreEqual(features[i], fspecs[i].feature().c_str()); - Assert::AreEqual(*specs[i], fspecs[i].spec()); - } - } - }; - - class SpecifierParsing : public TestClass<SpecifierParsing> - { - TEST_METHOD(parsed_specifier_from_string) - { - auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib"); - Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); - auto spec = maybe_spec.get(); - Assert::AreEqual("zlib", spec->name.c_str()); - Assert::AreEqual(size_t(0), spec->features.size()); - Assert::AreEqual("", spec->triplet.c_str()); - } - - TEST_METHOD(parsed_specifier_from_string_with_triplet) - { - auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib:x64-uwp"); - Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); - auto spec = maybe_spec.get(); - Assert::AreEqual("zlib", spec->name.c_str()); - Assert::AreEqual("x64-uwp", spec->triplet.c_str()); - } - - TEST_METHOD(parsed_specifier_from_string_with_colons) - { - auto ec = vcpkg::ParsedSpecifier::from_string("zlib:x86-uwp:").error(); - Assert::AreEqual(vcpkg::PackageSpecParseResult::TOO_MANY_COLONS, ec); - } - - TEST_METHOD(parsed_specifier_from_string_with_feature) - { - auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[feature]:x64-uwp"); - Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); - auto spec = maybe_spec.get(); - Assert::AreEqual("zlib", spec->name.c_str()); - Assert::IsTrue(spec->features.size() == 1); - Assert::AreEqual("feature", spec->features.front().c_str()); - Assert::AreEqual("x64-uwp", spec->triplet.c_str()); - } - - TEST_METHOD(parsed_specifier_from_string_with_many_features) - { - auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[0, 1,2]"); - Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); - auto spec = maybe_spec.get(); - Assert::AreEqual("zlib", spec->name.c_str()); - Assert::IsTrue(spec->features.size() == 3); - Assert::AreEqual("0", spec->features[0].c_str()); - Assert::AreEqual("1", spec->features[1].c_str()); - Assert::AreEqual("2", spec->features[2].c_str()); - Assert::AreEqual("", spec->triplet.c_str()); - } - - TEST_METHOD(parsed_specifier_wildcard_feature) - { - auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[*]"); - Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); - auto spec = maybe_spec.get(); - Assert::AreEqual("zlib", spec->name.c_str()); - Assert::IsTrue(spec->features.size() == 1); - Assert::AreEqual("*", spec->features[0].c_str()); - Assert::AreEqual("", spec->triplet.c_str()); - } - - TEST_METHOD(expand_wildcards) - { - auto zlib = - vcpkg::FullPackageSpec::from_string("zlib[0,1]", Triplet::X86_UWP).value_or_exit(VCPKG_LINE_INFO); - auto openssl = - vcpkg::FullPackageSpec::from_string("openssl[*]", Triplet::X86_UWP).value_or_exit(VCPKG_LINE_INFO); - auto specs = FullPackageSpec::to_feature_specs({zlib, openssl}); - Util::sort(specs); - auto spectargets = FeatureSpec::from_strings_and_triplet( - { - "openssl", - "zlib", - "openssl[*]", - "zlib[0]", - "zlib[1]", - }, - Triplet::X86_UWP); - Util::sort(spectargets); - Assert::IsTrue(specs.size() == spectargets.size()); - Assert::IsTrue(Util::all_equal(specs, spectargets)); - } - - TEST_METHOD(utf8_to_utf16) - { - auto str = vcpkg::Strings::to_utf16("abc"); - Assert::AreEqual(L"abc", str.c_str()); - } - - TEST_METHOD(utf8_to_utf16_with_whitespace) - { - auto str = vcpkg::Strings::to_utf16("abc -x86-windows"); - Assert::AreEqual(L"abc -x86-windows", str.c_str()); - } - }; - - TEST_CLASS(Metrics){}; -} diff --git a/toolsrc/src/tests.paragraph.cpp b/toolsrc/src/tests.paragraph.cpp deleted file mode 100644 index e99d07694..000000000 --- a/toolsrc/src/tests.paragraph.cpp +++ /dev/null @@ -1,441 +0,0 @@ -#include "tests.pch.h" - -#if defined(_WIN32) -#pragma comment(lib, "version") -#pragma comment(lib, "winhttp") -#endif - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -namespace Strings = vcpkg::Strings; - -namespace UnitTest1 -{ - class ControlParsing : public TestClass<ControlParsing> - { - TEST_METHOD(SourceParagraph_Construct_Minimum) - { - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - }}); - - Assert::IsTrue(m_pgh.has_value()); - auto& pgh = *m_pgh.get(); - - Assert::AreEqual("zlib", pgh->core_paragraph->name.c_str()); - Assert::AreEqual("1.2.8", pgh->core_paragraph->version.c_str()); - Assert::AreEqual("", pgh->core_paragraph->maintainer.c_str()); - Assert::AreEqual("", pgh->core_paragraph->description.c_str()); - Assert::AreEqual(size_t(0), pgh->core_paragraph->depends.size()); - } - - TEST_METHOD(SourceParagraph_Construct_Maximum) - { - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "s"}, - {"Version", "v"}, - {"Maintainer", "m"}, - {"Description", "d"}, - {"Build-Depends", "bd"}, - {"Default-Features", "df"}, - {"Supports", "x64"}, - }}); - Assert::IsTrue(m_pgh.has_value()); - auto& pgh = *m_pgh.get(); - - Assert::AreEqual("s", pgh->core_paragraph->name.c_str()); - Assert::AreEqual("v", pgh->core_paragraph->version.c_str()); - Assert::AreEqual("m", pgh->core_paragraph->maintainer.c_str()); - Assert::AreEqual("d", pgh->core_paragraph->description.c_str()); - Assert::AreEqual(size_t(1), pgh->core_paragraph->depends.size()); - Assert::AreEqual("bd", pgh->core_paragraph->depends[0].name().c_str()); - Assert::AreEqual(size_t(1), pgh->core_paragraph->default_features.size()); - Assert::AreEqual("df", pgh->core_paragraph->default_features[0].c_str()); - Assert::AreEqual(size_t(1), pgh->core_paragraph->supports.size()); - Assert::AreEqual("x64", pgh->core_paragraph->supports[0].c_str()); - } - - TEST_METHOD(SourceParagraph_Two_Depends) - { - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Build-Depends", "z, openssl"}, - }}); - Assert::IsTrue(m_pgh.has_value()); - auto& pgh = *m_pgh.get(); - - Assert::AreEqual(size_t(2), pgh->core_paragraph->depends.size()); - Assert::AreEqual("z", pgh->core_paragraph->depends[0].name().c_str()); - Assert::AreEqual("openssl", pgh->core_paragraph->depends[1].name().c_str()); - } - - TEST_METHOD(SourceParagraph_Three_Depends) - { - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Build-Depends", "z, openssl, xyz"}, - }}); - Assert::IsTrue(m_pgh.has_value()); - auto& pgh = *m_pgh.get(); - - Assert::AreEqual(size_t(3), pgh->core_paragraph->depends.size()); - Assert::AreEqual("z", pgh->core_paragraph->depends[0].name().c_str()); - Assert::AreEqual("openssl", pgh->core_paragraph->depends[1].name().c_str()); - Assert::AreEqual("xyz", pgh->core_paragraph->depends[2].name().c_str()); - } - - TEST_METHOD(SourceParagraph_Three_Supports) - { - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Supports", "x64, windows, uwp"}, - }}); - Assert::IsTrue(m_pgh.has_value()); - auto& pgh = *m_pgh.get(); - - Assert::AreEqual(size_t(3), pgh->core_paragraph->supports.size()); - Assert::AreEqual("x64", pgh->core_paragraph->supports[0].c_str()); - Assert::AreEqual("windows", pgh->core_paragraph->supports[1].c_str()); - Assert::AreEqual("uwp", pgh->core_paragraph->supports[2].c_str()); - } - - TEST_METHOD(SourceParagraph_Construct_Qualified_Depends) - { - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, - {"Version", "1.2.8"}, - {"Build-Depends", "libA (windows), libB (uwp)"}, - }}); - Assert::IsTrue(m_pgh.has_value()); - auto& pgh = *m_pgh.get(); - - Assert::AreEqual("zlib", pgh->core_paragraph->name.c_str()); - Assert::AreEqual("1.2.8", pgh->core_paragraph->version.c_str()); - Assert::AreEqual("", pgh->core_paragraph->maintainer.c_str()); - Assert::AreEqual("", pgh->core_paragraph->description.c_str()); - Assert::AreEqual(size_t(2), pgh->core_paragraph->depends.size()); - Assert::AreEqual("libA", pgh->core_paragraph->depends[0].name().c_str()); - Assert::AreEqual("windows", pgh->core_paragraph->depends[0].qualifier.c_str()); - Assert::AreEqual("libB", pgh->core_paragraph->depends[1].name().c_str()); - Assert::AreEqual("uwp", pgh->core_paragraph->depends[1].qualifier.c_str()); - } - - TEST_METHOD(SourceParagraph_Default_Features) - { - auto m_pgh = - vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "a"}, - {"Version", "1.0"}, - {"Default-Features", "a1"}, - }}); - Assert::IsTrue(m_pgh.has_value()); - auto& pgh = *m_pgh.get(); - - Assert::AreEqual(size_t(1), pgh->core_paragraph->default_features.size()); - Assert::AreEqual("a1", pgh->core_paragraph->default_features[0].c_str()); - } - - TEST_METHOD(BinaryParagraph_Construct_Minimum) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - }); - - Assert::AreEqual("zlib", pgh.spec.name().c_str()); - Assert::AreEqual("1.2.8", pgh.version.c_str()); - Assert::AreEqual("", pgh.maintainer.c_str()); - Assert::AreEqual("", pgh.description.c_str()); - Assert::AreEqual("x86-windows", pgh.spec.triplet().canonical_name().c_str()); - Assert::AreEqual(size_t(0), pgh.depends.size()); - } - - TEST_METHOD(BinaryParagraph_Construct_Maximum) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "s"}, - {"Version", "v"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Maintainer", "m"}, - {"Description", "d"}, - {"Depends", "bd"}, - }); - Assert::AreEqual("s", pgh.spec.name().c_str()); - Assert::AreEqual("v", pgh.version.c_str()); - Assert::AreEqual("m", pgh.maintainer.c_str()); - Assert::AreEqual("d", pgh.description.c_str()); - Assert::AreEqual(size_t(1), pgh.depends.size()); - Assert::AreEqual("bd", pgh.depends[0].c_str()); - } - - TEST_METHOD(BinaryParagraph_Three_Depends) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", "a, b, c"}, - }); - - Assert::AreEqual(size_t(3), pgh.depends.size()); - Assert::AreEqual("a", pgh.depends[0].c_str()); - Assert::AreEqual("b", pgh.depends[1].c_str()); - Assert::AreEqual("c", pgh.depends[2].c_str()); - } - - TEST_METHOD(BinaryParagraph_Abi) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Abi", "abcd123"}, - }); - - Assert::AreEqual(size_t(0), pgh.depends.size()); - Assert::IsTrue(pgh.abi == "abcd123"); - } - - TEST_METHOD(BinaryParagraph_Default_Features) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "a"}, - {"Version", "1.0"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Default-Features", "a1"}, - }); - - Assert::AreEqual(size_t(0), pgh.depends.size()); - Assert::AreEqual(size_t(1), pgh.default_features.size()); - Assert::IsTrue(pgh.default_features[0] == "a1"); - } - - TEST_METHOD(parse_paragraphs_empty) - { - const char* str = ""; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::IsTrue(pghs.empty()); - } - - TEST_METHOD(parse_paragraphs_one_field) - { - const char* str = "f1: v1"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual(size_t(1), pghs[0].size()); - Assert::AreEqual("v1", pghs[0]["f1"].c_str()); - } - - TEST_METHOD(parse_paragraphs_one_pgh) - { - const char* str = "f1: v1\n" - "f2: v2"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual(size_t(2), pghs[0].size()); - Assert::AreEqual("v1", pghs[0]["f1"].c_str()); - Assert::AreEqual("v2", pghs[0]["f2"].c_str()); - } - - TEST_METHOD(parse_paragraphs_two_pgh) - { - const char* str = "f1: v1\n" - "f2: v2\n" - "\n" - "f3: v3\n" - "f4: v4"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(2), pghs.size()); - Assert::AreEqual(size_t(2), pghs[0].size()); - Assert::AreEqual("v1", pghs[0]["f1"].c_str()); - Assert::AreEqual("v2", pghs[0]["f2"].c_str()); - Assert::AreEqual(size_t(2), pghs[1].size()); - Assert::AreEqual("v3", pghs[1]["f3"].c_str()); - Assert::AreEqual("v4", pghs[1]["f4"].c_str()); - } - - TEST_METHOD(parse_paragraphs_field_names) - { - const char* str = "1:\n" - "f:\n" - "F:\n" - "0:\n" - "F-2:\n"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual(size_t(5), pghs[0].size()); - } - - TEST_METHOD(parse_paragraphs_multiple_blank_lines) - { - const char* str = "f1: v1\n" - "f2: v2\n" - "\n" - "\n" - "f3: v3\n" - "f4: v4"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(2), pghs.size()); - } - - TEST_METHOD(parse_paragraphs_empty_fields) - { - const char* str = "f1:\n" - "f2: "; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual(size_t(2), pghs[0].size()); - Assert::AreEqual("", pghs[0]["f1"].c_str()); - Assert::AreEqual("", pghs[0]["f2"].c_str()); - Assert::AreEqual(size_t(2), pghs[0].size()); - } - - TEST_METHOD(parse_paragraphs_multiline_fields) - { - const char* str = "f1: simple\n" - " f1\r\n" - "f2:\r\n" - " f2\r\n" - " continue\r\n"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual("simple\n f1", pghs[0]["f1"].c_str()); - Assert::AreEqual("\n f2\n continue", pghs[0]["f2"].c_str()); - } - - TEST_METHOD(parse_paragraphs_crlfs) - { - const char* str = "f1: v1\r\n" - "f2: v2\r\n" - "\r\n" - "f3: v3\r\n" - "f4: v4"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(2), pghs.size()); - Assert::AreEqual(size_t(2), pghs[0].size()); - Assert::AreEqual("v1", pghs[0]["f1"].c_str()); - Assert::AreEqual("v2", pghs[0]["f2"].c_str()); - Assert::AreEqual(size_t(2), pghs[1].size()); - Assert::AreEqual("v3", pghs[1]["f3"].c_str()); - Assert::AreEqual("v4", pghs[1]["f4"].c_str()); - } - - TEST_METHOD(parse_paragraphs_comment) - { - const char* str = "f1: v1\r\n" - "#comment\r\n" - "f2: v2\r\n" - "#comment\r\n" - "\r\n" - "#comment\r\n" - "f3: v3\r\n" - "#comment\r\n" - "f4: v4"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(2), pghs.size()); - Assert::AreEqual(size_t(2), pghs[0].size()); - Assert::AreEqual("v1", pghs[0]["f1"].c_str()); - Assert::AreEqual("v2", pghs[0]["f2"].c_str()); - Assert::AreEqual(size_t(2), pghs[1].size()); - Assert::AreEqual("v3", pghs[1]["f3"].c_str()); - Assert::AreEqual("v4", pghs[1]["f4"].c_str()); - } - - TEST_METHOD(parse_comment_before_single_slashN) - { - const char* str = "f1: v1\r\n" - "#comment\n"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs[0].size()); - Assert::AreEqual("v1", pghs[0]["f1"].c_str()); - } - - TEST_METHOD(BinaryParagraph_serialize_min) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - }); - std::string ss = Strings::serialize(pgh); - auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual(size_t(4), pghs[0].size()); - Assert::AreEqual("zlib", pghs[0]["Package"].c_str()); - Assert::AreEqual("1.2.8", pghs[0]["Version"].c_str()); - Assert::AreEqual("x86-windows", pghs[0]["Architecture"].c_str()); - Assert::AreEqual("same", pghs[0]["Multi-Arch"].c_str()); - } - - TEST_METHOD(BinaryParagraph_serialize_max) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Description", "first line\n second line"}, - {"Maintainer", "abc <abc@abc.abc>"}, - {"Depends", "dep"}, - {"Multi-Arch", "same"}, - }); - std::string ss = Strings::serialize(pgh); - auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual(size_t(7), pghs[0].size()); - Assert::AreEqual("zlib", pghs[0]["Package"].c_str()); - Assert::AreEqual("1.2.8", pghs[0]["Version"].c_str()); - Assert::AreEqual("x86-windows", pghs[0]["Architecture"].c_str()); - Assert::AreEqual("same", pghs[0]["Multi-Arch"].c_str()); - Assert::AreEqual("first line\n second line", pghs[0]["Description"].c_str()); - Assert::AreEqual("dep", pghs[0]["Depends"].c_str()); - } - - TEST_METHOD(BinaryParagraph_serialize_multiple_deps) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", "a, b, c"}, - }); - std::string ss = Strings::serialize(pgh); - auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual("a, b, c", pghs[0]["Depends"].c_str()); - } - - TEST_METHOD(BinaryParagraph_serialize_abi) - { - vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", "a, b, c"}, - {"Abi", "123abc"}, - }); - std::string ss = Strings::serialize(pgh); - auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(size_t(1), pghs.size()); - Assert::AreEqual("123abc", pghs[0]["Abi"].c_str()); - } - }; -} diff --git a/toolsrc/src/tests.pch.cpp b/toolsrc/src/tests.pch.cpp deleted file mode 100644 index bdddab76a..000000000 --- a/toolsrc/src/tests.pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "tests.pch.h"
diff --git a/toolsrc/src/tests.plan.cpp b/toolsrc/src/tests.plan.cpp deleted file mode 100644 index 9d8717878..000000000 --- a/toolsrc/src/tests.plan.cpp +++ /dev/null @@ -1,1261 +0,0 @@ -#include "tests.pch.h" - -#include <tests.utils.h> - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -using namespace vcpkg; - -namespace UnitTest1 -{ - static 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 = {}) - { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<Pgh> scf_pghs; - scf_pghs.push_back(Pgh{{"Source", name}, - {"Version", "0"}, - {"Build-Depends", depends}, - {"Default-Features", Strings::join(", ", default_features)}}); - for (auto&& feature : features) - { - scf_pghs.push_back(Pgh{ - {"Feature", feature.first}, - {"Description", "feature"}, - {"Build-Depends", feature.second}, - }); - } - auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::move(scf_pghs)); - Assert::IsTrue(m_pgh.has_value()); - return std::move(*m_pgh.get()); - } - - /// <summary> - /// Assert that the given action an install of given features from given package. - /// </summary> - static void features_check(Dependencies::AnyAction* install_action, - std::string pkg_name, - std::vector<std::string> vec, - const Triplet& triplet = Triplet::X86_WINDOWS) - { - Assert::IsTrue(install_action->install_action.has_value()); - const auto& plan = install_action->install_action.value_or_exit(VCPKG_LINE_INFO); - const auto& feature_list = plan.feature_list; - - Assert::AreEqual(plan.spec.triplet().to_string().c_str(), triplet.to_string().c_str()); - - auto* scfl = plan.source_control_file_location.get(); - Assert::AreEqual(pkg_name.c_str(), scfl->source_control_file->core_paragraph->name.c_str()); - Assert::AreEqual(size_t(vec.size()), feature_list.size()); - - for (auto&& feature_name : vec) - { - if (feature_name == "core" || feature_name == "") - { - Assert::IsTrue(Util::find(feature_list, "core") != feature_list.end() || - Util::find(feature_list, "") != feature_list.end()); - continue; - } - Assert::IsTrue(Util::find(feature_list, feature_name) != feature_list.end()); - } - } - - /// <summary> - /// Assert that the given action is a remove of given package. - /// </summary> - static void remove_plan_check(Dependencies::AnyAction* remove_action, - std::string pkg_name, - const Triplet& triplet = Triplet::X86_WINDOWS) - { - const auto& plan = remove_action->remove_action.value_or_exit(VCPKG_LINE_INFO); - Assert::AreEqual(plan.spec.triplet().to_string().c_str(), triplet.to_string().c_str()); - Assert::AreEqual(pkg_name.c_str(), plan.spec.name().c_str()); - } - - /// <summary> - /// Map of source control files by their package name. - /// </summary> - struct PackageSpecMap - { - std::unordered_map<std::string, SourceControlFileLocation> map; - Triplet triplet; - PackageSpecMap(const Triplet& t = Triplet::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 = {}) - { - auto scfl = SourceControlFileLocation { make_control_file(name, depends, features, default_features), "" }; - return emplace(std::move(scfl)); - } - - PackageSpec emplace(vcpkg::SourceControlFileLocation&& scfl) - { - auto spec = PackageSpec::from_name_and_triplet(scfl.source_control_file->core_paragraph->name, triplet); - Assert::IsTrue(spec.has_value()); - map.emplace(scfl.source_control_file->core_paragraph->name, std::move(scfl)); - return PackageSpec{*spec.get()}; - } - }; - - class InstallPlanTests : public TestClass<InstallPlanTests> - { - TEST_METHOD(basic_install_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "b"); - auto spec_b = spec_map.emplace("b", "c"); - auto spec_c = spec_map.emplace("c"); - - Dependencies::MapPortFileProvider map_port(spec_map.map); - auto install_plan = Dependencies::create_feature_install_plan( - map_port, {FeatureSpec{spec_a, ""}}, StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(3), install_plan.size()); - Assert::AreEqual("c", install_plan[0].spec().name().c_str()); - Assert::AreEqual("b", install_plan[1].spec().name().c_str()); - Assert::AreEqual("a", install_plan[2].spec().name().c_str()); - } - - TEST_METHOD(multiple_install_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "d"); - auto spec_b = spec_map.emplace("b", "d, e"); - auto spec_c = spec_map.emplace("c", "e, h"); - auto spec_d = spec_map.emplace("d", "f, g, h"); - auto spec_e = spec_map.emplace("e", "g"); - auto spec_f = spec_map.emplace("f"); - auto spec_g = spec_map.emplace("g"); - auto spec_h = spec_map.emplace("h"); - - Dependencies::MapPortFileProvider map_port(spec_map.map); - auto install_plan = Dependencies::create_feature_install_plan( - map_port, - {FeatureSpec{spec_a, ""}, FeatureSpec{spec_b, ""}, FeatureSpec{spec_c, ""}}, - StatusParagraphs(std::move(status_paragraphs))); - - auto iterator_pos = [&](const PackageSpec& spec) -> int { - auto it = std::find_if( - install_plan.begin(), install_plan.end(), [&](auto& action) { return action.spec() == spec; }); - Assert::IsTrue(it != install_plan.end()); - return (int)(it - install_plan.begin()); - }; - - int a_pos = iterator_pos(spec_a), b_pos = iterator_pos(spec_b), c_pos = iterator_pos(spec_c), - d_pos = iterator_pos(spec_d), e_pos = iterator_pos(spec_e), f_pos = iterator_pos(spec_f), - g_pos = iterator_pos(spec_g), h_pos = iterator_pos(spec_h); - - Assert::IsTrue(a_pos > d_pos); - Assert::IsTrue(b_pos > e_pos); - Assert::IsTrue(b_pos > d_pos); - Assert::IsTrue(c_pos > e_pos); - Assert::IsTrue(c_pos > h_pos); - Assert::IsTrue(d_pos > f_pos); - Assert::IsTrue(d_pos > g_pos); - Assert::IsTrue(d_pos > h_pos); - Assert::IsTrue(e_pos > g_pos); - } - - TEST_METHOD(existing_package_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - - PackageSpecMap spec_map; - auto spec_a = FullPackageSpec{spec_map.emplace("a")}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_a}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(1), install_plan.size()); - auto p = install_plan[0].install_action.get(); - Assert::IsNotNull(p); - Assert::AreEqual("a", p->spec.name().c_str()); - Assert::AreEqual(Dependencies::InstallPlanType::ALREADY_INSTALLED, p->plan_type); - Assert::AreEqual(Dependencies::RequestType::USER_REQUESTED, p->request_type); - } - - TEST_METHOD(user_requested_package_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map; - auto spec_a = FullPackageSpec{spec_map.emplace("a", "b")}; - auto spec_b = FullPackageSpec{spec_map.emplace("b")}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_a}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(2), install_plan.size()); - auto p = install_plan[0].install_action.get(); - Assert::IsNotNull(p); - Assert::AreEqual("b", p->spec.name().c_str()); - Assert::AreEqual(Dependencies::InstallPlanType::BUILD_AND_INSTALL, p->plan_type); - Assert::AreEqual(Dependencies::RequestType::AUTO_SELECTED, p->request_type); - - auto p2 = install_plan[1].install_action.get(); - Assert::IsNotNull(p2); - Assert::AreEqual("a", p2->spec.name().c_str()); - Assert::AreEqual(Dependencies::InstallPlanType::BUILD_AND_INSTALL, p2->plan_type); - Assert::AreEqual(Dependencies::RequestType::USER_REQUESTED, p2->request_type); - } - - TEST_METHOD(long_install_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("j", "k")); - status_paragraphs.push_back(make_status_pgh("k")); - - PackageSpecMap spec_map; - - auto spec_a = spec_map.emplace("a", "b, c, d, e, f, g, h, j, k"); - auto spec_b = spec_map.emplace("b", "c, d, e, f, g, h, j, k"); - auto spec_c = spec_map.emplace("c", "d, e, f, g, h, j, k"); - auto spec_d = spec_map.emplace("d", "e, f, g, h, j, k"); - auto spec_e = spec_map.emplace("e", "f, g, h, j, k"); - auto spec_f = spec_map.emplace("f", "g, h, j, k"); - auto spec_g = spec_map.emplace("g", "h, j, k"); - auto spec_h = spec_map.emplace("h", "j, k"); - auto spec_j = spec_map.emplace("j", "k"); - auto spec_k = spec_map.emplace("k"); - - Dependencies::MapPortFileProvider map_port(spec_map.map); - auto install_plan = Dependencies::create_feature_install_plan( - map_port, {FeatureSpec{spec_a, ""}}, StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(8), install_plan.size()); - Assert::AreEqual("h", install_plan[0].spec().name().c_str()); - Assert::AreEqual("g", install_plan[1].spec().name().c_str()); - Assert::AreEqual("f", install_plan[2].spec().name().c_str()); - Assert::AreEqual("e", install_plan[3].spec().name().c_str()); - Assert::AreEqual("d", install_plan[4].spec().name().c_str()); - Assert::AreEqual("c", install_plan[5].spec().name().c_str()); - Assert::AreEqual("b", install_plan[6].spec().name().c_str()); - Assert::AreEqual("a", install_plan[7].spec().name().c_str()); - } - - TEST_METHOD(basic_feature_test_1) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a", "b, b[b1]")); - status_paragraphs.push_back(make_status_pgh("b")); - status_paragraphs.push_back(make_status_feature_pgh("b", "b1")); - - PackageSpecMap spec_map; - auto spec_a = FullPackageSpec{spec_map.emplace("a", "b, b[b1]", {{"a1", "b[b2]"}}), {"a1"}}; - auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}, {"b3", ""}})}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_a}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(4), install_plan.size()); - remove_plan_check(&install_plan[0], "a"); - remove_plan_check(&install_plan[1], "b"); - features_check(&install_plan[2], "b", {"b1", "core", "b1"}); - features_check(&install_plan[3], "a", {"a1", "core"}); - } - - TEST_METHOD(basic_feature_test_2) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map; - - auto spec_a = FullPackageSpec{spec_map.emplace("a", "b[b1]", {{"a1", "b[b2]"}}), {"a1"}}; - auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}, {"b3", ""}})}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_a}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(2), install_plan.size()); - features_check(&install_plan[0], "b", {"b1", "b2", "core"}); - features_check(&install_plan[1], "a", {"a1", "core"}); - } - - TEST_METHOD(basic_feature_test_3) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - - PackageSpecMap spec_map; - - auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; - auto spec_b = FullPackageSpec{spec_map.emplace("b")}; - auto spec_c = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_c, spec_a}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(4), install_plan.size()); - remove_plan_check(&install_plan[0], "a"); - features_check(&install_plan[1], "b", {"core"}); - features_check(&install_plan[2], "a", {"a1", "core"}); - features_check(&install_plan[3], "c", {"core"}); - } - - TEST_METHOD(basic_feature_test_4) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.push_back(make_status_feature_pgh("a", "a1", "")); - - PackageSpecMap spec_map; - - auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}})}; - auto spec_b = FullPackageSpec{spec_map.emplace("b")}; - auto spec_c = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_c}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(1), install_plan.size()); - features_check(&install_plan[0], "c", {"core"}); - } - - TEST_METHOD(basic_feature_test_5) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map; - - auto spec_a = - FullPackageSpec{spec_map.emplace("a", "", {{"a1", "b[b1]"}, {"a2", "b[b2]"}, {"a3", "a[a2]"}}), {"a3"}}; - auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}})}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_a}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(2), install_plan.size()); - features_check(&install_plan[0], "b", {"core", "b2"}); - features_check(&install_plan[1], "a", {"core", "a3", "a2"}); - } - - TEST_METHOD(basic_feature_test_6) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("b")); - - PackageSpecMap spec_map; - auto spec_a = FullPackageSpec{spec_map.emplace("a", "b[core]"), {"core"}}; - auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}}), {"b1"}}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_a, spec_b}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(3), install_plan.size()); - remove_plan_check(&install_plan[0], "b"); - features_check(&install_plan[1], "b", {"core", "b1"}); - features_check(&install_plan[2], "a", {"core"}); - } - - TEST_METHOD(basic_feature_test_7) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("x", "b")); - status_paragraphs.push_back(make_status_pgh("b")); - - PackageSpecMap spec_map; - - auto spec_a = FullPackageSpec{spec_map.emplace("a")}; - auto spec_x = FullPackageSpec{spec_map.emplace("x", "a"), {"core"}}; - auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}}), {"b1"}}; - - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - FullPackageSpec::to_feature_specs({spec_b}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::AreEqual(size_t(5), install_plan.size()); - remove_plan_check(&install_plan[0], "x"); - remove_plan_check(&install_plan[1], "b"); - - // TODO: order here may change but A < X, and B anywhere - features_check(&install_plan[2], "b", {"core", "b1"}); - features_check(&install_plan[3], "a", {"core"}); - features_check(&install_plan[4], "x", {"core"}); - } - - TEST_METHOD(basic_feature_test_8) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.spec = - PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); - - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; - auto spec_b_64 = FullPackageSpec{spec_map.emplace("b")}; - auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - - spec_map.triplet = Triplet::X86_WINDOWS; - auto spec_a_86 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; - auto spec_b_86 = FullPackageSpec{spec_map.emplace("b")}; - auto spec_c_86 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({spec_c_64, spec_a_86, spec_a_64, spec_c_86}), - StatusParagraphs(std::move(status_paragraphs))); - - remove_plan_check(&install_plan[0], "a", Triplet::X64_WINDOWS); - remove_plan_check(&install_plan[1], "a"); - features_check(&install_plan[2], "b", {"core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[3], "a", {"a1", "core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[4], "c", {"core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[5], "b", {"core"}); - features_check(&install_plan[6], "a", {"a1", "core"}); - features_check(&install_plan[7], "c", {"core"}); - } - - TEST_METHOD(install_all_features_test) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}), {"core"}}; - - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); - Assert::IsTrue(install_specs.has_value()); - if (!install_specs.has_value()) return; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::IsTrue(install_plan.size() == 1); - features_check(&install_plan[0], "a", {"0", "1", "core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(install_default_features_test_1) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - // Add a port "a" with default features "1" and features "0" and "1". - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"}); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - // Expect the default feature "1" to be installed, but not "0" - Assert::IsTrue(install_plan.size() == 1); - features_check(&install_plan[0], "a", {"1", "core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(install_default_features_test_2) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.spec = - PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); - - // Add a port "a" of which "core" is already installed, but we will - // install the default features "explicitly" - // "a" has two features, of which "a1" is default. - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - // Expect "a" to get removed for rebuild and then installed with default - // features. - Assert::IsTrue(install_plan.size() == 2); - remove_plan_check(&install_plan[0], "a", Triplet::X64_WINDOWS); - features_check(&install_plan[1], "a", {"a1", "core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(install_default_features_test_3) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - // "a" has two features, of which "a1" is default. - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); - - // Explicitly install "a" without default features - auto install_specs = FullPackageSpec::from_string("a[core]", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - // Expect the default feature not to get installed. - Assert::IsTrue(install_plan.size() == 1); - features_check(&install_plan[0], "a", {"core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(install_default_features_of_dependency_test_1) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - // Add a port "a" which depends on the core of "b" - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - spec_map.emplace("a", "b[core]"); - // "b" has two features, of which "b1" is default. - spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - // Expect "a" to get installed and defaults of "b" through the dependency, - // as no explicit features of "b" are installed by the user. - Assert::IsTrue(install_plan.size() == 2); - features_check(&install_plan[0], "b", {"b1", "core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[1], "a", {"core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(do_not_install_default_features_of_existing_dependency) - { - // Add a port "a" which depends on the core of "b" - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - spec_map.emplace("a", "b[core]"); - // "b" has two features, of which "b1" is default. - spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); - - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - // "b[core]" is already installed - status_paragraphs.push_back(make_status_pgh("b")); - status_paragraphs.back()->package.spec = - PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - // Expect "a" to get installed, but not require rebuilding "b" - Assert::IsTrue(install_plan.size() == 1); - features_check(&install_plan[0], "a", {"core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(install_default_features_of_dependency_test_2) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("b")); - status_paragraphs.back()->package.spec = - PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); - - // Add a port "a" which depends on the core of "b", which was already - // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - spec_map.emplace("a", "b[core]"); - // "b" has two features, of which "b1" is default. - spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - // Expect "a" to get installed, not the defaults of "b", as the required - // dependencies are already there, installed explicitly by the user. - Assert::IsTrue(install_plan.size() == 1); - features_check(&install_plan[0], "a", {"core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(install_plan_action_dependencies) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - // Add a port "a" which depends on the core of "b", which was already - // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_c = spec_map.emplace("c"); - auto spec_b = spec_map.emplace("b", "c"); - spec_map.emplace("a", "b"); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::IsTrue(install_plan.size() == 3); - features_check(&install_plan[0], "c", {"core"}, Triplet::X64_WINDOWS); - - features_check(&install_plan[1], "b", {"core"}, Triplet::X64_WINDOWS); - Assert::IsTrue(install_plan[1].install_action.get()->computed_dependencies == - std::vector<PackageSpec>{spec_c}); - - features_check(&install_plan[2], "a", {"core"}, Triplet::X64_WINDOWS); - Assert::IsTrue(install_plan[2].install_action.get()->computed_dependencies == - std::vector<PackageSpec>{spec_b}); - } - - TEST_METHOD(install_plan_action_dependencies_2) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - // Add a port "a" which depends on the core of "b", which was already - // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_c = spec_map.emplace("c"); - auto spec_b = spec_map.emplace("b", "c"); - spec_map.emplace("a", "c, b"); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::IsTrue(install_plan.size() == 3); - features_check(&install_plan[0], "c", {"core"}, Triplet::X64_WINDOWS); - - features_check(&install_plan[1], "b", {"core"}, Triplet::X64_WINDOWS); - Assert::IsTrue(install_plan[1].install_action.get()->computed_dependencies == - std::vector<PackageSpec>{spec_c}); - - features_check(&install_plan[2], "a", {"core"}, Triplet::X64_WINDOWS); - Assert::IsTrue(install_plan[2].install_action.get()->computed_dependencies == - std::vector<PackageSpec>{spec_b, spec_c}); - } - - TEST_METHOD(install_plan_action_dependencies_3) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - // Add a port "a" which depends on the core of "b", which was already - // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - spec_map.emplace("a", "", {{"0", ""}, {"1", "a[0]"}}, {"1"}); - - // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::IsTrue(install_plan.size() == 1); - features_check(&install_plan[0], "a", {"1", "0", "core"}, Triplet::X64_WINDOWS); - Assert::IsTrue(install_plan[0].install_action.get()->computed_dependencies == std::vector<PackageSpec>{}); - } - - TEST_METHOD(install_with_default_features) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a", "")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto b_spec = spec_map.emplace("b", "", {{"0", ""}}, {"0"}); - auto a_spec = spec_map.emplace("a", "b[core]", {{"0", ""}}); - - // Install "a" and indicate that "b" should not install default features - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {FeatureSpec{a_spec, "0"}, FeatureSpec{b_spec, "core"}}, status_db); - - Assert::IsTrue(install_plan.size() == 3); - remove_plan_check(&install_plan[0], "a"); - features_check(&install_plan[1], "b", {"core"}); - features_check(&install_plan[2], "a", {"0", "core"}); - } - - TEST_METHOD(upgrade_with_default_features_1) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a", "", "1")); - pghs.push_back(make_status_feature_pgh("a", "0")); - StatusParagraphs status_db(std::move(pghs)); - - // Add a port "a" of which "core" and "0" are already installed. - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"}); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - auto plan = graph.serialize(); - - // The upgrade should not install the default feature - Assert::AreEqual(size_t(2), plan.size()); - - Assert::AreEqual("a", plan[0].spec().name().c_str()); - remove_plan_check(&plan[0], "a"); - features_check(&plan[1], "a", {"core", "0"}); - } - - TEST_METHOD(upgrade_with_default_features_2) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - // B is currently installed _without_ default feature b0 - pghs.push_back(make_status_pgh("b", "", "b0", "x64-windows")); - pghs.push_back(make_status_pgh("a", "b[core]", "", "x64-windows")); - - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_a = spec_map.emplace("a", "b[core]"); - auto spec_b = spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0", "b1"}); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - graph.upgrade(spec_b); - auto plan = graph.serialize(); - - // The upgrade should install the new default feature b1 but not b0 - Assert::AreEqual(size_t(4), plan.size()); - remove_plan_check(&plan[0], "a", Triplet::X64_WINDOWS); - remove_plan_check(&plan[1], "b", Triplet::X64_WINDOWS); - features_check(&plan[2], "b", {"core", "b1"}, Triplet::X64_WINDOWS); - features_check(&plan[3], "a", {"core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(upgrade_with_default_features_3) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - // note: unrelated package due to x86 triplet - pghs.push_back(make_status_pgh("b", "", "", "x86-windows")); - pghs.push_back(make_status_pgh("a", "", "", "x64-windows")); - - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_a = spec_map.emplace("a", "b[core]"); - spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0"}); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - auto plan = graph.serialize(); - - // The upgrade should install the default feature - Assert::AreEqual(size_t(3), plan.size()); - remove_plan_check(&plan[0], "a", Triplet::X64_WINDOWS); - features_check(&plan[1], "b", {"b0", "core"}, Triplet::X64_WINDOWS); - features_check(&plan[2], "a", {"core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(upgrade_with_new_default_feature) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a", "", "0", "x86-windows")); - - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}, {"2", ""}}, {"0", "1"}); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - auto plan = graph.serialize(); - - // The upgrade should install the new default feature but not the old default feature 0 - Assert::AreEqual(size_t(2), plan.size()); - remove_plan_check(&plan[0], "a", Triplet::X86_WINDOWS); - features_check(&plan[1], "a", {"core", "1"}, Triplet::X86_WINDOWS); - } - - TEST_METHOD(transitive_features_test) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"0", "b[0]"}}), {"core"}}; - auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "c", {{"0", "c[0]"}}), {"core"}}; - auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; - - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); - Assert::IsTrue(install_specs.has_value()); - if (!install_specs.has_value()) return; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::IsTrue(install_plan.size() == 3); - features_check(&install_plan[0], "c", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[1], "b", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[2], "a", {"0", "core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(no_transitive_features_test) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"0", ""}}), {"core"}}; - auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "c", {{"0", ""}}), {"core"}}; - auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; - - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); - Assert::IsTrue(install_specs.has_value()); - if (!install_specs.has_value()) return; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::IsTrue(install_plan.size() == 3); - features_check(&install_plan[0], "c", {"core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[1], "b", {"core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[2], "a", {"0", "core"}, Triplet::X64_WINDOWS); - } - - TEST_METHOD(only_transitive_features_test) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - - PackageSpecMap spec_map(Triplet::X64_WINDOWS); - auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "", {{"0", "b[0]"}}), {"core"}}; - auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "", {{"0", "c[0]"}}), {"core"}}; - auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; - - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); - Assert::IsTrue(install_specs.has_value()); - if (!install_specs.has_value()) return; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, - FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), - StatusParagraphs(std::move(status_paragraphs))); - - Assert::IsTrue(install_plan.size() == 3); - features_check(&install_plan[0], "c", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[1], "b", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[2], "a", {"0", "core"}, Triplet::X64_WINDOWS); - } - }; - - class RemovePlanTests : public TestClass<RemovePlanTests> - { - TEST_METHOD(basic_remove_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - StatusParagraphs status_db(std::move(pghs)); - - auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("a")}, status_db); - - Assert::AreEqual(size_t(1), remove_plan.size()); - Assert::AreEqual("a", remove_plan[0].spec.name().c_str()); - } - - TEST_METHOD(recurse_remove_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_pgh("b", "a")); - StatusParagraphs status_db(std::move(pghs)); - - auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("a")}, status_db); - - Assert::AreEqual(size_t(2), remove_plan.size()); - Assert::AreEqual("b", remove_plan[0].spec.name().c_str()); - Assert::AreEqual("a", remove_plan[1].spec.name().c_str()); - } - - TEST_METHOD(features_depend_remove_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_pgh("b")); - pghs.push_back(make_status_feature_pgh("b", "0", "a")); - StatusParagraphs status_db(std::move(pghs)); - - auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("a")}, status_db); - - Assert::AreEqual(size_t(2), remove_plan.size()); - Assert::AreEqual("b", remove_plan[0].spec.name().c_str()); - Assert::AreEqual("a", remove_plan[1].spec.name().c_str()); - } - - TEST_METHOD(features_depend_remove_scheme_once_removed) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("expat")); - pghs.push_back(make_status_pgh("vtk", "expat")); - pghs.push_back(make_status_pgh("opencv")); - pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk")); - StatusParagraphs status_db(std::move(pghs)); - - auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("expat")}, status_db); - - Assert::AreEqual(size_t(3), remove_plan.size()); - Assert::AreEqual("opencv", remove_plan[0].spec.name().c_str()); - Assert::AreEqual("vtk", remove_plan[1].spec.name().c_str()); - Assert::AreEqual("expat", remove_plan[2].spec.name().c_str()); - } - - TEST_METHOD(features_depend_remove_scheme_once_removed_x64) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("expat", "", "", "x64")); - pghs.push_back(make_status_pgh("vtk", "expat", "", "x64")); - pghs.push_back(make_status_pgh("opencv", "", "", "x64")); - pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk", "x64")); - StatusParagraphs status_db(std::move(pghs)); - - auto remove_plan = Dependencies::create_remove_plan( - {unsafe_pspec("expat", Triplet::from_canonical_name("x64"))}, status_db); - - Assert::AreEqual(size_t(3), remove_plan.size()); - Assert::AreEqual("opencv", remove_plan[0].spec.name().c_str()); - Assert::AreEqual("vtk", remove_plan[1].spec.name().c_str()); - Assert::AreEqual("expat", remove_plan[2].spec.name().c_str()); - } - - TEST_METHOD(features_depend_core_remove_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("curl", "", "", "x64")); - pghs.push_back(make_status_pgh("cpr", "curl[core]", "", "x64")); - StatusParagraphs status_db(std::move(pghs)); - - auto remove_plan = Dependencies::create_remove_plan( - {unsafe_pspec("curl", Triplet::from_canonical_name("x64"))}, status_db); - - Assert::AreEqual(size_t(2), remove_plan.size()); - Assert::AreEqual("cpr", remove_plan[0].spec.name().c_str()); - Assert::AreEqual("curl", remove_plan[1].spec.name().c_str()); - } - - TEST_METHOD(features_depend_core_remove_scheme_2) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("curl", "", "", "x64")); - pghs.push_back(make_status_feature_pgh("curl", "a", "", "x64")); - pghs.push_back(make_status_feature_pgh("curl", "b", "curl[a]", "x64")); - StatusParagraphs status_db(std::move(pghs)); - - auto remove_plan = Dependencies::create_remove_plan( - {unsafe_pspec("curl", Triplet::from_canonical_name("x64"))}, status_db); - - Assert::AreEqual(size_t(1), remove_plan.size()); - Assert::AreEqual("curl", remove_plan[0].spec.name().c_str()); - } - }; - - class UpgradePlanTests : public TestClass<UpgradePlanTests> - { - TEST_METHOD(basic_upgrade_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a"); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - - auto plan = graph.serialize(); - - Assert::AreEqual(size_t(2), plan.size()); - Assert::AreEqual("a", plan[0].spec().name().c_str()); - Assert::IsTrue(plan[0].remove_action.has_value()); - Assert::AreEqual("a", plan[1].spec().name().c_str()); - Assert::IsTrue(plan[1].install_action.has_value()); - } - - TEST_METHOD(basic_upgrade_scheme_with_recurse) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_pgh("b", "a")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a"); - spec_map.emplace("b", "a"); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - - auto plan = graph.serialize(); - - Assert::AreEqual(size_t(4), plan.size()); - Assert::AreEqual("b", plan[0].spec().name().c_str()); - Assert::IsTrue(plan[0].remove_action.has_value()); - - Assert::AreEqual("a", plan[1].spec().name().c_str()); - Assert::IsTrue(plan[1].remove_action.has_value()); - - Assert::AreEqual("a", plan[2].spec().name().c_str()); - Assert::IsTrue(plan[2].install_action.has_value()); - - Assert::AreEqual("b", plan[3].spec().name().c_str()); - Assert::IsTrue(plan[3].install_action.has_value()); - } - - TEST_METHOD(basic_upgrade_scheme_with_bystander) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_pgh("b")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a"); - spec_map.emplace("b", "a"); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - - auto plan = graph.serialize(); - - Assert::AreEqual(size_t(2), plan.size()); - Assert::AreEqual("a", plan[0].spec().name().c_str()); - Assert::IsTrue(plan[0].remove_action.has_value()); - Assert::AreEqual("a", plan[1].spec().name().c_str()); - Assert::IsTrue(plan[1].install_action.has_value()); - } - - TEST_METHOD(basic_upgrade_scheme_with_new_dep) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "b"); - spec_map.emplace("b"); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - - auto plan = graph.serialize(); - - Assert::AreEqual(size_t(3), plan.size()); - Assert::AreEqual("a", plan[0].spec().name().c_str()); - Assert::IsTrue(plan[0].remove_action.has_value()); - Assert::AreEqual("b", plan[1].spec().name().c_str()); - Assert::IsTrue(plan[1].install_action.has_value()); - Assert::AreEqual("a", plan[2].spec().name().c_str()); - Assert::IsTrue(plan[2].install_action.has_value()); - } - - TEST_METHOD(basic_upgrade_scheme_with_features) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_feature_pgh("a", "a1")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - - auto plan = graph.serialize(); - - Assert::AreEqual(size_t(2), plan.size()); - - Assert::AreEqual("a", plan[0].spec().name().c_str()); - Assert::IsTrue(plan[0].remove_action.has_value()); - - features_check(&plan[1], "a", {"core", "a1"}); - } - - TEST_METHOD(basic_upgrade_scheme_with_new_default_feature) - { - // only core of package "a" is installed - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - StatusParagraphs status_db(std::move(pghs)); - - // a1 was added as a default feature and should be installed in upgrade - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}, {"a1"}); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - - auto plan = graph.serialize(); - - Assert::AreEqual(size_t(2), plan.size()); - - Assert::AreEqual("a", plan[0].spec().name().c_str()); - Assert::IsTrue(plan[0].remove_action.has_value()); - - features_check(&plan[1], "a", {"core", "a1"}); - } - - TEST_METHOD(basic_upgrade_scheme_with_self_features) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_feature_pgh("a", "a1", "")); - pghs.push_back(make_status_feature_pgh("a", "a2", "a[a1]")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "", {{"a1", ""}, {"a2", "a[a1]"}}); - - Dependencies::MapPortFileProvider provider(spec_map.map); - Dependencies::PackageGraph graph(provider, status_db); - - graph.upgrade(spec_a); - - auto plan = graph.serialize(); - - Assert::AreEqual(size_t(2), plan.size()); - - Assert::AreEqual("a", plan[0].spec().name().c_str()); - Assert::IsTrue(plan[0].remove_action.has_value()); - - Assert::AreEqual("a", plan[1].spec().name().c_str()); - Assert::IsTrue(plan[1].install_action.has_value()); - Assert::IsTrue(plan[1].install_action.get()->feature_list == std::set<std::string>{"core", "a1", "a2"}); - } - }; - - class ExportPlanTests : public TestClass<ExportPlanTests> - { - TEST_METHOD(basic_export_scheme) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a"); - - auto plan = Dependencies::create_export_plan({spec_a}, status_db); - - Assert::AreEqual(size_t(1), plan.size()); - Assert::AreEqual("a", plan[0].spec.name().c_str()); - Assert::IsTrue(plan[0].plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); - } - - TEST_METHOD(basic_export_scheme_with_recurse) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_pgh("b", "a")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a"); - auto spec_b = spec_map.emplace("b", "a"); - - auto plan = Dependencies::create_export_plan({spec_b}, status_db); - - Assert::AreEqual(size_t(2), plan.size()); - Assert::AreEqual("a", plan[0].spec.name().c_str()); - Assert::IsTrue(plan[0].plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); - - Assert::AreEqual("b", plan[1].spec.name().c_str()); - Assert::IsTrue(plan[1].plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); - } - - TEST_METHOD(basic_export_scheme_with_bystander) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_pgh("b")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a"); - auto spec_b = spec_map.emplace("b", "a"); - - auto plan = Dependencies::create_export_plan({spec_a}, status_db); - - Assert::AreEqual(size_t(1), plan.size()); - Assert::AreEqual("a", plan[0].spec.name().c_str()); - Assert::IsTrue(plan[0].plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); - } - - TEST_METHOD(basic_export_scheme_with_missing) - { - StatusParagraphs status_db; - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a"); - - auto plan = Dependencies::create_export_plan({spec_a}, status_db); - - Assert::AreEqual(size_t(1), plan.size()); - Assert::AreEqual("a", plan[0].spec.name().c_str()); - Assert::IsTrue(plan[0].plan_type == Dependencies::ExportPlanType::NOT_BUILT); - } - - TEST_METHOD(basic_export_scheme_with_features) - { - std::vector<std::unique_ptr<StatusParagraph>> pghs; - pghs.push_back(make_status_pgh("b")); - pghs.push_back(make_status_pgh("a")); - pghs.push_back(make_status_feature_pgh("a", "a1", "b[core]")); - StatusParagraphs status_db(std::move(pghs)); - - PackageSpecMap spec_map; - auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}); - - auto plan = Dependencies::create_export_plan({spec_a}, status_db); - - Assert::AreEqual(size_t(2), plan.size()); - - Assert::AreEqual("b", plan[0].spec.name().c_str()); - Assert::IsTrue(plan[0].plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); - - Assert::AreEqual("a", plan[1].spec.name().c_str()); - Assert::IsTrue(plan[1].plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); - } - }; -} diff --git a/toolsrc/src/tests.statusparagraphs.cpp b/toolsrc/src/tests.statusparagraphs.cpp deleted file mode 100644 index fa0d54fac..000000000 --- a/toolsrc/src/tests.statusparagraphs.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "tests.pch.h" - -#include <tests.utils.h> - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -using namespace vcpkg; -using namespace vcpkg::Paragraphs; - -namespace UnitTest1 -{ - class StatusParagraphsTests : public TestClass<StatusParagraphsTests> - { - TEST_METHOD(find_installed) - { - auto pghs = parse_paragraphs(R"( -Package: ffmpeg -Version: 3.3.3 -Architecture: x64-windows -Multi-Arch: same -Description: -Status: install ok installed -)"); - Assert::IsTrue(!!pghs); - if (!pghs) return; - - StatusParagraphs status_db(Util::fmap( - *pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); - - auto it = status_db.find_installed(unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS)); - Assert::IsTrue(it != status_db.end()); - } - - TEST_METHOD(find_not_installed) - { - auto pghs = parse_paragraphs(R"( -Package: ffmpeg -Version: 3.3.3 -Architecture: x64-windows -Multi-Arch: same -Description: -Status: purge ok not-installed -)"); - Assert::IsTrue(!!pghs); - if (!pghs) return; - - StatusParagraphs status_db(Util::fmap( - *pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); - - auto it = status_db.find_installed(unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS)); - Assert::IsTrue(it == status_db.end()); - } - - TEST_METHOD(find_with_feature_packages) - { - auto pghs = parse_paragraphs(R"( -Package: ffmpeg -Version: 3.3.3 -Architecture: x64-windows -Multi-Arch: same -Description: -Status: install ok installed - -Package: ffmpeg -Feature: openssl -Depends: openssl -Architecture: x64-windows -Multi-Arch: same -Description: -Status: purge ok not-installed -)"); - Assert::IsTrue(!!pghs); - if (!pghs) return; - - StatusParagraphs status_db(Util::fmap( - *pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); - - auto it = status_db.find_installed(unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS)); - Assert::IsTrue(it != status_db.end()); - - // Feature "openssl" is not installed and should not be found - auto it1 = status_db.find_installed({unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS), "openssl"}); - Assert::IsTrue(it1 == status_db.end()); - } - - TEST_METHOD(find_for_feature_packages) - { - auto pghs = parse_paragraphs(R"( -Package: ffmpeg -Version: 3.3.3 -Architecture: x64-windows -Multi-Arch: same -Description: -Status: install ok installed - -Package: ffmpeg -Feature: openssl -Depends: openssl -Architecture: x64-windows -Multi-Arch: same -Description: -Status: install ok installed -)"); - Assert::IsTrue(!!pghs); - if (!pghs) return; - - StatusParagraphs status_db(Util::fmap( - *pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); - - // Feature "openssl" is installed and should therefore be found - auto it = status_db.find_installed({unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS), "openssl"}); - Assert::IsTrue(it != status_db.end()); - } - }; -} diff --git a/toolsrc/src/tests.update.cpp b/toolsrc/src/tests.update.cpp deleted file mode 100644 index 5e3f9f3e2..000000000 --- a/toolsrc/src/tests.update.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "tests.pch.h" - -#include <tests.utils.h> - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -using namespace vcpkg; -using namespace vcpkg::Update; - -namespace UnitTest1 -{ - using Pgh = std::vector<std::unordered_map<std::string, std::string>>; - - class UpdateTests : public TestClass<UpdateTests> - { - TEST_METHOD(find_outdated_packages_basic) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.version = "2"; - - StatusParagraphs status_db(std::move(status_paragraphs)); - - std::unordered_map<std::string, SourceControlFileLocation> map; - auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}})); - map.emplace("a", SourceControlFileLocation { std::move(scf), "" }); - Dependencies::MapPortFileProvider provider(map); - - auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), - &OutdatedPackage::compare_by_name); - - Assert::AreEqual(size_t(1), pkgs.size()); - Assert::AreEqual("2", pkgs[0].version_diff.left.to_string().c_str()); - Assert::AreEqual("0", pkgs[0].version_diff.right.to_string().c_str()); - } - - TEST_METHOD(find_outdated_packages_features) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.version = "2"; - - status_paragraphs.push_back(make_status_feature_pgh("a", "b")); - status_paragraphs.back()->package.version = "2"; - - StatusParagraphs status_db(std::move(status_paragraphs)); - - std::unordered_map<std::string, SourceControlFileLocation> map; - auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}})); - map.emplace("a", SourceControlFileLocation { std::move(scf), "" }); - Dependencies::MapPortFileProvider provider(map); - - auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), - &OutdatedPackage::compare_by_name); - - Assert::AreEqual(size_t(1), pkgs.size()); - Assert::AreEqual("2", pkgs[0].version_diff.left.to_string().c_str()); - Assert::AreEqual("0", pkgs[0].version_diff.right.to_string().c_str()); - } - - TEST_METHOD(find_outdated_packages_features_2) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.version = "2"; - - status_paragraphs.push_back(make_status_feature_pgh("a", "b")); - status_paragraphs.back()->package.version = "0"; - status_paragraphs.back()->state = InstallState::NOT_INSTALLED; - status_paragraphs.back()->want = Want::PURGE; - - StatusParagraphs status_db(std::move(status_paragraphs)); - - std::unordered_map<std::string, SourceControlFileLocation> map; - auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}})); - map.emplace("a", SourceControlFileLocation{ std::move(scf), "" }); - Dependencies::MapPortFileProvider provider(map); - - auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), - &OutdatedPackage::compare_by_name); - - Assert::AreEqual(size_t(1), pkgs.size()); - Assert::AreEqual("2", pkgs[0].version_diff.left.to_string().c_str()); - Assert::AreEqual("0", pkgs[0].version_diff.right.to_string().c_str()); - } - - TEST_METHOD(find_outdated_packages_none) - { - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.version = "2"; - - StatusParagraphs status_db(std::move(status_paragraphs)); - - std::unordered_map<std::string, SourceControlFileLocation> map; - auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "2"}}})); - map.emplace("a", SourceControlFileLocation{ std::move(scf), "" }); - Dependencies::MapPortFileProvider provider(map); - - auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), - &OutdatedPackage::compare_by_name); - - Assert::AreEqual(size_t(0), pkgs.size()); - } - }; -} diff --git a/toolsrc/src/tests.utils.cpp b/toolsrc/src/tests.utils.cpp deleted file mode 100644 index ac391f559..000000000 --- a/toolsrc/src/tests.utils.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "tests.pch.h" - -#include "tests.utils.h" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; -using namespace vcpkg; - -std::unique_ptr<StatusParagraph> make_status_pgh(const char* name, - const char* depends, - const char* default_features, - const char* triplet) -{ - using Pgh = std::unordered_map<std::string, std::string>; - return std::make_unique<StatusParagraph>(Pgh{{"Package", name}, - {"Version", "1"}, - {"Architecture", triplet}, - {"Multi-Arch", "same"}, - {"Depends", depends}, - {"Default-Features", default_features}, - {"Status", "install ok installed"}}); -} -std::unique_ptr<StatusParagraph> make_status_feature_pgh(const char* name, - const char* feature, - const char* depends, - const char* triplet) -{ - using Pgh = std::unordered_map<std::string, std::string>; - return std::make_unique<StatusParagraph>(Pgh{{"Package", name}, - {"Version", "1"}, - {"Feature", feature}, - {"Architecture", triplet}, - {"Multi-Arch", "same"}, - {"Depends", depends}, - {"Status", "install ok installed"}}); -} - -PackageSpec unsafe_pspec(std::string name, Triplet t) -{ - auto m_ret = PackageSpec::from_name_and_triplet(name, t); - Assert::IsTrue(m_ret.has_value()); - return m_ret.value_or_exit(VCPKG_LINE_INFO); -} diff --git a/toolsrc/src/vcpkg-test/arguments.cpp b/toolsrc/src/vcpkg-test/arguments.cpp new file mode 100644 index 000000000..3fe5fa420 --- /dev/null +++ b/toolsrc/src/vcpkg-test/arguments.cpp @@ -0,0 +1,109 @@ +#include <vcpkg-test/catch.h> + +#include <vcpkg/vcpkgcmdarguments.h> + +#include <vector> + +using vcpkg::CommandSetting; +using vcpkg::CommandStructure; +using vcpkg::CommandSwitch; +using vcpkg::VcpkgCmdArguments; + +TEST_CASE ("VcpkgCmdArguments from lowercase argument sequence", "[arguments]") +{ + std::vector<std::string> t = {"--vcpkg-root", + "C:\\vcpkg", + "--scripts-root=C:\\scripts", + "--debug", + "--sendmetrics", + "--printmetrics", + "--overlay-ports=C:\\ports1", + "--overlay-ports=C:\\ports2", + "--overlay-triplets=C:\\tripletsA", + "--overlay-triplets=C:\\tripletsB"}; + auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size()); + + REQUIRE(*v.vcpkg_root_dir == "C:\\vcpkg"); + REQUIRE(*v.scripts_root_dir == "C:\\scripts"); + REQUIRE(v.debug); + REQUIRE(*v.debug.get()); + REQUIRE(v.sendmetrics); + REQUIRE(*v.sendmetrics.get()); + REQUIRE(v.printmetrics); + REQUIRE(*v.printmetrics.get()); + + REQUIRE(v.overlay_ports->size() == 2); + REQUIRE(v.overlay_ports->at(0) == "C:\\ports1"); + REQUIRE(v.overlay_ports->at(1) == "C:\\ports2"); + + REQUIRE(v.overlay_triplets->size() == 2); + REQUIRE(v.overlay_triplets->at(0) == "C:\\tripletsA"); + REQUIRE(v.overlay_triplets->at(1) == "C:\\tripletsB"); +} + +TEST_CASE ("VcpkgCmdArguments from uppercase argument sequence", "[arguments]") +{ + std::vector<std::string> t = {"--VCPKG-ROOT", + "C:\\vcpkg", + "--SCRIPTS-ROOT=C:\\scripts", + "--DEBUG", + "--SENDMETRICS", + "--PRINTMETRICS", + "--OVERLAY-PORTS=C:\\ports1", + "--OVERLAY-PORTS=C:\\ports2", + "--OVERLAY-TRIPLETS=C:\\tripletsA", + "--OVERLAY-TRIPLETS=C:\\tripletsB"}; + auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size()); + + REQUIRE(*v.vcpkg_root_dir == "C:\\vcpkg"); + REQUIRE(*v.scripts_root_dir == "C:\\scripts"); + REQUIRE(v.debug); + REQUIRE(*v.debug.get()); + REQUIRE(v.sendmetrics); + REQUIRE(*v.sendmetrics.get()); + REQUIRE(v.printmetrics); + REQUIRE(*v.printmetrics.get()); + + REQUIRE(v.overlay_ports->size() == 2); + REQUIRE(v.overlay_ports->at(0) == "C:\\ports1"); + REQUIRE(v.overlay_ports->at(1) == "C:\\ports2"); + + REQUIRE(v.overlay_triplets->size() == 2); + REQUIRE(v.overlay_triplets->at(0) == "C:\\tripletsA"); + REQUIRE(v.overlay_triplets->at(1) == "C:\\tripletsB"); +} + +TEST_CASE ("VcpkgCmdArguments from argument sequence with valued options", "[arguments]") +{ + SECTION ("case 1") + { + std::array<CommandSetting, 1> settings = {{{"--a", ""}}}; + CommandStructure cmdstruct = {"", 0, SIZE_MAX, {{}, settings}, nullptr}; + + std::vector<std::string> t = {"--a=b", "command", "argument"}; + auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size()); + auto opts = v.parse_arguments(cmdstruct); + + REQUIRE(opts.settings["--a"] == "b"); + REQUIRE(v.command_arguments.size() == 1); + REQUIRE(v.command_arguments[0] == "argument"); + REQUIRE(v.command == "command"); + } + + SECTION ("case 2") + { + std::array<CommandSwitch, 2> switches = {{{"--a", ""}, {"--c", ""}}}; + std::array<CommandSetting, 2> settings = {{{"--b", ""}, {"--d", ""}}}; + CommandStructure cmdstruct = {"", 0, SIZE_MAX, {switches, settings}, nullptr}; + + std::vector<std::string> t = {"--a", "--b=c"}; + auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size()); + auto opts = v.parse_arguments(cmdstruct); + + REQUIRE(opts.settings["--b"] == "c"); + REQUIRE(opts.settings.find("--d") == opts.settings.end()); + REQUIRE(opts.switches.find("--a") != opts.switches.end()); + REQUIRE(opts.settings.find("--c") == opts.settings.end()); + REQUIRE(v.command_arguments.size() == 0); + } +} diff --git a/toolsrc/src/vcpkg-test/catch.cpp b/toolsrc/src/vcpkg-test/catch.cpp new file mode 100644 index 000000000..8b5d1aa15 --- /dev/null +++ b/toolsrc/src/vcpkg-test/catch.cpp @@ -0,0 +1,11 @@ +#define CATCH_CONFIG_RUNNER +#include <vcpkg-test/catch.h> + +#include <vcpkg/base/system.debug.h> + +int main(int argc, char** argv) +{ + vcpkg::Debug::g_debugging = true; + + return Catch::Session().run(argc, argv); +} diff --git a/toolsrc/src/vcpkg-test/chrono.cpp b/toolsrc/src/vcpkg-test/chrono.cpp new file mode 100644 index 000000000..306217ad0 --- /dev/null +++ b/toolsrc/src/vcpkg-test/chrono.cpp @@ -0,0 +1,34 @@ +#include <vcpkg-test/catch.h> + +#include <vcpkg/base/chrono.h> + +namespace Chrono = vcpkg::Chrono; + +TEST_CASE ("parse time", "[chrono]") +{ + auto timestring = "1990-02-03T04:05:06.0Z"; + auto maybe_time = Chrono::CTime::parse(timestring); + + REQUIRE(maybe_time.has_value()); + REQUIRE(maybe_time.get()->to_string() == timestring); +} + +TEST_CASE ("parse blank time", "[chrono]") +{ + auto maybe_time = Chrono::CTime::parse(""); + + REQUIRE_FALSE(maybe_time.has_value()); +} + +TEST_CASE ("difference of times", "[chrono]") +{ + auto maybe_time1 = Chrono::CTime::parse("1990-02-03T04:05:06.0Z"); + auto maybe_time2 = Chrono::CTime::parse("1990-02-10T04:05:06.0Z"); + + REQUIRE(maybe_time1.has_value()); + REQUIRE(maybe_time2.has_value()); + + auto delta = maybe_time2.get()->to_time_point() - maybe_time1.get()->to_time_point(); + + REQUIRE(std::chrono::duration_cast<std::chrono::hours>(delta).count() == 24 * 7); +} diff --git a/toolsrc/src/vcpkg-test/dependencies.cpp b/toolsrc/src/vcpkg-test/dependencies.cpp new file mode 100644 index 000000000..5ed05cc07 --- /dev/null +++ b/toolsrc/src/vcpkg-test/dependencies.cpp @@ -0,0 +1,28 @@ +#include <vcpkg-test/catch.h> + +#include <vcpkg/sourceparagraph.h> + +using namespace vcpkg; +using Parse::parse_comma_list; + +TEST_CASE ("parse depends", "[dependencies]") +{ + auto v = expand_qualified_dependencies(parse_comma_list("libA (windows)")); + REQUIRE(v.size() == 1); + REQUIRE(v.at(0).depend.name == "libA"); + REQUIRE(v.at(0).qualifier == "windows"); +} + +TEST_CASE ("filter depends", "[dependencies]") +{ + auto deps = expand_qualified_dependencies(parse_comma_list("libA (windows), libB, libC (uwp)")); + auto v = filter_dependencies(deps, Triplet::X64_WINDOWS); + REQUIRE(v.size() == 2); + REQUIRE(v.at(0) == "libA"); + REQUIRE(v.at(1) == "libB"); + + auto v2 = filter_dependencies(deps, Triplet::ARM_UWP); + REQUIRE(v.size() == 2); + REQUIRE(v2.at(0) == "libB"); + REQUIRE(v2.at(1) == "libC"); +} diff --git a/toolsrc/src/vcpkg-test/files.cpp b/toolsrc/src/vcpkg-test/files.cpp new file mode 100644 index 000000000..d40edb3bd --- /dev/null +++ b/toolsrc/src/vcpkg-test/files.cpp @@ -0,0 +1,243 @@ +#include <vcpkg-test/catch.h> +#include <vcpkg-test/util.h> + +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> + +#include <iostream> +#include <random> + +#include <vector> + +using vcpkg::Test::AllowSymlinks; +using vcpkg::Test::base_temporary_directory; +using vcpkg::Test::can_create_symlinks; + +#define CHECK_EC_ON_FILE(file, ec) \ + do \ + { \ + if (ec) \ + { \ + FAIL(file << ": " << ec.message()); \ + } \ + } while (0) + +namespace +{ + using uid_t = std::uniform_int_distribution<std::uint64_t>; + using urbg_t = std::mt19937_64; + + urbg_t get_urbg(std::uint64_t index) + { + // smallest prime > 2**63 - 1 + return urbg_t{index + 9223372036854775837ULL}; + } + + std::string get_random_filename(urbg_t& urbg) { return vcpkg::Strings::b32_encode(uid_t{}(urbg)); } + + struct MaxDepth + { + std::uint64_t i; + explicit MaxDepth(std::uint64_t i) : i(i) {} + operator uint64_t() const { return i; } + }; + + struct Width + { + std::uint64_t i; + explicit Width(std::uint64_t i) : i(i) {} + operator uint64_t() const { return i; } + }; + + struct CurrentDepth + { + std::uint64_t i; + explicit CurrentDepth(std::uint64_t i) : i(i) {} + operator uint64_t() const { return i; } + CurrentDepth incremented() const { return CurrentDepth{i + 1}; } + }; + + void create_directory_tree(urbg_t& urbg, + vcpkg::Files::Filesystem& fs, + const fs::path& base, + MaxDepth max_depth, + AllowSymlinks allow_symlinks = AllowSymlinks::Yes, + Width width = Width{5}, + CurrentDepth current_depth = CurrentDepth{0}) + { + std::random_device rd; + + // we want ~70% of our "files" to be directories, and then a third + // each of the remaining ~30% to be regular files, directory symlinks, + // and regular symlinks + constexpr std::uint64_t directory_min_tag = 0; + constexpr std::uint64_t directory_max_tag = 6; + constexpr std::uint64_t regular_file_tag = 7; + constexpr std::uint64_t regular_symlink_tag = 8; + constexpr std::uint64_t directory_symlink_tag = 9; + + allow_symlinks = AllowSymlinks{allow_symlinks && can_create_symlinks()}; + + // if we're at the max depth, we only want to build non-directories + std::uint64_t file_type; + if (current_depth >= max_depth) + { + file_type = uid_t{regular_file_tag, directory_symlink_tag}(urbg); + } + else if (current_depth < 2) + { + file_type = directory_min_tag; + } + else + { + file_type = uid_t{directory_min_tag, regular_symlink_tag}(urbg); + } + + if (!allow_symlinks && file_type > regular_file_tag) + { + file_type = regular_file_tag; + } + + std::error_code ec; + if (file_type <= directory_max_tag) + { + fs.create_directory(base, ec); + if (ec) + { + CHECK_EC_ON_FILE(base, ec); + } + + for (int i = 0; i < width; ++i) + { + create_directory_tree(urbg, + fs, + base / get_random_filename(urbg), + max_depth, + allow_symlinks, + width, + current_depth.incremented()); + } + } + else if (file_type == regular_file_tag) + { + // regular file + fs.write_contents(base, "", ec); + } + else if (file_type == regular_symlink_tag) + { + // regular symlink + auto base_link = base; + base_link.replace_filename(base.filename().u8string() + "-orig"); + fs.write_contents(base_link, "", ec); + CHECK_EC_ON_FILE(base_link, ec); + vcpkg::Test::create_symlink(base_link, base, ec); + } + else // type == directory_symlink_tag + { + // directory symlink + auto parent = base; + parent.remove_filename(); + vcpkg::Test::create_directory_symlink(parent, base, ec); + } + + CHECK_EC_ON_FILE(base, ec); + REQUIRE(fs::exists(fs.symlink_status(base, ec))); + CHECK_EC_ON_FILE(base, ec); + } + + vcpkg::Files::Filesystem& setup() + { + auto& fs = vcpkg::Files::get_real_filesystem(); + + std::error_code ec; + fs.create_directory(base_temporary_directory(), ec); + CHECK_EC_ON_FILE(base_temporary_directory(), ec); + + return fs; + } +} + +TEST_CASE ("remove all", "[files]") +{ + auto urbg = get_urbg(0); + + auto& fs = setup(); + + fs::path temp_dir = base_temporary_directory() / get_random_filename(urbg); + INFO("temp dir is: " << temp_dir); + + create_directory_tree(urbg, fs, temp_dir, MaxDepth{5}); + + std::error_code ec; + fs::path fp; + fs.remove_all(temp_dir, ec, fp); + CHECK_EC_ON_FILE(fp, ec); + + REQUIRE_FALSE(fs.exists(temp_dir, ec)); + CHECK_EC_ON_FILE(temp_dir, ec); +} + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +TEST_CASE ("remove all -- benchmarks", "[files][!benchmark]") +{ + auto urbg = get_urbg(1); + auto& fs = setup(); + + struct + { + urbg_t& urbg; + vcpkg::Files::Filesystem& fs; + + void operator()(Catch::Benchmark::Chronometer& meter, MaxDepth max_depth, AllowSymlinks allow_symlinks) const + { + std::vector<fs::path> temp_dirs; + temp_dirs.resize(meter.runs()); + + std::generate(begin(temp_dirs), end(temp_dirs), [&] { + fs::path temp_dir = base_temporary_directory() / get_random_filename(urbg); + create_directory_tree(urbg, fs, temp_dir, max_depth, allow_symlinks); + return temp_dir; + }); + + meter.measure([&](int run) { + std::error_code ec; + fs::path fp; + const auto& temp_dir = temp_dirs[run]; + + fs.remove_all(temp_dir, ec, fp); + CHECK_EC_ON_FILE(fp, ec); + }); + + for (const auto& dir : temp_dirs) + { + std::error_code ec; + REQUIRE_FALSE(fs.exists(dir, ec)); + CHECK_EC_ON_FILE(dir, ec); + } + } + } do_benchmark = {urbg, fs}; + + BENCHMARK_ADVANCED("small directory, no symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{2}, AllowSymlinks::No); + }; + + BENCHMARK_ADVANCED("large directory, no symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{5}, AllowSymlinks::No); + }; + + if (can_create_symlinks()) + { + BENCHMARK_ADVANCED("small directory, symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{2}, AllowSymlinks::Yes); + }; + + BENCHMARK_ADVANCED("large directory, symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{5}, AllowSymlinks::Yes); + }; + } +} +#endif diff --git a/toolsrc/src/vcpkg-test/paragraph.cpp b/toolsrc/src/vcpkg-test/paragraph.cpp new file mode 100644 index 000000000..a95879cfa --- /dev/null +++ b/toolsrc/src/vcpkg-test/paragraph.cpp @@ -0,0 +1,445 @@ +#include <vcpkg-test/catch.h> +#include <vcpkg-test/util.h> + +#include <vcpkg/base/strings.h> + +#include <vcpkg/paragraphs.h> + +namespace Strings = vcpkg::Strings; + +TEST_CASE ("SourceParagraph construct minimum", "[paragraph]") +{ + auto m_pgh = + vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + }}); + + REQUIRE(m_pgh.has_value()); + auto& pgh = **m_pgh.get(); + + REQUIRE(pgh.core_paragraph->name == "zlib"); + REQUIRE(pgh.core_paragraph->version == "1.2.8"); + REQUIRE(pgh.core_paragraph->maintainer == ""); + REQUIRE(pgh.core_paragraph->description == ""); + REQUIRE(pgh.core_paragraph->depends.size() == 0); +} + +TEST_CASE ("SourceParagraph construct maximum", "[paragraph]") +{ + auto m_pgh = + vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "s"}, + {"Version", "v"}, + {"Maintainer", "m"}, + {"Description", "d"}, + {"Build-Depends", "bd"}, + {"Default-Features", "df"}, + {"Supports", "x64"}, + }}); + REQUIRE(m_pgh.has_value()); + auto& pgh = **m_pgh.get(); + + REQUIRE(pgh.core_paragraph->name == "s"); + REQUIRE(pgh.core_paragraph->version == "v"); + REQUIRE(pgh.core_paragraph->maintainer == "m"); + REQUIRE(pgh.core_paragraph->description == "d"); + REQUIRE(pgh.core_paragraph->depends.size() == 1); + REQUIRE(pgh.core_paragraph->depends[0].name() == "bd"); + REQUIRE(pgh.core_paragraph->default_features.size() == 1); + REQUIRE(pgh.core_paragraph->default_features[0] == "df"); + REQUIRE(pgh.core_paragraph->supports.size() == 1); + REQUIRE(pgh.core_paragraph->supports[0] == "x64"); +} + +TEST_CASE ("SourceParagraph two depends", "[paragraph]") +{ + auto m_pgh = + vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "z, openssl"}, + }}); + REQUIRE(m_pgh.has_value()); + auto& pgh = **m_pgh.get(); + + REQUIRE(pgh.core_paragraph->depends.size() == 2); + REQUIRE(pgh.core_paragraph->depends[0].name() == "z"); + REQUIRE(pgh.core_paragraph->depends[1].name() == "openssl"); +} + +TEST_CASE ("SourceParagraph three depends", "[paragraph]") +{ + auto m_pgh = + vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "z, openssl, xyz"}, + }}); + REQUIRE(m_pgh.has_value()); + auto& pgh = **m_pgh.get(); + + REQUIRE(pgh.core_paragraph->depends.size() == 3); + REQUIRE(pgh.core_paragraph->depends[0].name() == "z"); + REQUIRE(pgh.core_paragraph->depends[1].name() == "openssl"); + REQUIRE(pgh.core_paragraph->depends[2].name() == "xyz"); +} + +TEST_CASE ("SourceParagraph three supports", "[paragraph]") +{ + auto m_pgh = + vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Supports", "x64, windows, uwp"}, + }}); + REQUIRE(m_pgh.has_value()); + auto& pgh = **m_pgh.get(); + + REQUIRE(pgh.core_paragraph->supports.size() == 3); + REQUIRE(pgh.core_paragraph->supports[0] == "x64"); + REQUIRE(pgh.core_paragraph->supports[1] == "windows"); + REQUIRE(pgh.core_paragraph->supports[2] == "uwp"); +} + +TEST_CASE ("SourceParagraph construct qualified depends", "[paragraph]") +{ + auto m_pgh = + vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "libA (windows), libB (uwp)"}, + }}); + REQUIRE(m_pgh.has_value()); + auto& pgh = **m_pgh.get(); + + REQUIRE(pgh.core_paragraph->name == "zlib"); + REQUIRE(pgh.core_paragraph->version == "1.2.8"); + REQUIRE(pgh.core_paragraph->maintainer == ""); + REQUIRE(pgh.core_paragraph->description == ""); + REQUIRE(pgh.core_paragraph->depends.size() == 2); + REQUIRE(pgh.core_paragraph->depends[0].name() == "libA"); + REQUIRE(pgh.core_paragraph->depends[0].qualifier == "windows"); + REQUIRE(pgh.core_paragraph->depends[1].name() == "libB"); + REQUIRE(pgh.core_paragraph->depends[1].qualifier == "uwp"); +} + +TEST_CASE ("SourceParagraph default features", "[paragraph]") +{ + auto m_pgh = + vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ + {"Source", "a"}, + {"Version", "1.0"}, + {"Default-Features", "a1"}, + }}); + REQUIRE(m_pgh.has_value()); + auto& pgh = **m_pgh.get(); + + REQUIRE(pgh.core_paragraph->default_features.size() == 1); + REQUIRE(pgh.core_paragraph->default_features[0] == "a1"); +} + +TEST_CASE ("BinaryParagraph construct minimum", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + }); + + REQUIRE(pgh.spec.name() == "zlib"); + REQUIRE(pgh.version == "1.2.8"); + REQUIRE(pgh.maintainer == ""); + REQUIRE(pgh.description == ""); + REQUIRE(pgh.spec.triplet().canonical_name() == "x86-windows"); + REQUIRE(pgh.depends.size() == 0); +} + +TEST_CASE ("BinaryParagraph construct maximum", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "s"}, + {"Version", "v"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Maintainer", "m"}, + {"Description", "d"}, + {"Depends", "bd"}, + }); + + REQUIRE(pgh.spec.name() == "s"); + REQUIRE(pgh.version == "v"); + REQUIRE(pgh.maintainer == "m"); + REQUIRE(pgh.description == "d"); + REQUIRE(pgh.depends.size() == 1); + REQUIRE(pgh.depends[0] == "bd"); +} + +TEST_CASE ("BinaryParagraph three depends", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Depends", "a, b, c"}, + }); + + REQUIRE(pgh.depends.size() == 3); + REQUIRE(pgh.depends[0] == "a"); + REQUIRE(pgh.depends[1] == "b"); + REQUIRE(pgh.depends[2] == "c"); +} + +TEST_CASE ("BinaryParagraph abi", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Abi", "abcd123"}, + }); + + REQUIRE(pgh.depends.size() == 0); + REQUIRE(pgh.abi == "abcd123"); +} + +TEST_CASE ("BinaryParagraph default features", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "a"}, + {"Version", "1.0"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Default-Features", "a1"}, + }); + + REQUIRE(pgh.depends.size() == 0); + REQUIRE(pgh.default_features.size() == 1); + REQUIRE(pgh.default_features[0] == "a1"); +} + +TEST_CASE ("parse paragraphs empty", "[paragraph]") +{ + const char* str = ""; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + REQUIRE(pghs.empty()); +} + +TEST_CASE ("parse paragraphs one field", "[paragraph]") +{ + const char* str = "f1: v1"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0].size() == 1); + REQUIRE(pghs[0]["f1"] == "v1"); +} + +TEST_CASE ("parse paragraphs one pgh", "[paragraph]") +{ + const char* str = "f1: v1\n" + "f2: v2"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0].size() == 2); + REQUIRE(pghs[0]["f1"] == "v1"); + REQUIRE(pghs[0]["f2"] == "v2"); +} + +TEST_CASE ("parse paragraphs two pgh", "[paragraph]") +{ + const char* str = "f1: v1\n" + "f2: v2\n" + "\n" + "f3: v3\n" + "f4: v4"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 2); + REQUIRE(pghs[0].size() == 2); + REQUIRE(pghs[0]["f1"] == "v1"); + REQUIRE(pghs[0]["f2"] == "v2"); + REQUIRE(pghs[1].size() == 2); + REQUIRE(pghs[1]["f3"] == "v3"); + REQUIRE(pghs[1]["f4"] == "v4"); +} + +TEST_CASE ("parse paragraphs field names", "[paragraph]") +{ + const char* str = "1:\n" + "f:\n" + "F:\n" + "0:\n" + "F-2:\n"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0].size() == 5); +} + +TEST_CASE ("parse paragraphs multiple blank lines", "[paragraph]") +{ + const char* str = "f1: v1\n" + "f2: v2\n" + "\n" + "\n" + "f3: v3\n" + "f4: v4"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 2); +} + +TEST_CASE ("parse paragraphs empty fields", "[paragraph]") +{ + const char* str = "f1:\n" + "f2: "; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0].size() == 2); + REQUIRE(pghs[0]["f1"] == ""); + REQUIRE(pghs[0]["f2"] == ""); + REQUIRE(pghs[0].size() == 2); +} + +TEST_CASE ("parse paragraphs multiline fields", "[paragraph]") +{ + const char* str = "f1: simple\n" + " f1\r\n" + "f2:\r\n" + " f2\r\n" + " continue\r\n"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0]["f1"] == "simple\n f1"); + REQUIRE(pghs[0]["f2"] == "\n f2\n continue"); +} + +TEST_CASE ("parse paragraphs crlfs", "[paragraph]") +{ + const char* str = "f1: v1\r\n" + "f2: v2\r\n" + "\r\n" + "f3: v3\r\n" + "f4: v4"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 2); + REQUIRE(pghs[0].size() == 2); + REQUIRE(pghs[0]["f1"] == "v1"); + REQUIRE(pghs[0]["f2"] == "v2"); + REQUIRE(pghs[1].size() == 2); + REQUIRE(pghs[1]["f3"] == "v3"); + REQUIRE(pghs[1]["f4"] == "v4"); +} + +TEST_CASE ("parse paragraphs comment", "[paragraph]") +{ + const char* str = "f1: v1\r\n" + "#comment\r\n" + "f2: v2\r\n" + "#comment\r\n" + "\r\n" + "#comment\r\n" + "f3: v3\r\n" + "#comment\r\n" + "f4: v4"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 2); + REQUIRE(pghs[0].size() == 2); + REQUIRE(pghs[0]["f1"] == "v1"); + REQUIRE(pghs[0]["f2"] == "v2"); + REQUIRE(pghs[1].size()); + REQUIRE(pghs[1]["f3"] == "v3"); + REQUIRE(pghs[1]["f4"] == "v4"); +} + +TEST_CASE ("parse comment before single line feed", "[paragraph]") +{ + const char* str = "f1: v1\r\n" + "#comment\n"; + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).value_or_exit(VCPKG_LINE_INFO); + REQUIRE(pghs[0].size() == 1); + REQUIRE(pghs[0]["f1"] == "v1"); +} + +TEST_CASE ("BinaryParagraph serialize min", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + }); + std::string ss = Strings::serialize(pgh); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0].size() == 4); + REQUIRE(pghs[0]["Package"] == "zlib"); + REQUIRE(pghs[0]["Version"] == "1.2.8"); + REQUIRE(pghs[0]["Architecture"] == "x86-windows"); + REQUIRE(pghs[0]["Multi-Arch"] == "same"); +} + +TEST_CASE ("BinaryParagraph serialize max", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Description", "first line\n second line"}, + {"Maintainer", "abc <abc@abc.abc>"}, + {"Depends", "dep"}, + {"Multi-Arch", "same"}, + }); + std::string ss = Strings::serialize(pgh); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0].size() == 7); + REQUIRE(pghs[0]["Package"] == "zlib"); + REQUIRE(pghs[0]["Version"] == "1.2.8"); + REQUIRE(pghs[0]["Architecture"] == "x86-windows"); + REQUIRE(pghs[0]["Multi-Arch"] == "same"); + REQUIRE(pghs[0]["Description"] == "first line\n second line"); + REQUIRE(pghs[0]["Depends"] == "dep"); +} + +TEST_CASE ("BinaryParagraph serialize multiple deps", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Depends", "a, b, c"}, + }); + std::string ss = Strings::serialize(pgh); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0]["Depends"] == "a, b, c"); +} + +TEST_CASE ("BinaryParagraph serialize abi", "[paragraph]") +{ + vcpkg::BinaryParagraph pgh({ + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Depends", "a, b, c"}, + {"Abi", "123abc"}, + }); + std::string ss = Strings::serialize(pgh); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); + + REQUIRE(pghs.size() == 1); + REQUIRE(pghs[0]["Abi"] == "123abc"); +} diff --git a/toolsrc/src/vcpkg-test/plan.cpp b/toolsrc/src/vcpkg-test/plan.cpp new file mode 100644 index 000000000..049ef2066 --- /dev/null +++ b/toolsrc/src/vcpkg-test/plan.cpp @@ -0,0 +1,1241 @@ +#include <vcpkg-test/catch.h> +#include <vcpkg-test/util.h> + +#include <vcpkg/dependencies.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/triplet.h> + +#include <memory> +#include <unordered_map> +#include <vector> + +using namespace vcpkg; + +using Test::make_status_feature_pgh; +using Test::make_status_pgh; +using Test::unsafe_pspec; + +static 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 = {}) +{ + using Pgh = std::unordered_map<std::string, std::string>; + std::vector<Pgh> scf_pghs; + scf_pghs.push_back(Pgh{{"Source", name}, + {"Version", "0"}, + {"Build-Depends", depends}, + {"Default-Features", Strings::join(", ", default_features)}}); + for (auto&& feature : features) + { + scf_pghs.push_back(Pgh{ + {"Feature", feature.first}, + {"Description", "feature"}, + {"Build-Depends", feature.second}, + }); + } + auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::move(scf_pghs)); + REQUIRE(m_pgh.has_value()); + return std::move(*m_pgh.get()); +} + +/// <summary> +/// Assert that the given action an install of given features from given package. +/// </summary> +static void features_check(Dependencies::AnyAction& install_action, + std::string pkg_name, + std::vector<std::string> vec, + const Triplet& triplet = Triplet::X86_WINDOWS) +{ + REQUIRE(install_action.install_action.has_value()); + const auto& plan = install_action.install_action.value_or_exit(VCPKG_LINE_INFO); + const auto& feature_list = plan.feature_list; + + REQUIRE(plan.spec.triplet().to_string() == triplet.to_string()); + + auto& scfl = *plan.source_control_file_location.get(); + REQUIRE(pkg_name == scfl.source_control_file->core_paragraph->name); + REQUIRE(feature_list.size() == vec.size()); + + for (auto&& feature_name : vec) + { + // TODO: see if this can be simplified + if (feature_name == "core" || feature_name == "") + { + REQUIRE((Util::find(feature_list, "core") != feature_list.end() || + Util::find(feature_list, "") != feature_list.end())); + continue; + } + REQUIRE(Util::find(feature_list, feature_name) != feature_list.end()); + } +} + +/// <summary> +/// Assert that the given action is a remove of given package. +/// </summary> +static void remove_plan_check(Dependencies::AnyAction& remove_action, + std::string pkg_name, + const Triplet& triplet = Triplet::X86_WINDOWS) +{ + const auto& plan = remove_action.remove_action.value_or_exit(VCPKG_LINE_INFO); + REQUIRE(plan.spec.triplet().to_string() == triplet.to_string()); + REQUIRE(pkg_name == plan.spec.name()); +} + +/// <summary> +/// Map of source control files by their package name. +/// </summary> +struct PackageSpecMap +{ + std::unordered_map<std::string, SourceControlFileLocation> map; + Triplet triplet; + PackageSpecMap(const Triplet& t = Triplet::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 = {}) + { + auto scfl = SourceControlFileLocation{make_control_file(name, depends, features, default_features), ""}; + return emplace(std::move(scfl)); + } + + PackageSpec emplace(vcpkg::SourceControlFileLocation&& scfl) + { + auto spec = PackageSpec::from_name_and_triplet(scfl.source_control_file->core_paragraph->name, triplet); + REQUIRE(spec.has_value()); + map.emplace(scfl.source_control_file->core_paragraph->name, std::move(scfl)); + return PackageSpec{*spec.get()}; + } +}; + +TEST_CASE ("basic install scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "b"); + auto spec_b = spec_map.emplace("b", "c"); + auto spec_c = spec_map.emplace("c"); + + Dependencies::MapPortFileProvider map_port(spec_map.map); + auto install_plan = Dependencies::create_feature_install_plan( + map_port, {FeatureSpec{spec_a, ""}}, StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 3); + REQUIRE(install_plan.at(0).spec().name() == "c"); + REQUIRE(install_plan.at(1).spec().name() == "b"); + REQUIRE(install_plan.at(2).spec().name() == "a"); +} + +TEST_CASE ("multiple install scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "d"); + auto spec_b = spec_map.emplace("b", "d, e"); + auto spec_c = spec_map.emplace("c", "e, h"); + auto spec_d = spec_map.emplace("d", "f, g, h"); + auto spec_e = spec_map.emplace("e", "g"); + auto spec_f = spec_map.emplace("f"); + auto spec_g = spec_map.emplace("g"); + auto spec_h = spec_map.emplace("h"); + + Dependencies::MapPortFileProvider map_port(spec_map.map); + auto install_plan = Dependencies::create_feature_install_plan( + map_port, + {FeatureSpec{spec_a, ""}, FeatureSpec{spec_b, ""}, FeatureSpec{spec_c, ""}}, + StatusParagraphs(std::move(status_paragraphs))); + + auto iterator_pos = [&](const PackageSpec& spec) { + auto it = + std::find_if(install_plan.begin(), install_plan.end(), [&](auto& action) { return action.spec() == spec; }); + REQUIRE(it != install_plan.end()); + return it - install_plan.begin(); + }; + + const auto a_pos = iterator_pos(spec_a); + const auto b_pos = iterator_pos(spec_b); + const auto c_pos = iterator_pos(spec_c); + const auto d_pos = iterator_pos(spec_d); + const auto e_pos = iterator_pos(spec_e); + const auto f_pos = iterator_pos(spec_f); + const auto g_pos = iterator_pos(spec_g); + const auto h_pos = iterator_pos(spec_h); + + REQUIRE(a_pos > d_pos); + REQUIRE(b_pos > e_pos); + REQUIRE(b_pos > d_pos); + REQUIRE(c_pos > e_pos); + REQUIRE(c_pos > h_pos); + REQUIRE(d_pos > f_pos); + REQUIRE(d_pos > g_pos); + REQUIRE(d_pos > h_pos); + REQUIRE(e_pos > g_pos); +} + +TEST_CASE ("existing package scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(vcpkg::Test::make_status_pgh("a")); + + PackageSpecMap spec_map; + auto spec_a = FullPackageSpec{spec_map.emplace("a")}; + + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, FullPackageSpec::to_feature_specs({spec_a}), StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 1); + const auto p = install_plan.at(0).install_action.get(); + REQUIRE(p); + REQUIRE(p->spec.name() == "a"); + REQUIRE(p->plan_type == Dependencies::InstallPlanType::ALREADY_INSTALLED); + REQUIRE(p->request_type == Dependencies::RequestType::USER_REQUESTED); +} + +TEST_CASE ("user requested package scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map; + const auto spec_a = FullPackageSpec{spec_map.emplace("a", "b")}; + const auto spec_b = FullPackageSpec{spec_map.emplace("b")}; + + const auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, FullPackageSpec::to_feature_specs({spec_a}), StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 2); + const auto p = install_plan.at(0).install_action.get(); + REQUIRE(p); + REQUIRE(p->spec.name() == "b"); + REQUIRE(p->plan_type == Dependencies::InstallPlanType::BUILD_AND_INSTALL); + REQUIRE(p->request_type == Dependencies::RequestType::AUTO_SELECTED); + + const auto p2 = install_plan.at(1).install_action.get(); + REQUIRE(p2); + REQUIRE(p2->spec.name() == "a"); + REQUIRE(p2->plan_type == Dependencies::InstallPlanType::BUILD_AND_INSTALL); + REQUIRE(p2->request_type == Dependencies::RequestType::USER_REQUESTED); +} + +TEST_CASE ("long install scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("j", "k")); + status_paragraphs.push_back(make_status_pgh("k")); + + PackageSpecMap spec_map; + + auto spec_a = spec_map.emplace("a", "b, c, d, e, f, g, h, j, k"); + auto spec_b = spec_map.emplace("b", "c, d, e, f, g, h, j, k"); + auto spec_c = spec_map.emplace("c", "d, e, f, g, h, j, k"); + auto spec_d = spec_map.emplace("d", "e, f, g, h, j, k"); + auto spec_e = spec_map.emplace("e", "f, g, h, j, k"); + auto spec_f = spec_map.emplace("f", "g, h, j, k"); + auto spec_g = spec_map.emplace("g", "h, j, k"); + auto spec_h = spec_map.emplace("h", "j, k"); + auto spec_j = spec_map.emplace("j", "k"); + auto spec_k = spec_map.emplace("k"); + + Dependencies::MapPortFileProvider map_port(spec_map.map); + auto install_plan = Dependencies::create_feature_install_plan( + map_port, {FeatureSpec{spec_a, ""}}, StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 8); + REQUIRE(install_plan.at(0).spec().name() == "h"); + REQUIRE(install_plan.at(1).spec().name() == "g"); + REQUIRE(install_plan.at(2).spec().name() == "f"); + REQUIRE(install_plan.at(3).spec().name() == "e"); + REQUIRE(install_plan.at(4).spec().name() == "d"); + REQUIRE(install_plan.at(5).spec().name() == "c"); + REQUIRE(install_plan.at(6).spec().name() == "b"); + REQUIRE(install_plan.at(7).spec().name() == "a"); +} + +TEST_CASE ("basic feature test 1", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a", "b, b[b1]")); + status_paragraphs.push_back(make_status_pgh("b")); + status_paragraphs.push_back(make_status_feature_pgh("b", "b1")); + + PackageSpecMap spec_map; + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b, b[b1]", {{"a1", "b[b2]"}}), {"a1"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}, {"b3", ""}})}; + + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, FullPackageSpec::to_feature_specs({spec_a}), StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 4); + remove_plan_check(install_plan.at(0), "a"); + remove_plan_check(install_plan.at(1), "b"); + features_check(install_plan.at(2), "b", {"b1", "core", "b1"}); + features_check(install_plan.at(3), "a", {"a1", "core"}); +} + +TEST_CASE ("basic feature test 2", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map; + + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b[b1]", {{"a1", "b[b2]"}}), {"a1"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}, {"b3", ""}})}; + + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, FullPackageSpec::to_feature_specs({spec_a}), StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 2); + features_check(install_plan.at(0), "b", {"b1", "b2", "core"}); + features_check(install_plan.at(1), "a", {"a1", "core"}); +} + +TEST_CASE ("basic feature test 3", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + + PackageSpecMap spec_map; + + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; + + auto install_plan = Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_c, spec_a}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 4); + remove_plan_check(install_plan.at(0), "a"); + features_check(install_plan.at(1), "b", {"core"}); + features_check(install_plan.at(2), "a", {"a1", "core"}); + features_check(install_plan.at(3), "c", {"core"}); +} + +TEST_CASE ("basic feature test 4", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.push_back(make_status_feature_pgh("a", "a1", "")); + + PackageSpecMap spec_map; + + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}})}; + auto spec_b = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; + + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, FullPackageSpec::to_feature_specs({spec_c}), StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 1); + features_check(install_plan.at(0), "c", {"core"}); +} + +TEST_CASE ("basic feature test 5", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map; + + auto spec_a = + FullPackageSpec{spec_map.emplace("a", "", {{"a1", "b[b1]"}, {"a2", "b[b2]"}, {"a3", "a[a2]"}}), {"a3"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}})}; + + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, FullPackageSpec::to_feature_specs({spec_a}), StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 2); + features_check(install_plan.at(0), "b", {"core", "b2"}); + features_check(install_plan.at(1), "a", {"core", "a3", "a2"}); +} + +TEST_CASE ("basic feature test 6", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("b")); + + PackageSpecMap spec_map; + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b[core]"), {"core"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}}), {"b1"}}; + + auto install_plan = Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_a, spec_b}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 3); + remove_plan_check(install_plan.at(0), "b"); + features_check(install_plan.at(1), "b", {"core", "b1"}); + features_check(install_plan.at(2), "a", {"core"}); +} + +TEST_CASE ("basic feature test 7", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("x", "b")); + status_paragraphs.push_back(make_status_pgh("b")); + + PackageSpecMap spec_map; + + auto spec_a = FullPackageSpec{spec_map.emplace("a")}; + auto spec_x = FullPackageSpec{spec_map.emplace("x", "a"), {"core"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}}), {"b1"}}; + + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, FullPackageSpec::to_feature_specs({spec_b}), StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 5); + remove_plan_check(install_plan.at(0), "x"); + remove_plan_check(install_plan.at(1), "b"); + + // TODO: order here may change but A < X, and B anywhere + features_check(install_plan.at(2), "b", {"core", "b1"}); + features_check(install_plan.at(3), "a", {"core"}); + features_check(install_plan.at(4), "x", {"core"}); +} + +TEST_CASE ("basic feature test 8", "[plan][!mayfail]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.back()->package.spec = + PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; + auto spec_b_64 = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; + + spec_map.triplet = Triplet::X86_WINDOWS; + auto spec_a_86 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; + auto spec_b_86 = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c_86 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; + + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({spec_c_64, spec_a_86, spec_a_64, spec_c_86}), + StatusParagraphs(std::move(status_paragraphs))); + + remove_plan_check(install_plan.at(0), "a", Triplet::X64_WINDOWS); + remove_plan_check(install_plan.at(1), "a"); + features_check(install_plan.at(2), "b", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(3), "a", {"a1", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(4), "c", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(5), "b", {"core"}); + features_check(install_plan.at(6), "a", {"a1", "core"}); + features_check(install_plan.at(7), "c", {"core"}); +} + +TEST_CASE ("install all features test", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}), {"core"}}; + + auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + REQUIRE(install_specs.has_value()); + if (!install_specs.has_value()) return; + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 1); + features_check(install_plan.at(0), "a", {"0", "1", "core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("install default features test 1", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + // Add a port "a" with default features "1" and features "0" and "1". + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"}); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + // Expect the default feature "1" to be installed, but not "0" + REQUIRE(install_plan.size() == 1); + features_check(install_plan.at(0), "a", {"1", "core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("install default features test 2", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.back()->package.spec = + PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + + // Add a port "a" of which "core" is already installed, but we will + // install the default features "explicitly" + // "a" has two features, of which "a1" is default. + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + // Expect "a" to get removed for rebuild and then installed with default + // features. + REQUIRE(install_plan.size() == 2); + remove_plan_check(install_plan.at(0), "a", Triplet::X64_WINDOWS); + features_check(install_plan.at(1), "a", {"a1", "core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("install default features test 3", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + // "a" has two features, of which "a1" is default. + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); + + // Explicitly install "a" without default features + auto install_specs = FullPackageSpec::from_string("a[core]", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + // Expect the default feature not to get installed. + REQUIRE(install_plan.size() == 1); + features_check(install_plan.at(0), "a", {"core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("install default features of dependency test 1", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + // Add a port "a" which depends on the core of "b" + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "b[core]"); + // "b" has two features, of which "b1" is default. + spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + // Expect "a" to get installed and defaults of "b" through the dependency, + // as no explicit features of "b" are installed by the user. + REQUIRE(install_plan.size() == 2); + features_check(install_plan.at(0), "b", {"b1", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(1), "a", {"core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("do not install default features of existing dependency", "[plan]") +{ + // Add a port "a" which depends on the core of "b" + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "b[core]"); + // "b" has two features, of which "b1" is default. + spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); + + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + // "b[core]" is already installed + status_paragraphs.push_back(make_status_pgh("b")); + status_paragraphs.back()->package.spec = + PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + // Expect "a" to get installed, but not require rebuilding "b" + REQUIRE(install_plan.size() == 1); + features_check(install_plan.at(0), "a", {"core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("install default features of dependency test 2", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("b")); + status_paragraphs.back()->package.spec = + PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + + // Add a port "a" which depends on the core of "b", which was already + // installed explicitly + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "b[core]"); + // "b" has two features, of which "b1" is default. + spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + // Expect "a" to get installed, not the defaults of "b", as the required + // dependencies are already there, installed explicitly by the user. + REQUIRE(install_plan.size() == 1); + features_check(install_plan.at(0), "a", {"core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("install plan action dependencies", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + // Add a port "a" which depends on the core of "b", which was already + // installed explicitly + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_c = spec_map.emplace("c"); + auto spec_b = spec_map.emplace("b", "c"); + spec_map.emplace("a", "b"); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 3); + features_check(install_plan.at(0), "c", {"core"}, Triplet::X64_WINDOWS); + + features_check(install_plan.at(1), "b", {"core"}, Triplet::X64_WINDOWS); + REQUIRE(install_plan.at(1).install_action.get()->computed_dependencies == std::vector<PackageSpec>{spec_c}); + + features_check(install_plan.at(2), "a", {"core"}, Triplet::X64_WINDOWS); + REQUIRE(install_plan.at(2).install_action.get()->computed_dependencies == std::vector<PackageSpec>{spec_b}); +} + +TEST_CASE ("install plan action dependencies 2", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + // Add a port "a" which depends on the core of "b", which was already + // installed explicitly + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_c = spec_map.emplace("c"); + auto spec_b = spec_map.emplace("b", "c"); + spec_map.emplace("a", "c, b"); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 3); + features_check(install_plan.at(0), "c", {"core"}, Triplet::X64_WINDOWS); + + features_check(install_plan.at(1), "b", {"core"}, Triplet::X64_WINDOWS); + REQUIRE(install_plan.at(1).install_action.get()->computed_dependencies == std::vector<PackageSpec>{spec_c}); + + features_check(install_plan.at(2), "a", {"core"}, Triplet::X64_WINDOWS); + REQUIRE(install_plan.at(2).install_action.get()->computed_dependencies == std::vector<PackageSpec>{spec_b, spec_c}); +} + +TEST_CASE ("install plan action dependencies 3", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + // Add a port "a" which depends on the core of "b", which was already + // installed explicitly + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + spec_map.emplace("a", "", {{"0", ""}, {"1", "a[0]"}}, {"1"}); + + // Install "a" (without explicit feature specification) + auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 1); + features_check(install_plan.at(0), "a", {"1", "0", "core"}, Triplet::X64_WINDOWS); + REQUIRE(install_plan.at(0).install_action.get()->computed_dependencies == std::vector<PackageSpec>{}); +} + +TEST_CASE ("install with default features", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a", "")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto b_spec = spec_map.emplace("b", "", {{"0", ""}}, {"0"}); + auto a_spec = spec_map.emplace("a", "b[core]", {{"0", ""}}); + + // Install "a" and indicate that "b" should not install default features + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, {FeatureSpec{a_spec, "0"}, FeatureSpec{b_spec, "core"}}, status_db); + + REQUIRE(install_plan.size() == 3); + remove_plan_check(install_plan.at(0), "a"); + features_check(install_plan.at(1), "b", {"core"}); + features_check(install_plan.at(2), "a", {"0", "core"}); +} + +TEST_CASE ("upgrade with default features 1", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a", "", "1")); + pghs.push_back(make_status_feature_pgh("a", "0")); + StatusParagraphs status_db(std::move(pghs)); + + // Add a port "a" of which "core" and "0" are already installed. + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"}); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + auto plan = graph.serialize(); + + // The upgrade should not install the default feature + REQUIRE(plan.size() == 2); + + REQUIRE(plan.at(0).spec().name() == "a"); + remove_plan_check(plan.at(0), "a"); + features_check(plan.at(1), "a", {"core", "0"}); +} + +TEST_CASE ("upgrade with default features 2", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + // B is currently installed _without_ default feature b0 + pghs.push_back(make_status_pgh("b", "", "b0", "x64-windows")); + pghs.push_back(make_status_pgh("a", "b[core]", "", "x64-windows")); + + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_a = spec_map.emplace("a", "b[core]"); + auto spec_b = spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0", "b1"}); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + graph.upgrade(spec_b); + auto plan = graph.serialize(); + + // The upgrade should install the new default feature b1 but not b0 + REQUIRE(plan.size() == 4); + remove_plan_check(plan.at(0), "a", Triplet::X64_WINDOWS); + remove_plan_check(plan.at(1), "b", Triplet::X64_WINDOWS); + features_check(plan.at(2), "b", {"core", "b1"}, Triplet::X64_WINDOWS); + features_check(plan.at(3), "a", {"core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("upgrade with default features 3", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + // note: unrelated package due to x86 triplet + pghs.push_back(make_status_pgh("b", "", "", "x86-windows")); + pghs.push_back(make_status_pgh("a", "", "", "x64-windows")); + + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_a = spec_map.emplace("a", "b[core]"); + spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0"}); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + auto plan = graph.serialize(); + + // The upgrade should install the default feature + REQUIRE(plan.size() == 3); + remove_plan_check(plan.at(0), "a", Triplet::X64_WINDOWS); + features_check(plan.at(1), "b", {"b0", "core"}, Triplet::X64_WINDOWS); + features_check(plan.at(2), "a", {"core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("upgrade with new default feature", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a", "", "0", "x86-windows")); + + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}, {"2", ""}}, {"0", "1"}); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + auto plan = graph.serialize(); + + // The upgrade should install the new default feature but not the old default feature 0 + REQUIRE(plan.size() == 2); + remove_plan_check(plan.at(0), "a", Triplet::X86_WINDOWS); + features_check(plan.at(1), "a", {"core", "1"}, Triplet::X86_WINDOWS); +} + +TEST_CASE ("transitive features test", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"0", "b[0]"}}), {"core"}}; + auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "c", {{"0", "c[0]"}}), {"core"}}; + auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; + + auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + REQUIRE(install_specs.has_value()); + if (!install_specs.has_value()) return; + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 3); + features_check(install_plan.at(0), "c", {"0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(1), "b", {"0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(2), "a", {"0", "core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("no transitive features test", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"0", ""}}), {"core"}}; + auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "c", {{"0", ""}}), {"core"}}; + auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; + + auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + REQUIRE(install_specs.has_value()); + if (!install_specs.has_value()) return; + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 3); + features_check(install_plan.at(0), "c", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(1), "b", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(2), "a", {"0", "core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("only transitive features test", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map(Triplet::X64_WINDOWS); + auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "", {{"0", "b[0]"}}), {"core"}}; + auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "", {{"0", "c[0]"}}), {"core"}}; + auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; + + auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + REQUIRE(install_specs.has_value()); + if (!install_specs.has_value()) return; + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}), + StatusParagraphs(std::move(status_paragraphs))); + + REQUIRE(install_plan.size() == 3); + features_check(install_plan.at(0), "c", {"0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(1), "b", {"0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(2), "a", {"0", "core"}, Triplet::X64_WINDOWS); +} + +TEST_CASE ("basic remove scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + StatusParagraphs status_db(std::move(pghs)); + + auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("a")}, status_db); + + REQUIRE(remove_plan.size() == 1); + REQUIRE(remove_plan.at(0).spec.name() == "a"); +} + +TEST_CASE ("recurse remove scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_pgh("b", "a")); + StatusParagraphs status_db(std::move(pghs)); + + auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("a")}, status_db); + + REQUIRE(remove_plan.size() == 2); + REQUIRE(remove_plan.at(0).spec.name() == "b"); + REQUIRE(remove_plan.at(1).spec.name() == "a"); +} + +TEST_CASE ("features depend remove scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_pgh("b")); + pghs.push_back(make_status_feature_pgh("b", "0", "a")); + StatusParagraphs status_db(std::move(pghs)); + + auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("a")}, status_db); + + REQUIRE(remove_plan.size() == 2); + REQUIRE(remove_plan.at(0).spec.name() == "b"); + REQUIRE(remove_plan.at(1).spec.name() == "a"); +} + +TEST_CASE ("features depend remove scheme once removed", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("expat")); + pghs.push_back(make_status_pgh("vtk", "expat")); + pghs.push_back(make_status_pgh("opencv")); + pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk")); + StatusParagraphs status_db(std::move(pghs)); + + auto remove_plan = Dependencies::create_remove_plan({unsafe_pspec("expat")}, status_db); + + REQUIRE(remove_plan.size() == 3); + REQUIRE(remove_plan.at(0).spec.name() == "opencv"); + REQUIRE(remove_plan.at(1).spec.name() == "vtk"); + REQUIRE(remove_plan.at(2).spec.name() == "expat"); +} + +TEST_CASE ("features depend remove scheme once removed x64", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("expat", "", "", "x64")); + pghs.push_back(make_status_pgh("vtk", "expat", "", "x64")); + pghs.push_back(make_status_pgh("opencv", "", "", "x64")); + pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk", "x64")); + StatusParagraphs status_db(std::move(pghs)); + + auto remove_plan = + Dependencies::create_remove_plan({unsafe_pspec("expat", Triplet::from_canonical_name("x64"))}, status_db); + + REQUIRE(remove_plan.size() == 3); + REQUIRE(remove_plan.at(0).spec.name() == "opencv"); + REQUIRE(remove_plan.at(1).spec.name() == "vtk"); + REQUIRE(remove_plan.at(2).spec.name() == "expat"); +} + +TEST_CASE ("features depend core remove scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("curl", "", "", "x64")); + pghs.push_back(make_status_pgh("cpr", "curl[core]", "", "x64")); + StatusParagraphs status_db(std::move(pghs)); + + auto remove_plan = + Dependencies::create_remove_plan({unsafe_pspec("curl", Triplet::from_canonical_name("x64"))}, status_db); + + REQUIRE(remove_plan.size() == 2); + REQUIRE(remove_plan.at(0).spec.name() == "cpr"); + REQUIRE(remove_plan.at(1).spec.name() == "curl"); +} + +TEST_CASE ("features depend core remove scheme 2", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("curl", "", "", "x64")); + pghs.push_back(make_status_feature_pgh("curl", "a", "", "x64")); + pghs.push_back(make_status_feature_pgh("curl", "b", "curl[a]", "x64")); + StatusParagraphs status_db(std::move(pghs)); + + auto remove_plan = + Dependencies::create_remove_plan({unsafe_pspec("curl", Triplet::from_canonical_name("x64"))}, status_db); + + REQUIRE(remove_plan.size() == 1); + REQUIRE(remove_plan.at(0).spec.name() == "curl"); +} + +TEST_CASE ("basic upgrade scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a"); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + + auto plan = graph.serialize(); + + REQUIRE(plan.size() == 2); + REQUIRE(plan.at(0).spec().name() == "a"); + REQUIRE(plan.at(0).remove_action.has_value()); + REQUIRE(plan.at(1).spec().name() == "a"); + REQUIRE(plan.at(1).install_action.has_value()); +} + +TEST_CASE ("basic upgrade scheme with recurse", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_pgh("b", "a")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a"); + spec_map.emplace("b", "a"); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + + auto plan = graph.serialize(); + + REQUIRE(plan.size() == 4); + REQUIRE(plan.at(0).spec().name() == "b"); + REQUIRE(plan.at(0).remove_action.has_value()); + + REQUIRE(plan.at(1).spec().name() == "a"); + REQUIRE(plan.at(1).remove_action.has_value()); + + REQUIRE(plan.at(2).spec().name() == "a"); + REQUIRE(plan.at(2).install_action.has_value()); + + REQUIRE(plan.at(3).spec().name() == "b"); + REQUIRE(plan.at(3).install_action.has_value()); +} + +TEST_CASE ("basic upgrade scheme with bystander", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_pgh("b")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a"); + spec_map.emplace("b", "a"); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + + auto plan = graph.serialize(); + + REQUIRE(plan.size() == 2); + REQUIRE(plan.at(0).spec().name() == "a"); + REQUIRE(plan.at(0).remove_action.has_value()); + REQUIRE(plan.at(1).spec().name() == "a"); + REQUIRE(plan.at(1).install_action.has_value()); +} + +TEST_CASE ("basic upgrade scheme with new dep", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "b"); + spec_map.emplace("b"); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + + auto plan = graph.serialize(); + + REQUIRE(plan.size() == 3); + REQUIRE(plan.at(0).spec().name() == "a"); + REQUIRE(plan.at(0).remove_action.has_value()); + REQUIRE(plan.at(1).spec().name() == "b"); + REQUIRE(plan.at(1).install_action.has_value()); + REQUIRE(plan.at(2).spec().name() == "a"); + REQUIRE(plan.at(2).install_action.has_value()); +} + +TEST_CASE ("basic upgrade scheme with features", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_feature_pgh("a", "a1")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + + auto plan = graph.serialize(); + + REQUIRE(plan.size() == 2); + + REQUIRE(plan.at(0).spec().name() == "a"); + REQUIRE(plan.at(0).remove_action.has_value()); + + features_check(plan.at(1), "a", {"core", "a1"}); +} + +TEST_CASE ("basic upgrade scheme with new default feature", "[plan]") +{ + // only core of package "a" is installed + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + StatusParagraphs status_db(std::move(pghs)); + + // a1 was added as a default feature and should be installed in upgrade + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}, {"a1"}); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + + auto plan = graph.serialize(); + + REQUIRE(plan.size() == 2); + + REQUIRE(plan.at(0).spec().name() == "a"); + REQUIRE(plan.at(0).remove_action.has_value()); + + features_check(plan.at(1), "a", {"core", "a1"}); +} + +TEST_CASE ("basic upgrade scheme with self features", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_feature_pgh("a", "a1", "")); + pghs.push_back(make_status_feature_pgh("a", "a2", "a[a1]")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "", {{"a1", ""}, {"a2", "a[a1]"}}); + + Dependencies::MapPortFileProvider provider(spec_map.map); + Dependencies::PackageGraph graph(provider, status_db); + + graph.upgrade(spec_a); + + auto plan = graph.serialize(); + + REQUIRE(plan.size() == 2); + + REQUIRE(plan.at(0).spec().name() == "a"); + REQUIRE(plan.at(0).remove_action.has_value()); + + REQUIRE(plan.at(1).spec().name() == "a"); + REQUIRE(plan.at(1).install_action.has_value()); + REQUIRE(plan.at(1).install_action.get()->feature_list == std::set<std::string>{"core", "a1", "a2"}); +} + +TEST_CASE ("basic export scheme", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a"); + + auto plan = Dependencies::create_export_plan({spec_a}, status_db); + + REQUIRE(plan.size() == 1); + REQUIRE(plan.at(0).spec.name() == "a"); + REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); +} + +TEST_CASE ("basic export scheme with recurse", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_pgh("b", "a")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a"); + auto spec_b = spec_map.emplace("b", "a"); + + auto plan = Dependencies::create_export_plan({spec_b}, status_db); + + REQUIRE(plan.size() == 2); + REQUIRE(plan.at(0).spec.name() == "a"); + REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + + REQUIRE(plan.at(1).spec.name() == "b"); + REQUIRE(plan.at(1).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); +} + +TEST_CASE ("basic export scheme with bystander", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_pgh("b")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a"); + auto spec_b = spec_map.emplace("b", "a"); + + auto plan = Dependencies::create_export_plan({spec_a}, status_db); + + REQUIRE(plan.size() == 1); + REQUIRE(plan.at(0).spec.name() == "a"); + REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); +} + +TEST_CASE ("basic export scheme with missing", "[plan]") +{ + StatusParagraphs status_db; + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a"); + + auto plan = Dependencies::create_export_plan({spec_a}, status_db); + + REQUIRE(plan.size() == 1); + REQUIRE(plan.at(0).spec.name() == "a"); + REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::NOT_BUILT); +} + +TEST_CASE ("basic export scheme with features", "[plan]") +{ + std::vector<std::unique_ptr<StatusParagraph>> pghs; + pghs.push_back(make_status_pgh("b")); + pghs.push_back(make_status_pgh("a")); + pghs.push_back(make_status_feature_pgh("a", "a1", "b[core]")); + StatusParagraphs status_db(std::move(pghs)); + + PackageSpecMap spec_map; + auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}); + + auto plan = Dependencies::create_export_plan({spec_a}, status_db); + + REQUIRE(plan.size() == 2); + + REQUIRE(plan.at(0).spec.name() == "b"); + REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + + REQUIRE(plan.at(1).spec.name() == "a"); + REQUIRE(plan.at(1).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); +} diff --git a/toolsrc/src/vcpkg-test/specifier.cpp b/toolsrc/src/vcpkg-test/specifier.cpp new file mode 100644 index 000000000..330a96d78 --- /dev/null +++ b/toolsrc/src/vcpkg-test/specifier.cpp @@ -0,0 +1,134 @@ +#include <vcpkg-test/catch.h> + +#include <vcpkg/base/util.h> +#include <vcpkg/packagespec.h> + +using namespace vcpkg; + +TEST_CASE ("specifier conversion", "[specifier]") +{ + SECTION ("full package spec to feature specs") + { + constexpr std::size_t SPEC_SIZE = 6; + + auto a_spec = PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + auto b_spec = PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + + auto fspecs = FullPackageSpec::to_feature_specs({{a_spec, {"0", "1"}}, {b_spec, {"2", "3"}}}); + + REQUIRE(fspecs.size() == SPEC_SIZE); + + std::array<const char*, SPEC_SIZE> features = {"", "0", "1", "", "2", "3"}; + std::array<PackageSpec*, SPEC_SIZE> specs = {&a_spec, &a_spec, &a_spec, &b_spec, &b_spec, &b_spec}; + + for (std::size_t i = 0; i < SPEC_SIZE; ++i) + { + REQUIRE(features.at(i) == fspecs.at(i).feature()); + REQUIRE(*specs.at(i) == fspecs.at(i).spec()); + } + } +} + +TEST_CASE ("specifier parsing", "[specifier]") +{ + SECTION ("parsed specifier from string") + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib"); + REQUIRE(maybe_spec.error() == vcpkg::PackageSpecParseResult::SUCCESS); + + auto& spec = *maybe_spec.get(); + REQUIRE(spec.name == "zlib"); + REQUIRE(spec.features.size() == 0); + REQUIRE(spec.triplet == ""); + } + + SECTION ("parsed specifier from string with triplet") + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib:x64-uwp"); + REQUIRE(maybe_spec.error() == vcpkg::PackageSpecParseResult::SUCCESS); + + auto& spec = *maybe_spec.get(); + REQUIRE(spec.name == "zlib"); + REQUIRE(spec.triplet == "x64-uwp"); + } + + SECTION ("parsed specifier from string with colons") + { + auto ec = vcpkg::ParsedSpecifier::from_string("zlib:x86-uwp:").error(); + REQUIRE(ec == vcpkg::PackageSpecParseResult::TOO_MANY_COLONS); + } + + SECTION ("parsed specifier from string with feature") + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[feature]:x64-uwp"); + REQUIRE(maybe_spec.error() == vcpkg::PackageSpecParseResult::SUCCESS); + + auto& spec = *maybe_spec.get(); + REQUIRE(spec.name == "zlib"); + REQUIRE(spec.features.size() == 1); + REQUIRE(spec.features.at(0) == "feature"); + REQUIRE(spec.triplet == "x64-uwp"); + } + + SECTION ("parsed specifier from string with many features") + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[0, 1,2]"); + REQUIRE(maybe_spec.error() == vcpkg::PackageSpecParseResult::SUCCESS); + + auto& spec = *maybe_spec.get(); + REQUIRE(spec.name == "zlib"); + REQUIRE(spec.features.size() == 3); + REQUIRE(spec.features.at(0) == "0"); + REQUIRE(spec.features.at(1) == "1"); + REQUIRE(spec.features.at(2) == "2"); + REQUIRE(spec.triplet == ""); + } + + SECTION ("parsed specifier wildcard feature") + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[*]"); + REQUIRE(maybe_spec.error() == vcpkg::PackageSpecParseResult::SUCCESS); + + auto& spec = *maybe_spec.get(); + REQUIRE(spec.name == "zlib"); + REQUIRE(spec.features.size() == 1); + REQUIRE(spec.features.at(0) == "*"); + REQUIRE(spec.triplet == ""); + } + + SECTION ("expand wildcards") + { + auto zlib = vcpkg::FullPackageSpec::from_string("zlib[0,1]", Triplet::X86_UWP).value_or_exit(VCPKG_LINE_INFO); + auto openssl = + vcpkg::FullPackageSpec::from_string("openssl[*]", Triplet::X86_UWP).value_or_exit(VCPKG_LINE_INFO); + auto specs = FullPackageSpec::to_feature_specs({zlib, openssl}); + Util::sort(specs); + auto spectargets = FeatureSpec::from_strings_and_triplet( + { + "openssl", + "zlib", + "openssl[*]", + "zlib[0]", + "zlib[1]", + }, + Triplet::X86_UWP); + Util::sort(spectargets); + + REQUIRE(specs.size() == spectargets.size()); + REQUIRE(Util::all_equal(specs, spectargets)); + } + +#if defined(_WIN32) + SECTION ("ASCII to utf16") + { + auto str = vcpkg::Strings::to_utf16("abc"); + REQUIRE(str == L"abc"); + } + + SECTION ("ASCII to utf16 with whitespace") + { + auto str = vcpkg::Strings::to_utf16("abc -x86-windows"); + REQUIRE(str == L"abc -x86-windows"); + } +#endif +}; diff --git a/toolsrc/src/vcpkg-test/statusparagraphs.cpp b/toolsrc/src/vcpkg-test/statusparagraphs.cpp new file mode 100644 index 000000000..c0833e8ba --- /dev/null +++ b/toolsrc/src/vcpkg-test/statusparagraphs.cpp @@ -0,0 +1,110 @@ +#include <vcpkg-test/catch.h> +#include <vcpkg-test/util.h> + +#include <vcpkg/base/util.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/statusparagraphs.h> + +using namespace vcpkg; +using namespace vcpkg::Paragraphs; +using namespace vcpkg::Test; + +TEST_CASE ("find installed", "[statusparagraphs]") +{ + auto pghs = parse_paragraphs(R"( +Package: ffmpeg +Version: 3.3.3 +Architecture: x64-windows +Multi-Arch: same +Description: +Status: install ok installed +)"); + + REQUIRE(pghs); + + StatusParagraphs status_db( + Util::fmap(*pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); + + auto it = status_db.find_installed(unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS)); + REQUIRE(it != status_db.end()); +} + +TEST_CASE ("find not installed", "[statusparagraphs]") +{ + auto pghs = parse_paragraphs(R"( +Package: ffmpeg +Version: 3.3.3 +Architecture: x64-windows +Multi-Arch: same +Description: +Status: purge ok not-installed +)"); + + REQUIRE(pghs); + + StatusParagraphs status_db( + Util::fmap(*pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); + + auto it = status_db.find_installed(unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS)); + REQUIRE(it == status_db.end()); +} + +TEST_CASE ("find with feature packages", "[statusparagraphs]") +{ + auto pghs = parse_paragraphs(R"( +Package: ffmpeg +Version: 3.3.3 +Architecture: x64-windows +Multi-Arch: same +Description: +Status: install ok installed + +Package: ffmpeg +Feature: openssl +Depends: openssl +Architecture: x64-windows +Multi-Arch: same +Description: +Status: purge ok not-installed +)"); + + REQUIRE(pghs); + + StatusParagraphs status_db( + Util::fmap(*pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); + + auto it = status_db.find_installed(unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS)); + REQUIRE(it != status_db.end()); + + // Feature "openssl" is not installed and should not be found + auto it1 = status_db.find_installed({unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS), "openssl"}); + REQUIRE(it1 == status_db.end()); +} + +TEST_CASE ("find for feature packages", "[statusparagraphs]") +{ + auto pghs = parse_paragraphs(R"( +Package: ffmpeg +Version: 3.3.3 +Architecture: x64-windows +Multi-Arch: same +Description: +Status: install ok installed + +Package: ffmpeg +Feature: openssl +Depends: openssl +Architecture: x64-windows +Multi-Arch: same +Description: +Status: install ok installed +)"); + REQUIRE(pghs); + + StatusParagraphs status_db( + Util::fmap(*pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); + + // Feature "openssl" is installed and should therefore be found + auto it = status_db.find_installed({unsafe_pspec("ffmpeg", Triplet::X64_WINDOWS), "openssl"}); + REQUIRE(it != status_db.end()); +} diff --git a/toolsrc/src/vcpkg-test/strings.cpp b/toolsrc/src/vcpkg-test/strings.cpp new file mode 100644 index 000000000..6b744eee6 --- /dev/null +++ b/toolsrc/src/vcpkg-test/strings.cpp @@ -0,0 +1,33 @@ +#include <vcpkg-test/catch.h> + +#include <vcpkg/base/strings.h> + +#include <cstdint> +#include <utility> +#include <vector> + +TEST_CASE ("b32 encoding", "[strings]") +{ + using u64 = std::uint64_t; + + std::vector<std::pair<std::uint64_t, std::string>> map; + + map.emplace_back(0, "AAAAAAAAAAAAA"); + map.emplace_back(1, "BAAAAAAAAAAAA"); + + map.emplace_back(u64(1) << 32, "AAAAAAEAAAAAA"); + map.emplace_back((u64(1) << 32) + 1, "BAAAAAEAAAAAA"); + + map.emplace_back(0xE4D0'1065'D11E'0229, "JRA4RIXMQAUJO"); + map.emplace_back(0xA626'FE45'B135'07FF, "77BKTYWI6XJMK"); + map.emplace_back(0xEE36'D228'0C31'D405, "FAVDDGAFSWN4O"); + map.emplace_back(0x1405'64E7'FE7E'A88C, "MEK5H774ELBIB"); + map.emplace_back(0xFFFF'FFFF'FFFF'FFFF, "777777777777P"); + + std::string result; + for (const auto& pr : map) + { + result = vcpkg::Strings::b32_encode(pr.first); + REQUIRE(vcpkg::Strings::b32_encode(pr.first) == pr.second); + } +} diff --git a/toolsrc/src/vcpkg-test/supports.cpp b/toolsrc/src/vcpkg-test/supports.cpp new file mode 100644 index 000000000..8bd386da0 --- /dev/null +++ b/toolsrc/src/vcpkg-test/supports.cpp @@ -0,0 +1,79 @@ +#include <vcpkg-test/catch.h> + +#include <vcpkg/sourceparagraph.h> + +using namespace vcpkg; +using Parse::parse_comma_list; + +TEST_CASE ("parse supports all", "[supports]") +{ + auto v = Supports::parse({ + "x64", + "x86", + "arm", + "windows", + "uwp", + "v140", + "v141", + "crt-static", + "crt-dynamic", + }); + + REQUIRE(v.has_value()); + + REQUIRE(v.get()->is_supported(System::CPUArchitecture::X64, + Supports::Platform::UWP, + Supports::Linkage::DYNAMIC, + Supports::ToolsetVersion::V140)); + REQUIRE(v.get()->is_supported(System::CPUArchitecture::ARM, + Supports::Platform::WINDOWS, + Supports::Linkage::STATIC, + Supports::ToolsetVersion::V141)); +} + +TEST_CASE ("parse supports invalid", "[supports]") +{ + auto v = Supports::parse({"arm64"}); + + REQUIRE_FALSE(v.has_value()); + + REQUIRE(v.error().size() == 1); + REQUIRE(v.error().at(0) == "arm64"); +} + +TEST_CASE ("parse supports case sensitive", "[supports]") +{ + auto v = Supports::parse({"Windows"}); + + REQUIRE_FALSE(v.has_value()); + REQUIRE(v.error().size() == 1); + REQUIRE(v.error().at(0) == "Windows"); +} + +TEST_CASE ("parse supports some", "[supports]") +{ + auto v = Supports::parse({ + "x64", + "x86", + "windows", + }); + + REQUIRE(v.has_value()); + + REQUIRE(v.get()->is_supported(System::CPUArchitecture::X64, + Supports::Platform::WINDOWS, + Supports::Linkage::DYNAMIC, + Supports::ToolsetVersion::V140)); + REQUIRE_FALSE(v.get()->is_supported(System::CPUArchitecture::ARM, + Supports::Platform::WINDOWS, + Supports::Linkage::DYNAMIC, + Supports::ToolsetVersion::V140)); + REQUIRE_FALSE(v.get()->is_supported(System::CPUArchitecture::X64, + Supports::Platform::UWP, + Supports::Linkage::DYNAMIC, + Supports::ToolsetVersion::V140)); + REQUIRE(v.get()->is_supported(System::CPUArchitecture::X64, + Supports::Platform::WINDOWS, + Supports::Linkage::STATIC, + Supports::ToolsetVersion::V141)); +} diff --git a/toolsrc/src/vcpkg-test/update.cpp b/toolsrc/src/vcpkg-test/update.cpp new file mode 100644 index 000000000..70b2f04c1 --- /dev/null +++ b/toolsrc/src/vcpkg-test/update.cpp @@ -0,0 +1,102 @@ +#include <vcpkg-test/catch.h> +#include <vcpkg-test/util.h> + +#include <vcpkg/base/sortedvector.h> + +#include <vcpkg/update.h> + +using namespace vcpkg; +using namespace vcpkg::Update; +using namespace vcpkg::Test; + +using Pgh = std::vector<std::unordered_map<std::string, std::string>>; + +TEST_CASE ("find outdated packages basic", "[update]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.back()->package.version = "2"; + + StatusParagraphs status_db(std::move(status_paragraphs)); + + std::unordered_map<std::string, SourceControlFileLocation> map; + auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}})); + map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + Dependencies::MapPortFileProvider provider(map); + + auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), + &OutdatedPackage::compare_by_name); + + REQUIRE(pkgs.size() == 1); + REQUIRE(pkgs[0].version_diff.left.to_string() == "2"); + REQUIRE(pkgs[0].version_diff.right.to_string() == "0"); +} + +TEST_CASE ("find outdated packages features", "[update]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.back()->package.version = "2"; + + status_paragraphs.push_back(make_status_feature_pgh("a", "b")); + status_paragraphs.back()->package.version = "2"; + + StatusParagraphs status_db(std::move(status_paragraphs)); + + std::unordered_map<std::string, SourceControlFileLocation> map; + auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}})); + map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + Dependencies::MapPortFileProvider provider(map); + + auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), + &OutdatedPackage::compare_by_name); + + REQUIRE(pkgs.size() == 1); + REQUIRE(pkgs[0].version_diff.left.to_string() == "2"); + REQUIRE(pkgs[0].version_diff.right.to_string() == "0"); +} + +TEST_CASE ("find outdated packages features 2", "[update]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.back()->package.version = "2"; + + status_paragraphs.push_back(make_status_feature_pgh("a", "b")); + status_paragraphs.back()->package.version = "0"; + status_paragraphs.back()->state = InstallState::NOT_INSTALLED; + status_paragraphs.back()->want = Want::PURGE; + + StatusParagraphs status_db(std::move(status_paragraphs)); + + std::unordered_map<std::string, SourceControlFileLocation> map; + auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}})); + map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + Dependencies::MapPortFileProvider provider(map); + + auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), + &OutdatedPackage::compare_by_name); + + REQUIRE(pkgs.size() == 1); + REQUIRE(pkgs[0].version_diff.left.to_string() == "2"); + REQUIRE(pkgs[0].version_diff.right.to_string() == "0"); +} + +TEST_CASE ("find outdated packages none", "[update]") +{ + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.back()->package.version = "2"; + + StatusParagraphs status_db(std::move(status_paragraphs)); + + std::unordered_map<std::string, SourceControlFileLocation> map; + auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "2"}}})); + map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + Dependencies::MapPortFileProvider provider(map); + + auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db), + &OutdatedPackage::compare_by_name); + + REQUIRE(pkgs.size() == 0); +} diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp new file mode 100644 index 000000000..a2343c21b --- /dev/null +++ b/toolsrc/src/vcpkg-test/util.cpp @@ -0,0 +1,182 @@ +#include <vcpkg-test/catch.h> +#include <vcpkg-test/util.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/files.h> +#include <vcpkg/statusparagraph.h> + +// used to get the implementation specific compiler flags (i.e., __cpp_lib_filesystem) +#include <ciso646> + +#include <iostream> +#include <memory> + +#if defined(_WIN32) +#include <windows.h> +#endif + +#define FILESYSTEM_SYMLINK_STD 0 +#define FILESYSTEM_SYMLINK_UNIX 1 +#define FILESYSTEM_SYMLINK_NONE 2 + +#if defined(__cpp_lib_filesystem) + +#define FILESYSTEM_SYMLINK FILESYSTEM_SYMLINK_STD +#include <filesystem> // required for filesystem::create_{directory_}symlink + +#elif !defined(_MSC_VER) + +#define FILESYSTEM_SYMLINK FILESYSTEM_SYMLINK_UNIX +#include <unistd.h> + +#else + +#define FILESYSTEM_SYMLINK FILESYSTEM_SYMLINK_NONE + +#endif + +namespace vcpkg::Test +{ + std::unique_ptr<vcpkg::StatusParagraph> make_status_pgh(const char* name, + const char* depends, + const char* default_features, + const char* triplet) + { + using Pgh = std::unordered_map<std::string, std::string>; + return std::make_unique<StatusParagraph>(Pgh{{"Package", name}, + {"Version", "1"}, + {"Architecture", triplet}, + {"Multi-Arch", "same"}, + {"Depends", depends}, + {"Default-Features", default_features}, + {"Status", "install ok installed"}}); + } + + std::unique_ptr<StatusParagraph> make_status_feature_pgh(const char* name, + const char* feature, + const char* depends, + const char* triplet) + { + using Pgh = std::unordered_map<std::string, std::string>; + return std::make_unique<StatusParagraph>(Pgh{{"Package", name}, + {"Version", "1"}, + {"Feature", feature}, + {"Architecture", triplet}, + {"Multi-Arch", "same"}, + {"Depends", depends}, + {"Status", "install ok installed"}}); + } + + PackageSpec unsafe_pspec(std::string name, Triplet t) + { + auto m_ret = PackageSpec::from_name_and_triplet(name, t); + REQUIRE(m_ret.has_value()); + return m_ret.value_or_exit(VCPKG_LINE_INFO); + } + + static AllowSymlinks internal_can_create_symlinks() noexcept + { +#if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_NONE + return AllowSymlinks::No; +#elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX + return AllowSymlinks::Yes; +#elif !defined(_WIN32) // FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD + return AllowSymlinks::Yes; +#else + HKEY key; + bool allow_symlinks = true; + + const auto status = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)", 0, 0, &key); + + if (status == ERROR_FILE_NOT_FOUND) + { + allow_symlinks = false; + std::clog << "Symlinks are not allowed on this system\n"; + } + + if (status == ERROR_SUCCESS) RegCloseKey(key); + + return allow_symlinks ? AllowSymlinks::Yes : AllowSymlinks::No; +#endif + } + const static AllowSymlinks CAN_CREATE_SYMLINKS = internal_can_create_symlinks(); + + AllowSymlinks can_create_symlinks() noexcept { return CAN_CREATE_SYMLINKS; } + + static fs::path internal_base_temporary_directory() + { +#if defined(_WIN32) + wchar_t* tmp = static_cast<wchar_t*>(std::calloc(32'767, 2)); + + if (!GetEnvironmentVariableW(L"TEMP", tmp, 32'767)) + { + std::cerr << "No temporary directory found.\n"; + std::abort(); + } + + fs::path result = tmp; + std::free(tmp); + + return result / L"vcpkg-test"; +#else + return "/tmp/vcpkg-test"; +#endif + } + + const static fs::path BASE_TEMPORARY_DIRECTORY = internal_base_temporary_directory(); + + const fs::path& base_temporary_directory() noexcept { return BASE_TEMPORARY_DIRECTORY; } + +#if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_NONE + constexpr char no_filesystem_message[] = + "<filesystem> doesn't exist; on windows, we don't attempt to use the win32 calls to create symlinks"; +#endif + + void create_symlink(const fs::path& target, const fs::path& file, std::error_code& ec) + { +#if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD + if (can_create_symlinks()) + { + std::filesystem::path targetp = target.native(); + std::filesystem::path filep = file.native(); + + std::filesystem::create_symlink(targetp, filep, ec); + } + else + { + vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, "Symlinks are not allowed on this system"); + } +#elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX + if (symlink(target.c_str(), file.c_str()) != 0) + { + ec.assign(errno, std::system_category()); + } +#else + static_cast<void>(ec); + vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message); +#endif + } + + void create_directory_symlink(const fs::path& target, const fs::path& file, std::error_code& ec) + { +#if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD + if (can_create_symlinks()) + { + std::filesystem::path targetp = target.native(); + std::filesystem::path filep = file.native(); + + std::filesystem::create_directory_symlink(targetp, filep, ec); + } + else + { + vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, "Symlinks are not allowed on this system"); + } +#elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX + ::vcpkg::Test::create_symlink(target, file, ec); +#else + static_cast<void>(ec); + vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message); +#endif + } +} diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 363b39814..3fdbd0d3e 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -125,12 +125,8 @@ static void inner(const VcpkgCmdArguments& args) auto default_vs_path = System::get_environment_variable("VCPKG_VISUAL_STUDIO_PATH").value_or(""); - - - const Expected<VcpkgPaths> expected_paths = VcpkgPaths::create(vcpkg_root_dir, - vcpkg_scripts_root_dir, - default_vs_path, - args.overlay_triplets.get()); + const Expected<VcpkgPaths> expected_paths = + VcpkgPaths::create(vcpkg_root_dir, vcpkg_scripts_root_dir, default_vs_path, args.overlay_triplets.get()); Checks::check_exit(VCPKG_LINE_INFO, !expected_paths.error(), "Error: Invalid vcpkg root directory %s: %s", @@ -143,7 +139,11 @@ static void inner(const VcpkgCmdArguments& args) #else const int exit_code = chdir(paths.root.c_str()); #endif - Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Changing the working dir failed"); + Checks::check_exit( + VCPKG_LINE_INFO, + exit_code == 0, + "Changing the working directory to the vcpkg root directory failed. Did you incorrectly define the VCPKG_ROOT " + "environment variable, or did you mistakenly create a file named .vcpkg-root somewhere?"); if (args.command == "install" || args.command == "remove" || args.command == "export" || args.command == "update") { diff --git a/toolsrc/src/vcpkg/archives.cpp b/toolsrc/src/vcpkg/archives.cpp index 69a916828..d22e841de 100644 --- a/toolsrc/src/vcpkg/archives.cpp +++ b/toolsrc/src/vcpkg/archives.cpp @@ -15,9 +15,10 @@ namespace vcpkg::Archives #endif ; + fs.remove_all(to_path, VCPKG_LINE_INFO); + fs.remove_all(to_path_partial, VCPKG_LINE_INFO); + // TODO: check this error code std::error_code ec; - fs.remove_all(to_path, ec); - fs.remove_all(to_path_partial, ec); fs.create_directories(to_path_partial, ec); const auto ext = archive.extension(); #if defined(_WIN32) diff --git a/toolsrc/src/vcpkg/base/checks.cpp b/toolsrc/src/vcpkg/base/checks.cpp index 0266ad683..c7584258a 100644 --- a/toolsrc/src/vcpkg/base/checks.cpp +++ b/toolsrc/src/vcpkg/base/checks.cpp @@ -27,9 +27,8 @@ namespace vcpkg #if defined(_WIN32) ::TerminateProcess(::GetCurrentProcess(), exit_code); -#else - std::exit(exit_code); #endif + std::exit(exit_code); } void Checks::unreachable(const LineInfo& line_info) diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 5099795e9..bbf37fd25 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -6,6 +6,7 @@ #include <vcpkg/base/system.print.h> #include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> +#include <vcpkg/base/work_queue.h> #if defined(__linux__) || defined(__APPLE__) #include <fcntl.h> @@ -24,6 +25,123 @@ namespace vcpkg::Files { static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); + namespace + { + fs::file_status status_implementation(bool follow_symlinks, const fs::path& p, std::error_code& ec) noexcept + { + using fs::file_type; + using fs::perms; +#if defined(_WIN32) + WIN32_FILE_ATTRIBUTE_DATA file_attributes; + auto ft = file_type::unknown; + auto permissions = perms::unknown; + if (!GetFileAttributesExW(p.c_str(), GetFileExInfoStandard, &file_attributes)) + { + const auto err = GetLastError(); + if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) + { + ft = file_type::not_found; + } + else + { + ec.assign(err, std::system_category()); + } + } + else if (!follow_symlinks && file_attributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + { + // this also gives junctions file_type::directory_symlink + if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + ft = file_type::directory_symlink; + } + else + { + ft = file_type::symlink; + } + } + else if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + ft = file_type::directory; + } + else + { + // otherwise, the file is a regular file + ft = file_type::regular; + } + + if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_READONLY) + { + constexpr auto all_write = perms::group_write | perms::owner_write | perms::others_write; + permissions = perms::all & ~all_write; + } + else if (ft != file_type::none && ft != file_type::none) + { + permissions = perms::all; + } + + return fs::file_status(ft, permissions); + +#else + auto result = follow_symlinks ? fs::stdfs::status(p, ec) : fs::stdfs::symlink_status(p, ec); + // libstdc++ doesn't correctly not-set ec on nonexistent paths + if (ec.value() == ENOENT || ec.value() == ENOTDIR) + { + ec.clear(); + return fs::file_status(file_type::not_found, perms::unknown); + } + return fs::file_status(result.type(), result.permissions()); +#endif + } + + fs::file_status status(const fs::path& p, std::error_code& ec) noexcept + { + return status_implementation(true, p, ec); + } + fs::file_status symlink_status(const fs::path& p, std::error_code& ec) noexcept + { + return status_implementation(false, p, ec); + } + + // does _not_ follow symlinks + void set_writeable(const fs::path& path, std::error_code& ec) noexcept + { +#if defined(_WIN32) + auto const file_name = path.c_str(); + WIN32_FILE_ATTRIBUTE_DATA attributes; + if (!GetFileAttributesExW(file_name, GetFileExInfoStandard, &attributes)) + { + ec.assign(GetLastError(), std::system_category()); + return; + } + + auto dw_attributes = attributes.dwFileAttributes; + dw_attributes &= ~FILE_ATTRIBUTE_READONLY; + if (!SetFileAttributesW(file_name, dw_attributes)) + { + ec.assign(GetLastError(), std::system_category()); + } +#else + struct stat s; + if (lstat(path.c_str(), &s)) + { + ec.assign(errno, std::system_category()); + return; + } + + auto mode = s.st_mode; + // if the file is a symlink, perms don't matter + if (!(mode & S_IFLNK)) + { + mode |= S_IWUSR; + if (chmod(path.c_str(), mode)) + { + ec.assign(errno, std::system_category()); + } + } +#endif + } + } + std::string Filesystem::read_contents(const fs::path& path, LineInfo linfo) const { auto maybe_contents = this->read_contents(path); @@ -56,6 +174,43 @@ namespace vcpkg::Files return r; } + bool Filesystem::exists(const fs::path& path, std::error_code& ec) const + { + return fs::exists(this->symlink_status(path, ec)); + } + + bool Filesystem::exists(LineInfo li, const fs::path& path) const + { + std::error_code ec; + auto result = this->exists(path, ec); + if (ec) Checks::exit_with_message(li, "error checking existence of file %s: %s", path.u8string(), ec.message()); + return result; + } + bool Filesystem::exists(const fs::path& path) const + { + std::error_code ec; + // drop this on the floor, for compatibility with existing code + return exists(path, ec); + } + + fs::file_status Filesystem::status(vcpkg::LineInfo li, const fs::path& p) const noexcept + { + std::error_code ec; + auto result = this->status(p, ec); + if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); + + return result; + } + + fs::file_status Filesystem::symlink_status(vcpkg::LineInfo li, const fs::path& p) const noexcept + { + std::error_code ec; + auto result = this->symlink_status(p, ec); + if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); + + return result; + } + void Filesystem::write_lines(const fs::path& path, const std::vector<std::string>& lines, LineInfo linfo) { std::error_code ec; @@ -63,6 +218,33 @@ namespace vcpkg::Files if (ec) Checks::exit_with_message(linfo, "error writing lines: %s: %s", path.u8string(), ec.message()); } + void Filesystem::remove_all(const fs::path& path, LineInfo li) + { + std::error_code ec; + fs::path failure_point; + + this->remove_all(path, ec, failure_point); + + if (ec) + { + Checks::exit_with_message(li, + "Failure to remove_all(%s) due to file %s: %s", + path.string(), + failure_point.string(), + ec.message()); + } + } + + fs::path Filesystem::canonical(LineInfo li, const fs::path& path) const + { + std::error_code ec; + + const auto result = this->canonical(path, ec); + + if (ec) Checks::exit_with_message(li, "Error getting canonicalization of %s: %s", path.string(), ec.message()); + return result; + } + struct RealFilesystem final : Filesystem { virtual Expected<std::string> read_contents(const fs::path& file_path) const override @@ -87,7 +269,7 @@ namespace vcpkg::Files file_stream.read(&output[0], length); file_stream.close(); - return std::move(output); + return output; } virtual Expected<std::vector<std::string>> read_lines(const fs::path& file_path) const override { @@ -101,17 +283,20 @@ namespace vcpkg::Files std::string line; while (std::getline(file_stream, line)) { + // Remove the trailing \r to accomodate Windows line endings. + if ((!line.empty()) && (line.back() == '\r')) line.pop_back(); + output.push_back(line); } file_stream.close(); - return std::move(output); + return output; } virtual fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename) const override { fs::path current_dir = starting_dir; - if (exists(current_dir / filename)) + if (exists(VCPKG_LINE_INFO, current_dir / filename)) { return current_dir; } @@ -136,7 +321,7 @@ namespace vcpkg::Files current_dir = std::move(parent); const fs::path candidate = current_dir / filename; - if (exists(candidate)) + if (exists(VCPKG_LINE_INFO, candidate)) { return current_dir; } @@ -254,30 +439,132 @@ namespace vcpkg::Files #endif } virtual bool remove(const fs::path& path, std::error_code& ec) override { return fs::stdfs::remove(path, ec); } - virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec) override + virtual void remove_all(const fs::path& path, std::error_code& ec, fs::path& failure_point) override { - // Working around the currently buggy remove_all() - std::uintmax_t out = fs::stdfs::remove_all(path, ec); + /* + does not use the std::experimental::filesystem call since this is + quite a bit faster, and also supports symlinks + */ - for (int i = 0; i < 5 && this->exists(path); i++) + struct remove { - using namespace std::chrono_literals; - std::this_thread::sleep_for(i * 100ms); - out += fs::stdfs::remove_all(path, ec); - } + struct ErrorInfo : Util::ResourceBase + { + std::error_code ec; + fs::path failure_point; + }; + /* + if `current_path` is a directory, first `remove`s all + elements of the directory, then removes current_path. + + else if `current_path` exists, removes current_path + + else does nothing + */ + static void do_remove(const fs::path& current_path, ErrorInfo& err) + { + std::error_code ec; + const auto path_status = Files::symlink_status(current_path, ec); + if (check_ec(ec, current_path, err)) return; + if (!fs::exists(path_status)) return; + + const auto path_type = path_status.type(); - if (this->exists(path)) + if ((path_status.permissions() & fs::perms::owner_write) != fs::perms::owner_write) + { + set_writeable(current_path, ec); + if (check_ec(ec, current_path, err)) return; + } + + if (path_type == fs::file_type::directory) + { + for (const auto& entry : fs::stdfs::directory_iterator(current_path)) + { + do_remove(entry, err); + if (err.ec) return; + } +#if defined(_WIN32) + if (!RemoveDirectoryW(current_path.c_str())) + { + ec.assign(GetLastError(), std::system_category()); + } +#else + if (rmdir(current_path.c_str())) + { + ec.assign(errno, std::system_category()); + } +#endif + } +#if defined(_WIN32) + else if (path_type == fs::file_type::directory_symlink) + { + if (!RemoveDirectoryW(current_path.c_str())) + { + ec.assign(GetLastError(), std::system_category()); + } + } + else + { + if (!DeleteFileW(current_path.c_str())) + { + ec.assign(GetLastError(), std::system_category()); + } + } +#else + else + { + if (unlink(current_path.c_str())) + { + ec.assign(errno, std::system_category()); + } + } +#endif + + check_ec(ec, current_path, err); + } + + static bool check_ec(const std::error_code& ec, const fs::path& current_path, ErrorInfo& err) + { + if (ec) + { + err.ec = ec; + err.failure_point = current_path; + + return true; + } + else + { + return false; + } + } + }; + + /* + we need to do backoff on the removal of the top level directory, + so we can only delete the directory after all the + lower levels have been deleted. + */ + + remove::ErrorInfo err; + for (int backoff = 0; backoff < 5; ++backoff) { - System::print2( - System::Color::warning, - "Some files in ", - path.u8string(), - " were unable to be removed. Close any editors operating in this directory and retry.\n"); + if (backoff) + { + using namespace std::chrono_literals; + auto backoff_time = 100ms * backoff; + std::this_thread::sleep_for(backoff_time); + } + + remove::do_remove(path, err); + if (!err.ec) + { + break; + } } - return out; + ec = std::move(err.ec); + failure_point = std::move(err.failure_point); } - virtual bool exists(const fs::path& path) const override { return fs::stdfs::exists(path); } virtual bool is_directory(const fs::path& path) const override { return fs::stdfs::is_directory(path); } virtual bool is_regular_file(const fs::path& path) const override { return fs::stdfs::is_regular_file(path); } virtual bool is_empty(const fs::path& path) const override { return fs::stdfs::is_empty(path); } @@ -307,11 +594,11 @@ namespace vcpkg::Files virtual fs::file_status status(const fs::path& path, std::error_code& ec) const override { - return fs::stdfs::status(path, ec); + return Files::status(path, ec); } virtual fs::file_status symlink_status(const fs::path& path, std::error_code& ec) const override { - return fs::stdfs::symlink_status(path, ec); + return Files::symlink_status(path, ec); } virtual void write_contents(const fs::path& file_path, const std::string& data, std::error_code& ec) override { @@ -342,6 +629,11 @@ namespace vcpkg::Files } } + virtual fs::path canonical(const fs::path& path, std::error_code& ec) const override + { + return fs::stdfs::canonical(path, ec); + } + virtual std::vector<fs::path> find_from_PATH(const std::string& name) const override { #if defined(_WIN32) @@ -355,7 +647,7 @@ namespace vcpkg::Files for (auto&& ext : EXTS) { auto p = fs::u8path(base + ext.c_str()); - if (Util::find(ret, p) == ret.end() && this->exists(p)) + if (Util::find(ret, p) == ret.end() && this->exists(VCPKG_LINE_INFO, p)) { ret.push_back(p); Debug::print("Found path: ", p.u8string(), '\n'); diff --git a/toolsrc/src/vcpkg/base/strings.cpp b/toolsrc/src/vcpkg/base/strings.cpp index 54a74a7a1..46e78a363 100644 --- a/toolsrc/src/vcpkg/base/strings.cpp +++ b/toolsrc/src/vcpkg/base/strings.cpp @@ -288,3 +288,43 @@ bool Strings::contains(StringView haystack, StringView needle) { return Strings::search(haystack, needle) != haystack.end(); } + +namespace vcpkg::Strings +{ + namespace + { + template<class Integral> + std::string b32_encode_implementation(Integral x) + { + static_assert(std::is_integral<Integral>::value, "b64url_encode must take an integer type"); + using Unsigned = std::make_unsigned_t<Integral>; + auto value = static_cast<Unsigned>(x); + + // 32 values, plus the implicit \0 + constexpr static char map[33] = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZ234567"; + + // log2(32) + constexpr static int shift = 5; + // 32 - 1 + constexpr static auto mask = 31; + + // ceiling(bitsize(Integral) / log2(32)) + constexpr static auto result_size = (sizeof(value) * 8 + shift - 1) / shift; + + std::string result; + result.reserve(result_size); + + for (std::size_t i = 0; i < result_size; ++i) + { + result.push_back(map[value & mask]); + value >>= shift; + } + + return result; + } + } + + std::string b32_encode(std::uint64_t x) noexcept { return b32_encode_implementation(x); } + +} diff --git a/toolsrc/src/vcpkg/binaryparagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp index 4b80debab..8b1886098 100644 --- a/toolsrc/src/vcpkg/binaryparagraph.cpp +++ b/toolsrc/src/vcpkg/binaryparagraph.cpp @@ -27,7 +27,7 @@ namespace vcpkg BinaryParagraph::BinaryParagraph() = default; - BinaryParagraph::BinaryParagraph(std::unordered_map<std::string, std::string> fields) + BinaryParagraph::BinaryParagraph(Parse::RawParagraph fields) { using namespace vcpkg::Parse; diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 68df1f965..b809db0bc 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -32,24 +32,16 @@ namespace vcpkg::Build::Command using Dependencies::InstallPlanAction;
using Dependencies::InstallPlanType;
- static constexpr StringLiteral OPTION_CHECKS_ONLY = "--checks-only";
-
void perform_and_exit_ex(const FullPackageSpec& full_spec,
const SourceControlFileLocation& scfl,
const ParsedArguments& options,
const VcpkgPaths& paths)
{
+ vcpkg::Util::unused(options);
+
+ const StatusParagraphs status_db = database_load_check(paths);
const PackageSpec& spec = full_spec.package_spec;
- const auto& scf = *scfl.source_control_file;
- if (Util::Sets::contains(options.switches, OPTION_CHECKS_ONLY))
- {
- const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet());
- const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
- const size_t error_count =
- PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info, scfl.source_location);
- Checks::check_exit(VCPKG_LINE_INFO, error_count == 0);
- Checks::exit_success(VCPKG_LINE_INFO);
- }
+ const SourceControlFile& scf = *scfl.source_control_file;
Checks::check_exit(VCPKG_LINE_INFO,
spec.name() == scf.core_paragraph->name,
@@ -57,7 +49,6 @@ namespace vcpkg::Build::Command scf.core_paragraph->name,
spec.name());
- const StatusParagraphs status_db = database_load_check(paths);
const Build::BuildPackageOptions build_package_options{
Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
@@ -72,8 +63,7 @@ namespace vcpkg::Build::Command std::set<std::string> features_as_set(full_spec.features.begin(), full_spec.features.end());
features_as_set.emplace("core");
- const Build::BuildPackageConfig build_config{
- scf, spec.triplet(), fs::path(scfl.source_location), build_package_options, features_as_set};
+ const Build::BuildPackageConfig build_config{scfl, spec.triplet(), build_package_options, features_as_set};
const auto build_timer = Chrono::ElapsedTimer::create_started();
const auto result = Build::build_package(paths, build_config, status_db);
@@ -104,15 +94,11 @@ namespace vcpkg::Build::Command Checks::exit_success(VCPKG_LINE_INFO);
}
- static constexpr std::array<CommandSwitch, 1> BUILD_SWITCHES = {{
- {OPTION_CHECKS_ONLY, "Only run checks, do not rebuild package"},
- }};
-
const CommandStructure COMMAND_STRUCTURE = {
Help::create_example_string("build zlib:x64-windows"),
1,
1,
- {BUILD_SWITCHES, {}},
+ {{}, {}},
nullptr,
};
@@ -230,6 +216,23 @@ namespace vcpkg::Build }));
}
+ std::unordered_map<std::string, std::string> make_env_passthrough(const PreBuildInfo& pre_build_info)
+ {
+ std::unordered_map<std::string, std::string> env;
+
+ for (auto&& env_var : pre_build_info.passthrough_env_vars)
+ {
+ auto env_val = System::get_environment_variable(env_var);
+
+ if (env_val)
+ {
+ env[env_var] = env_val.value_or_exit(VCPKG_LINE_INFO);
+ }
+ }
+
+ return env;
+ }
+
std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset)
{
if (pre_build_info.external_toolchain_file.has_value()) return "";
@@ -274,7 +277,7 @@ namespace vcpkg::Build return bcf;
}
- static void write_binary_control_file(const VcpkgPaths& paths, BinaryControlFile bcf)
+ static void write_binary_control_file(const VcpkgPaths& paths, const BinaryControlFile& bcf)
{
std::string start = Strings::serialize(bcf.core_paragraph);
for (auto&& feature : bcf.features)
@@ -285,23 +288,37 @@ namespace vcpkg::Build paths.get_filesystem().write_contents(binary_control_file, start, VCPKG_LINE_INFO);
}
+ static std::vector<Features> get_dependencies(const SourceControlFile& scf,
+ const std::set<std::string>& feature_list,
+ const Triplet& triplet)
+ {
+ return Util::fmap_flatten(feature_list, [&](std::string const& feature) -> std::vector<Features> {
+ if (feature == "core")
+ {
+ return filter_dependencies_to_features(scf.core_paragraph->depends, triplet);
+ }
+
+ auto maybe_feature = scf.find_feature(feature);
+ Checks::check_exit(VCPKG_LINE_INFO, maybe_feature.has_value());
+
+ return filter_dependencies_to_features(maybe_feature.get()->depends, triplet);
+ });
+ }
+
+ static std::vector<std::string> get_dependency_names(const SourceControlFile& scf,
+ const std::set<std::string>& feature_list,
+ const Triplet& triplet)
+ {
+ return Util::fmap(get_dependencies(scf, feature_list, triplet),
+ [&](const Features& feat) { return feat.name; });
+ }
+
static std::vector<FeatureSpec> compute_required_feature_specs(const BuildPackageConfig& config,
const StatusParagraphs& status_db)
{
const Triplet& triplet = config.triplet;
- const std::vector<std::string> dep_strings =
- Util::fmap_flatten(config.feature_list, [&](std::string const& feature) -> std::vector<std::string> {
- if (feature == "core")
- {
- return filter_dependencies(config.scf.core_paragraph->depends, triplet);
- }
-
- auto maybe_feature = config.scf.find_feature(feature);
- Checks::check_exit(VCPKG_LINE_INFO, maybe_feature.has_value());
-
- return filter_dependencies(maybe_feature.get()->depends, triplet);
- });
+ const std::vector<std::string> dep_strings = get_dependency_names(config.scf, config.feature_list, triplet);
auto dep_fspecs = FeatureSpec::from_strings_and_triplet(dep_strings, triplet);
Util::sort_unique_erase(dep_fspecs);
@@ -353,40 +370,18 @@ namespace vcpkg::Build return concurrency;
}
- static ExtendedBuildResult do_build_package(const VcpkgPaths& paths,
- const PreBuildInfo& pre_build_info,
- const PackageSpec& spec,
- const std::string& abi_tag,
- const BuildPackageConfig& config)
+ static std::vector<System::CMakeVariable> get_cmake_vars(const VcpkgPaths& paths,
+ const BuildPackageConfig& config,
+ const Triplet& triplet,
+ const Toolset& toolset)
{
- auto& fs = paths.get_filesystem();
- const Triplet& triplet = spec.triplet();
- const auto& triplet_file_path = paths.get_triplet_file_path(spec.triplet()).u8string();
-
- if (!Strings::case_insensitive_ascii_starts_with(triplet_file_path, paths.triplets.u8string()))
- {
- System::printf("-- Loading triplet configuration from: %s\n", triplet_file_path);
- }
- if (!Strings::case_insensitive_ascii_starts_with(config.port_dir.u8string(), paths.ports.u8string()))
- {
- System::printf("-- Installing port from location: %s\n", config.port_dir.u8string());
- }
-
#if !defined(_WIN32)
// TODO: remove when vcpkg.exe is in charge for acquiring tools. Change introduced in vcpkg v0.0.107.
// bootstrap should have already downloaded ninja, but making sure it is present in case it was deleted.
vcpkg::Util::unused(paths.get_tool_exe(Tools::NINJA));
#endif
- const fs::path& cmake_exe_path = paths.get_tool_exe(Tools::CMAKE);
const fs::path& git_exe_path = paths.get_tool_exe(Tools::GIT);
-#if defined(_WIN32)
- const fs::path& powershell_exe_path = paths.get_tool_exe("powershell-core");
- if (!fs.exists(powershell_exe_path.parent_path() / "powershell.exe"))
- {
- fs.copy(powershell_exe_path, powershell_exe_path.parent_path() / "powershell.exe", fs::copy_options::none);
- }
-#endif
std::string all_features;
for (auto& feature : config.scf.feature_paragraphs)
@@ -394,14 +389,13 @@ namespace vcpkg::Build all_features.append(feature->name + ";");
}
- const Toolset& toolset = paths.get_toolset(pre_build_info);
-
std::vector<System::CMakeVariable> variables{
{"CMD", "BUILD"},
{"PORT", config.scf.core_paragraph->name},
{"CURRENT_PORT_DIR", config.port_dir},
- {"TARGET_TRIPLET", spec.triplet().canonical_name()},
- {"TARGET_TRIPLET_FILE", triplet_file_path},
+ {"TARGET_TRIPLET", triplet.canonical_name()},
+ {"TARGET_TRIPLET_FILE", paths.get_triplet_file_path(triplet).u8string()},
+ {"ENV_OVERRIDES_FILE", config.port_dir / "environment-overrides.cmake"},
{"VCPKG_PLATFORM_TOOLSET", toolset.version.c_str()},
{"VCPKG_USE_HEAD_VERSION", Util::Enum::to_bool(config.build_package_options.use_head_version) ? "1" : "0"},
{"DOWNLOADS", paths.downloads},
@@ -417,9 +411,21 @@ namespace vcpkg::Build variables.push_back({"GIT", git_exe_path});
}
+ return variables;
+ }
+
+ static std::string make_build_cmd(const VcpkgPaths& paths,
+ const PreBuildInfo& pre_build_info,
+ const BuildPackageConfig& config,
+ const Triplet& triplet)
+ {
+ const Toolset& toolset = paths.get_toolset(pre_build_info);
+ const fs::path& cmake_exe_path = paths.get_tool_exe(Tools::CMAKE);
+ std::vector<System::CMakeVariable> variables = get_cmake_vars(paths, config, triplet, toolset);
+
const std::string cmd_launch_cmake = System::make_cmake_cmd(cmake_exe_path, paths.ports_cmake, variables);
- auto command = make_build_env_cmd(pre_build_info, toolset);
+ std::string command = make_build_env_cmd(pre_build_info, toolset);
if (!command.empty())
{
#ifdef _WIN32
@@ -428,16 +434,102 @@ namespace vcpkg::Build command.append(" && ");
#endif
}
+
command.append(cmd_launch_cmake);
+
+ return command;
+ }
+
+ static std::string get_triplet_abi(const VcpkgPaths& paths,
+ const PreBuildInfo& pre_build_info,
+ const Triplet& triplet)
+ {
+ static std::map<fs::path, std::string> s_hash_cache;
+
+ const fs::path triplet_file_path = paths.get_triplet_file_path(triplet);
+ const auto& fs = paths.get_filesystem();
+
+ std::string hash;
+
+ auto it_hash = s_hash_cache.find(triplet_file_path);
+ if (it_hash != s_hash_cache.end())
+ {
+ hash = it_hash->second;
+ }
+ else
+ {
+ hash = Hash::get_file_hash(fs, triplet_file_path, "SHA1");
+
+ if (auto p = pre_build_info.external_toolchain_file.get())
+ {
+ hash += "-";
+ hash += Hash::get_file_hash(fs, *p, "SHA1");
+ }
+ else if (pre_build_info.cmake_system_name == "Linux")
+ {
+ hash += "-";
+ hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "linux.cmake", "SHA1");
+ }
+ else if (pre_build_info.cmake_system_name == "Darwin")
+ {
+ hash += "-";
+ hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "osx.cmake", "SHA1");
+ }
+ else if (pre_build_info.cmake_system_name == "FreeBSD")
+ {
+ hash += "-";
+ hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "freebsd.cmake", "SHA1");
+ }
+ else if (pre_build_info.cmake_system_name == "Android")
+ {
+ hash += "-";
+ hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "android.cmake", "SHA1");
+ }
+
+ s_hash_cache.emplace(triplet_file_path, hash);
+ }
+
+ return hash;
+ }
+
+ static ExtendedBuildResult do_build_package(const VcpkgPaths& paths,
+ const PreBuildInfo& pre_build_info,
+ const PackageSpec& spec,
+ const std::string& abi_tag,
+ const BuildPackageConfig& config)
+ {
+ auto& fs = paths.get_filesystem();
+#if defined(_WIN32)
+ const fs::path& powershell_exe_path = paths.get_tool_exe("powershell-core");
+ if (!fs.exists(powershell_exe_path.parent_path() / "powershell.exe"))
+ {
+ fs.copy(powershell_exe_path, powershell_exe_path.parent_path() / "powershell.exe", fs::copy_options::none);
+ }
+#endif
+
+ const Triplet& triplet = spec.triplet();
+ const auto& triplet_file_path = paths.get_triplet_file_path(spec.triplet()).u8string();
+
+ if (!Strings::case_insensitive_ascii_starts_with(triplet_file_path, paths.triplets.u8string()))
+ {
+ System::printf("-- Loading triplet configuration from: %s\n", triplet_file_path);
+ }
+ if (!Strings::case_insensitive_ascii_starts_with(config.port_dir.u8string(), paths.ports.u8string()))
+ {
+ System::printf("-- Installing port from location: %s\n", config.port_dir.u8string());
+ }
+
const auto timer = Chrono::ElapsedTimer::create_started();
- const int return_code = System::cmd_execute_clean(
- command,
- {}
-#ifdef _WIN32
- ,
- powershell_exe_path.parent_path().u8string() + ";"
+
+ std::string command = make_build_cmd(paths, pre_build_info, config, triplet);
+ std::unordered_map<std::string, std::string> env = make_env_passthrough(pre_build_info);
+
+#if defined(_WIN32)
+ const int return_code =
+ System::cmd_execute_clean(command, env, powershell_exe_path.parent_path().u8string() + ";");
+#else
+ const int return_code = System::cmd_execute_clean(command, env);
#endif
- );
const auto buildtimeus = timer.microseconds();
const auto spec_string = spec.to_string();
@@ -495,7 +587,8 @@ namespace vcpkg::Build if (fs.is_directory(file)) // Will only keep the logs
{
std::error_code ec;
- fs.remove_all(file, ec);
+ fs::path failure_point;
+ fs.remove_all(file, ec, failure_point);
}
}
}
@@ -516,6 +609,9 @@ namespace vcpkg::Build std::vector<AbiEntry> abi_tag_entries(dependency_abis.begin(), dependency_abis.end());
+#if defined(_WIN32)
+ abi_tag_entries.emplace_back(AbiEntry{"powershell", paths.get_tool_version("powershell-core")});
+#endif
abi_tag_entries.emplace_back(AbiEntry{"cmake", paths.get_tool_version(Tools::CMAKE)});
// If there is an unusually large number of files in the port then
@@ -527,7 +623,7 @@ namespace vcpkg::Build std::vector<fs::path> port_files;
for (auto& port_file : fs::stdfs::recursive_directory_iterator(config.port_dir))
{
- if (fs::is_regular_file(status(port_file)))
+ if (fs::is_regular_file(fs.status(VCPKG_LINE_INFO, port_file)))
{
port_files.push_back(port_file);
if (port_files.size() > max_port_file_count)
@@ -610,8 +706,8 @@ namespace vcpkg::Build auto& fs = paths.get_filesystem();
auto pkg_path = paths.package_dir(spec);
+ fs.remove_all(pkg_path, VCPKG_LINE_INFO);
std::error_code ec;
- fs.remove_all(pkg_path, ec);
fs.create_directories(pkg_path, ec);
auto files = fs.get_files_non_recursive(pkg_path);
Checks::check_exit(VCPKG_LINE_INFO, files.empty(), "unable to clear path: %s", pkg_path.u8string());
@@ -693,7 +789,7 @@ namespace vcpkg::Build AbiEntry{status_it->get()->package.spec.name(), status_it->get()->package.abi});
}
- const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet);
+ const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet, config.scfl);
auto maybe_abi_tag_and_file = compute_abi_tag(paths, config, pre_build_info, dependency_abis);
@@ -711,7 +807,7 @@ namespace vcpkg::Build {
System::print2("Using cached binary package: ", archive_path.u8string(), "\n");
- auto archive_result = decompress_archive(paths, spec, archive_path);
+ int archive_result = decompress_archive(paths, spec, archive_path);
if (archive_result != 0)
{
@@ -794,7 +890,7 @@ namespace vcpkg::Build fs.rename_or_copy(tmp_failure_zip, archive_tombstone_path, ".tmp", ec);
// clean up temporary directory
- fs.remove_all(tmp_log_path, ec);
+ fs.remove_all(tmp_log_path, VCPKG_LINE_INFO);
}
}
@@ -845,7 +941,7 @@ namespace vcpkg::Build Commands::Version::version());
}
- static BuildInfo inner_create_buildinfo(std::unordered_map<std::string, std::string> pgh)
+ static BuildInfo inner_create_buildinfo(Parse::RawParagraph pgh)
{
Parse::ParagraphParser parser(std::move(pgh));
@@ -902,13 +998,14 @@ namespace vcpkg::Build BuildInfo read_build_info(const Files::Filesystem& fs, const fs::path& filepath)
{
- const Expected<std::unordered_map<std::string, std::string>> pghs =
- Paragraphs::get_single_paragraph(fs, filepath);
+ const Expected<Parse::RawParagraph> pghs = Paragraphs::get_single_paragraph(fs, filepath);
Checks::check_exit(VCPKG_LINE_INFO, pghs.get() != nullptr, "Invalid BUILD_INFO file for package");
return inner_create_buildinfo(*pghs.get());
}
- PreBuildInfo PreBuildInfo::from_triplet_file(const VcpkgPaths& paths, const Triplet& triplet)
+ PreBuildInfo PreBuildInfo::from_triplet_file(const VcpkgPaths& paths,
+ const Triplet& triplet,
+ Optional<const SourceControlFileLocation&> port)
{
static constexpr CStringView FLAG_GUID = "c35112b6-d1ba-415b-aa5d-81de856ef8eb";
@@ -916,11 +1013,16 @@ namespace vcpkg::Build const fs::path ports_cmake_script_path = paths.scripts / "get_triplet_environment.cmake";
const fs::path triplet_file_path = paths.get_triplet_file_path(triplet);
- const auto cmd_launch_cmake = System::make_cmake_cmd(cmake_exe_path,
- ports_cmake_script_path,
- {
- {"CMAKE_TRIPLET_FILE", triplet_file_path},
- });
+ std::vector<System::CMakeVariable> args{{"CMAKE_TRIPLET_FILE", triplet_file_path}};
+
+ if (port)
+ {
+ args.emplace_back("CMAKE_ENV_OVERRIDES_FILE",
+ port.value_or_exit(VCPKG_LINE_INFO).source_location / "environment-overrides.cmake");
+ }
+
+ const auto cmd_launch_cmake = System::make_cmake_cmd(cmake_exe_path, ports_cmake_script_path, args);
+
const auto ec_data = System::cmd_execute_and_capture_output(cmd_launch_cmake);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, ec_data.output);
@@ -946,111 +1048,57 @@ namespace vcpkg::Build const std::string variable_name = s.at(0);
const std::string variable_value = variable_with_no_value ? "" : s.at(1);
- if (variable_name == "VCPKG_TARGET_ARCHITECTURE")
- {
- pre_build_info.target_architecture = variable_value;
- continue;
- }
-
- if (variable_name == "VCPKG_CMAKE_SYSTEM_NAME")
- {
- pre_build_info.cmake_system_name = variable_value;
- continue;
- }
-
- if (variable_name == "VCPKG_CMAKE_SYSTEM_VERSION")
- {
- pre_build_info.cmake_system_version = variable_value;
- continue;
- }
-
- if (variable_name == "VCPKG_PLATFORM_TOOLSET")
- {
- pre_build_info.platform_toolset =
- variable_value.empty() ? nullopt : Optional<std::string>{variable_value};
- continue;
- }
-
- if (variable_name == "VCPKG_VISUAL_STUDIO_PATH")
+ auto maybe_option = VCPKG_OPTIONS.find(variable_name);
+ if (maybe_option != VCPKG_OPTIONS.end())
{
- pre_build_info.visual_studio_path =
- variable_value.empty() ? nullopt : Optional<fs::path>{variable_value};
- continue;
- }
-
- if (variable_name == "VCPKG_CHAINLOAD_TOOLCHAIN_FILE")
- {
- pre_build_info.external_toolchain_file =
- variable_value.empty() ? nullopt : Optional<std::string>{variable_value};
- continue;
+ switch (maybe_option->second)
+ {
+ case VcpkgTripletVar::TARGET_ARCHITECTURE:
+ pre_build_info.target_architecture = variable_value;
+ break;
+ case VcpkgTripletVar::CMAKE_SYSTEM_NAME: pre_build_info.cmake_system_name = variable_value; break;
+ case VcpkgTripletVar::CMAKE_SYSTEM_VERSION:
+ pre_build_info.cmake_system_version = variable_value;
+ break;
+ case VcpkgTripletVar::PLATFORM_TOOLSET:
+ pre_build_info.platform_toolset =
+ variable_value.empty() ? nullopt : Optional<std::string>{variable_value};
+ break;
+ case VcpkgTripletVar::VISUAL_STUDIO_PATH:
+ pre_build_info.visual_studio_path =
+ variable_value.empty() ? nullopt : Optional<fs::path>{variable_value};
+ break;
+ case VcpkgTripletVar::CHAINLOAD_TOOLCHAIN_FILE:
+ pre_build_info.external_toolchain_file =
+ variable_value.empty() ? nullopt : Optional<std::string>{variable_value};
+ break;
+ case VcpkgTripletVar::BUILD_TYPE:
+ if (variable_value.empty())
+ pre_build_info.build_type = nullopt;
+ else if (Strings::case_insensitive_ascii_equals(variable_value, "debug"))
+ pre_build_info.build_type = ConfigurationType::DEBUG;
+ else if (Strings::case_insensitive_ascii_equals(variable_value, "release"))
+ pre_build_info.build_type = ConfigurationType::RELEASE;
+ else
+ Checks::exit_with_message(
+ VCPKG_LINE_INFO, "Unknown setting for VCPKG_BUILD_TYPE: %s", variable_value);
+ break;
+ case VcpkgTripletVar::ENV_PASSTHROUGH:
+ pre_build_info.passthrough_env_vars = Strings::split(variable_value, ";");
+ break;
+ }
}
-
- if (variable_name == "VCPKG_BUILD_TYPE")
+ else
{
- if (variable_value.empty())
- pre_build_info.build_type = nullopt;
- else if (Strings::case_insensitive_ascii_equals(variable_value, "debug"))
- pre_build_info.build_type = ConfigurationType::DEBUG;
- else if (Strings::case_insensitive_ascii_equals(variable_value, "release"))
- pre_build_info.build_type = ConfigurationType::RELEASE;
- else
- Checks::exit_with_message(
- VCPKG_LINE_INFO, "Unknown setting for VCPKG_BUILD_TYPE: %s", variable_value);
- continue;
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown variable name %s", line);
}
-
- Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown variable name %s", line);
}
- pre_build_info.triplet_abi_tag = [&]() {
- const auto& fs = paths.get_filesystem();
- static std::map<fs::path, std::string> s_hash_cache;
-
- auto it_hash = s_hash_cache.find(triplet_file_path);
- if (it_hash != s_hash_cache.end())
- {
- return it_hash->second;
- }
- auto hash = Hash::get_file_hash(fs, triplet_file_path, "SHA1");
-
- if (auto p = pre_build_info.external_toolchain_file.get())
- {
- hash += "-";
- hash += Hash::get_file_hash(fs, *p, "SHA1");
- }
- else if (pre_build_info.cmake_system_name.empty() ||
- pre_build_info.cmake_system_name == "WindowsStore")
- {
- hash += "-";
- hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "windows.cmake", "SHA1");
- }
- else if (pre_build_info.cmake_system_name == "Linux")
- {
- hash += "-";
- hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "linux.cmake", "SHA1");
- }
- else if (pre_build_info.cmake_system_name == "Darwin")
- {
- hash += "-";
- hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "osx.cmake", "SHA1");
- }
- else if (pre_build_info.cmake_system_name == "FreeBSD")
- {
- hash += "-";
- hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "freebsd.cmake", "SHA1");
- }
- else if (pre_build_info.cmake_system_name == "Android")
- {
- hash += "-";
- hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "android.cmake", "SHA1");
- }
-
- s_hash_cache.emplace(triplet_file_path, hash);
- return hash;
- }();
+ pre_build_info.triplet_abi_tag = get_triplet_abi(paths, pre_build_info, triplet);
return pre_build_info;
}
+
ExtendedBuildResult::ExtendedBuildResult(BuildResult code) : code(code) {}
ExtendedBuildResult::ExtendedBuildResult(BuildResult code, std::unique_ptr<BinaryControlFile>&& bcf)
: code(code), binary_control_file(std::move(bcf))
diff --git a/toolsrc/src/vcpkg/commands.cache.cpp b/toolsrc/src/vcpkg/commands.cache.cpp index c321de3b5..4c49db004 100644 --- a/toolsrc/src/vcpkg/commands.cache.cpp +++ b/toolsrc/src/vcpkg/commands.cache.cpp @@ -14,7 +14,7 @@ namespace vcpkg::Commands::Cache std::vector<BinaryParagraph> output; for (auto&& path : paths.get_filesystem().get_files_non_recursive(paths.packages)) { - const Expected<std::unordered_map<std::string, std::string>> pghs = + const Expected<Parse::RawParagraph> pghs = Paragraphs::get_single_paragraph(paths.get_filesystem(), path / "CONTROL"); if (const auto p = pghs.get()) { diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index c12c26ff7..f0f162f5c 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -236,13 +236,7 @@ namespace vcpkg::Commands::CI { auto triplet = p->spec.triplet(); - const Build::BuildPackageConfig build_config{ - *scfl->source_control_file, - triplet, - static_cast<fs::path>(scfl->source_location), - build_options, - p->feature_list - }; + const Build::BuildPackageConfig build_config{*scfl, triplet, build_options, p->feature_list}; auto dependency_abis = Util::fmap(p->computed_dependencies, [&](const PackageSpec& spec) -> Build::AbiEntry { @@ -254,7 +248,7 @@ namespace vcpkg::Commands::CI return {spec.name(), it->second}; }); const auto& pre_build_info = pre_build_info_cache.get_lazy( - triplet, [&]() { return Build::PreBuildInfo::from_triplet_file(paths, triplet); }); + triplet, [&]() { return Build::PreBuildInfo::from_triplet_file(paths, triplet, *scfl); }); auto maybe_tag_and_file = Build::compute_abi_tag(paths, build_config, pre_build_info, dependency_abis); @@ -356,7 +350,7 @@ namespace vcpkg::Commands::CI } StatusParagraphs status_db = database_load_check(paths); - + Dependencies::PathsPortFileProvider provider(paths, args.overlay_ports.get()); const Build::BuildPackageOptions install_plan_options = { diff --git a/toolsrc/src/vcpkg/commands.cpp b/toolsrc/src/vcpkg/commands.cpp index 54e9346ba..3ac568979 100644 --- a/toolsrc/src/vcpkg/commands.cpp +++ b/toolsrc/src/vcpkg/commands.cpp @@ -24,6 +24,7 @@ namespace vcpkg::Commands {"env", &Env::perform_and_exit}, {"build-external", &BuildExternal::perform_and_exit}, {"export", &Export::perform_and_exit}, + {"depend-info", &DependInfo::perform_and_exit}, }; return t; } @@ -38,7 +39,6 @@ namespace vcpkg::Commands {"integrate", &Integrate::perform_and_exit}, {"owns", &Owns::perform_and_exit}, {"update", &Update::perform_and_exit}, - {"depend-info", &DependInfo::perform_and_exit}, {"edit", &Edit::perform_and_exit}, {"create", &Create::perform_and_exit}, {"import", &Import::perform_and_exit}, diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp index 8394e0166..8ca88dd56 100644 --- a/toolsrc/src/vcpkg/commands.dependinfo.cpp +++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp @@ -4,65 +4,129 @@ #include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
+#include <vcpkg/dependencies.h>
#include <vcpkg/help.h>
-#include <vcpkg/paragraphs.h>
+#include <vcpkg/input.h>
+#include <vcpkg/install.h>
#include <vcpkg/packagespec.h>
-
#include <vector>
-#include <memory>
-#include <vcpkg/dependencies.h>
+using vcpkg::Dependencies::AnyAction;
+using vcpkg::Dependencies::create_feature_install_plan;
+using vcpkg::Dependencies::InstallPlanAction;
using vcpkg::Dependencies::PathsPortFileProvider;
namespace vcpkg::Commands::DependInfo
{
constexpr StringLiteral OPTION_DOT = "--dot";
constexpr StringLiteral OPTION_DGML = "--dgml";
- constexpr StringLiteral OPTION_NO_RECURSE = "--no-recurse";
+ constexpr StringLiteral OPTION_SHOW_DEPTH = "--show-depth";
+ constexpr StringLiteral OPTION_MAX_RECURSE = "--max-recurse";
+ constexpr StringLiteral OPTION_SORT = "--sort";
+
+ constexpr int NO_RECURSE_LIMIT_VALUE = -1;
+
+ constexpr std::array<CommandSwitch, 3> DEPEND_SWITCHES = {{{OPTION_DOT, "Creates graph on basis of dot"},
+ {OPTION_DGML, "Creates graph on basis of dgml"},
+ {OPTION_SHOW_DEPTH, "Show recursion depth in output"}}};
- constexpr std::array<CommandSwitch, 3> DEPEND_SWITCHES = {{
- {OPTION_DOT, "Creates graph on basis of dot"},
- {OPTION_DGML, "Creates graph on basis of dgml"},
- {OPTION_NO_RECURSE,
- "Computes only immediate dependencies of packages explicitly specified on the command-line"},
- }};
+ constexpr std::array<CommandSetting, 2> DEPEND_SETTINGS = {
+ {{OPTION_MAX_RECURSE, "Set max recursion depth, a value of -1 indicates no limit"},
+ {OPTION_SORT,
+ "Set sort order for the list of dependencies, accepted values are: lexicographical, topological (default), "
+ "reverse"}}};
const CommandStructure COMMAND_STRUCTURE = {
- Help::create_example_string(R"###(depend-info [pat])###"),
+ Help::create_example_string("depend-info sqlite3"),
0,
SIZE_MAX,
- {DEPEND_SWITCHES, {}},
+ {DEPEND_SWITCHES, DEPEND_SETTINGS},
nullptr,
};
- std::string replace_dashes_with_underscore(const std::string& input)
+ struct PackageDependInfo
{
- std::string output = input;
- std::replace(output.begin(), output.end(), '-', '_');
- return output;
+ std::string package;
+ int depth;
+ std::set<std::string> features;
+ std::vector<std::string> dependencies;
+ };
+
+ enum SortMode
+ {
+ Lexicographical = 0,
+ Topological,
+ ReverseTopological,
+ Default = Topological
+ };
+
+ int get_max_depth(const ParsedArguments& options)
+ {
+ auto iter = options.settings.find(OPTION_MAX_RECURSE);
+ if (iter != options.settings.end())
+ {
+ std::string value = iter->second;
+ try
+ {
+ return std::stoi(value);
+ }
+ catch (std::exception&)
+ {
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Value of --max-depth must be an integer");
+ }
+ }
+ // No --max-depth set, default to no limit.
+ return NO_RECURSE_LIMIT_VALUE;
}
- std::string create_dot_as_string(const std::vector<const SourceControlFile*>& source_control_files)
+ SortMode get_sort_mode(const ParsedArguments& options)
+ {
+ constexpr StringLiteral OPTION_SORT_LEXICOGRAPHICAL = "lexicographical";
+ constexpr StringLiteral OPTION_SORT_TOPOLOGICAL = "topological";
+ constexpr StringLiteral OPTION_SORT_REVERSE = "reverse";
+
+ static const std::map<std::string, SortMode> sortModesMap{{OPTION_SORT_LEXICOGRAPHICAL, Lexicographical},
+ {OPTION_SORT_TOPOLOGICAL, Topological},
+ {OPTION_SORT_REVERSE, ReverseTopological}};
+
+ auto iter = options.settings.find(OPTION_SORT);
+ if (iter != options.settings.end())
+ {
+ const std::string value = Strings::ascii_to_lowercase(std::string{iter->second});
+ auto it = sortModesMap.find(value);
+ if (it != sortModesMap.end())
+ {
+ return it->second;
+ }
+ Checks::exit_with_message(VCPKG_LINE_INFO,
+ "Value of --sort must be one of `%s`, `%s`, or `%s`",
+ OPTION_SORT_LEXICOGRAPHICAL,
+ OPTION_SORT_TOPOLOGICAL,
+ OPTION_SORT_REVERSE);
+ }
+ return Default;
+ }
+
+ std::string create_dot_as_string(const std::vector<PackageDependInfo>& depend_info)
{
int empty_node_count = 0;
std::string s;
s.append("digraph G{ rankdir=LR; edge [minlen=3]; overlap=false;");
- for (const auto& source_control_file : source_control_files)
+ for (const auto& package : depend_info)
{
- const SourceParagraph& source_paragraph = *source_control_file->core_paragraph;
- if (source_paragraph.depends.empty())
+ if (package.dependencies.empty())
{
empty_node_count++;
continue;
}
- const std::string name = replace_dashes_with_underscore(source_paragraph.name);
+ const std::string name = Strings::replace_all(std::string{ package.package }, "-", "_");
s.append(Strings::format("%s;", name));
- for (const Dependency& d : source_paragraph.depends)
+ for (const auto &d : package.dependencies)
{
- const std::string dependency_name = replace_dashes_with_underscore(d.depend.name);
+ const std::string dependency_name = Strings::replace_all(std::string{ d }, "-", "_");
s.append(Strings::format("%s -> %s;", name, dependency_name));
}
}
@@ -71,39 +135,22 @@ namespace vcpkg::Commands::DependInfo return s;
}
- std::string create_dgml_as_string(const std::vector<const SourceControlFile*>& source_control_files)
+ std::string create_dgml_as_string(const std::vector<PackageDependInfo>& depend_info)
{
std::string s;
s.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
s.append("<DirectedGraph xmlns=\"http://schemas.microsoft.com/vs/2009/dgml\">");
std::string nodes, links;
- for (const auto& source_control_file : source_control_files)
+ for (const auto& package : depend_info)
{
- const SourceParagraph& source_paragraph = *source_control_file->core_paragraph;
- const std::string name = source_paragraph.name;
+ const std::string name = package.package;
nodes.append(Strings::format("<Node Id=\"%s\" />", name));
// Iterate over dependencies.
- for (const Dependency& d : source_paragraph.depends)
- {
- if (d.qualifier.empty())
- links.append(Strings::format("<Link Source=\"%s\" Target=\"%s\" />", name, d.depend.name));
- else
- links.append(Strings::format(
- "<Link Source=\"%s\" Target=\"%s\" StrokeDashArray=\"4\" />", name, d.depend.name));
- }
-
- // Iterate over feature dependencies.
- const std::vector<std::unique_ptr<FeatureParagraph>>& feature_paragraphs =
- source_control_file->feature_paragraphs;
- for (const auto& feature_paragraph : feature_paragraphs)
+ for (const auto& d : package.dependencies)
{
- for (const Dependency& d : feature_paragraph->depends)
- {
- links.append(Strings::format(
- "<Link Source=\"%s\" Target=\"%s\" StrokeDashArray=\"4\" />", name, d.depend.name));
- }
+ links.append(Strings::format("<Link Source=\"%s\" Target=\"%s\" />", name, d));
}
}
@@ -116,135 +163,162 @@ namespace vcpkg::Commands::DependInfo }
std::string create_graph_as_string(const std::unordered_set<std::string>& switches,
- const std::vector<const SourceControlFile*>& source_control_files)
+ const std::vector<PackageDependInfo>& depend_info)
{
if (Util::Sets::contains(switches, OPTION_DOT))
{
- return create_dot_as_string(source_control_files);
+ return create_dot_as_string(depend_info);
}
else if (Util::Sets::contains(switches, OPTION_DGML))
{
- return create_dgml_as_string(source_control_files);
+ return create_dgml_as_string(depend_info);
}
return "";
}
- void build_dependencies_list(std::set<std::string>& packages_to_keep,
- const std::string& requested_package,
- const std::vector<const SourceControlFile*>& source_control_files,
- const std::unordered_set<std::string>& switches)
+ void assign_depth_to_dependencies(const std::string& package,
+ const int depth,
+ const int max_depth,
+ std::map<std::string, PackageDependInfo>& dependencies_map)
{
- auto maybe_requested_spec = ParsedSpecifier::from_string(requested_package);
- // TODO: move this check to the top-level invocation of this function since
- // argument `requested_package` shall always be valid in inner-level invocation.
- if (!maybe_requested_spec.has_value())
- {
- System::print2(System::Color::warning,
- "'",
- requested_package,
- "' is not a valid package specifier: ",
- vcpkg::to_string(maybe_requested_spec.error()),
- "\n");
- return;
- }
- auto requested_spec = maybe_requested_spec.get();
+ auto iter = dependencies_map.find(package);
+ Checks::check_exit(VCPKG_LINE_INFO, iter != dependencies_map.end(), "Package not found in dependency graph");
- const auto source_control_file =
- Util::find_if(source_control_files, [&requested_spec](const auto& source_control_file) {
- return source_control_file->core_paragraph->name == requested_spec->name;
- });
+ PackageDependInfo& info = iter->second;
- if (source_control_file != source_control_files.end())
+ if (depth > info.depth)
{
- const auto new_package = packages_to_keep.insert(requested_spec->name).second;
-
- if (new_package && !Util::Sets::contains(switches, OPTION_NO_RECURSE))
+ info.depth = depth;
+ if (depth < max_depth || max_depth == NO_RECURSE_LIMIT_VALUE)
{
- for (const auto& dependency : (*source_control_file)->core_paragraph->depends)
+ for (auto&& dependency : info.dependencies)
{
- build_dependencies_list(packages_to_keep, dependency.depend.name, source_control_files, switches);
- }
-
- // Collect features with `*` considered
- std::set<const FeatureParagraph*> collected_features;
- for (const auto& requested_feature_name : requested_spec->features)
- {
- if (requested_feature_name == "*")
- {
- for (auto &&feature_paragraph : (*source_control_file)->feature_paragraphs)
- {
- collected_features.insert(std::addressof(Util::as_const(*feature_paragraph)));
- }
- continue;
- }
- auto maybe_feature = (*source_control_file)->find_feature(requested_feature_name);
- if (auto &&feature_paragraph = maybe_feature.get())
- {
- collected_features.insert(std::addressof(Util::as_const(*feature_paragraph)));
- }
- else
- {
- System::print2(System::Color::warning,
- "dependency '",
- requested_feature_name,
- "' of package '",
- requested_spec->name,
- "' does not exist\n");
- continue;
- }
- }
- for (auto feature_paragraph : collected_features)
- {
- for (const auto& dependency : feature_paragraph->depends)
- {
- build_dependencies_list(packages_to_keep, dependency.depend.name, source_control_files, switches);
- }
+ assign_depth_to_dependencies(dependency, depth + 1, max_depth, dependencies_map);
}
}
}
- else
+ };
+
+ std::vector<PackageDependInfo> extract_depend_info(const std::vector<const InstallPlanAction*>& install_actions,
+ const int max_depth)
+ {
+ std::map<std::string, PackageDependInfo> package_dependencies;
+ for (const InstallPlanAction* pia : install_actions)
{
- System::print2(System::Color::warning, "package '", requested_package, "' does not exist\n");
+ const InstallPlanAction& install_action = *pia;
+
+ const std::vector<std::string> dependencies =
+ Util::fmap(install_action.computed_dependencies, [](const PackageSpec& spec) { return spec.name(); });
+
+ std::set<std::string> features{install_action.feature_list};
+ features.erase("core");
+
+ std::string port_name = install_action.spec.name();
+
+ PackageDependInfo info {port_name, -1, features, dependencies};
+ package_dependencies.emplace(port_name, std::move(info));
}
+
+ const InstallPlanAction& init = *install_actions.back();
+ assign_depth_to_dependencies(init.spec.name(), 0, max_depth, package_dependencies);
+
+ std::vector<PackageDependInfo> out =
+ Util::fmap(package_dependencies, [](auto&& kvpair) -> PackageDependInfo { return kvpair.second; });
+ Util::erase_remove_if(out, [](auto&& info) { return info.depth < 0; });
+ return out;
}
- void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
+ const int max_depth = get_max_depth(options);
+ const SortMode sort_mode = get_sort_mode(options);
+ const bool show_depth = Util::Sets::contains(options.switches, OPTION_SHOW_DEPTH);
- // TODO: Optimize implementation, current implementation needs to load all ports from disk which is too slow.
- PathsPortFileProvider provider(paths, args.overlay_ports.get());
- auto source_control_files = Util::fmap(provider.load_all_control_files(), [](auto&& scfl) -> const SourceControlFile * {
- return scfl->source_control_file.get();
+ const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) {
+ return Input::check_and_get_full_package_spec(
+ std::string{arg}, default_triplet, COMMAND_STRUCTURE.example_text);
});
- if (args.command_arguments.size() >= 1)
+ for (auto&& spec : specs)
{
- std::set<std::string> packages_to_keep;
- for (const auto& requested_package : args.command_arguments)
+ Input::check_triplet(spec.package_spec.triplet(), paths);
+ }
+
+ PathsPortFileProvider provider(paths, args.overlay_ports.get());
+
+ // By passing an empty status_db, we should get a plan containing all dependencies.
+ // All actions in the plan should be install actions, as there's no installed packages to remove.
+ StatusParagraphs status_db;
+ std::vector<AnyAction> action_plan =
+ create_feature_install_plan(provider, FullPackageSpec::to_feature_specs(specs), status_db);
+ std::vector<const InstallPlanAction*> install_actions = Util::fmap(action_plan, [&](const AnyAction& action) {
+ if (auto install_action = action.install_action.get())
{
- build_dependencies_list(packages_to_keep, requested_package, source_control_files, options.switches);
+ return install_action;
}
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Only install actions should exist in the plan");
+ });
- Util::erase_remove_if(source_control_files, [&packages_to_keep](const auto& source_control_file) {
- return !Util::Sets::contains(packages_to_keep, source_control_file->core_paragraph->name);
- });
- }
+ std::vector<PackageDependInfo> depend_info = extract_depend_info(install_actions, max_depth);
if (Util::Sets::contains(options.switches, OPTION_DOT) || Util::Sets::contains(options.switches, OPTION_DGML))
{
- const std::string graph_as_string = create_graph_as_string(options.switches, source_control_files);
+ const std::vector<const SourceControlFile*> source_control_files =
+ Util::fmap(install_actions, [](const InstallPlanAction* install_action) {
+ const SourceControlFileLocation& scfl =
+ install_action->source_control_file_location.value_or_exit(VCPKG_LINE_INFO);
+ return const_cast<const SourceControlFile*>(scfl.source_control_file.get());
+ });
+
+ const std::string graph_as_string = create_graph_as_string(options.switches, depend_info);
System::print2(graph_as_string, '\n');
Checks::exit_success(VCPKG_LINE_INFO);
}
- for (auto&& source_control_file : source_control_files)
+
+ // TODO: Improve this code
+ auto lex = [](const PackageDependInfo& lhs, const PackageDependInfo& rhs) -> bool {
+ return lhs.package < rhs.package;
+ };
+ auto topo = [](const PackageDependInfo& lhs, const PackageDependInfo& rhs) -> bool {
+ return lhs.depth > rhs.depth;
+ };
+ auto reverse = [topo](const PackageDependInfo& lhs, const PackageDependInfo& rhs) -> bool {
+ return lhs.depth < rhs.depth;
+ };
+
+ switch (sort_mode)
{
- const SourceParagraph& source_paragraph = *source_control_file->core_paragraph.get();
- const auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name(); });
- System::print2(source_paragraph.name, ": ", s, "\n");
+ case SortMode::Lexicographical: std::sort(std::begin(depend_info), std::end(depend_info), lex); break;
+ case SortMode::ReverseTopological:
+ std::sort(std::begin(depend_info), std::end(depend_info), reverse);
+ break;
+ case SortMode::Topological: std::sort(std::begin(depend_info), std::end(depend_info), topo); break;
+ default: Checks::unreachable(VCPKG_LINE_INFO);
}
+ for (auto&& info : depend_info)
+ {
+ if (info.depth >= 0)
+ {
+ std::string features = Strings::join(", ", info.features);
+ const std::string dependencies = Strings::join(", ", info.dependencies);
+
+ if (show_depth)
+ {
+ System::print2(System::Color::error, "(", info.depth, ") ");
+ }
+ System::print2(System::Color::success, info.package);
+ if (!features.empty())
+ {
+ System::print2("[");
+ System::print2(System::Color::warning, features);
+ System::print2("]");
+ }
+ System::print2(": ", dependencies, "\n");
+ }
+ }
Checks::exit_success(VCPKG_LINE_INFO);
}
}
diff --git a/toolsrc/src/vcpkg/commands.exportifw.cpp b/toolsrc/src/vcpkg/commands.exportifw.cpp index f0946110c..3d963a297 100644 --- a/toolsrc/src/vcpkg/commands.exportifw.cpp +++ b/toolsrc/src/vcpkg/commands.exportifw.cpp @@ -352,13 +352,15 @@ namespace vcpkg::Export::IFW System::print2("Generating repository ", repository_dir.generic_u8string(), "...\n"); std::error_code ec; + fs::path failure_point; Files::Filesystem& fs = paths.get_filesystem(); - fs.remove_all(repository_dir, ec); + fs.remove_all(repository_dir, ec, failure_point); Checks::check_exit(VCPKG_LINE_INFO, !ec, - "Could not remove outdated repository directory %s", - repository_dir.generic_u8string()); + "Could not remove outdated repository directory %s due to file %s", + repository_dir.generic_u8string(), + failure_point.string()); const auto cmd_line = Strings::format(R"("%s" --packages "%s" "%s" > nul)", repogen_exe.u8string(), @@ -414,16 +416,18 @@ namespace vcpkg::Export::IFW const VcpkgPaths& paths) { std::error_code ec; + fs::path failure_point; Files::Filesystem& fs = paths.get_filesystem(); // Prepare packages directory const fs::path ifw_packages_dir_path = get_packages_dir_path(export_id, ifw_options, paths); - fs.remove_all(ifw_packages_dir_path, ec); + fs.remove_all(ifw_packages_dir_path, ec, failure_point); Checks::check_exit(VCPKG_LINE_INFO, !ec, - "Could not remove outdated packages directory %s", - ifw_packages_dir_path.generic_u8string()); + "Could not remove outdated packages directory %s due to file %s", + ifw_packages_dir_path.generic_u8string(), + failure_point.string()); fs.create_directory(ifw_packages_dir_path, ec); Checks::check_exit( diff --git a/toolsrc/src/vcpkg/commands.import.cpp b/toolsrc/src/vcpkg/commands.import.cpp index 40f5a434c..c18d788c5 100644 --- a/toolsrc/src/vcpkg/commands.import.cpp +++ b/toolsrc/src/vcpkg/commands.import.cpp @@ -108,7 +108,7 @@ namespace vcpkg::Commands::Import const fs::path include_directory(args.command_arguments[1]); const fs::path project_directory(args.command_arguments[2]); - const Expected<std::unordered_map<std::string, std::string>> pghs = + const Expected<Parse::RawParagraph> pghs = Paragraphs::get_single_paragraph(paths.get_filesystem(), control_file_path); Checks::check_exit(VCPKG_LINE_INFO, pghs.get() != nullptr, diff --git a/toolsrc/src/vcpkg/commands.portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp index b30c38f43..cddc274b8 100644 --- a/toolsrc/src/vcpkg/commands.portsdiff.cpp +++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp @@ -105,7 +105,7 @@ namespace vcpkg::Commands::PortsDiff std::map<std::string, VersionT> names_and_versions; for (auto&& port : all_ports) names_and_versions.emplace(port->core_paragraph->name, port->core_paragraph->version); - fs.remove_all(temp_checkout_path, ec); + fs.remove_all(temp_checkout_path, VCPKG_LINE_INFO); return names_and_versions; } diff --git a/toolsrc/src/vcpkg/commands.search.cpp b/toolsrc/src/vcpkg/commands.search.cpp index 3d8387ee1..943233502 100644 --- a/toolsrc/src/vcpkg/commands.search.cpp +++ b/toolsrc/src/vcpkg/commands.search.cpp @@ -2,12 +2,12 @@ #include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> #include <vcpkg/globalstate.h> #include <vcpkg/help.h> #include <vcpkg/paragraphs.h> #include <vcpkg/sourceparagraph.h> #include <vcpkg/vcpkglib.h> -#include <vcpkg/dependencies.h> using vcpkg::Dependencies::PathsPortFileProvider; @@ -67,9 +67,9 @@ namespace vcpkg::Commands::Search const bool full_description = Util::Sets::contains(options.switches, OPTION_FULLDESC); PathsPortFileProvider provider(paths, args.overlay_ports.get()); - auto source_paragraphs = Util::fmap(provider.load_all_control_files(), [](auto&& port) -> const SourceControlFile * { - return port->source_control_file.get(); - }); + auto source_paragraphs = + Util::fmap(provider.load_all_control_files(), + [](auto&& port) -> const SourceControlFile* { return port->source_control_file.get(); }); if (args.command_arguments.empty()) { diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index b604c9acf..9fccf950e 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -108,9 +108,8 @@ namespace vcpkg::Dependencies static ClusterSource cluster_from_scf(const SourceControlFileLocation& scfl, Triplet t) { ClusterSource ret; - ret.build_edges.emplace("core", - filter_dependencies_to_specs(scfl.source_control_file->core_paragraph->depends, - t)); + ret.build_edges.emplace("core", + filter_dependencies_to_specs(scfl.source_control_file->core_paragraph->depends, t)); for (const auto& feature : scfl.source_control_file->feature_paragraphs) ret.build_edges.emplace(feature->name, filter_dependencies_to_specs(feature->depends, t)); @@ -123,22 +122,23 @@ namespace vcpkg::Dependencies const PortFileProvider& m_provider; }; - std::string to_output_string(RequestType request_type, - const CStringView s, - const Build::BuildPackageOptions& options, + std::string to_output_string(RequestType request_type, + const CStringView s, + const Build::BuildPackageOptions& options, const fs::path& install_port_path, const fs::path& default_port_path) { - if (!default_port_path.empty() - && !Strings::case_insensitive_ascii_starts_with(install_port_path.u8string(), - default_port_path.u8string())) + if (!default_port_path.empty() && + !Strings::case_insensitive_ascii_starts_with(install_port_path.u8string(), default_port_path.u8string())) { const char* const from_head = options.use_head_version == Build::UseHeadVersion::YES ? " (from HEAD)" : ""; switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s -- %s", s, from_head, install_port_path.u8string()); - case RequestType::USER_REQUESTED: return Strings::format(" %s%s -- %s", s, from_head, install_port_path.u8string()); - default: Checks::unreachable(VCPKG_LINE_INFO); + case RequestType::AUTO_SELECTED: + return Strings::format(" * %s%s -- %s", s, from_head, install_port_path.u8string()); + case RequestType::USER_REQUESTED: + return Strings::format(" %s%s -- %s", s, from_head, install_port_path.u8string()); + default: Checks::unreachable(VCPKG_LINE_INFO); } } return to_output_string(request_type, s, options); @@ -152,7 +152,7 @@ namespace vcpkg::Dependencies switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s", s, from_head); + case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s", s, from_head); case RequestType::USER_REQUESTED: return Strings::format(" %s%s", s, from_head); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -162,7 +162,7 @@ namespace vcpkg::Dependencies { switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s", s); + case RequestType::AUTO_SELECTED: return Strings::format(" * %s", s); case RequestType::USER_REQUESTED: return Strings::format(" %s", s); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -293,7 +293,8 @@ namespace vcpkg::Dependencies MapPortFileProvider::MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileLocation>& map) : ports(map) - {} + { + } Optional<const SourceControlFileLocation&> MapPortFileProvider::get_control_file(const std::string& spec) const { @@ -304,13 +305,14 @@ namespace vcpkg::Dependencies std::vector<const SourceControlFileLocation*> MapPortFileProvider::load_all_control_files() const { - return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation * { return &kvpair.second; }); + return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation* { return &kvpair.second; }); } PathsPortFileProvider::PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, - const std::vector<std::string>* ports_dirs_paths) + const std::vector<std::string>* ports_dirs_paths) : filesystem(paths.get_filesystem()) { + auto& fs = Files::get_real_filesystem(); if (ports_dirs_paths) { for (auto&& overlay_path : *ports_dirs_paths) @@ -325,7 +327,7 @@ namespace vcpkg::Dependencies overlay.string()); Checks::check_exit(VCPKG_LINE_INFO, - fs::stdfs::is_directory(overlay), + fs::is_directory(fs.status(VCPKG_LINE_INFO, overlay)), "Error: Path \"%s\" must be a directory", overlay.string()); @@ -354,7 +356,7 @@ namespace vcpkg::Dependencies { if (scf->get()->core_paragraph->name == spec) { - SourceControlFileLocation scfl{ std::move(*scf), ports_dir }; + SourceControlFileLocation scfl{std::move(*scf), ports_dir}; auto it = cache.emplace(spec, std::move(scfl)); return it.first->second; } @@ -362,9 +364,8 @@ namespace vcpkg::Dependencies else { vcpkg::print_error_message(maybe_scf.error()); - Checks::exit_with_message(VCPKG_LINE_INFO, - "Error: Failed to load port from %s", - spec, ports_dir.u8string()); + Checks::exit_with_message( + VCPKG_LINE_INFO, "Error: Failed to load port from %s", spec, ports_dir.u8string()); } } @@ -373,7 +374,7 @@ namespace vcpkg::Dependencies { if (scf->get()->core_paragraph->name == spec) { - SourceControlFileLocation scfl{ std::move(*scf), ports_dir / spec }; + SourceControlFileLocation scfl{std::move(*scf), ports_dir / spec}; auto it = cache.emplace(spec, std::move(scfl)); return it.first->second; } @@ -399,7 +400,7 @@ namespace vcpkg::Dependencies auto port_name = scf->get()->core_paragraph->name; if (cache.find(port_name) == cache.end()) { - SourceControlFileLocation scfl{ std::move(*scf), ports_dir }; + SourceControlFileLocation scfl{std::move(*scf), ports_dir}; auto it = cache.emplace(port_name, std::move(scfl)); ret.emplace_back(&it.first->second); } @@ -407,9 +408,8 @@ namespace vcpkg::Dependencies else { vcpkg::print_error_message(maybe_scf.error()); - Checks::exit_with_message(VCPKG_LINE_INFO, - "Error: Failed to load port from %s", - ports_dir.u8string()); + Checks::exit_with_message( + VCPKG_LINE_INFO, "Error: Failed to load port from %s", ports_dir.u8string()); } continue; } @@ -421,7 +421,7 @@ namespace vcpkg::Dependencies auto port_name = scf->core_paragraph->name; if (cache.find(port_name) == cache.end()) { - SourceControlFileLocation scfl{ std::move(scf), ports_dir / port_name }; + SourceControlFileLocation scfl{std::move(scf), ports_dir / port_name}; auto it = cache.emplace(port_name, std::move(scfl)); ret.emplace_back(&it.first->second); } @@ -768,9 +768,10 @@ namespace vcpkg::Dependencies /// <param name="map">Map of all source control files in the current environment.</param> /// <param name="specs">Feature specifications to resolve dependencies for.</param> /// <param name="status_db">Status of installed packages in the current environment.</param> - std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFileLocation>& map, - const std::vector<FeatureSpec>& specs, - const StatusParagraphs& status_db) + std::vector<AnyAction> create_feature_install_plan( + const std::unordered_map<std::string, SourceControlFileLocation>& map, + const std::vector<FeatureSpec>& specs, + const StatusParagraphs& status_db) { MapPortFileProvider provider(map); return create_feature_install_plan(provider, specs, status_db); @@ -832,9 +833,8 @@ namespace vcpkg::Dependencies { // If it will be transiently uninstalled, we need to issue a full installation command auto* pscfl = p_cluster->source.value_or_exit(VCPKG_LINE_INFO).scfl; - Checks::check_exit(VCPKG_LINE_INFO, - pscfl != nullptr, - "Error: Expected a SourceControlFileLocation to exist"); + Checks::check_exit( + VCPKG_LINE_INFO, pscfl != nullptr, "Error: Expected a SourceControlFileLocation to exist"); auto&& scfl = *pscfl; auto dep_specs = Util::fmap(m_graph_plan->install_graph.adjacency_list(p_cluster), @@ -914,7 +914,9 @@ namespace vcpkg::Dependencies PackageGraph::~PackageGraph() = default; - void print_plan(const std::vector<AnyAction>& action_plan, const bool is_recursive, const fs::path& default_ports_dir) + void print_plan(const std::vector<AnyAction>& action_plan, + const bool is_recursive, + const fs::path& default_ports_dir) { std::vector<const RemovePlanAction*> remove_plans; std::vector<const InstallPlanAction*> rebuilt_plans; @@ -971,13 +973,10 @@ namespace vcpkg::Dependencies static auto actions_to_output_string = [&](const std::vector<const InstallPlanAction*>& v) { return Strings::join("\n", v, [&](const InstallPlanAction* p) { - if (auto * pscfl = p->source_control_file_location.get()) + if (auto* pscfl = p->source_control_file_location.get()) { - return to_output_string(p->request_type, - p->displayname(), - p->build_options, - pscfl->source_location, - default_ports_dir); + return to_output_string( + p->request_type, p->displayname(), p->build_options, pscfl->source_location, default_ports_dir); } return to_output_string(p->request_type, p->displayname(), p->build_options); diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index 88c1526c5..f306bf4e6 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -400,8 +400,10 @@ namespace vcpkg::Export Files::Filesystem& fs = paths.get_filesystem(); const fs::path export_to_path = paths.root; const fs::path raw_exported_dir_path = export_to_path / export_id; + fs.remove_all(raw_exported_dir_path, VCPKG_LINE_INFO); + + // TODO: error handling std::error_code ec; - fs.remove_all(raw_exported_dir_path, ec); fs.create_directory(raw_exported_dir_path, ec); // execute the plan @@ -476,7 +478,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console if (!opts.raw) { - fs.remove_all(raw_exported_dir_path, ec); + fs.remove_all(raw_exported_dir_path, VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index de19c360a..f6330e408 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -174,7 +174,7 @@ namespace vcpkg::Install const std::vector<fs::path> package_file_paths = fs.get_files_recursive(package_dir); const size_t package_remove_char_count = package_dir.generic_string().size() + 1; // +1 for the slash auto package_files = Util::fmap(package_file_paths, [package_remove_char_count](const fs::path& path) { - return std::move(std::string(path.generic_string(), package_remove_char_count)); + return std::move(std::string(path.generic_string(), package_remove_char_count)); }); return SortedVector<std::string>(std::move(package_files)); @@ -202,6 +202,12 @@ namespace vcpkg::Install struct intersection_compare { + // The VS2015 standard library requires comparison operators of T and U + // to also support comparison of T and T, and of U and U, due to debug checks. +#if _MSC_VER < 1910 + bool operator()(const std::string& lhs, const std::string& rhs) { return lhs < rhs; } + bool operator()(const file_pack& lhs, const file_pack& rhs) { return lhs.first < rhs.first; } +#endif bool operator()(const std::string& lhs, const file_pack& rhs) { return lhs < rhs.first; } bool operator()(const file_pack& lhs, const std::string& rhs) { return lhs.first < rhs; } }; @@ -331,11 +337,8 @@ namespace vcpkg::Install auto result = [&]() -> Build::ExtendedBuildResult { const auto& scfl = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO); - const Build::BuildPackageConfig build_config{*scfl.source_control_file, - action.spec.triplet(), - static_cast<fs::path>(scfl.source_location), - action.build_options, - action.feature_list}; + const Build::BuildPackageConfig build_config{ + scfl, action.spec.triplet(), action.build_options, action.feature_list}; return Build::build_package(paths, build_config, status_db); }(); @@ -355,8 +358,7 @@ namespace vcpkg::Install { auto& fs = paths.get_filesystem(); const fs::path package_dir = paths.package_dir(action.spec); - std::error_code ec; - fs.remove_all(package_dir, ec); + fs.remove_all(package_dir, VCPKG_LINE_INFO); } if (action.build_options.clean_downloads == Build::CleanDownloads::YES) diff --git a/toolsrc/src/vcpkg/logicexpression.cpp b/toolsrc/src/vcpkg/logicexpression.cpp new file mode 100644 index 000000000..0cf08ee03 --- /dev/null +++ b/toolsrc/src/vcpkg/logicexpression.cpp @@ -0,0 +1,268 @@ + +#include "pch.h" + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/logicexpression.h> + +#include <string> +#include <vector> + +namespace vcpkg +{ + struct ParseError + { + ParseError(int column, std::string line, std::string message) : column(column), line(line), message(message) {} + + const int column; + const std::string line; + const std::string message; + + void print_error() const + { + System::print2(System::Color::error, + "Error: ", + message, + "\n" + " on expression: \"", + line, + "\"\n", + " ", + std::string(column, ' '), + "^\n"); + Checks::exit_fail(VCPKG_LINE_INFO); + } + }; + + // logic expression supports the following : + // primary-expression: + // ( logic-expression ) + // identifier + // identifier: + // alpha-numeric string of characters + // logic-expression: <- this is the entry point + // not-expression + // not-expression | logic-expression + // not-expression & logic-expression + // not-expression: + // ! primary-expression + // primary-expression + // + // | and & have equal precidence and cannot be used together at the same nesting level + // for example a|b&c is not allowd but (a|b)&c and a|(b&c) are allowed. + class ExpressionParser + { + public: + ExpressionParser(const std::string& str, const std::string& evaluation_context) + : raw_text(str), evaluation_context(evaluation_context) + { + go_to_begin(); + + final_result = logic_expression(); + + if (current_iter != raw_text.end()) + { + add_error("Invalid logic expression"); + } + + if (err) + { + err->print_error(); + final_result = false; + } + } + + bool get_result() const { return final_result; } + + bool has_error() const { return err == nullptr; } + + private: + bool final_result; + + std::string::const_iterator current_iter; + const std::string& raw_text; + char current_char; + + const std::string& evaluation_context; + + std::unique_ptr<ParseError> err; + + void add_error(std::string message, int column = -1) + { + // avoid castcading errors by only saving the first + if (!err) + { + if (column < 0) + { + column = current_column(); + } + err = std::make_unique<ParseError>(column, raw_text, message); + } + + // Avoid error loops by skipping to the end + skip_to_end(); + } + + int current_column() const { return static_cast<int>(current_iter - raw_text.begin()); } + + void go_to_begin() + { + current_iter = raw_text.begin(); + current_char = (current_iter != raw_text.end() ? *current_iter : current_char); + + if (current_char == ' ' || current_char == '\t') + { + next_skip_whitespace(); + } + } + void skip_to_end() + { + current_iter = raw_text.end(); + current_char = '\0'; + } + char current() const { return current_char; } + char next() + { + if (current_char != '\0') + { + current_iter++; + current_char = (current_iter != raw_text.end() ? *current_iter : '\0'); + } + return current(); + } + void skip_whitespace() + { + while (current_char == ' ' || current_char == '\t') + { + current_char = next(); + } + } + char next_skip_whitespace() + { + next(); + skip_whitespace(); + return current_char; + } + + static bool is_alphanum(char ch) + { + return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || (ch == '-'); + } + + bool evaluate_identifier(const std::string name) const + { + return evaluation_context.find(name) != std::string::npos; + } + + // identifier: + // alpha-numeric string of characters + bool identifier_expression() + { + auto curr = current(); + std::string name; + + for (curr = current(); is_alphanum(curr); curr = next()) + { + name += curr; + } + + if (name.empty()) + { + add_error("Invalid logic expression, unexpected character"); + return false; + } + + bool result = evaluate_identifier(name); + skip_whitespace(); + return result; + } + + // not-expression: + // ! primary-expression + // primary-expression + bool not_expression() + { + if (current() == '!') + { + next_skip_whitespace(); + return !primary_expression(); + } + + return primary_expression(); + } + + template<char oper, char other, bool operation(bool, bool)> + bool logic_expression_helper(bool seed) + { + do + { + // Support chains of the operator to avoid breaking backwards compatability + while (next() == oper) + { + }; + seed = operation(not_expression(), seed); + + } while (current() == oper); + + if (current() == other) + { + add_error("Mixing & and | is not allowed, Use () to specify order of operations."); + } + + skip_whitespace(); + return seed; + } + static bool and_helper(bool left, bool right) { return left && right; } + static bool or_helper(bool left, bool right) { return left || right; } + + // logic-expression: <- entry point + // not-expression + // not-expression | logic-expression + // not-expression & logic-expression + bool logic_expression() + { + auto result = not_expression(); + + switch (current()) + { + case '|': + { + return logic_expression_helper<'|', '&', or_helper>(result); + } + case '&': + { + return logic_expression_helper<'&', '|', and_helper>(result); + } + default: return result; + } + } + + // primary-expression: + // ( logic-expression ) + // identifier + bool primary_expression() + { + if (current() == '(') + { + next_skip_whitespace(); + bool result = logic_expression(); + if (current() != ')') + { + add_error("Error: missing closing )"); + return result; + } + next_skip_whitespace(); + return result; + } + + return identifier_expression(); + } + }; + + bool evaluate_expression(const std::string& expression, const std::string& evaluation_context) + { + ExpressionParser parser(expression, evaluation_context); + + return parser.get_result(); + } +} diff --git a/toolsrc/src/vcpkg/paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp index 21ef2c4d9..1232b940a 100644 --- a/toolsrc/src/vcpkg/paragraphs.cpp +++ b/toolsrc/src/vcpkg/paragraphs.cpp @@ -116,7 +116,7 @@ namespace vcpkg::Paragraphs skip_spaces(ch); } - void get_paragraph(char& ch, std::unordered_map<std::string, std::string>& fields) + void get_paragraph(char& ch, RawParagraph& fields) { fields.clear(); std::string fieldname; @@ -141,9 +141,9 @@ namespace vcpkg::Paragraphs } public: - std::vector<std::unordered_map<std::string, std::string>> get_paragraphs() + std::vector<RawParagraph> get_paragraphs() { - std::vector<std::unordered_map<std::string, std::string>> paragraphs; + std::vector<RawParagraph> paragraphs; char ch; peek(ch); @@ -164,51 +164,48 @@ namespace vcpkg::Paragraphs } }; - Expected<std::unordered_map<std::string, std::string>> get_single_paragraph(const Files::Filesystem& fs, - const fs::path& control_path) + Expected<RawParagraph> parse_single_paragraph(const std::string& str) { - const Expected<std::string> contents = fs.read_contents(control_path); - if (auto spgh = contents.get()) + const std::vector<RawParagraph> p = Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); + + if (p.size() == 1) { - return parse_single_paragraph(*spgh); + return p.at(0); } - return contents.error(); + return std::error_code(ParagraphParseResult::EXPECTED_ONE_PARAGRAPH); } - Expected<std::vector<std::unordered_map<std::string, std::string>>> get_paragraphs(const Files::Filesystem& fs, - const fs::path& control_path) + Expected<RawParagraph> get_single_paragraph(const Files::Filesystem& fs, const fs::path& control_path) { const Expected<std::string> contents = fs.read_contents(control_path); if (auto spgh = contents.get()) { - return parse_paragraphs(*spgh); + return parse_single_paragraph(*spgh); } return contents.error(); } - Expected<std::unordered_map<std::string, std::string>> parse_single_paragraph(const std::string& str) + Expected<std::vector<RawParagraph>> get_paragraphs(const Files::Filesystem& fs, const fs::path& control_path) { - const std::vector<std::unordered_map<std::string, std::string>> p = - Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); - - if (p.size() == 1) + const Expected<std::string> contents = fs.read_contents(control_path); + if (auto spgh = contents.get()) { - return p.at(0); + return parse_paragraphs(*spgh); } - return std::error_code(ParagraphParseResult::EXPECTED_ONE_PARAGRAPH); + return contents.error(); } - Expected<std::vector<std::unordered_map<std::string, std::string>>> parse_paragraphs(const std::string& str) + Expected<std::vector<RawParagraph>> parse_paragraphs(const std::string& str) { return Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); } ParseExpected<SourceControlFile> try_load_port(const Files::Filesystem& fs, const fs::path& path) { - Expected<std::vector<std::unordered_map<std::string, std::string>>> pghs = get_paragraphs(fs, path / "CONTROL"); + Expected<std::vector<RawParagraph>> pghs = get_paragraphs(fs, path / "CONTROL"); if (auto vector_pghs = pghs.get()) { return SourceControlFile::parse_control_file(std::move(*vector_pghs)); @@ -221,7 +218,7 @@ namespace vcpkg::Paragraphs Expected<BinaryControlFile> try_load_cached_package(const VcpkgPaths& paths, const PackageSpec& spec) { - Expected<std::vector<std::unordered_map<std::string, std::string>>> pghs = + Expected<std::vector<RawParagraph>> pghs = get_paragraphs(paths.get_filesystem(), paths.package_dir(spec) / "CONTROL"); if (auto p = pghs.get()) diff --git a/toolsrc/src/vcpkg/parse.cpp b/toolsrc/src/vcpkg/parse.cpp index d50296cf8..9c9968249 100644 --- a/toolsrc/src/vcpkg/parse.cpp +++ b/toolsrc/src/vcpkg/parse.cpp @@ -6,8 +6,7 @@ namespace vcpkg::Parse { - static Optional<std::string> remove_field(std::unordered_map<std::string, std::string>* fields, - const std::string& fieldname) + static Optional<std::string> remove_field(RawParagraph* fields, const std::string& fieldname) { auto it = fields->find(fieldname); if (it == fields->end()) diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp index a40b27bd7..65e00668a 100644 --- a/toolsrc/src/vcpkg/remove.cpp +++ b/toolsrc/src/vcpkg/remove.cpp @@ -73,7 +73,7 @@ namespace vcpkg::Remove if (ec) { #if defined(_WIN32) - fs::stdfs::permissions(target, fs::stdfs::perms::owner_all | fs::stdfs::perms::group_all, ec); + fs::stdfs::permissions(target, fs::perms::owner_all | fs::perms::group_all, ec); fs.remove(target, ec); if (ec) { @@ -86,7 +86,7 @@ namespace vcpkg::Remove #endif } } - else if (!fs::stdfs::exists(status)) + else if (!fs::exists(status)) { System::printf(System::Color::warning, "Warning: %s: file not found\n", target.u8string()); } @@ -179,8 +179,7 @@ namespace vcpkg::Remove { System::printf("Purging package %s...\n", display_name); Files::Filesystem& fs = paths.get_filesystem(); - std::error_code ec; - fs.remove_all(paths.packages / action.spec.dir(), ec); + fs.remove_all(paths.packages / action.spec.dir(), VCPKG_LINE_INFO); System::printf(System::Color::success, "Purging package %s... done\n", display_name); } } diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index 9bc59cbe7..298095df6 100644 --- a/toolsrc/src/vcpkg/sourceparagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -1,5 +1,6 @@ #include "pch.h" +#include <vcpkg/logicexpression.h> #include <vcpkg/packagespec.h> #include <vcpkg/sourceparagraph.h> #include <vcpkg/triplet.h> @@ -142,7 +143,7 @@ namespace vcpkg } ParseExpected<SourceControlFile> SourceControlFile::parse_control_file( - std::vector<std::unordered_map<std::string, std::string>>&& control_paragraphs) + std::vector<Parse::RawParagraph>&& control_paragraphs) { if (control_paragraphs.size() == 0) { @@ -222,15 +223,8 @@ namespace vcpkg std::vector<std::string> ret; for (auto&& dep : deps) { - auto qualifiers = Strings::split(dep.qualifier, "&"); - if (std::all_of(qualifiers.begin(), qualifiers.end(), [&](const std::string& qualifier) { - if (qualifier.empty()) return true; - if (qualifier[0] == '!') - { - return t.canonical_name().find(qualifier.substr(1)) == std::string::npos; - } - return t.canonical_name().find(qualifier) != std::string::npos; - })) + const auto& qualifier = dep.qualifier; + if (qualifier.empty() || evaluate_expression(qualifier, t.canonical_name())) { ret.emplace_back(dep.name()); } @@ -238,6 +232,20 @@ namespace vcpkg return ret; } + std::vector<Features> filter_dependencies_to_features(const std::vector<vcpkg::Dependency>& deps, const Triplet& t) + { + std::vector<Features> ret; + for (auto&& dep : deps) + { + const auto& qualifier = dep.qualifier; + if (qualifier.empty() || evaluate_expression(qualifier, t.canonical_name())) + { + ret.emplace_back(dep.depend); + } + } + return ret; + } + std::vector<FeatureSpec> filter_dependencies_to_specs(const std::vector<Dependency>& deps, const Triplet& t) { return FeatureSpec::from_strings_and_triplet(filter_dependencies(deps, t), t); diff --git a/toolsrc/src/vcpkg/statusparagraph.cpp b/toolsrc/src/vcpkg/statusparagraph.cpp index 86946a31a..f7e00f21c 100644 --- a/toolsrc/src/vcpkg/statusparagraph.cpp +++ b/toolsrc/src/vcpkg/statusparagraph.cpp @@ -24,7 +24,7 @@ namespace vcpkg .push_back('\n'); } - StatusParagraph::StatusParagraph(std::unordered_map<std::string, std::string>&& fields) + StatusParagraph::StatusParagraph(Parse::RawParagraph&& fields) : want(Want::ERROR_STATE), state(InstallState::ERROR_STATE) { auto status_it = fields.find(BinaryParagraphRequiredField::STATUS); diff --git a/toolsrc/src/vcpkg/tools.cpp b/toolsrc/src/vcpkg/tools.cpp index 4f4b23055..7d56854c6 100644 --- a/toolsrc/src/vcpkg/tools.cpp +++ b/toolsrc/src/vcpkg/tools.cpp @@ -294,20 +294,6 @@ CMake suite maintained and supported by Kitware (kitware.com/cmake). } }; - static fs::path get_7za_path(const VcpkgPaths& paths) - { -#if defined(_WIN32) - static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "7zip").value_or_exit(VCPKG_LINE_INFO); - if (!paths.get_filesystem().exists(TOOL_DATA.exe_path)) - { - return fetch_tool(paths, "7zip", TOOL_DATA); - } - return TOOL_DATA.exe_path; -#else - Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot download 7zip for non-Windows platforms."); -#endif - } - struct NinjaProvider : ToolProvider { std::string m_exe = "ninja"; @@ -443,31 +429,21 @@ git version 2.17.1.windows.2 virtual const fs::path& get_tool_path(const VcpkgPaths& paths, const std::string& tool) const override { return path_only_cache.get_lazy(tool, [&]() { - // First deal with specially handled tools. - // For these we may look in locations like Program Files, the PATH etc as well as the auto-downloaded - // location. - if (tool == Tools::SEVEN_ZIP) return get_7za_path(paths); - if (tool == Tools::CMAKE || tool == Tools::GIT || tool == Tools::NINJA || tool == Tools::NUGET || - tool == Tools::IFW_INSTALLER_BASE) - return get_tool_pathversion(paths, tool).path; if (tool == Tools::IFW_BINARYCREATOR) return get_tool_path(paths, Tools::IFW_INSTALLER_BASE).parent_path() / "binarycreator.exe"; if (tool == Tools::IFW_REPOGEN) return get_tool_path(paths, Tools::IFW_INSTALLER_BASE).parent_path() / "repogen.exe"; - // For other tools, we simply always auto-download them. - const ToolData tool_data = parse_tool_data_from_xml(paths, tool).value_or_exit(VCPKG_LINE_INFO); - if (paths.get_filesystem().exists(tool_data.exe_path)) - { - return tool_data.exe_path; - } - return fetch_tool(paths, tool, tool_data); + return get_tool_pathversion(paths, tool).path; }); } const PathAndVersion& get_tool_pathversion(const VcpkgPaths& paths, const std::string& tool) const { return path_version_cache.get_lazy(tool, [&]() -> PathAndVersion { + // First deal with specially handled tools. + // For these we may look in locations like Program Files, the PATH etc as well as the auto-downloaded + // location. if (tool == Tools::CMAKE) { if (System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value()) @@ -495,7 +471,18 @@ git version 2.17.1.windows.2 if (tool == Tools::NUGET) return get_path(paths, NuGetProvider()); if (tool == Tools::IFW_INSTALLER_BASE) return get_path(paths, IfwInstallerBaseProvider()); - Checks::exit_with_message(VCPKG_LINE_INFO, "Finding version for %s is not implemented yet.", tool); + // For other tools, we simply always auto-download them. + auto maybe_tool_data = parse_tool_data_from_xml(paths, tool); + if (auto p_tool_data = maybe_tool_data.get()) + { + if (paths.get_filesystem().exists(p_tool_data->exe_path)) + { + return {p_tool_data->exe_path, p_tool_data->sha512}; + } + return {fetch_tool(paths, tool, *p_tool_data), p_tool_data->sha512}; + } + + Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown or unavailable tool: %s", tool); }); } diff --git a/toolsrc/src/vcpkg/userconfig.cpp b/toolsrc/src/vcpkg/userconfig.cpp index a7c4e2765..a3c019be7 100644 --- a/toolsrc/src/vcpkg/userconfig.cpp +++ b/toolsrc/src/vcpkg/userconfig.cpp @@ -51,7 +51,7 @@ namespace vcpkg { const auto& pghs = *p_pghs; - std::unordered_map<std::string, std::string> keys; + Parse::RawParagraph keys; if (pghs.size() > 0) keys = pghs[0]; for (size_t x = 1; x < pghs.size(); ++x) diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index 7a28fb571..e48340df7 100644 --- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -148,9 +148,8 @@ namespace vcpkg } if (Strings::starts_with(arg, "--scripts-root=")) { - parse_cojoined_value(arg.substr(sizeof("--scripts-root=") - 1), - "--scripts-root", - args.scripts_root_dir); + parse_cojoined_value( + arg.substr(sizeof("--scripts-root=") - 1), "--scripts-root", args.scripts_root_dir); continue; } if (arg == "--triplet") @@ -161,16 +160,14 @@ namespace vcpkg } if (Strings::starts_with(arg, "--overlay-ports=")) { - parse_cojoined_multivalue(arg.substr(sizeof("--overlay-ports=") - 1), - "--overlay-ports", - args.overlay_ports); + parse_cojoined_multivalue( + arg.substr(sizeof("--overlay-ports=") - 1), "--overlay-ports", args.overlay_ports); continue; } if (Strings::starts_with(arg, "--overlay-triplets=")) { - parse_cojoined_multivalue(arg.substr(sizeof("--overlay-triplets=") - 1), - "--overlay-triplets", - args.overlay_triplets); + parse_cojoined_multivalue( + arg.substr(sizeof("--overlay-triplets=") - 1), "--overlay-triplets", args.overlay_triplets); continue; } if (arg == "--debug") @@ -224,11 +221,11 @@ namespace vcpkg { const auto& key = arg.substr(0, eq_pos); const auto& value = arg.substr(eq_pos + 1); - + auto it = args.optional_command_arguments.find(key); if (args.optional_command_arguments.end() == it) { - args.optional_command_arguments.emplace(key, std::vector<std::string> { value }); + args.optional_command_arguments.emplace(key, std::vector<std::string>{value}); } else { @@ -370,8 +367,9 @@ namespace vcpkg { if (v.empty()) { - System::printf( - System::Color::error, "Error: The option '%s' must be passed an argument.\n", option.name); + System::printf(System::Color::error, + "Error: The option '%s' must be passed an argument.\n", + option.name); failed = true; } else @@ -389,7 +387,7 @@ namespace vcpkg System::printf(System::Color::error, "Unknown option(s) for command '%s':\n", this->command); for (auto&& option : options_copy) { - System::print2(" ", option.first, "\n"); + System::print2(" '", option.first, "'\n"); } System::print2("\n"); failed = true; @@ -425,12 +423,9 @@ namespace vcpkg System::printf(" %-40s %s\n", (option.name + "=..."), option.short_help_text); } System::printf(" %-40s %s\n", "--triplet <t>", "Set the default triplet for unqualified packages"); - System::printf(" %-40s %s\n", - "--overlay-ports=<path>", - "Specify directories to be used when searching for ports"); - System::printf(" %-40s %s\n", - "--overlay-triplets=<path>", - "Specify directories containing triplets files"); + System::printf( + " %-40s %s\n", "--overlay-ports=<path>", "Specify directories to be used when searching for ports"); + System::printf(" %-40s %s\n", "--overlay-triplets=<path>", "Specify directories containing triplets files"); System::printf(" %-40s %s\n", "--vcpkg-root <path>", "Specify the vcpkg directory to use instead of current directory or tool directory"); diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index d16acf2e8..bc46d2cfc 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -18,8 +18,9 @@ namespace vcpkg const std::string& default_vs_path, const std::vector<std::string>* triplets_dirs) { + auto& fs = Files::get_real_filesystem(); std::error_code ec; - const fs::path canonical_vcpkg_root_dir = fs::stdfs::canonical(vcpkg_root_dir, ec); + const fs::path canonical_vcpkg_root_dir = fs.canonical(vcpkg_root_dir, ec); if (ec) { return ec; @@ -42,7 +43,7 @@ namespace vcpkg if (auto odp = overriddenDownloadsPath.get()) { auto asPath = fs::u8path(*odp); - if (!fs::stdfs::is_directory(asPath)) + if (!fs::is_directory(fs.status(VCPKG_LINE_INFO, asPath))) { Metrics::g_metrics.lock()->track_property("error", "Invalid VCPKG_DOWNLOADS override directory."); Checks::exit_with_message( @@ -71,12 +72,12 @@ namespace vcpkg { if (scripts_dir->empty() || !fs::stdfs::is_directory(*scripts_dir)) { - Metrics::g_metrics.lock()->track_property("error", "Invalid scripts override directory."); - Checks::exit_with_message( - VCPKG_LINE_INFO, - "Invalid scripts override directory: %s; " - "create that directory or unset --scripts-root to use the default scripts location.", - scripts_dir->u8string()); + Metrics::g_metrics.lock()->track_property("error", "Invalid scripts override directory."); + Checks::exit_with_message( + VCPKG_LINE_INFO, + "Invalid scripts override directory: %s; " + "create that directory or unset --scripts-root to use the default scripts location.", + scripts_dir->u8string()); } paths.scripts = *scripts_dir; @@ -147,26 +148,25 @@ namespace vcpkg } Util::sort_unique_erase(output); return output; - }); + }); } const fs::path VcpkgPaths::get_triplet_file_path(const Triplet& triplet) const { - return m_triplets_cache.get_lazy(triplet, [&]()-> auto { - for (auto&& triplet_dir : triplets_dirs) - { - auto&& path = triplet_dir / (triplet.canonical_name() + ".cmake"); - if (this->get_filesystem().exists(path)) + return m_triplets_cache.get_lazy( + triplet, [&]() -> auto { + for (auto&& triplet_dir : triplets_dirs) { - return path; + auto&& path = triplet_dir / (triplet.canonical_name() + ".cmake"); + if (this->get_filesystem().exists(path)) + { + return path; + } } - } - Checks::exit_with_message(VCPKG_LINE_INFO, - "Error: Triplet file %s.cmake not found", - triplet.canonical_name()); - }); - + Checks::exit_with_message( + VCPKG_LINE_INFO, "Error: Triplet file %s.cmake not found", triplet.canonical_name()); + }); } const fs::path& VcpkgPaths::get_tool_exe(const std::string& tool) const diff --git a/toolsrc/vcpkg.sln b/toolsrc/vcpkg.sln index 8d0c849c6..b9f6ade65 100644 --- a/toolsrc/vcpkg.sln +++ b/toolsrc/vcpkg.sln @@ -1,4 +1,4 @@ -
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
diff --git a/toolsrc/vcpkg/vcpkg.vcxproj b/toolsrc/vcpkg/vcpkg.vcxproj index 8edea2244..917cd3b9c 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj +++ b/toolsrc/vcpkg/vcpkg.vcxproj @@ -147,4 +147,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
\ No newline at end of file +</Project>
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 2eff1abee..568d316c6 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -249,6 +249,7 @@ <ClCompile Include="..\src\vcpkg\help.cpp" />
<ClCompile Include="..\src\vcpkg\input.cpp" />
<ClCompile Include="..\src\vcpkg\install.cpp" />
+ <ClCompile Include="..\src\vcpkg\logicexpression.cpp" />
<ClCompile Include="..\src\vcpkg\metrics.cpp" />
<ClCompile Include="..\src\vcpkg\packagespec.cpp" />
<ClCompile Include="..\src\vcpkg\packagespecparseresult.cpp" />
@@ -274,4 +275,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
\ No newline at end of file +</Project>
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index aec56b039..1074a5116 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -108,6 +108,9 @@ <ClCompile Include="..\src\vcpkg\install.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vcpkg\logicexpression.cpp">
+ <Filter>Source Files\vcpkg</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vcpkg\metrics.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index e533d0e15..14ec1e105 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -144,4 +144,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
\ No newline at end of file +</Project>
diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index 4cda29461..d656de747 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -19,21 +19,19 @@ </ProjectConfiguration>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\tests.arguments.cpp" />
- <ClCompile Include="..\src\tests.chrono.cpp" />
- <ClCompile Include="..\src\tests.dependencies.cpp" />
- <ClCompile Include="..\src\tests.packagespec.cpp" />
- <ClCompile Include="..\src\tests.paragraph.cpp" />
- <ClCompile Include="..\src\tests.pch.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="..\src\tests.plan.cpp" />
- <ClCompile Include="..\src\tests.statusparagraphs.cpp" />
- <ClCompile Include="..\src\tests.update.cpp" />
- <ClCompile Include="..\src\tests.utils.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\arguments.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\catch.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\chrono.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\dependencies.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\files.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\paragraph.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\plan.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\specifier.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\statusparagraphs.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\strings.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\supports.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\update.cpp" />
+ <ClCompile Include="..\src\vcpkg-test\util.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj">
@@ -41,8 +39,8 @@ </ProjectReference>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\include\tests.pch.h" />
- <ClInclude Include="..\include\tests.utils.h" />
+ <ClInclude Include="..\include\vcpkg-test\catch.h" />
+ <ClInclude Include="..\include\vcpkg-test\util.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F27B8DB0-1279-4AF8-A2E3-1D49C4F0220D}</ProjectGuid>
@@ -66,7 +64,7 @@ <UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
@@ -84,7 +82,7 @@ <ImportGroup Label="Shared">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(SolutionDir)msbuild.x86.debug\$(ProjectName)\</IntDir>
<OutDir>$(SolutionDir)msbuild.x86.debug\</OutDir>
</PropertyGroup>
@@ -110,38 +108,34 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;$(VCInstallDir)UnitTest\include;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
- <PrecompiledHeaderFile>tests.pch.h</PrecompiledHeaderFile>
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
- <SubSystem>Windows</SubSystem>
+ <SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;$(VCInstallDir)UnitTest\include;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
- <PrecompiledHeaderFile>tests.pch.h</PrecompiledHeaderFile>
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
- <SubSystem>Windows</SubSystem>
+ <SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
@@ -149,19 +143,17 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\include;$(VCInstallDir)UnitTest\include;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
- <PrecompiledHeaderFile>tests.pch.h</PrecompiledHeaderFile>
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <SubSystem>Windows</SubSystem>
+ <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -171,19 +163,17 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\include;$(VCInstallDir)UnitTest\include;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
- <PrecompiledHeaderFile>tests.pch.h</PrecompiledHeaderFile>
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <SubSystem>Windows</SubSystem>
+ <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;$(VsInstallRoot)\VC\Auxiliary\VS\UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -193,4 +183,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
\ No newline at end of file +</Project>
diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters index 0f799426e..74a746af1 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters @@ -15,43 +15,52 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\tests.arguments.cpp">
+ <ClCompile Include="..\src\vcpkg-test\arguments.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.dependencies.cpp">
+ <ClCompile Include="..\src\vcpkg-test\catch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.packagespec.cpp">
+ <ClCompile Include="..\src\vcpkg-test\chrono.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.paragraph.cpp">
+ <ClCompile Include="..\src\vcpkg-test\dependencies.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.statusparagraphs.cpp">
+ <ClCompile Include="..\src\vcpkg-test\paragraph.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.plan.cpp">
+ <ClCompile Include="..\src\vcpkg-test\plan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.update.cpp">
+ <ClCompile Include="..\src\vcpkg-test\specifier.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.pch.cpp">
+ <ClCompile Include="..\src\vcpkg-test\statusparagraphs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.utils.cpp">
+ <ClCompile Include="..\src\vcpkg-test\supports.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\src\tests.chrono.cpp">
+ <ClCompile Include="..\src\vcpkg-test\update.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vcpkg-test\util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vcpkg-test\files.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vcpkg-test\strings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\include\tests.pch.h">
+ <ClInclude Include="..\include\vcpkg-tests\catch.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\include\tests.utils.h">
+ <ClInclude Include="..\include\vcpkg-tests\util.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
-</Project>
\ No newline at end of file +</Project>
|
