diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-03-06 15:02:48 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-03-07 23:53:11 +0800 |
commit | cc62858052df390a2f599c575173793a9f6520f4 (patch) | |
tree | 16082edda69e1246f6f72f6509ae15de54de63dc /gio | |
parent | c2c96a58cf7cf59ca83b363e0a9759828aa3747c (diff) | |
download | glibmm-cc62858052df390a2f599c575173793a9f6520f4.tar.gz |
Visual Studio builds: build giomm without gendef
Make sure that we are defining GIOMM_API as __declspec(dllexport) when
building giomm and so stop the use of gendef.exe. We are now ready to
drop gendef from the glibmm sources.
Diffstat (limited to 'gio')
-rw-r--r-- | gio/giomm/meson.build | 64 | ||||
-rw-r--r-- | gio/giommconfig.h.in | 15 | ||||
-rw-r--r-- | gio/giommconfig.h.meson | 15 |
3 files changed, 32 insertions, 62 deletions
diff --git a/gio/giomm/meson.build b/gio/giomm/meson.build index 7dc21f0f..b60435ef 100644 --- a/gio/giomm/meson.build +++ b/gio/giomm/meson.build @@ -3,7 +3,7 @@ # Input: giomm_build_dep, giomm_pcname, maintainer_mode, project_source_root, # generate_binding_py, handle_built_files_py, m4_files, pm_files, # glibmm_libversion, install_includedir, python3, giomm_rc, gmmproc_dir, -# is_host_windows, gendef, gmmproc, generate_wrap_init_pl +# is_host_windows, gmmproc, generate_wrap_init_pl # Output: giomm_hg_ccg_basenames, giomm_extra_h_files, built_files_root, # giomm_built_h_file_targets, giomm_dep @@ -211,6 +211,16 @@ install_headers(giomm_extra_h_files, subdir: giomm_pcname / 'giomm') untracked_giomm = 'untracked' / 'gio' / 'giomm' src_untracked_giomm = project_source_root / untracked_giomm +extra_giomm_objects = [] +giomm_cpp_flags = [ '-DGIOMM_BUILD=1' ] + +# Build the .rc file for Windows builds and link to it +if is_host_windows + windows = import('windows') + giomm_res = windows.compile_resources(giomm_rc) + extra_giomm_objects += giomm_res +endif + if maintainer_mode # Maintainer mode. Generate .h and .cc files from .hg and .ccg files in ../src. @@ -292,13 +302,15 @@ if maintainer_mode ) extra_include_dirs = ['..', '..' / '..' / 'glib'] - gio_int_lib = static_library('giomm-int', + + giomm_library = library(giomm_pcname, extra_giomm_objects, giomm_used_built_cc_file_targets, giomm_extra_cc_files, built_dummy_h_file_target, + version: glibmm_libversion, include_directories: extra_include_dirs, - cpp_args: '-DGIOMM_BUILD=1', + cpp_args: giomm_cpp_flags, dependencies: giomm_build_dep, link_with: glibmm_library, - install: false, + install: true, ) built_h_cc_dir = meson.current_build_dir() @@ -339,56 +351,20 @@ else # not maintainer_mode '..' / '..' / 'glib', '..' / '..' / 'untracked' / 'glib', ] - # We need this so that we can run gendef.exe to get the .def file - # needed for obtaining the .lib file for the giomm DLL - gio_int_lib = static_library('giomm-int', + giomm_library = library(giomm_pcname, extra_giomm_objects, built_cc_files, giomm_extra_cc_files, + version: glibmm_libversion, include_directories: extra_include_dirs, - cpp_args: '-DGIOMM_BUILD=1', + cpp_args: giomm_cpp_flags, dependencies: giomm_build_dep, link_with: glibmm_library, - install: false, + install: true, ) built_h_cc_dir = src_untracked_giomm endif -giomm_def = [] -giomm_extra_link_args = [] -extra_giomm_objects = [] - -if is_msvc - giomm_def = custom_target('giomm.def', - output: 'giomm.def', - depends: gio_int_lib, - command: [ gendef, - '@OUTPUT@', - '@0@-@1@.dll'.format(giomm_pcname, glibmm_libversion.split('.')[0]), - gio_int_lib.full_path(), - ], - install: false, - ) - giomm_extra_link_args = ['/def:@0@'.format(giomm_def.full_path())] -endif - -# Build the .rc file for Windows builds and link to it -if is_host_windows - windows = import('windows') - giomm_res = windows.compile_resources(giomm_rc) - extra_giomm_objects += giomm_res -endif - -giomm_library = library(giomm_pcname, extra_giomm_objects, - objects: gio_int_lib.extract_all_objects(), - version: glibmm_libversion, - dependencies: giomm_build_dep, - link_depends: giomm_def, - link_args: giomm_extra_link_args, - link_with: glibmm_library, - install: true, -) - # Install built .h and _p.h files. meson.add_install_script( python3.path(), generate_binding_py, 'install_built_h_files', diff --git a/gio/giommconfig.h.in b/gio/giommconfig.h.in index 8f27b73d..b9579c6e 100644 --- a/gio/giommconfig.h.in +++ b/gio/giommconfig.h.in @@ -19,20 +19,17 @@ #undef GIOMM_STATIC_LIB // Enable DLL-specific stuff only when not building a static library -#if !defined(__CYGWIN__) && defined(__MINGW32__) && !defined(GIOMM_STATIC_LIB) +#if !defined(__CYGWIN__) && (defined(__MINGW32__) || defined(_MSC_VER)) && !defined(GIOMM_STATIC_LIB) # define GIOMM_DLL 1 #endif #ifdef GIOMM_DLL -# if defined(GIOMM_BUILD) && defined(_WINDLL) - /* Do not dllexport as it is handled by gendef on MSVC */ -# define GIOMM_API -# elif !defined(GIOMM_BUILD) -# define GIOMM_API __declspec(dllimport) +# if defined(GIOMM_BUILD) +# define GIOMM_API __declspec(dllexport) # else - /* Build a static library */ -# define GIOMM_API -# endif /* GIOMM_BUILD - _WINDLL */ +# define GIOMM_API __declspec(dllimport) +# endif +/* Build a static library or non-native-Windows library */ #else # define GIOMM_API #endif /* GIOMM_DLL */ diff --git a/gio/giommconfig.h.meson b/gio/giommconfig.h.meson index 82aedddf..9ac31c6d 100644 --- a/gio/giommconfig.h.meson +++ b/gio/giommconfig.h.meson @@ -19,20 +19,17 @@ #mesondefine GIOMM_STATIC_LIB // Enable DLL-specific stuff only when not building a static library -#if !defined(__CYGWIN__) && defined(__MINGW32__) && !defined(GIOMM_STATIC_LIB) +#if !defined(__CYGWIN__) && (defined(__MINGW32__) || defined(_MSC_VER)) && !defined(GIOMM_STATIC_LIB) # define GIOMM_DLL 1 #endif #ifdef GIOMM_DLL -# if defined(GIOMM_BUILD) && defined(_WINDLL) - /* Do not dllexport as it is handled by gendef on MSVC */ -# define GIOMM_API -# elif !defined(GIOMM_BUILD) -# define GIOMM_API __declspec(dllimport) +# if defined(GIOMM_BUILD) +# define GIOMM_API __declspec(dllexport) # else - /* Build a static library */ -# define GIOMM_API -# endif /* GIOMM_BUILD - _WINDLL */ +# define GIOMM_API __declspec(dllimport) +# endif +/* Build a static library or non-native-Windows library */ #else # define GIOMM_API #endif /* GIOMM_DLL */ |