Vcpkg--vc++ Packaging Tools

Source: Internet
Author: User
Tags microsoft c visual studio 2010

Vcpkg--vc++ Packaging Tools

Vcpkg is a C/C + + Project package management tool, developed by the Microsoft C + + team that runs on Windows, to help you get the libraries for both C. and + + on the Windows platform.

Vcpkg itself is also developed using C + + (while other C + + package management is mostly not developed by C + +), and vcpkg helps users to better use these installed libraries in Visual Studio.

Vcpkg integrates git to build CMake of system integration, and most C + + projects can use CMake to create native project files and build them directly or indirectly.

Vcpkg follows the principle:

    • Open source

    • No installation Required

    • Support for re-sending builds

    • Custom Build

    • Community Engagement contributions

    • Port integration (similar to BSD Ports mechanism)

Installation and Bootstrap:

git clone https://github.  Com/microsoft/vcpkgCD vcpkgpowershell-exec bypass Scripts\bootstrap.ps1  

Search libraries:

Vcpkg Search

Installation Library:

Vcpkg Install CPPRESTSDK

To view the installed libraries:

Vcpkg List

To integrate the library into Visual Studio:

vcpkg Integrate Install

MSDN Introduction Blog:

https://blogs.msdn.microsoft.com/vcblog/2016/09/19/vcpkg-a-tool-to-acquire-and-build-c-open-source-libraries-on-windows/

Original: https://github.com/Microsoft/vcpkg/blob/master/README.md#

Vcpkg

Overview

Vcpkg can help you get to the C and C + + libraries of the Windows platform. This tool and ecosystem are in the preview phase. Your participation is very important to the success of Vcpkg.

Run Vcpkghelp to get a short description of the available commands.

Quick Tutorials

Requirements:

    • Visual Studio Update 3 or
    • Visual Studio 2017
    • CMake 3.8.0 or higher cadres (note: If you are not found on the machine, it will be automatically installed on your machine)
    • Git.exe Add to Path

Clone Vcpkg Library

C:\src\>git Clone Https://github.com/Microsoft/vcpkg.git

And then run

C:\SRC\>CD vcpkg

        c:\src\vcpkg>.\bootstrap-vcpkg.bat

