c5f01e1dee
* Add iOS community triplets and toolchain support Added an iOS toolchain to enable building packages for iOS. The toolchain is used when a triplet's VCPKG_CMAKE_SYSTEM_NAME is set to iOS. To configure which architecture should be built, as well as other iOS specifics, the following triplet variables can be set: - VCPKG_TARGET_ARCHITECTURE - VCPKG_OSX_SYSROOT - VCPKG_OSX_DEPLOYMENT_TARGET - VCPKG_OSX_ARCHITECTURES The following VCPKG_TARGET_ARCHITECTURE values are currently supported: - arm, arm64, x64, x86. The following VCPKG_OSX_SYSROOT values are currently supported: - iphoneos, iphonesimulator, or an absolute path to the device or simulator Xcode SDK. VCPKG_OSX_DEPLOYMENT_TARGET can be set to control the minimum iOS delopyment target for the built libraries. CMAKE_OSX_ARCHITECTURES is derived from VCPKG_TARGET_ARCHITECTURE, so generally it should not be set. In case if someone needs to target a more specific architecture (like armv7k or arm64e), it can be set in the triplet via VCPKG_OSX_ARCHITECTURES. Note that only certain combinations of the architecture and sysroot will work: simulator SDKs only provide x86-based libraries, etc. The toolchain also sets CMAKE_SYSTEM_PROCESSOR for certain configurations, because certain packages (like libpng) depend on the processor type. Added 4 community iOS triplets that build static libraries: - arm-ios, arm64-ios, x86-ios, x64-ios. The non-arm triplets target the iOS simulator. The triplets build static libraries because they are easiest to integrate into an iOS project. Dynamic libraries or frameworks require code signing on iOS, which complicates integration. Added heuristics to try and automatically detect what iOS triplet to use when building your own CMake project (so when a CMake project sets CMAKE_TOOLCHAIN_FILE to buildsystems/vcpkg.cmake), if no explicit triplet is provided (VCPKG_TARGET_TRIPLET is undefined). The heuristic checks for the values of CMAKE_SYSTEM_NAME and CMAKE_OSX_ARCHITECTURES. Note that for this to work, CMAKE_OSX_ARCHITECTURES needs to be set before the first project() call in your CMake project. Added workaround so find_package finds vcpkg installed packages when targeting iOS. This is done by saving / restoring the value of CMAKE_FIND_ROOT_PATH while also adding the vcpkg package root in the find_package override macro. The workaround can be removed once vcpkg upgrades to CMake 3.15.0 or higher where the issue is fixed. Fixes: #6003 * Fix building libpng and pcre2 targetting iOS Fixes: #6003 |
||
---|---|---|
.github | ||
docs | ||
ports | ||
scripts | ||
toolsrc | ||
triplets | ||
.gitattributes | ||
.gitignore | ||
.vcpkg-root | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
LICENSE.txt | ||
NOTICE.txt | ||
README.md | ||
README_zh_CN.md | ||
bootstrap-vcpkg.bat | ||
bootstrap-vcpkg.sh |
README.md
Vcpkg
Overview
Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This tool and ecosystem are constantly evolving; your involvement is vital to its success!
For short description of available commands, run vcpkg help
.
- Github: https://github.com/microsoft/vcpkg
- Slack: https://cpplang.now.sh/, the #vcpkg channel
- Docs: Documentation
Windows (x86, x64, arm, uwp) | MacOS | Linux |
---|---|---|
Quick Start
Prerequisites:
- Windows 10, 8.1, 7, Linux, or MacOS
- Visual Studio 2015 Update 3 or newer (on Windows)
- Git
- gcc >= 7 or equivalent clang (on Linux)
- Optional: CMake 3.12.4
To get started:
> git clone https://github.com/Microsoft/vcpkg.git
> cd vcpkg
PS> .\bootstrap-vcpkg.bat
Linux:~/$ ./bootstrap-vcpkg.sh
Then, to hook up user-wide integration, run (note: requires admin on first use)
PS> .\vcpkg integrate install
Linux:~/$ ./vcpkg integrate install
Install any packages with
PS> .\vcpkg install sdl2 curl
Linux:~/$ ./vcpkg install sdl2 curl
The best way to use installed libraries with CMake is via the toolchain file scripts\buildsystems\vcpkg.cmake
. To use this file, you simply need to add it onto your CMake command line as -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake
.
In Visual Studio, you can create a New Project (or open an existing one). All installed libraries are immediately ready to be #include
'd and used in your project without additional configuration.
For more information, see our using a package example for the specifics. If your library is not present in vcpkg catalog, you can open an issue on the GitHub repo where the dev team and the community can see it and potentially create the port file for this library.
Additional notes on macOS and Linux support can be found in the official announcement.
Tab-Completion / Auto-Completion
vcpkg
supports auto-completion of commands, package names, options etc in Powershell and bash. To enable tab-completion, use one of the following:
PS> .\vcpkg integrate powershell
Linux:~/$ ./vcpkg integrate bash
and restart your console.
Examples
See the documentation for specific walkthroughs, including installing and using a package, adding a new package from a zipfile, and adding a new package from a GitHub repo.
Our docs are now also available online at ReadTheDocs: https://vcpkg.readthedocs.io/!
See a 4 minute video demo.
Contributing
Vcpkg is built with your contributions. Here are some ways you can contribute:
- Submit Issues in vcpkg or existing packages
- Submit Fixes and New Packages
Please refer to our Contribution guidelines for more details.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
License
Code licensed under the MIT License.