Linux mood color, Mac OS mood color

Original author: Eric Mittelette
  • Transfer
Stereotypes are long gone. Today, Microsoft adheres to the concept of "any developer, any application, any platform." Today we will tell you about vcpkg, a cross-platform package manager designed for quick installation of C / C ++ libraries, which is now available not only for Windows, but also for Linux and Mac OS. Look under the cat!



Now you can instantly access the vcpkg directory with C ++ libraries on two more platforms by doing just two simple steps that are familiar with Windows and UWP.

The vcpkg plugin has come a long way since its first presentation at the CppCon 2016 conference. Initially, there were only 20 libraries, but over the past 19 months their number has grown incredibly - to more than 900! This is an invaluable merit of the wonderful members of our community.

Judging by your reviews, it was the support of Linux and Mac systems that turned out to be the most popular of potential possibilities. And today we see that the vcpkg plugin has become available to a much larger number of users, simplifying cross-platform access to even more C ++ libraries. Today we suggest you evaluate the work with vcpkg on Windows, Linux or Mac OS.

Using vcpkg on Linux and Mac


The vcpkg plug-in now supports compatibility with Linux, Mac, and other POSIX systems. This was only possible thanks to the personal contribution of several remarkable community members to the development.

At the time of writing this blog post for Linux and Mac, there were over 300 libraries, and we expect to see many more soon. We are currently testing vcpkg on Ubuntu-LTS 16.04 / 18.04; we have successfully tested this new tool in Arch, Fedora, and FreeBSD.

Beginning of work


  1. Clone the vcpkg repository: git clone https://github.com/Microsoft/vcpkg
  2. Run the vcpkg bootloader: ./bootstrap-vcpkg.sh
  3. After installing vcpkg, you can create any library using the following syntax:
    vcpkg install sdl2

    It will be installed sdl2:x64-linux(by default, the stationary 64-bit version is installed, while it is the only one available for Linux).

    The result (.h, .lib) is saved in the same folder tree, and this folder should be referenced in the assembly management system configuration.
  4. Work with the created library:
    • If you use CMake CMAKE_TOOLCHAIN_FILEas the build management system, use to open libraries for `find_package()`. For example: cmake .. “-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake”.
    • You must make a link to the vcpkg folder, which contains the headers (\ vcpkg \ installed \ x64-linux \ include), as well as the .lib folder (\ vcpkg \ installed \ x64-linux \ lib) in order to create the project using the generated libraries .





Using vcpkg to bind to Linux from Windows via WSL


Since WSL is a Linux system, we will use it similarly to Linux. Once you configure it correctly once, you will create Linux libraries on a Windows computer exactly as if they were generated in a Linux sandbox. Follow the instructions used to install on Linux. Check out the instructions for installing WSL on Windows 10 and setting up with the Visual Studio for Linux extension.



As shown in the screenshot above, the vcpkg directory can be accessed from both Windows and WSL. In this example, sdl2 and sqlite3 were built in WSL (binary for Linux); sqlite3 is also intended for Windows (Windows dll).

Conclusion


Install vcpkg package manager on Linux or Mac, test it in your cross-platform projects, share your impressions and tell us what else we can improve.

Your feedback and comments are really very important to us. To share your opinion or ask a question, create an appeal on GitHub or send us a message to the email address vcpkg @ microsoft.com . We will also be grateful if you find a couple of minutes to participate in our survey.

about the author


Eric Mitlett is Senior Program Manager at the VC ++ Team. He owns libraries (STL, VC Runtime CPPRestSDK FC / ATL and vcpkg). He participated in the creation and presentation of vcpkg 18 months ago. Initially, 20 libraries, now more than 900. In addition, they are now supported by Linux and Mac. If you have questions, you can write to Eric: ericmitt @ microsoft.com .

Also popular now: