meson: Cleanup and fix issues using libapp_dep

Meson has a very useful tool for combining a set of linked libraries and
compiler arguments (like an internal pkg-config):
`declare_dependency()`. Use this command to ensure that we can easily
reuse libapp* over multiple libraries, executables and tests.

That way, if we also add a new dependency later on in one of the libapp
libraries, this won't need to be added multiple times.
This commit is contained in:
Niels De Graef
2020-05-11 05:55:37 +02:00
parent 8b0dfb99d5
commit ddfae277cb
3 changed files with 61 additions and 97 deletions

View File

@ -47,11 +47,10 @@ libappconfig = static_library('appconfig',
test('app-config',
executable('test-config',
[ 'test-config.c', app_debug_files, ],
include_directories: [ rootInclude, rootAppInclude, ],
dependencies: [
gegl, gio, gio_specific,
appstream_glib,
libapp_dep,
],
link_with: [
libgimpbase,
@ -61,21 +60,7 @@ test('app-config',
libgimpmodule,
libgimpthumb,
libappcore,
libappconfig,
libappfile,
libappfiledata,
libappgegl,
libappinternalprocs,
libapplayermodes,
libapplayermodeslegacy,
libappoperations,
libapppaint,
libapppdb,
libappplugin,
libapptext,
libappvectors,
libappxcf,
],
install: false,
),

View File

@ -73,6 +73,61 @@ libapp = static_library('app',
)
if platform_windows
# for GimpDashboard and GimpBacktrace
psapi_cflags = [ '-DPSAPI_VERSION=1' ]
link_args = [ '-lpsapi' ]
else
psapi_cflags = [ ]
link_args = []
endif
if platform_osx
link_args += osx_ldflags
endif
libapp_dep = declare_dependency(
dependencies: [
dbghelp,
drmingw,
gegl,
gexiv2,
gio,
gio_specific,
gtk3,
lcms,
libbacktrace,
pangocairo,
pangoft2,
rpc,
],
link_with: [
libapp,
libappcore,
libappfile,
libappfiledata,
libappgegl,
libappinternalprocs,
libapplayermodes,
libapplayermodeslegacy,
libappoperations,
libapppaint,
libapppdb,
libappplugin,
libapptext,
libappvectors,
libappxcf,
],
include_directories: [
rootInclude,
rootAppInclude,
],
compile_args: psapi_cflags,
link_args: link_args,
)
# Those subdirs need to link against the first ones
subdir('config')
subdir('tests')
@ -81,20 +136,6 @@ subdir('tests')
app_links = [
libappconfig,
libappcore,
libappfile,
libappfiledata,
libappgegl,
libappinternalprocs,
libapplayermodes,
libapplayermodeslegacy,
libappoperations,
libapppaint,
libapppdb,
libappplugin,
libapptext,
libappvectors,
libappxcf,
libgimpbase,
libgimpcolor,
libgimpconfig,
@ -115,20 +156,6 @@ app_gui_links = [
libgimpwidgets,
]
app_deps = [
dbghelp,
drmingw,
gegl,
gexiv2,
gio,
gtk3,
lcms,
libbacktrace,
pangocairo,
pangoft2,
rpc,
]
# Executables
if platform_windows
@ -167,21 +194,9 @@ if platform_windows
rootInclude, appInclude,
],
)
# for GimpDashboard and GimpBacktrace
psapi_cflags = [ '-DPSAPI_VERSION=1' ]
link_args = [ '-lpsapi' ]
else
console_rc_file = []
gui_rc_file = []
psapi_cflags = [ ]
link_args = []
endif
if platform_osx
link_args += osx_ldflags
endif
gimpconsole_exe = executable('gimp-console-'+gimp_app_version,
@ -194,12 +209,10 @@ gimpconsole_exe = executable('gimp-console-'+gimp_app_version,
'-DGIMP_CONSOLE_COMPILATION',
psapi_cflags,
],
include_directories: rootInclude,
dependencies: app_deps,
dependencies: libapp_dep,
link_with: [
app_links,
],
link_args: link_args,
install: true,
)
@ -212,12 +225,10 @@ gimpmain_exe = executable('gimp-'+gimp_app_version,
'-DGIMP_APP_GLUE_COMPILATION',
psapi_cflags,
],
include_directories: rootInclude,
dependencies: app_deps,
dependencies: libapp_dep,
link_with: [
app_links,
app_gui_links,
],
link_args: link_args,
install: true,
)

View File

@ -1,43 +1,13 @@
apptests_includes = [
rootInclude, rootAppInclude
]
apptests_deps = [
appstream_glib,
dbghelp,
drmingw,
gegl,
gtk3,
libbacktrace,
pangocairo,
pangoft2,
]
apptests_links = [
libapp,
libappactions,
libappconfig,
libappcore,
libappdialogs,
libappactions,
libappdialogs,
libappdisplay,
libappfile,
libappfiledata,
libappgegl,
libappgui,
libappinternalprocs,
libapplayermodes,
libapplayermodeslegacy,
libappmenus,
libappoperations,
libapppaint,
libapppdb,
libappplugin,
libapppropgui,
libapptext,
libapptools,
libappvectors,
libappwidgets,
libappxcf,
libgimpbase,
libgimpcolor,
libgimpconfig,
@ -55,8 +25,7 @@ libapptestutils_sources = [
libapptestutils = static_library('apptestutils',
libapptestutils_sources,
include_directories: apptests_includes,
dependencies: apptests_deps,
dependencies: libapp_dep,
link_with: apptests_links,
)
@ -78,8 +47,7 @@ app_tests = [
foreach test_name : app_tests
test_exe = executable(test_name,
'test-@0@.c'.format(test_name),
include_directories: apptests_includes,
dependencies: apptests_deps,
dependencies: [ libapp_dep, appstream_glib ],
link_with: apptests_links,
)