Currently the documentation for building on Windows, specifically the "Native Compilation with Clang (Windows SDK Build)" route, could use a few minor improvement to make the development onboarding experience more smoothly. Fixes #14214
Unified · Split
| @@ -144,7 +144,12 @@ they will be automatically downloaded and built by Meson. · 143 unmodified lines | ||
| 144 | 144 | or the full [Visual Studio](https://visualstudio.microsoft.com/downloads/#visual-studio-community-2022): |
| 145 | 145 | - From the installer, select the necessary components: |
| 146 | 146 | - Clang compiler for Windows |
| 147 | + - C++ CMake tools for Windows | |
| 147 | 148 | - Windows SDK |
| 149 | + - Activate the developer shell: | |
| 150 | + ``` | |
| 151 | + & "<Visual Studio Path>\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation | Out-Null | |
| 152 | + ``` | |
| 148 | 153 | 2. Install Meson, as outlined in [Getting Meson](https://mesonbuild.com/Getting-meson.html): |
| 149 | 154 | - **Important**: At the time of writing, there is an issue in Meson with |
| 150 | 155 | escaping response files. |
| @@ -154,19 +159,31 @@ they will be automatically downloaded and built by Meson. · 3 unmodified lines | ||
| 154 | 159 | |
| 155 | 160 | If you wish to install a fixed version, follow the steps outlined |
| 156 | 161 | [here](https://github.com/mpv-player/mpv/blob/481e498427fc34956ad24b94157553908f5cd638/.github/workflows/build.yml#L132-L135). |
| 157 | −3. Set environment variables or use the ``--native-file`` option in Meson. | |
| 162 | +3. The following build script utilizes the Meson subprojects system to build mpv and its dependencies. | |
| 163 | + To make sure all dependency versions are up-to-date, update the subprojects database from Meson's WrapDB. | |
| 164 | + Also explicitly download several wraps as some nested projects may pull older versions of them. | |
| 165 | + ``` | |
| 166 | + meson wrap update-db | |
| 158 | 167 | |
| 159 | − ``` powershell | |
| 160 | − $env:CC = "clang" | |
| 161 | − $env:CXX = "clang++" | |
| 168 | + meson wrap install expat | |
| 169 | + meson wrap install harfbuzz | |
| 170 | + meson wrap install libpng | |
| 171 | + meson wrap install zlib | |
| 172 | + ``` | |
| 173 | +4. Set environment variables or use the `--native-file` option in Meson. | |
| 174 | + ```powershell | |
| 175 | + $env:CC = 'clang' | |
| 176 | + $env:CXX = 'clang++' | |
| 162 | 177 | $env:CC_LD = 'lld' |
| 163 | 178 | $env:CXX_LD = 'lld' |
| 164 | 179 | $env:WINDRES = 'llvm-rc' |
| 165 | 180 | ``` |
| 166 | − | |
| 167 | −4. Execute [build-win32.ps1](https://github.com/mpv-player/mpv/blob/master/ci/build-win32.ps1): | |
| 168 | − - This script utilizes the Meson subprojects system to build mpv and its | |
| 169 | − dependencies. Refer to the script for more details. | |
| 181 | + Note that some dependencies (e.g. LuaJIT) may require `sed` to configure. Fortunately, it is already bundled in | |
| 182 | + [Git for Windows](https://www.git-scm.com/download/win): | |
| 183 | + ```powershell | |
| 184 | + $env:PATH += ';<Git Path>\usr\bin' | |
| 185 | + ``` | |
| 186 | +5. Execute [ci\build-win32.ps1](https://github.com/mpv-player/mpv/blob/master/ci/build-win32.ps1). Refer to the script for more details. | |
| 170 | 187 | |
| 171 | 188 | This process will produce a fully static ``mpv.exe`` and ``mpv.com``, as well as |
| 172 | 189 | a static ``libmpv.a``. |