build: Redo the tools build

Move the tools directory to be toplevel, and instead of
recompiling sources twice, link them with the our new
static libgtk.a.
This commit is contained in:
Matthias Clasen 2021-01-27 21:56:12 -05:00
parent 9e539a7f59
commit ac0f524722
18 changed files with 10 additions and 9 deletions

View File

@ -15,7 +15,7 @@ gtk_cargs = [
# introspected # introspected
gtk_private_sources = files([ gtk_private_sources = files([
'fnmatch.c', 'fnmatch.c',
'tools/gdkpixbufutils.c', 'gdkpixbufutils.c',
'gsettings-mapping.c', 'gsettings-mapping.c',
'gtkaccessibleattributeset.c', 'gtkaccessibleattributeset.c',
'gtkaccessiblevalue.c', 'gtkaccessiblevalue.c',
@ -113,7 +113,7 @@ gtk_private_sources = files([
'gtkgladecatalog.c', 'gtkgladecatalog.c',
'gtkhsla.c', 'gtkhsla.c',
'gtkiconcache.c', 'gtkiconcache.c',
'tools/gtkiconcachevalidator.c', 'gtkiconcachevalidator.c',
'gtkiconhelper.c', 'gtkiconhelper.c',
'gtkkineticscrolling.c', 'gtkkineticscrolling.c',
'gtkmagnifier.c', 'gtkmagnifier.c',
@ -1277,5 +1277,3 @@ libgtk_static_dep = declare_dependency(sources: gtk_dep_sources,
link_with: [libgtk_static, libgtk_css, libgdk, libgsk ], link_with: [libgtk_static, libgtk_css, libgdk, libgsk ],
link_args: common_ldflags, link_args: common_ldflags,
) )
subdir('tools')

View File

@ -689,6 +689,7 @@ subdir('gtk/css')
subdir('gdk') subdir('gdk')
subdir('gsk') subdir('gsk')
subdir('gtk') subdir('gtk')
subdir('tools')
subdir('modules') subdir('modules')
if get_option('demos') if get_option('demos')
subdir('demos') subdir('demos')

View File

@ -1,27 +1,29 @@
# Installed tools # Installed tools
gtk_tools = [ gtk_tools = [
['gtk4-query-settings', ['gtk-query-settings.c']], ['gtk4-query-settings', ['gtk-query-settings.c'], []],
['gtk4-builder-tool', ['gtk-builder-tool.c', ['gtk4-builder-tool', ['gtk-builder-tool.c',
'gtk-builder-tool-simplify.c', 'gtk-builder-tool-simplify.c',
'gtk-builder-tool-validate.c', 'gtk-builder-tool-validate.c',
'gtk-builder-tool-enumerate.c', 'gtk-builder-tool-enumerate.c',
'gtk-builder-tool-preview.c']], 'gtk-builder-tool-preview.c'], [] ],
['gtk4-update-icon-cache', ['updateiconcache.c', 'gtkiconcachevalidator.c']], ['gtk4-update-icon-cache', ['updateiconcache.c'], [ libgtk_static ] ],
['gtk4-encode-symbolic-svg', ['encodesymbolic.c', 'gdkpixbufutils.c']], ['gtk4-encode-symbolic-svg', ['encodesymbolic.c'], [ libgtk_static ] ],
] ]
if os_unix if os_unix
gtk_tools += [['gtk4-launch', ['gtk-launch.c']]] gtk_tools += [['gtk4-launch', ['gtk-launch.c'], []]]
endif endif
foreach tool: gtk_tools foreach tool: gtk_tools
tool_name = tool.get(0) tool_name = tool.get(0)
tool_srcs = tool.get(1) tool_srcs = tool.get(1)
tool_libs = tool.get(2)
exe = executable(tool_name, exe = executable(tool_name,
sources: tool_srcs, sources: tool_srcs,
include_directories: [confinc], include_directories: [confinc],
c_args: common_cflags, c_args: common_cflags,
link_with: tool_libs,
dependencies: libgtk_dep, dependencies: libgtk_dep,
install: true, install: true,
) )