Gimp/app/meson.build
Jehan 52928e04a5 Issue #7327: Cannot build GIMP3 on MSYS2 using Meson.
This is untested on my side, because the bug only happens on native
builds with meson (our CI has cross-builds with meson and native builds
with autotools and I only do cross-builds locally) but I think/hope it
will work.

Basically we were using .full_path() because these rc files were also
used as input of some configure_file() calls which doesn't like custom
target objects as input (it wants strings or file objects). Yet a bug
in meson didn't like the colon used in native Windows full paths ('C:'
and such) when used in windows.compile_resources(). This has been fixed
by Luca Bacci in: https://github.com/mesonbuild/meson/pull/9368
Yet we just cannot depend on very early meson (or worse dev meson code).

On the other hand, if the input is a custom_tgt object, it uses the
object ID which we give as first parameter of custom_target() so we know
it's appropriately named without colons (such as 'gimp_plugins_rc').
Thus we should not bump into this issue again.

For the few usage in configure_file(), I just add a .full_path() only
when needed at call time.

Last but not least, I replace the bogus `meson --version` call by a
`python3 -c 'exit()'` as advised by Eli Schwartz:
2afa019c70 (note_1284951)

The reason is that it is apparently possible (or will be when some
reimplementation of meson will be done) that the `meson` executable
itself does not exist. On the other hand, `python3` should always be
there, as a mandatory dependency of the build tool.

In order to use an appropriate `python3`, I made the
pythonmod.find_installation() check required in our build (which should
not be a problem since it's a meson requirement as well), even when the
-Dpython option is false (this one depends on other requirements too
anyway, such as version and pygobject). This way I can call this meson
variable of discovered python in my bogus call, instead of calling a
(potentially different) python from PATH environment.
2021-10-12 17:06:18 +02:00

234 lines
4.5 KiB
Meson

rootAppInclude = include_directories('.')
app_mkenums_custom_target_commonargs = [
gimp_mkenums_custom_target_commonargs,
'--dtail',' { 0, NULL, NULL }\n'+
' };\n'+
'\n'+
' static GType type = 0;\n'+
'\n'+
' if (G_UNLIKELY (! type))\n'+
' {\n'+
' type = g_@type@_register_static ("@EnumName@", values);\n'+
' gimp_type_set_translation_context (type, "@enumnick@");\n'+
' gimp_@type@_set_value_descriptions (type, descs);\n'+
' }\n'+
'\n'+
' return type;\n'+
'}\n',
]
subdir('actions')
subdir('core')
subdir('dialogs')
subdir('display')
subdir('file')
subdir('file-data')
subdir('gegl')
subdir('gui')
subdir('menus')
subdir('operations')
subdir('paint')
subdir('pdb')
subdir('plug-in')
subdir('propgui')
subdir('text')
subdir('tools')
subdir('vectors')
subdir('widgets')
subdir('xcf')
# For app/config
app_debug_files = files(
'gimp-debug.c',
'gimp-log.c',
)
# Top-level library
libapp_sources = [
'app.c',
'errors.c',
'gimp-debug.c',
'gimp-log.c',
'gimp-update.c',
'gimp-version.c',
'language.c',
'sanity.c',
'signals.c',
'tests.c',
'unique.c',
gitversion_h,
gimpdbusservice_gen,
]
libapp = static_library('app',
libapp_sources,
include_directories: [ rootInclude, rootAppInclude, configInclude, ],
c_args: [ '-DG_LOG_DOMAIN="Gimp"', '-DGIMP_APP_GLUE_COMPILATION', ],
dependencies: [
gegl, gdk_pixbuf, gtk3,
],
)
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')
app_links = [
libappconfig,
libgimpbase,
libgimpcolor,
libgimpconfig,
libgimpmath,
libgimpmodule,
libgimpthumb,
]
app_gui_links = [
libappactions,
libappdialogs,
libappdisplay,
libappgui,
libappmenus,
libapppropgui,
libapptools,
libappwidgets,
libgimpwidgets,
]
# Executables
if platform_windows
console_rc_name = 'gimp-console-'+ gimp_app_version
gimp_app_console_rc = configure_file(
input : gimp_plugins_rc.full_path(),
output: console_rc_name + '.rc',
copy: true,
)
console_rc_file = windows.compile_resources(
gimp_app_console_rc,
args: [
'--define', 'ORIGINALFILENAME_STR="@0@"'.format(console_rc_name+'.exe'),
'--define', 'INTERNALNAME_STR="@0@"' .format(console_rc_name),
'--define', 'TOP_SRCDIR="@0@"' .format(meson.source_root()),
],
include_directories: [
rootInclude, appInclude,
],
)
gui_rc_name = 'gimp-'+ gimp_app_version
gimp_app_gui_rc = configure_file(
input : gimp_plugins_rc.full_path(),
output: gui_rc_name + '.rc',
copy: true,
)
gui_rc_file = windows.compile_resources(
gimp_app_rc,
args: [
'--define', 'ORIGINALFILENAME_STR="@0@"'.format(gui_rc_name+'.exe'),
'--define', 'INTERNALNAME_STR="@0@"' .format(gui_rc_name),
'--define', 'TOP_SRCDIR="@0@"' .format(meson.source_root()),
],
include_directories: [
rootInclude, appInclude,
],
)
else
console_rc_file = []
gui_rc_file = []
endif
gimpconsole_exe = executable('gimp-console-'+gimp_app_version,
'main.c',
libapp_sources,
console_rc_file,
c_args: [
'-DG_LOG_DOMAIN="Gimp"',
'-DGIMP_APP_GLUE_COMPILATION',
'-DGIMP_CONSOLE_COMPILATION',
psapi_cflags,
],
dependencies: libapp_dep,
link_with: [
app_links,
],
install: true,
)
gimpmain_exe = executable('gimp-'+gimp_app_version,
'main.c',
libapp_sources,
gui_rc_file,
c_args: [
'-DG_LOG_DOMAIN="Gimp"',
'-DGIMP_APP_GLUE_COMPILATION',
psapi_cflags,
],
dependencies: libapp_dep,
link_with: [
app_links,
app_gui_links,
],
install: true,
)