From fe2a9887a8ccb14f2386e01b14834e97a33bc2d7 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 21 Dec 2016 04:07:24 +0530 Subject: meson: Improve MSVC and MinGW support and fix dependencies everywhere Disable gio tests on Windows, fix .gitignore to not ignore config.h.meson, and add more things to it. Rename the library file naming and versioning to match what Autotools outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll and glib-2.0-0.dll on Windows with MSVC. Several more tiny fixes, more executables built and installed, install pkg-config and m4 files, fix building of gobject tests. Changes to gdbus-codegen to support out-of-tree builds without environment variables set (which you can't in Meson). We now add the build directory to the Python module search path. --- gmodule/meson.build | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'gmodule') diff --git a/gmodule/meson.build b/gmodule/meson.build index 465c4e4de..3319740a3 100644 --- a/gmodule/meson.build +++ b/gmodule/meson.build @@ -22,21 +22,21 @@ int main (int argc, char ** argv) { }''' # On Windows force native WIN32 shared lib loader -if host_machine.system() == 'windows' +if host_system == 'windows' g_module_impl = 'G_MODULE_IMPL_WIN32' # Force native AIX library loader # dlopen() filepath must be of the form /path/libname.a(libname.so) -elif host_machine.system() == 'aix' +elif host_system == 'aix' g_module_impl = 'G_MODULE_IMPL_AR' elif cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries') g_module_impl = 'G_MODULE_IMPL_DL' # NSLinkModule (dyld) in system libraries (Darwin) -elif cc.has_function('NSLinkModule', prefix : '#include ', name : 'NSLinkModule') +elif cc.has_function('NSLinkModule') g_module_impl = 'G_MODULE_IMPL_DYLD' g_module_need_uscore = 1 elif cc.links(dlopen_dlsym_test_code, args : '-ldl', name : 'dlopen() and dlsym() in libdl') g_module_impl = 'G_MODULE_IMPL_DL' - libdl_dep = find_library('dl') + libdl_dep = cc.find_library('dl') g_module_lib_args = '-ldl' endif @@ -45,17 +45,23 @@ if g_module_impl == 'G_MODULE_IMPL_DL' # FIXME: check for OSF1/5.0 RTLD_GLOBAL brokenness (is this still relevant?) # Check whether we need preceding underscores - if not meson.is_cross_build() + if cc.get_id() == 'msvc' + message('Building for MSVC: assuming that symbols are prefixed with underscore') + g_module_need_uscore = 1 + elif meson.has_exe_wrapper() # FIXME: communicate result via stdout instead of return value, so non-0 return is not printed in bold red rres = cc.run(dlopen_dlsym_test_code, args : g_module_lib_args, name : 'dlsym() preceding underscores') - if rres.compiled() and rres.returncode() == 0 + if host_system == 'windows' or rres.returncode() == 0 g_module_need_uscore = 1 endif + else + message('Cross-compiling: assuming that symbols aren\'t prefixed with underscore') + g_module_need_uscore = 0 endif - if cc.has_function('dlerror', prefix : '#include ', args : g_module_lib_args, name : 'dlerror') + if cc.has_function('dlerror', args : g_module_lib_args) g_module_have_dlerror = 1 endif endif @@ -76,15 +82,17 @@ gmoduleconf_h = configure_file(input : 'gmoduleconf.h.in', output : 'gmoduleconf.h', configuration : gmoduleconf_conf) -install_headers([ 'gmodule.h' ], subdir : 'glib-2.0/') +install_headers(['gmodule.h'], subdir : 'glib-2.0/') -libgmodule = shared_library('gmodule', - sources : [ 'gmodule.c' ], - version : glib_version, - soversion : interface_version, +libgmodule = shared_library('gmodule-2.0', + sources : ['gmodule.c'], + version : library_version, + soversion : soversion, install : true, - include_directories : inc_dirs, - link_with : libglib, - dependencies : libdl_dep, - c_args : ['-DG_LOG_DOMAIN="GModule"', '-DG_DISABLE_DEPRECATED' ], + include_directories : [configinc, gmoduleinc], + dependencies : [libdl_dep, libglib_dep], + c_args : ['-DG_LOG_DOMAIN="GModule"', '-DG_DISABLE_DEPRECATED'], ) + +libgmodule_dep = declare_dependency(link_with : libgmodule, + include_directories : gmoduleinc) -- cgit v1.2.1