This document guides you through setting up this repository for C++ development on Windows using Microsoft Visual Studio and the Windows SDK.
For New Users: If you are new to Windows C++ development, this guide provides a step-by-step installation of Visual Studio 2022 Community and the Windows SDK, ensuring you have all the components required for standard development tasks.
For Advanced Configurations: If you already have Visual Studio and the Windows SDK installed but wish to specify exact versions, this guide will help you configure your environment using the [repo_build.msbuild]
configuration within repo.toml
at the project root.
To enable the Windows C++ build process:
-
Set the
"platform:windows-x86_64".enabled
flag totrue
in yourrepo.toml
file:[repo_build.build] "platform:windows-x86_64".enabled = true
-
Set the
link_host_toolchain
flag totrue
in yourrepo.toml
file:[repo_build.msbuild] link_host_toolchain = true
Note: If you already have Visual Studio and the Windows SDK installed, this might be the only change needed. The tooling will auto-detect installed components.
-
Download Visual Studio Installer
- Visit the Visual Studio Downloads.
- Click "Free download" under "Community".
-
Run the Installer
- Open the downloaded installer.
- Select "Community" edition and click "Install".
-
Select Workloads
- Check "Desktop development with C++".
- This includes tools like the MSVC compiler and C++ libraries.
-
- If you need specific components, go to "Individual components".
- Select additional tools as needed.
-
Complete the Installation
- Proceed with the installation to download and set up all files.
Usually, the Windows SDK is included with the "Desktop development with C++" workload. To verify or install it separately:
-
Launch Visual Studio Installer
- Open the installer if it's not already running.
-
Modify Installation
- Click "Modify" on your Visual Studio installation.
-
Verify Windows SDK
- Ensure "Windows SDK" is selected under "Optional" sections or "Individual components".
-
Apply Changes
- Click "Modify" to install or update the SDK.
If Visual Studio and the Windows SDK are installed in default locations, the build tooling will auto-detect them without additional configuration.
- Default Windows SDK:
C:\Program Files (x86)\Windows Kits
- Default Visual Studio 2019:
C:\Program Files (x86)\Microsoft Visual Studio
- Default Visual Studio 2022:
C:\Program Files\Microsoft Visual Studio
For installations at non-standard paths, specify them in repo.toml
:
[repo_build.msbuild]
vs_path = "D:\\CustomPath\\Visual Studio\\2022\\Community"
winsdk_path = "D:\\CustomPath\\Windows Kits\\10\\bin\\10.0.19041.0"
Adjust and save the paths as needed.
For multiple Visual Studio or Windows SDK installations, the latest version is used by default. If unspecified, default edition preference is "Enterprise", "Professional", "Community". To specify preferred versions, editions, or paths:
[repo_build.msbuild]
vs_version = "vs2022"
vs_edition = "Community"
vs_path = "D:\\AnotherPath\\Visual Studio\\2022\\Enterprise\\"
[repo_build.msbuild]
winsdk_version = "10.0.19041.0"
winsdk_path = "D:\\CustomSDKPath\\Windows Kits\\10\\bin\\10.0.19041.0"
With these configurations, you control which versions the build system uses, ensuring consistency in environments with multiple installations.