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 | or the full [Visual Studio](https://visualstudio.microsoft.com/downloads/#visual-studio-community-2022): | 144 | or the full [Visual Studio](https://visualstudio.microsoft.com/downloads/#visual-studio-community-2022): |
| 145 | - From the installer, select the necessary components: | 145 | - From the installer, select the necessary components: |
| 146 | - Clang compiler for Windows | 146 | - Clang compiler for Windows |
| 147 | - C++ CMake tools for Windows | ||
| 147 | - Windows SDK | 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 | 2. Install Meson, as outlined in [Getting Meson](https://mesonbuild.com/Getting-meson.html): | 153 | 2. Install Meson, as outlined in [Getting Meson](https://mesonbuild.com/Getting-meson.html): |
| 149 | - **Important**: At the time of writing, there is an issue in Meson with | 154 | - **Important**: At the time of writing, there is an issue in Meson with |
| 150 | escaping response files. | 155 | escaping response files. |
| @@ -154,19 +159,31 @@ they will be automatically downloaded and built by Meson. · 3 unmodified lines | |||
| 154 | 159 | ||
| 155 | If you wish to install a fixed version, follow the steps outlined | 160 | If you wish to install a fixed version, follow the steps outlined |
| 156 | [here](https://github.com/mpv-player/mpv/blob/481e498427fc34956ad24b94157553908f5cd638/.github/workflows/build.yml#L132-L135). | 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 | 168 | meson wrap install expat |
| 160 | $env:CC = "clang" | 169 | meson wrap install harfbuzz |
| 161 | $env:CXX = "clang++" | 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 | $env:CC_LD = 'lld' | 177 | $env:CC_LD = 'lld' |
| 163 | $env:CXX_LD = 'lld' | 178 | $env:CXX_LD = 'lld' |
| 164 | $env:WINDRES = 'llvm-rc' | 179 | $env:WINDRES = 'llvm-rc' |
| 165 | ``` | 180 | ``` |
| 166 | 181 | Note that some dependencies (e.g. LuaJIT) may require `sed` to configure. Fortunately, it is already bundled in | |
| 167 | 4. Execute [build-win32.ps1](https://github.com/mpv-player/mpv/blob/master/ci/build-win32.ps1): | 182 | [Git for Windows](https://www.git-scm.com/download/win): |
| 168 | - This script utilizes the Meson subprojects system to build mpv and its | 183 | ```powershell |
| 169 | dependencies. Refer to the script for more details. | 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 | This process will produce a fully static ``mpv.exe`` and ``mpv.com``, as well as | 188 | This process will produce a fully static ``mpv.exe`` and ``mpv.com``, as well as |
| 172 | a static ``libmpv.a``. | 189 | a static ``libmpv.a``. |