-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
DOCS(building): clarify Windows build & pre-built environments #7145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
citelao
wants to merge
5
commits into
mumble-voip:master
Choose a base branch
from
citelao:user/citelao/clearer_windows_build_instructions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2906fb9
DOCS(building): clarify Windows build & pre-built environments
748600b
DOCS(building): simplify pre-built env instructions
7d09173
DOCS(building): fix typos
b2d2f63
DOCS(building): Document python requirement
citelao 7a8f558
DOCS(building): feedback & reliable flags
citelao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| # Building on Windows | ||
|
|
||
| On Windows we only support [static builds](build_static.md). | ||
|
|
||
| Make sure to [install Visual Studio](setup_visual_studio.md) in order to be able to compile the necessary code. | ||
| On Windows we only support [static builds](build_static.md). You will need to [set up Visual Studio](setup_visual_studio.md) first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,71 @@ | ||
| # Setup Visual Studio | ||
|
|
||
| MSVC (Microsoft Visual C++) is Microsoft’s C++ compiler toolchain. It can be installed from Visual Studio Build Tools, or Visual Studio Community. | ||
| Either can be downloaded [here](https://visualstudio.microsoft.com/downloads) (Any somewhat recent version should work). | ||
| MSVC (Microsoft Visual C++) is Microsoft’s C++ compiler toolchain. It can be installed via the **Visual Studio Build Tools** or **Visual Studio Community**. | ||
| Either can be downloaded at [visualstudio.microsoft.com/downloads](https://visualstudio.microsoft.com/downloads) (any somewhat recent version should work). | ||
|
|
||
| Make sure to select the **C++ build tools** (or Development, respectively) and "**C++ MFC for latest v14[X] build tools**" (just pick the latest | ||
| version - e.g.v142). vcpkg also requires the **English Language pack** which is found in the Language packs section of the Visual Studio Installer. | ||
| In the Visual Studio Installer, make sure to select: | ||
|
|
||
| * **C++ build tools** (or Development, respectively) | ||
| * "**C++ MFC for latest v14[X] build tools**" (just pick the latest version - e.g.v142). | ||
|
|
||
| vcpkg also requires the **English Language pack** which is found in the Language packs section of the Visual Studio Installer. | ||
|
|
||
| ## Using MSVC | ||
|
|
||
| Unlike most macOS or Linux tools, the MSVC build tools don't get added to the PATH by default, so you can't simply call the compiler like `cl.exe`. Instead, you need to run a script (part of Visual Studio) to add them to your PATH. | ||
|
|
||
| The easiest way to do this, for a PowerShell window on a 64-bit machine, is to run `vcvars64.bat`: | ||
|
|
||
| ```powershell | ||
| # Based on the version of Visual Studio you have installed, the VC++ tools will be in a specific location. | ||
| # | ||
| # You can find them using `vswhere.exe`, which ships with all versions of VS since 2017 | ||
| # and is always in the same location. | ||
| $vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" | ||
|
|
||
| # e.g. Visual Studio 2015 path | ||
| # "${Env:PROGRAMFILES(X86)}\Microsoft Visual Studio 14.0\VC\" | ||
| # e.g. Visual Studio 2019 path | ||
| # "${Env:PROGRAMFILES(X86)}\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\" | ||
| $vcvars64 = . $vswhere -latest -products * -find "VC\Auxiliary\Build\vcvars64.bat" | ||
|
|
||
| # Load vcvars64.bat into your PowerShell window. | ||
| cmd /c "`"$vcvars64`" && set" | | ||
| ForEach-Object { | ||
| if ($_ -match "^([^=]+)=(.*)$") { [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } | ||
| } | ||
| ``` | ||
|
|
||
| This updates your current PowerShell window to let you use the MSVC build tools to build for x64. You can add it to your PowerShell profile, or you can simply run it as needed. | ||
|
|
||
| See MSDN's [Use the Microsoft C++ Build Tools from the command line](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170). | ||
|
|
||
| ### Alternatives | ||
|
|
||
| You can also use [prebuilt shortcuts](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#developer_command_prompt_shortcuts) like **x64 Native Tools Command Prompt**, which you can find in the Start menu after installing the MSVC. | ||
|
|
||
| These have some caveats that recommend using the `vcvars64.bat` or `vcvarsall.bat` technique instead: only **x64 Native Tools Command Prompt** supports building in 64-bit, but it is CMD, not PowerShell. The **Developer Powershell** shortcut is 32-bit only. If you are on a 64bit system, then you'll know that you have opened the correct prompt, if it prints `Environment initialized for: 'x64'`. | ||
|
|
||
| You can also use `vcvarsall.bat`, with args, instead of `vcvars64.bat`, to set up different environments: | ||
|
|
||
| ```powershell | ||
| # Find the path for `vcvarsall.bat`, as before: | ||
| $vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" | ||
| $vcvarsall = . $vswhere -latest -products * -find "VC\Auxiliary\Build\vcvarsall.bat" | ||
| $vcToolsPath = Split-Path $vcvarsall | ||
|
|
||
| # Shift context to VS | ||
| Push-Location $vcToolsPath | ||
|
|
||
| $architecture = 'x64' # amd64 and x64 resolve to the same path in vcvarsall.bat and are interchangeable. | ||
|
|
||
| # Have vcvarsall.bat load the 64 bit environment variables. | ||
| cmd /c "vcvarsall.bat $architecture&set" | | ||
| foreach { | ||
| if ($_ -match "=") { | ||
| $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" | ||
| } | ||
| } | ||
| # Go back to where we were before. | ||
| Pop-Location | ||
| ``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.