build: Fix linking demos on Visual Studio
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 28 Mar 2018 04:13:08 +0000 (12:13 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 2 Apr 2018 11:11:50 +0000 (19:11 +0800)
The demos are now built as GUI programs, which will require the presence
of WinMain() on Visual Studio builds, unless we specify the entry point.

Pass the /entry:mainCRTStartup linker flag on Visual Studio builds for
the demo programs so that they can link properly.

https://bugzilla.gnome.org/show_bug.cgi?id=773299

demos/gtk-demo/meson.build
demos/icon-browser/meson.build
demos/widget-factory/meson.build
meson.build

index 1317c29904b1370c612dcdf7964d6770f2ccccb8..432aecb51b27c07007b08a09377b8431e36c5f29 100644 (file)
@@ -104,6 +104,7 @@ executable('gtk4-demo',
            dependencies: gtkdemo_deps,
            include_directories: confinc,
            gui_app: true,
+           link_args: extra_demo_ldflags,
            install: true)
 
 executable('gtk4-demo-application',
@@ -112,6 +113,7 @@ executable('gtk4-demo-application',
            dependencies: gtkdemo_deps,
            include_directories: confinc,
            gui_app: true,
+           link_args: extra_demo_ldflags,
            install: true)
 
 # icons
index c1f9f759c5a98a0488ceb10f5bfdf47f2167d185..95b1c0f4e410fd2a163989b1d2bc30aaee079ec9 100644 (file)
@@ -14,6 +14,7 @@ executable('gtk4-icon-browser',
            dependencies: libgtk_dep,
            include_directories: confinc,
            gui_app: true,
+           link_args: extra_demo_ldflags,
            install: true)
 
 install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)
index bfe6050ae679779f25cef0a687640b7f6763b665..2050d2e7507cc231cc217d56100955cf02c22996 100644 (file)
@@ -9,6 +9,7 @@ executable('gtk4-widget-factory',
            dependencies: libgtk_dep,
            include_directories: confinc,
            gui_app: true,
+           link_args: extra_demo_ldflags,
            install: true)
 
 # desktop file
index e998d99314eed5d670c24bd275b10456a65c77d0..a84eaf374ae4622ed2cfc089137f159a9a9ec805 100644 (file)
@@ -559,9 +559,15 @@ if quartz_enabled
   backend_immodules += ['quartz']
 endif
 
+extra_demo_ldflags = []
 if win32_enabled
   pc_gdk_extra_libs += ['-lgdi32', '-limm32', '-lshell32', '-lole32']
-  if cc.get_id() != 'msvc'
+  if cc.get_id() == 'msvc'
+    # Since the demo programs are now built as pure GUI programs, we
+    # need to pass in /entry:mainCRTStartup so that they will properly
+    # link on Visual Studio builds
+    extra_demo_ldflags = ['/entry:mainCRTStartup']
+  else
     pc_gdk_extra_libs += ['-Wl,-luuid']
   endif
   pc_gdk_extra_libs += ['-lwinmm', '-ldwmapi', '-lsetupapi', '-lcfgmgr32']