Skip to content

giscanner/ccompiler.py: Fix macro defines with quotes on MSVC

Chun-wei Fan requested to merge ccompiler.msvc.fixes into master

Hi,

As I was enabling Meson builds for GJS to build on Visual Studio, g-ir-scanner choked because we were passing in '-DG_LOG_DOMAIN="Gjs"' from the Meson build files. It turned out that the MSVC compiler instance of distutils swallowed up the escaped quotes that Meson wrote into the generated build files, which caused -DG_LOG_DOMAIN=Gjs to be passed into the compiler command line when the dumper program was built, which will obviously cause the dumper program to fail to compile since there Gjs by itself is an undefined identifier.

In order to avoid that, this adds an extra escape character in ccompiler._set_cpp_options() to macros that are defined with quotes.

I will add an MR for the gnome-3-34 (1.62.x) stable branch as well for this.

For references, see gjs!355 (comment 632563).

With blessings, thank you!

Merge request reports