After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796641 - Build Meson recipes with MSVC on Windows
Build Meson recipes with MSVC on Windows
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: cerbero
git master
Other All
: Normal enhancement
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-06-20 13:04 UTC by Nirbheek Chauhan
Modified: 2018-06-29 11:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
cerbero: Build Meson projects with MSVC on Windows (15.05 KB, patch)
2018-06-20 13:04 UTC, Nirbheek Chauhan
committed Details | Review
cerbero/meson: Also generate .dll.a for MSVC DLLs (7.61 KB, patch)
2018-06-20 13:04 UTC, Nirbheek Chauhan
committed Details | Review
glib.recipe: Fix atomic ops check with MSVC (2.51 KB, patch)
2018-06-20 13:04 UTC, Nirbheek Chauhan
committed Details | Review
cerbero: Include PDB files in the devel package (7.00 KB, patch)
2018-06-20 13:05 UTC, Nirbheek Chauhan
committed Details | Review
Update README for Meson port and MSVC usage (5.30 KB, patch)
2018-06-29 06:40 UTC, Nirbheek Chauhan
committed Details | Review

Description Nirbheek Chauhan 2018-06-20 13:04:37 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.
Comment 1 Nirbheek Chauhan 2018-06-20 13:04:44 UTC
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.
Comment 2 Nirbheek Chauhan 2018-06-20 13:04:52 UTC
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.
Comment 3 Nirbheek Chauhan 2018-06-20 13:04:59 UTC
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.
Comment 4 Nirbheek Chauhan 2018-06-20 13:05:07 UTC
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.
Comment 5 Nirbheek Chauhan 2018-06-20 13:07:50 UTC
(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.
Comment 6 Nirbheek Chauhan 2018-06-29 06:40:10 UTC
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.
Comment 7 Nirbheek Chauhan 2018-06-29 11:03:54 UTC
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