diff options
author | Ting-Wei Lan <lantw@src.gnome.org> | 2018-04-22 20:47:32 +0800 |
---|---|---|
committer | Ting-Wei Lan <lantw@src.gnome.org> | 2018-04-22 21:57:10 +0800 |
commit | f922109a9c684d1fb852b041eccbeb4781b7039a (patch) | |
tree | 49b49be29780a0a3d71f48fed297154883e1f886 /meson.build | |
parent | 7a09cd4cdaff9c5643ad0e3e212cb2acb8ba9fde (diff) | |
download | gtk+-f922109a9c684d1fb852b041eccbeb4781b7039a.tar.gz |
build: Make the default setting work on non-Linux Unix-like systems
All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.
However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.
This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/meson.build b/meson.build index baab1b759d..cdd83e7635 100644 --- a/meson.build +++ b/meson.build @@ -102,20 +102,25 @@ os_darwin = false # to ensure they are enabled if host_machine.system() == 'darwin' os_darwin = true - win32_enabled = false elif host_machine.system() == 'windows' os_win32 = true - win32_enabled = true - x11_enabled = false - wayland_enabled = false - quartz_enabled = false elif host_machine.system() == 'linux' os_linux = true - win32_enabled = false +endif +os_unix = not os_win32 + +if os_darwin + wayland_enabled = false +else quartz_enabled = false endif -os_unix = not os_win32 +if os_win32 + wayland_enabled = false + x11_enabled = false +else + win32_enabled = false +endif gtk_prefix = get_option('prefix') gtk_includedir = join_paths(gtk_prefix, get_option('includedir')) @@ -265,7 +270,7 @@ common_cflags = cc.get_supported_arguments(test_cflags) # Symbol visibility if get_option('default_library') != 'static' - if host_machine.system() == 'windows' + if os_win32 cdata.set('DLL_EXPORT', true) cdata.set('_GDK_EXTERN', '__declspec(dllexport) extern') if cc.get_id() != 'msvc' @@ -284,7 +289,7 @@ if host_machine.system() == 'linux' and cc.get_id() == 'gcc' endif # Maintain compatibility with autotools -if host_machine.system() == 'darwin' +if os_darwin common_ldflags += [ '-compatibility_version 1', '-current_version 1.0', ] endif @@ -299,10 +304,11 @@ glib_dep = dependency('glib-2.0', version: glib_req, fallback : ['glib', 'libglib_dep']) gobject_dep = dependency('gobject-2.0', version: glib_req, fallback : ['glib', 'libgobject_dep']) -if host_machine.system() == 'windows' +if os_win32 giowin32_dep = dependency('gio-windows-2.0', version: glib_req, required: win32_enabled, fallback : ['glib', 'libgio_dep']) -else +endif +if os_unix giounix_dep = dependency('gio-unix-2.0', version: glib_req, required: false, fallback : ['glib', 'libgio_dep']) endif @@ -370,9 +376,10 @@ iso_codes_dep = dependency('iso-codes', required: false) fontconfig_dep = [] # only used in x11 backend atkbridge_dep = [] # only used in x11 backend -if host_machine.system() == 'windows' +if os_win32 platform_gio_dep = giowin32_dep -else +endif +if os_unix platform_gio_dep = giounix_dep endif @@ -582,7 +589,7 @@ if cc.has_function('bind_textdomain_codeset', dependencies: libintl_dep) cdata.set('HAVE_BIND_TEXTDOMAIN_CODESET', 1) endif -if host_machine.system() != 'windows' +if os_unix cdata.set('HAVE_GIO_UNIX', giounix_dep.found()) endif @@ -723,7 +730,7 @@ foreach pkg: pkgs install_dir: pkg_install_dir) endforeach -if host_machine.system() != 'windows' +if os_unix configure_file(input: 'gtk+-unix-print-4.0.pc.in', output: 'gtk+-unix-print-4.0.pc', configuration: pkgconf, |