[Mesa-dev] [PATCH 41/48] meson: Fix gtest linkage on msvc

Dylan Baker dylan at pnwbakers.com
Fri Jun 15 17:03:53 UTC 2018


Quoting Jon Turney (2018-06-15 09:51:31)
> On 11/06/2018 23:56, Dylan Baker wrote:
> > We need to add an extra flag (/SUBSYSTEM:CONSOLE) to get the msvc linker
> > to find main() in a static library.
> > ---
> >   src/gtest/meson.build | 7 +++++++
> >   1 file changed, 7 insertions(+)
> > 
> > diff --git a/src/gtest/meson.build b/src/gtest/meson.build
> > index 91a49240416..ed0d6974bd3 100644
> > --- a/src/gtest/meson.build
> > +++ b/src/gtest/meson.build
> > @@ -25,7 +25,14 @@ libgtest = static_library(
> >     build_by_default : false,
> >   )
> >   
> > +_gtest_link_args = []
> > +if cpp.get_id() == 'msvc'
> > +  # required to use main() from a static library
> > +  _gtest_link_args += '/SUBSYSTEM:CONSOLE'
> > +endif
> 
> I think this is perhaps working around a meson bug
> 
> (This linker setting should be implied by executable(gui_app:false), but 
> I don't think that is the case for msvc with ninja backend.  See 
> https://github.com/mesonbuild/meson/pull/1794)
> 
> The rest of the series looks ok to me, but it's not stuff I actually use.

I didn't even think about that it might be a ninja backend bug, I tried using
the gui_false and it didn't change anything. I think I'll go see if it works
correctly with the VS backend, if that's the case then I'll fix that I guess.

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180615/86380e29/attachment.sig>


More information about the mesa-dev mailing list