[gtk] build: Fix linking demos on Visual Studio



commit 19ce520c2d8b37fd67bed3aaf8dbfa0e62df4454
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Mar 28 12:13:08 2018 +0800

    build: Fix linking demos on Visual Studio
    
    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       | 2 ++
 demos/icon-browser/meson.build   | 1 +
 demos/widget-factory/meson.build | 1 +
 meson.build                      | 8 +++++++-
 4 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index 1317c29904..432aecb51b 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -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
diff --git a/demos/icon-browser/meson.build b/demos/icon-browser/meson.build
index c1f9f759c5..95b1c0f4e4 100644
--- a/demos/icon-browser/meson.build
+++ b/demos/icon-browser/meson.build
@@ -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)
diff --git a/demos/widget-factory/meson.build b/demos/widget-factory/meson.build
index bfe6050ae6..2050d2e750 100644
--- a/demos/widget-factory/meson.build
+++ b/demos/widget-factory/meson.build
@@ -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
diff --git a/meson.build b/meson.build
index e998d99314..a84eaf374a 100644
--- a/meson.build
+++ b/meson.build
@@ -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']


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]