Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

C++ Library Manager for Windows, Linux, and MacOS

License

NotificationsYou must be signed in to change notification settings

cemu-project/vcpkg

 
 

Repository files navigation

中文总览

Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS.This tool and ecosystem are constantly evolving, and we always appreciate contributions!

If you've never used vcpkg before, or if you're trying to figure out how to use vcpkg,check out ourGetting Started section for how to start using vcpkg.

For short description of available commands, once you've installed vcpkg,you can runvcpkg help, orvcpkg help [command] for command-specific help.

Build Status

Table of Contents

Getting Started

First, follow the quick start guide for eitherWindows, ormacOS and Linux,depending on what you're using.

For more information, seeInstalling and Using Packages.If a library you need is not present in the vcpkg catalog,you canopen an issue on the GitHub repowhere the vcpkg team and community can see it,and potentially add the port to vcpkg.

After you've gotten vcpkg installed and working,you may wish to addtab completion to your shell.

Finally, if you're interested in the future of vcpkg,check out themanifest guide!This is an experimental feature and will likely have bugs,so try it out andopen all the issues!

Quick Start: Windows

Prerequisites:

  • Windows 7 or newer
  • Git
  • Visual Studio 2015 Update 3 or greater with the English language pack

First, download and bootstrap vcpkg itself; it can be installed anywhere,but generally we recommend using vcpkg as a submodule for CMake projects,and installing it globally for Visual Studio projects.We recommend somewhere likeC:\src\vcpkg orC:\dev\vcpkg,since otherwise you may run into path issues for some port build systems.

> git clone https://github.com/microsoft/vcpkg> .\vcpkg\bootstrap-vcpkg.bat

To install the libraries for your project, run:

> .\vcpkg\vcpkg install [packages to install]

You can also search for the libraries you need with thesearch subcommand:

> .\vcpkg\vcpkg search [search term]

In order to use vcpkg with Visual Studio,run the following command (may require administrator elevation):

> .\vcpkg\vcpkg integrate install

After this, you can now create a New non-CMake Project (or open an existing one).All installed libraries are immediately ready to be#include'd and usedin your project without additional configuration.

If you're using CMake with Visual Studio,continuehere.

In order to use vcpkg with CMake outside of an IDE,you can use the toolchain file:

> cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake> cmake --build [build directory]

With CMake, you will still need tofind_package and the like to use the libraries.Check out theCMake section for more information,including on using CMake with an IDE.

For any other tools, including Visual Studio Code,check out theintegration guide.

Quick Start: Unix

Prerequisites for Linux:

Prerequisites for macOS:

First, download and bootstrap vcpkg itself; it can be installed anywhere,but generally we recommend using vcpkg as a submodule for CMake projects.

$ git clone https://github.com/microsoft/vcpkg$ ./vcpkg/bootstrap-vcpkg.sh

To install the libraries for your project, run:

$ ./vcpkg/vcpkg install [packages to install]

You can also search for the libraries you need with thesearch subcommand:

$ ./vcpkg/vcpkg search [search term]

In order to use vcpkg with CMake, you can use the toolchain file:

$ cmake -B [build directory] -S. -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake$ cmake --build [build directory]

With CMake, you will still need tofind_package and the like to use the libraries.Check out theCMake sectionfor more information on how best to use vcpkg with CMake,and CMake Tools for VSCode.

For any other tools, check out theintegration guide.

Installing Linux Developer Tools

Across the different distros of Linux, there are different packages you'llneed to install:

  • Debian, Ubuntu, popOS, and other Debian-based distributions:
$ sudo apt-get update$ sudo apt-get install build-essential tar curl zip unzip
  • CentOS
$ sudo yum install centos-release-scl$ sudo yum install devtoolset-7$ sclenable devtoolset-7 bash

For any other distributions, make sure you're installing g++ 6 or above.If you want to add instructions for your specific distro,please open a PR!

Installing macOS Developer Tools

On macOS 10.15, the only thing you should need to do is run the following in your terminal:

$ xcode-select --install

Then follow along with the prompts in the windows that comes up.

On macOS 10.14 and previous, you'll also need to install g++ from homebrew;follow the instructions in the following section.

Installing GCC for macOS before 10.15

This willonly be necessary if you're using a macOS version from before 10.15.Installing homebrew should be very easy; check out <brew.sh> for more information,but at its simplest, run the following command:

$ /bin/bash -c"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Then, in order to grab an up-to-date version of gcc, run the following:

$ brew install gcc

You'll then be able to bootstrap vcpkg along with thequick start guide

