From 07c72cb732e0a7b0d1071a6ac416c0d19ad39794 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 2 Mar 2020 17:32:32 +0800 Subject: meson: Build items in tools/extra_defs_gen on MSVC too Ensure we can generate the import lib for glibmm_generate_extra_defs on Visual Studio builds by using the same technique we used for glibmm and giomm, and build the two programs that is to be built along side with it. Also re-order the items in meson.build a bit so that we are able to use our gendef tool. --- tools/extra_defs_gen/meson.build | 54 ++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/extra_defs_gen/meson.build b/tools/extra_defs_gen/meson.build index 06c3b703..57a2c9b0 100644 --- a/tools/extra_defs_gen/meson.build +++ b/tools/extra_defs_gen/meson.build @@ -4,24 +4,52 @@ # glibmm_libversion # Output: - -glibmm_generate_extra_defs_library = library( - 'glibmm_generate_extra_defs-' + glibmm_api_version, +glibmm_generate_extra_defs_library_int = static_library( + 'glibmm_generate_extra_defs_int', 'generate_extra_defs.cc', - version: glibmm_libversion, dependencies: glibmm_build_dep, - install: true, + install: false, ) -if not is_msvc - executable('generate_defs_glib', 'generate_defs_glib.cc', - dependencies: glibmm_build_dep, - link_with: glibmm_generate_extra_defs_library, - install: false, - ) +glibmm_generate_extra_defs = [] +glibmm_generate_extra_defs_extra_link_args = [] - executable('generate_defs_gio', 'generate_defs_gio.cc', - dependencies: giomm_build_dep, - link_with: glibmm_generate_extra_defs_library, +if is_msvc + glibmm_generate_extra_defs = custom_target( + 'glibmm_generate_extra_defs.def', + output: 'glibmm_generate_extra_defs.def', + depends: glibmm_generate_extra_defs_library_int, + command: [ gendef, + '@OUTPUT@', + '@0@-@1@.dll'.format('glibmm_generate_extra_defs-' + + glibmm_api_version, glibmm_libversion.split('.')[0]), + glibmm_generate_extra_defs_library_int.full_path(), + ], install: false, ) + glibmm_generate_extra_defs_extra_link_args = [ + '/def:@0@'.format(glibmm_generate_extra_defs.full_path()) + ] endif + +glibmm_generate_extra_defs_library = library( + 'glibmm_generate_extra_defs-' + glibmm_api_version, + objects: glibmm_generate_extra_defs_library_int.extract_all_objects(), + version: glibmm_libversion, + link_depends: glibmm_generate_extra_defs, + link_args: glibmm_generate_extra_defs_extra_link_args, + dependencies: glibmm_build_dep, + install: true, +) + +executable('generate_defs_glib', 'generate_defs_glib.cc', + dependencies: glibmm_build_dep, + link_with: glibmm_generate_extra_defs_library, + install: false, +) + +executable('generate_defs_gio', 'generate_defs_gio.cc', + dependencies: giomm_build_dep, + link_with: glibmm_generate_extra_defs_library, + install: false, +) -- cgit v1.2.1