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']