Using vcpkg with CMake

If you're using vcpkg with CMake, the following may help!

Visual Studio Code with CMake Tools

Adding the following to your workspacesettings.json will makeCMake Tools automatically use vcpkg for libraries:

{"cmake.configureSettings": {"CMAKE_TOOLCHAIN_FILE":"[vcpkg root]/scripts/buildsystems/vcpkg.cmake"  }}

Vcpkg with Visual Studio CMake Projects

Open the CMake Settings Editor, and underCMake toolchain file,add the path to the vcpkg toolchain file:

[vcpkg root]/scripts/buildsystems/vcpkg.cmake

Vcpkg with CLion

Open the Toolchains settings(File > Settings on Windows and Linux, CLion > Preferences on macOS),and go to the CMake settings (Build, Execution, Deployment > CMake).Finally, inCMake options, add the following line:

-DCMAKE_TOOLCHAIN_FILE=C:/Users/nimazzuc/src/vcpkg/scripts/buildsystems/vcpkg.cmake

Unfortunately, you'll have to add this to each profile.

Vcpkg as a Submodule

When using vcpkg as a submodule of your project,you can add the following to your CMakeLists.txt before the firstproject() call,instead of passingCMAKE_TOOLCHAIN_FILE to the cmake invocation.

set(CMAKE_TOOLCHAIN_FILE${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmakeCACHESTRING"Vcpkg toolchain file")

This will still allow people to not use vcpkg,by passing theCMAKE_TOOLCHAIN_FILE directly,but it will make the configure-build step slightly easier.

Quick Start: Manifests

So, you want to look at what the future of vcpkg is going to be like!We really appreciate it 😄. First, though, a warning:manifest support in vcpkg is still in beta! Mostly, it should just work,but there are no guarantees and it's likely you'll hit at least a bug or twowhile you're using vcpkg in this mode. Additionally,we will likely break behavior before stabilizing, so be forewarned.Pleaseopen issues if you hit any bugs!

First, install vcpkg as normal forWindows orUnix.You may wish to install vcpkg in a central place,as the installed directory exists locally,and it's fine to run multiple vcpkg commands from the samevcpkg directory at the same time.

Then, we must turn on themanifests vcpkg feature flag by addingmanifests to the comma-separated--feature-flags option,or by adding it to the comma-separatedVCPKG_FEATURE_FLAGSenvironment variable.

You may also want to add vcpkg to thePATH.

Then, all one has to do is create a manifest;create a file calledvcpkg.json, and type the following:

{"name":"<name of your project>","version-string":"<version of your project>","dependencies": ["abseil","boost"  ]}

The libraries will be installed into thevcpkg_installeddirectory, in the same directory as yourvcpkg.json.If you can use the regular CMake toolchain,or the Visual Studio/MSBuild integration,it will install the dependencies automatically,although you will need to setVcpkgManifestEnabled toOn for MSBuild.If you wish to install your dependencies without using either CMake or MSBuild,you may use a simplevcpkg install --feature-flags=manifests

For more information, check out themanifestspecification.

Tab-Completion/Auto-Completion

vcpkg supports auto-completion of commands, package names,and options in both powershell and bash.To enable tab-completion in the shell of your choice, run:

> .\vcpkg integrate powershell

or

$ ./vcpkg integrate bash

depending on the shell you use, then restart your console.

Examples

See thedocumentation for specific walkthroughs,includinginstalling and using a package,adding a new package from a zipfile,andadding a new package from a GitHub repo.

Our docs are now also available online at ReadTheDocs:https://vcpkg.readthedocs.io/!

See a 4 minutevideo demo.

Contributing

Vcpkg is an open source project, and is thus built with your contributions.Here are some ways you can contribute:

Please refer to ourContributing Guide for more details.

This project has adopted theMicrosoft Open Source Code of Conduct.For more information see theCode of Conduct FAQor emailopencode@microsoft.comwith any additional questions or comments.

License

The code in this repository is licensed under theMIT License.

Telemetry

vcpkg collects usage data in order to help us improve your experience.The data collected by Microsoft is anonymous.You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,passing --disable-metrics to vcpkg on the command line,or by setting the VCPKG_DISABLE_METRICS environment variable.

Read more about vcpkg telemetry at docs/about/privacy.md

About

C++ Library Manager for Windows, Linux, and MacOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CMake58.6%
  • C++35.5%
  • C2.4%
  • PowerShell2.1%
  • PHP0.4%
  • Perl0.4%
  • Other0.6%

[8]ページ先頭

©2009-2025 Movatter.jp