mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-10 04:30:11 +00:00
meson: Build the input modules
Build the input modules for GTK+, either as modules or built directly into GTK. Also provide a configure option to build the specified immodules, or all, or the backend immodule(s) or none of the immodules into GTK. Note that for Visual Studio all immodules are built into the GTK DLL by default, like what is done in the Visual Studio projects. Note that building the backend immodules for Quartz, X11 and Wayland are currently untested.
This commit is contained in:
parent
6b079afa0a
commit
5e8edec254
@ -931,9 +931,9 @@ endif
|
||||
libgtk = shared_library('gtk-3',
|
||||
soversion: gtk_soversion,
|
||||
sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h],
|
||||
c_args: gtk_cargs + common_cflags,
|
||||
c_args: gtk_cargs + common_cflags + gtk_included_im_cflags,
|
||||
include_directories: [confinc, gdkinc, gtkinc],
|
||||
dependencies: gtk_deps + [libgdk_dep],
|
||||
dependencies: gtk_deps + [libgdk_dep] + gtk_included_im_deps,
|
||||
link_with: libgdk,
|
||||
link_args: common_ldflags,
|
||||
darwin_versions : gtk_osxversions,
|
||||
|
81
meson.build
81
meson.build
@ -130,6 +130,9 @@ gtk_applicationsdir = join_paths(gtk_datadir, 'applications')
|
||||
gtk_schemasdir = join_paths(gtk_datadir, 'glib-2.0/schemas')
|
||||
gtk_appdatadir = join_paths(gtk_datadir, 'metainfo')
|
||||
|
||||
# multipress: is mplocaledir defined somewhere?
|
||||
gtk_mplocaledir = join_paths(gtk_prefix, get_option('localedir'))
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
cdata = configuration_data()
|
||||
@ -600,6 +603,84 @@ if win32_enabled
|
||||
|
||||
endif
|
||||
|
||||
# IMModules stuff-unfortunately we need to put items here
|
||||
# as they can be built as modules or built directly into GTK
|
||||
builtin_all_immodules = false
|
||||
|
||||
builtin_modules_opt = get_option('builtin_immodules')
|
||||
builtin_immodules = []
|
||||
|
||||
if builtin_modules_opt == ''
|
||||
if cc.get_id() == 'msvc'
|
||||
# Current MSVC projects build all immodules directly into GTK by default
|
||||
message('IMModules are built into GTK for MSVC builds by default')
|
||||
builtin_immodules = ['all']
|
||||
else
|
||||
builtin_immodules = ['none']
|
||||
endif
|
||||
else
|
||||
builtin_immodules = builtin_modules_opt.split(',')
|
||||
endif
|
||||
|
||||
if builtin_immodules.contains('none')
|
||||
builtin_immodules = []
|
||||
elif builtin_immodules.contains('all')
|
||||
builtin_all_immodules = true
|
||||
elif builtin_immodules.contains('backend')
|
||||
builtin_immodules += backend_immodules
|
||||
endif
|
||||
|
||||
# Unfortunately it seems that we need to include the input module sources here, and build
|
||||
# them in $(buildrootdir) if we are to build them included in GTK...
|
||||
# Make sure the source listings are the same as in modules/input/Makefile.am
|
||||
immodule_srcdir = 'modules/input/'
|
||||
immodules = [
|
||||
[ 'am-et', [ immodule_srcdir + 'imam-et.c' ] ],
|
||||
[ 'cedilla', [ immodule_srcdir + 'imcedilla.c' ] ],
|
||||
[ 'cyrillic-translit', [ immodule_srcdir + 'imcyrillic-translit.c' ] ],
|
||||
[ 'inuktitut', [ immodule_srcdir + 'iminuktitut.c' ] ],
|
||||
[ 'ipa', [ immodule_srcdir + 'imipa.c' ] ],
|
||||
[ 'multipress', [ immodule_srcdir + 'gtkimcontextmultipress.c', immodule_srcdir + 'immultipress.c' ], true,
|
||||
['-DMULTIPRESS_LOCALEDIR="\"@0@\""'.format(gtk_mplocaledir),
|
||||
'-DMULTIPRESS_CONFDIR="\"@0@/gtk-3.0\""'.format(gtk_sysconfdir)] ],
|
||||
[ 'thai', [ immodule_srcdir + 'thai-charprop.c', immodule_srcdir + 'gtkimcontextthai.c', immodule_srcdir + 'imthai.c' ] ],
|
||||
[ 'ti-er', [ immodule_srcdir + 'imti-er.c' ] ],
|
||||
[ 'ti-et', [ immodule_srcdir + 'imti-et.c' ] ],
|
||||
[ 'viqr', [ immodule_srcdir + 'imviqr.c' ] ],
|
||||
[ 'broadway', [ immodule_srcdir + 'imbroadway.c' ], broadway_enabled ],
|
||||
[ 'ime', [ immodule_srcdir + 'gtkimcontextime.c', immodule_srcdir + 'imime.c' ], win32_enabled ],
|
||||
# anything below this line is untested!
|
||||
[ 'quartz', [ immodule_srcdir + 'imquartz.c' ], quartz_enabled, '-xobjective-c' ],
|
||||
[ 'wayland', [ immodule_srcdir + immodule_srcdir + 'imwayland.c', immodule_srcdir + 'text-input-unstable-v3-protocol.c' ], wayland_enabled ],
|
||||
[ 'waylandgtk', [ immodule_srcdir + 'imwaylandgtk.c', immodule_srcdir + 'gtk-text-input-protocol.c' ], wayland_enabled ],
|
||||
[ 'xim', [ immodule_srcdir + 'gtkimcontextxim.c', immodule_srcdir + 'imxim.c' ], x11_enabled ],
|
||||
]
|
||||
|
||||
gtk_included_im_cflags = []
|
||||
gtk_included_im_deps = []
|
||||
immodules_cflags = [ '-DGTK_COMPILATION' ]
|
||||
included_immodules_cflags = immodules_cflags
|
||||
|
||||
foreach l: immodules
|
||||
name = l[0]
|
||||
sources = l[1]
|
||||
cond = l.get(2, true)
|
||||
cflags = l.get(3, [])
|
||||
|
||||
if cond and (builtin_immodules.contains(name) or builtin_all_immodules)
|
||||
cflag_for_included_immodule = ['-DINCLUDE_IM_@0@'.format(name)]
|
||||
gtk_included_im_cflags += cflag_for_included_immodule
|
||||
included_immodules_cflags += immodules_cflags + cflag_for_included_immodule + cflags
|
||||
|
||||
mod = static_library('staticimmodule-@0@'.format(name),
|
||||
sources,
|
||||
c_args: common_cflags + included_immodules_cflags,
|
||||
include_directories: [confinc, gtkinc])
|
||||
|
||||
gtk_included_im_deps += declare_dependency(link_with: mod)
|
||||
endif
|
||||
endforeach
|
||||
|
||||
# Check for bind_textdomain_codeset, including -lintl if GLib brings it in by
|
||||
# doing the same check as glib. We can't check that by linking to glib because
|
||||
# it might be a subproject and hence not built yet.
|
||||
|
@ -37,3 +37,7 @@ option('build-examples', type: 'boolean', value: 'true',
|
||||
description : 'Build examples')
|
||||
option('build-tests', type: 'boolean', value: 'true',
|
||||
description : 'Build tests')
|
||||
|
||||
# input modules
|
||||
option('builtin_immodules', type: 'string',
|
||||
value: '', description: 'Build specified immodules into GTK so/DLL (comma-separated list), "all", "none" or "backend"')
|
||||
|
27
modules/input/meson.build
Normal file
27
modules/input/meson.build
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
# Note: the list of immodules is in $(srcroot)/meson.build!
|
||||
|
||||
foreach l: immodules
|
||||
name = l[0]
|
||||
sources = l[1]
|
||||
cond = l.get(2, true)
|
||||
cflags = l.get(3, [])
|
||||
immod_sources = []
|
||||
|
||||
# Only get the filename without modules/input
|
||||
foreach s: sources
|
||||
immod_sources += s.split('/')[2]
|
||||
endforeach
|
||||
|
||||
if cond and not (builtin_immodules.contains(name) or builtin_all_immodules)
|
||||
immodules_cflags += cflags
|
||||
|
||||
shared_module('im-@0@'.format(name),
|
||||
immod_sources,
|
||||
c_args: common_cflags + immodules_cflags,
|
||||
dependencies: [ libgtk_dep ],
|
||||
install_dir: '@0@/gtk-@1@/@2@/immodules/'.format(gtk_libdir, gtk_api_version, gtk_binary_version),
|
||||
include_directories: [confinc, gtkinc],
|
||||
install : true)
|
||||
endif
|
||||
endforeach
|
@ -5,4 +5,4 @@
|
||||
print_backends = []
|
||||
#endif
|
||||
|
||||
#subdir('input')
|
||||
subdir('input')
|
||||
|
Loading…
Reference in New Issue
Block a user