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
This commit is contained in:
Chun-wei Fan 2018-03-28 12:13:08 +08:00
parent d0e46d257c
commit 19ce520c2d
4 changed files with 11 additions and 1 deletions

View File

@ -104,6 +104,7 @@ executable('gtk4-demo',
dependencies: gtkdemo_deps, dependencies: gtkdemo_deps,
include_directories: confinc, include_directories: confinc,
gui_app: true, gui_app: true,
link_args: extra_demo_ldflags,
install: true) install: true)
executable('gtk4-demo-application', executable('gtk4-demo-application',
@ -112,6 +113,7 @@ executable('gtk4-demo-application',
dependencies: gtkdemo_deps, dependencies: gtkdemo_deps,
include_directories: confinc, include_directories: confinc,
gui_app: true, gui_app: true,
link_args: extra_demo_ldflags,
install: true) install: true)
# icons # icons

View File

@ -14,6 +14,7 @@ executable('gtk4-icon-browser',
dependencies: libgtk_dep, dependencies: libgtk_dep,
include_directories: confinc, include_directories: confinc,
gui_app: true, gui_app: true,
link_args: extra_demo_ldflags,
install: true) install: true)
install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir) install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)

View File

@ -9,6 +9,7 @@ executable('gtk4-widget-factory',
dependencies: libgtk_dep, dependencies: libgtk_dep,
include_directories: confinc, include_directories: confinc,
gui_app: true, gui_app: true,
link_args: extra_demo_ldflags,
install: true) install: true)
# desktop file # desktop file

View File

@ -559,9 +559,15 @@ if quartz_enabled
backend_immodules += ['quartz'] backend_immodules += ['quartz']
endif endif
extra_demo_ldflags = []
if win32_enabled if win32_enabled
pc_gdk_extra_libs += ['-lgdi32', '-limm32', '-lshell32', '-lole32'] 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'] pc_gdk_extra_libs += ['-Wl,-luuid']
endif endif
pc_gdk_extra_libs += ['-lwinmm', '-ldwmapi', '-lsetupapi', '-lcfgmgr32'] pc_gdk_extra_libs += ['-lwinmm', '-ldwmapi', '-lsetupapi', '-lcfgmgr32']