GNOME Bugzilla – Bug 796641
Build Meson recipes with MSVC on Windows
Last modified: 2018-06-29 11:04:50 UTC
This adds a dependency on Visual Studio (README updates are on the way) 2015 or newer, but these days you need that to get the Windows SDK anyway, so everyone installs it. The following recipes will now be built with MSVC: 1. proxy-libintl 2. zlib 3. glib (and glib-tools) 4. glib-networking 5. gst-transcoder This is the first step in converting as many recipes as possible to use Meson and MSVC in Cerbero. The main advantages of this are: * Support for native debug symbols (PDB files) * Massively faster compilation (10-15x faster) * More reliably compilation (no more hangs in msgmerge.exe or make.exe) * Faster (better-optimized) code, since we won't use an ancient GCC toolchain * The ability to pick between release and debug CRTs * Support for the MSVC C++ stdlib, exception handling, and so on This work retains the possibility of building with MinGW (using a variant) if people ask us about it, but for simplicity these patches do not add that. Cross-windows builds still use MinGW/GCC.
Created attachment 372735 [details] [review] cerbero: Build Meson projects with MSVC on Windows Unless the 'visualstudio' variant is disabled in the config by enabling the `novisualstudio` variant, recipes that use Meson will be built using Visual Studio. Cerbero will attempt to find either Visual Studio 2015 or Visual Studio 2017 and set the correct environment to use the MSVC toolchain. This is done once at startup, and then used by each recipe at build time. To get this environment in shell form, use the `win32-msvc-shell.cbc` and `win64-msvc-shell.cbc` config files.
Created attachment 372736 [details] [review] cerbero/meson: Also generate .dll.a for MSVC DLLs This is necessary for GCC/LD to be able to import variables exported in MSVC DLLs. We need this while building with Meson on Windows with MSVC.
Created attachment 372737 [details] [review] glib.recipe: Fix atomic ops check with MSVC Atomic ops are always available with MSVC. This change is already upstream.
Created attachment 372738 [details] [review] cerbero: Include PDB files in the devel package PDB files contain MSVC debug information, and are created by the MSVC linker for EXEs and DLLs. Hence, we have PDBs from three categories: plugins, libraries, and binaries. This commit includes PDBs from all three sources into the -devel package.
(In reply to Nirbheek Chauhan from comment #0) > This work retains the possibility of building with MinGW (using a variant) > if people ask us about it, but for simplicity these patches do not add that. What I meant here is, that we can officially support this if people ask, but only if people actually come to us and complain that they care about this. The README will only talk about Visual Studio on Windows otherwise.
Created attachment 372877 [details] [review] Update README for Meson port and MSVC usage With the Meson port, we can now build many recipes with MSVC, and we will default to doing that on Windows. People can switch to MinGW-only by adding 'novisualstudio' to variants in ~/.cerbero/cerbero.cbc We always needed an MSVC compiler for building the directshow plugins, and we need lib.exe from Visual Studio to generate import libraries from DLLs for all recipes built with Autotools. This change documents that correctly and bumps the requirement to Visual Studio 2015, which is what we support in GStreamer. VS 2013 may work, and support for it can be added if enough people ask for it. Also fix the documentation about how to install Python 3. The default installation path is in `C:\Program Files (x86)\Python36-32` which breaks Autotools and other shell-based builds. Note that Meson does not require this.
Attachment 372735 [details] pushed as 3006672 - cerbero: Build Meson projects with MSVC on Windows Attachment 372736 [details] pushed as 314a1f7 - cerbero/meson: Also generate .dll.a for MSVC DLLs Attachment 372737 [details] pushed as 32524df - glib.recipe: Fix atomic ops check with MSVC Attachment 372738 [details] pushed as 6bfa95d - cerbero: Include PDB files in the devel package Attachment 372877 [details] pushed as a4e65c3 - Update README for Meson port and MSVC usage