Follow the remaining steps in this article about adding and understanding the WebView2 code.
Optionally delete the WebView2 code from HelloWebView.cpp to restore the Win32 baseline app.Clone or download the WebView2Samples repo to your local drive.To use this article, you do the following: The project uses the Win32_GettingStarted (WebView2GettingStarted.sln) directory that's part of the WebView2Samples repo. This tutorial starts by opening an existing Win32 app project that has WebView2 code added.
As you add more libraries to your project, make sure they are linked here.In this article, you set up your development tools (if not done already), learn how to add WebView2 code to a Win32 app project, and learn about WebView2 concepts along the way. Finally you call TARGET_LINK_LIBRARIES and pass in all of the libraries (matching the vcpkg name you used to download them) that you want to use in your project, in this case SDL and raylib are configured. The key additions here are the additions of LINK_DIRECTORIES and INCLUDE_DIRECTORIES, this let’s CMake know where your packages are being installed. Open up the CMakeList.txt file and edit yours similar to the following file: cmake_minimum_required(VERSION 3.0.0)Ĭ:/dev/vcpkg/installed/x86-windows/include Don’t worry, it’s not a terrible process. It works with CMake and handles package installs, but you have to do a bit of grunt work (at least for now, vcpkg integration in Visual Studio Code is improving over time). Unfortunately vcpkg isn’t as seemless when working with Visual Studio Code. You are done, you know have a successful build environment. "nfigureSettings": /build/debug/fargo.exe”įinally hit F5 to run your code. Now add the following line somewhere within the settings.json file (making sure the line before it ends with a comma. Next in the newly opened editor window, click the editor button to switch to text editing mode. Open settings.json (this is a global configuration file for Visual Studio Code itself) by selecting File->Preferences->Settings or Ctrl+, (that’s a comma btw…). Next we need to configure Visual Studio Code to be aware of vcpkg. Launch Visual Studio Code, then lets set up a pair of extensions, CMake Tools and C++: Using vcpkg can also make C++ development more enjoyable for Visual Studio Code (and CLion users too) developers, but the process is slightly different. No need to configure the linker, simple add the appropriate #include to the top of your code and presto, you’re ready to go! What About Visual Studio Code? Due to the “integrate install” command we ran earlier your library is ready to go in Visual Studio, no further actions require.
This is done with the command: c:\dev\vcpkg\vcpkg install raylibĪt this point vcpkg will do the magic of downloading and installing the raylib library for you.
We are going to install the full version ‘raylib’. Note we have two different options here, raylib and raylib. Simply type: c:\dev\vcpkg\vcpkg search raylib We locate the name of the package using the built in search functionality. In this example I am going to use the excellent RayLib game library (you can learn more about RayLib 3.0 here). Let’s start by finding the name of the package we want to work with. First you need to find a package to use, of which there are 2000 configured in vcpkg at this point in time. That is it, we are now ready to start using vcpkg. These files are going to remain installed after we are done, so pick a location you are comfortable with but one that doesn’t require special permissions such as Program Files. Next we are going to need to pick a directory to install vcpkg to. Start off by creating a command prompt with administrative permissions or select Windows Key + X, then select Windows PowerShell(Admin).
Next you are going to want to make sure that MSVC build tools and a version of the Windows 10 SDK are both installed. Regardless to if you choose Visual Studio or Build Tools, there are some features you need to be sure to install, specifically C++ support: Additionally vcpkg can be used on Linux and MacOS as well, but in this tutorial we are going to focus on Windows development. It should be noted that vcpkg can work with Visual Studio Code.