PS d:\vcpkg>. \bootstrap-vcpkg.bat Microsoft (R) Build engine version 15.4.8.50001 for the. NET Framework Copyright (C) Microsoft Corporation. All rights reserved.     The build start time is 2017/12/2 0:10:17.     1> the Project "D:\vcpkg\toolsrc\dirs.proj" (the default target) on Node 1.     The 1> Project "D:\vcpkg\toolsrc\dirs.proj" (1) is generating "D:\vcpkg\toolsrc\vcpkg\vcpkg.vcxproj" (2) (clean target) on Node 1.     2>coreclean: Creating Directory "Release\". The 2> Project "D:\vcpkg\toolsrc\vcpkg\vcpkg.vcxproj" (2) is generating "D:\vcpkg\toolsrc\vcpkglib\vcpkglib.vcxproj" (3) on Node 1 (clean     Target).     3>coreclean: Creating Directory "Release\".     3> has completed the build project "D:\vcpkg\toolsrc\vcpkglib\vcpkglib.vcxproj" (clean target) operation.     2> has completed the build project "D:\vcpkg\toolsrc\vcpkg\vcpkg.vcxproj" (clean target) operation. 1> project "D:\vcpkg\toolsrc\dirs.proj" (1) is being generated on Node 1 "D:\vcpkg\toolsrc\vcpkgmetricsuploader\     Vcpkgmetricsuploader.vcxproj "(4) (clean target).     4>coreclean: Creating Directory "Release\".     4> has completed the build project "D:\vcpkg\toolsrc\vcpkgmetricsuploader\vcpkgmetricsuploader.vcxproj" (clean target) operation. 1> Project "D:\VCPKG\TOOLSRC\dirs.proj "(1) is generating" D:\vcpkg\toolsrc\vcpkg\vcpkg.vcxproj "(2:2) on Node 1 (build target). The 2:2> Project "D:\vcpkg\toolsrc\vcpkg\vcpkg.vcxproj" (2:2) is generating "D:\vcpkg\toolsrc\vcpkglib\vcpkglib.vcxproj" (3:4) on Node 1 (     Default target).         3>prepareforbuild: Creating Directory "D:\vcpkg\toolsrc\Release\".       Creating directory "Release\vcpkglib.tlog\".       Initializebuildstatus: "Release\vcpkglib.tlog\unsuccessfulbuild" is being created because "AlwaysCreate" is specified. Clcompile:c:\program Files (x86) \microsoft Visual Studio\2017\community\vc\tools\msvc\14.11.25503\bin\hostx86\x86 \CL.EXE/C/I.. \include/zi/nologo/w3/wx-/diagnostics:classic/sdl/mp/o2/oi/oy-/gl/d disable_metrics=0/d "VCPKG_VERSI On=-2017-12-01-34d8c77d35089484f66d80299dc6f8303a994a84 "/d _mbcs/d ndebug/d _mbcs/gm-/ehsc/md/gs/gy/fp:p Recise/zc:wchar_t/zc:forscope/zc:inline/yc "pch.h"/fp "release\vcpkglib.pch"/fo "release\\"/Fd "RELEASE\VCPKGL Ib.pdb "/gd/tp/analyze-/errorreport:queue/std:c++latest. \srC\pch.cpp pch.cpp C:\Program Files (x86) \microsoft Visual studio\2017\community\vc\tools\msvc\14.11.25503\ BIN\HOSTX86\X86\CL.EXE/C/I.. \include/zi/nologo/w3/wx-/diagnostics:classic/sdl/mp/o2/oi/oy-/gl/d disable_metrics=0/d "VCPKG_VERSI On=-2017-12-01-34d8c77d35089484f66d80299dc6f8303a994a84 "/d _mbcs/d ndebug/d _mbcs/gm-/ehsc/md/gs/gy/fp:p Recise/zc:wchar_t/zc:forscope/zc:inline/yu "pch.h"/fp "release\vcpkglib.pch"/fo "release\\"/Fd "RELEASE\VCPKGL Ib.pdb "/gd/tp/analyze-/errorreport:queue/std:c++latest. \src\vcpkg\base\checks.cpp. \s Rc\vcpkg\base\chrono.cpp. \src\vcpkg\base\cofffilereader.cpp. \src\vcpkg\base\enums.cpp. \src\vcpkg\base\fi Les.cpp. \src\vcpkg\base\lineinfo.cpp. \src\vcpkg\base\machinetype.cpp. \src\vcpkg\base\strings.cpp. \src Vcpkg\base\system.cpp. \src\vcpkg\binaryparagraph.cpp. \src\vcpkg\build.cpp. \src\vcpkg\commands.autocomple Te.cpp. \src\vCpkg\commands.buildexternal.cpp. \src\vcpkg\commands.cache.cpp.         \src\vcpkg\commands.ci.cpp. \src\vcpkg\commands.contact.cpp. \src\vcpkg\commands.cpp. \src\vcpkg\commands.create.cpp. \src\vcpkg\comman Ds.dependinfo.cpp. \src\vcpkg\commands.edit.cpp. \src\vcpkg\commands.env.cpp. \SRC\VCPKG\COMMANDS.EXPORTIFW. cpp. \src\vcpkg\commands.hash.cpp. \src\vcpkg\commands.import.cpp. \src\vcpkg\commands.integrate.cpp. \SR C\vcpkg\commands.list.cpp. \src\vcpkg\commands.owns.cpp. \src\vcpkg\commands.portsdiff.cpp. \src\vcpkg\comm Ands.search.cpp. \src\vcpkg\commands.version.cpp. \src\vcpkg\dependencies.cpp. \src\vcpkg\export.cpp. \src \vcpkg\globalstate.cpp. \src\vcpkg\help.cpp. \src\vcpkg\input.cpp. \src\vcpkg\install.cpp. \src\vcpkg\metr Ics.cpp. \src\vcpkg\packagespec.cpp. \src\vcpkg\packagespecparseresult.cpp. \src\vcpkg\paragraphparseresult. cpp. \src\vcpkg\paragraphs.cpp. \src\vcpkg\parse.cpp. \src\Vcpkg\postbuildlint.buildtype.cpp. \src\vcpkg Postbuildlint.cpp. \src\vcpkg\remove.cpp. \src\vcpkg\sourceparagraph.cpp.         \src\vcpkg\statusparagraph.cpp. \src\vcpkg\statusparagraphs.cpp. \src\vcpkg\triplet.cpp. \src\vcpkg\update.cpp. \src\vcpkg\vcpkgcmdargument S.cpp. \src\vcpkg\vcpkglib.cpp. \src\vcpkg\vcpkgpaths.cpp. \src\vcpkg\versiont.cpp checks.cpp chrono.cpp cofffilereader.cpp enums.cpp files.c         PP lineinfo.cpp machinetype.cpp strings.cpp system.cpp binaryparagraph.cpp Build.cpp commands.autocomplete.cpp commands.buildexternal.cpp commands.cache.cpp command         S.ci.cpp commands.contact.cpp commands.cpp commands.create.cpp commands.dependinfo.cpp Commands.edit.cpp commands.env.cpp commands.exportifw.cpp commands.hash.cpp commands. Import.cpp Commands.integraTe.cpp commands.list.cpp commands.owns.cpp commands.portsdiff.cpp commands.search.cpp Commands.version.cpp dependencies.cpp export.cpp globalstate.cpp help.cpp Inpu T.cpp install.cpp metrics.cpp Packagespec.cpp packagespecparseresult.cpp Paragraph         Parseresult.cpp paragraphs.cpp parse.cpp postbuildlint.buildtype.cpp postbuildlint.cpp         Remove.cpp sourceparagraph.cpp statusparagraph.cpp statusparagraphs.cpp triplet.cpp Update.cpp vcpkgcmdarguments.cpp vcpkglib.cpp vcpkgpaths.cpp versiont.cpp Lib         : C:\Program Files (x86) \microsoft Visual Studio\2017\community\vc\tools\msvc\14.11.25503\bin\hostx86\x86\lib.ex E/out: "D:\vcpkg\toolsrc\Release\vcpkglib.lib"/NOLOGO/LTCG release\pch.obj release\checks.obj Rel         Ease\chrono.objRelease\cofffilereader.obj release\enums.obj release\files.obj release\lineinfo.obj Releas E\machinetype.obj release\strings.obj release\system.obj release\binaryparagraph.obj Relea Se\build.obj release\commands.autocomplete.obj release\commands.buildexternal.obj Release\commands . cache.obj release\commands.ci.obj release\commands.contact.obj release\commands.obj Relea Se\commands.create.obj release\commands.dependinfo.obj release\commands.edit.obj Release\commands.         Env.obj release\commands.exportifw.obj release\commands.hash.obj Release\commands.import.obj Release\commands.integrate.obj release\commands.list.obj release\commands.owns.obj Release\comm Ands.portsdiff.obj release\commands.search.obj release\commands.version.obj RELEASE\DEPENDENCIES.O BJ Release\exporT.obj release\globalstate.obj release\help.obj release\input.obj release\install.obj Release\metrics.obj release\packagespec.obj release\packagespecparseresult.obj Release\paragrap         Hparseresult.obj release\paragraphs.obj release\parse.obj Release\postbuildlint.buildtype.obj Release\postbuildlint.obj release\remove.obj release\sourceparagraph.obj Release\statusparagra Ph.obj release\statusparagraphs.obj release\triplet.obj release\update.obj release\vcpkgcm Darguments.obj release\vcpkglib.obj release\vcpkgpaths.obj release\versiont.obj VCPKGLIB.V Cxproj-D:\vcpkg\toolsrc\Release\vcpkglib.lib finalizebuildstatus: Deleting files "Release\vcpkglib.tlog\unsucce         Ssfulbuild ".     A Touch task is being performed on "Release\vcpkglib.tlog\vcpkglib.lastbuildstate". 3> has completed the build project "D:\vcpkg\toolsrc\vcpkglib\vcpkglib.vcxproj" (DefaultThe target) operation.       2>prepareforbuild: Creating Directory "Release\vcpkg.tlog\".       Initializebuildstatus: "Release\vcpkg.tlog\unsuccessfulbuild" is being created because "AlwaysCreate" is specified. Clcompile:c:\program Files (x86) \microsoft Visual Studio\2017\community\vc\tools\msvc\14.11.25503\bin\hostx86\x86 \CL.EXE/C/I.. \include/zi/nologo/w3/wx-/diagnostics:classic/sdl/mp/o2/oi/oy-/gl/d _mbcs/d ndebug/d _MB cs/gm-/EH Sc/md/gs/gy/fp:precise/zc:wchar_t/zc:forscope/zc:inline/fo "release\\"/fd "release\vc141.pdb"/gd/tp/ana lyze-/errorreport:queue/std:c++latest. \src\vcpkg.cpp vcpkg.cpp Link:c:\program Files (x86) \microsoft Visual Studio\2017\community\vc\tool S\MSVC\14.11.25503\BIN\HOSTX86\X86\LINK.E xe/errorreport:queue/out: "D:\vcpkg\toolsrc\Release\vcpkg.exe"/nologo Winhttp.lib version.lib kernel32.lib u ser32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole3 2.lib Oleaut32.lib UUID. lib Odbc32. Lib Odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.li b o Leaut32.lib uuid.lib odbc32.lib odbccp32.lib/manifest/manifestuac: "level= ' AsInvoker ' uiaccess= ' false '"/M Anifes T:EMBED/DEBUG:FULL/PDB: "D:\vcpkg\toolsrc\Release\vcpkg.pdb"/opt:ref/opt:icf/ltcg:incremental/tlbid:1/dynam Icbase/nxcompat/implib: "D:\vcpkg\toolsrc\Release\vcpkg.lib"/machine:x86/safeseh release\vcpkg.obj D:\vcpkg\too Lsrc\release\vcpkglib.lib Generating code All 11899 functions were compiled because no usable ipdb/iobj from Previo         US compilation was found. Completed code generation Vcpkg.vcxproj-D:\vcpkg\toolsrc\Release\vcpkg.exe finalizebuildstatus: Deleting files "release\         Vcpkg.tlog\unsuccessfulbuild ".     A Touch task is being performed on "Release\vcpkg.tlog\vcpkg.lastbuildstate".     2> has completed the build project "D:\vcpkg\toolsrc\vcpkg\vcpkg.vcxproj" (build target) operation. 1> project "D:\vcpkg\toolsrc\dirs.proj" (1) node in progressGenerate "D:\vcpkg\toolsrc\vcpkgmetricsuploader\vcpkgmetricsuploader.vcxproj" (4:2) (build target) on 1.       4>prepareforbuild: Creating Directory "Release\vcpkgmet.7d6fdeeb.tlog\".       Initializebuildstatus: "Release\vcpkgmet.7d6fdeeb.tlog\unsuccessfulbuild" is being created because "AlwaysCreate" is specified. Clcompile:c:\program Files (x86) \microsoft Visual Studio\2017\community\vc\tools\msvc\14.11.25503\bin\hostx86\x86 \CL.EXE/C/I.. \include/zi/nologo/w3/wx-/diagnostics:classic/sdl/mp/o2/oi/oy-/gl/d _mbcs/d ndebug/d _MB cs/gm-/EH Sc/md/gs/gy/fp:precise/zc:wchar_t/zc:forscope/zc:inline/fo "release\\"/fd "release\vc141.pdb"/gd/tp/ana lyze-/errorreport:queue/std:c++latest.  \src\vcpkgmetricsuploader.cpp vcpkgmetricsuploader.cpp Link:c:\program Files (x86) \microsoft Visual STUDIO\2017\COMMUNITY\VC\TOOLS\MSVC\14.11.25503\BIN\HOSTX86\X86\LINK.E xe/errorreport:queue/out: "D:\vcpkg\tools Rc\release\vcpkgmetricsuploader. exe "/nologo winhttp.lib version.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib sh Ell32.lib ole32.lib oleaut32.lib u uid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib Comdlg32.lib advapi32.lib Shell 32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib/manifest/manifest UAC: "level= ' AsInvoker ' Uiacc ess= ' false '"/manifest:embed/debug:full/pdb: "D:\VCPKG\TOOLSRC\RELEASE\VCPKGMETRICSU Ploader.pdb "/opt:ref/op t:icf/ltcg:incremental/tlbid:1/dynamicbase/nxcompat/implib:" D:\vcpkg\toolsrc\Releas E\vcpkgmetricsuploader. Lib "/machine:x86/safeseh Release\vcpkgmetricsuploader.obj D:\vcpkg\toolsrc\Relea Se\vcpkglib.lib Generating code All 1535 functions were compiled because no usable ipdb/iobj from previous Compilat         Ion was found. Completed code generation Vcpkgmetricsuploader.vcxproj-D:\vcpkg\toolsrc\Release\vcpkgmetricsuploader.exe Finalizebuilds TATUs: Deleting file "Release\vcpkgmet.7d6fdeeb.tlog\unsuccessfulbuild".     A Touch task is being performed on "Release\vcpkgmet.7d6fdeeb.tlog\vcpkgmetricsuploader.lastbuildstate".     4> has completed the build project "D:\vcpkg\toolsrc\vcpkgmetricsuploader\vcpkgmetricsuploader.vcxproj" (build target) operation. 1> has completed the build project "D:\vcpkg\toolsrc\dirs.proj" (the default target) operation.    The build was successful. 0 Warnings 0 Error time 00:00:28.30

Then, run the following command to make the vcpkg available to all users of the computer (note: Administrator privileges are required)

C:\src\vcpkg>. \vcpkg Integrate Install

PS d:\vcpkg>. \vcpkg integrate installapplied User-wide integration for this vcpkg root. All MSBuild C + + projects can now #include any installed libraries. Linking'll be handled automatically. Installing new libraries would make them instantly available.  CMake projects should use: "-dcmake_toolchain_file=d:/vcpkg/scripts/buildsystems/vcpkg.cmake"

Use Vcpkg to install any package, such as:

c:\src\vcpkg>. \vcpkginstall Sdl2 Curl

Finally, you create a new project in Visual Studio or Visual Studio 2017 or open a project that already exists. You can use the # include reference header file and use the installed library.

Example SQLite installation

Query the name of SQLite

vcpkg.exe search sqlitelibodb-sqlite        2.4.0            Sqlite support for the ODB ORM librarysqlite3              3.15.0           SQLite is a software library that implements a se...If your library is not listed, please open an issue at:    https://github.com/Microsoft/vcpkg/issues

Then install Sqlite3

Vcpkg.exe Install sqlite3--current_installed_dir=d:/vcpkg/installed/x86-windows--downloads=d:/vcpkg/downloads-- current_packages_dir=d:/vcpkg/packages/sqlite3_x86-windows--current_buildtrees_dir=d:/vcpkg/buildtrees/ sqlite3--current_port_dir=d:/vcpkg/ports/sqlite3/.--Downloading https://sqlite.org/2016/ sqlite-amalgamation-3150000.zip...--Downloading Https://sqlite.org/2016/sqlite-amalgamation-3150000.zip ... ok--testing integrity of downloaded file...--testing integrity of downloaded file ... ok--extracting source d:/vcpkg/downloads/sqlite-amalgamation-3150000.zip--extracting done--Configuring x86-windows-rel--configuring X86-windows-rel done--Configuring x86-windows-dbg--Configuring x86-windows-dbg done-- Build x86-windows-rel--Build X86-windows-rel done--build x86-windows-dbg--build x86-windows-dbg done--Package X86-win  dows-rel--Package X86-windows-rel done--Package x86-windows-dbg--package x86-windows-dbg done--warning:could not find A matching PDB file for:d:/vcpkg/packages/sqlite3_x86-windows/bin/sqlite3.dll d:/vcpkg/packages/sqlite3_x86-windows/debug/bin/ sqlite3.dll--performing post-build validation--performing post-build validation donepackage sqlite3:x86-windows is Installed

Confirm that the installation is successful

Vcpkg.exe List

Installing the 64-bit version

Vcpkg.exe Install Sqlite3:x64-windows

Use

Open the new project for Visual Studio 2015, main.cpp as follows

#include <sqlite3.h>#include <stdio.h>int main(int argc,char** argv){    printf("%s\n",sqlite3_libversion()):    return 0;}

Compile run

FAQs
    • is Visual Studio 2010 supported?
      No, I'll introduce the "knowledge points" that VCPKG uses to help you develop the tools for visual Studio 2010.

    • Whether to support the static compilation library
      Yes, for examplevcpkg.exe install xxx:x86-windows-static

    • What about the library I need?
      Write yourself, follow-up I'll show you how to add a library to vcpkg

Vcpkg--vc++ Packaging Tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.