How to define "platform-like" postprocessing steps? #13009
-
I would like to build a Qt binary using meson, and compile it for Linux, Windows using MXE, and AppImage using linuxdeployqt. How should I structure my build files to achieve that? Right now I have # meson.build
project('gui-qt', 'cpp',)
qt5 = import('qt5')
qt5_dep = dependency('qt5')
gui = executable(
'gui', [ 'src/gui.cpp' ], dependencies : qt5_dep,
) and for MXE I have # mxe-win32.ini
[host_machine]
system = 'windows'
cpu_family = 'x86'
cpu = 'x86_64'
endian = 'little'
[binaries]
ar = 'x86_64-w64-mingw32.static-ar'
c = 'x86_64-w64-mingw32.static-gcc'
cpp = 'x86_64-w64-mingw32.static-g++'
ld = 'x86_64-w64-mingw32.static-ld.bfd'
pkgconfig = 'x86_64-w64-mingw32.static-pkg-config'
strip = 'x86_64-w64-mingw32.static-strip' What would be the best way to also implement linuxdeployqt? I could add linuxdeployqt = find_program('./linuxdeployqt-x86_64.AppImage')
appimage = custom_target(
'appimage',
input : gui,
output : 'GUI-x86_64.AppImage',
command : [linuxdeployqt, '--appimage-extract-and-run', 'appdir/gui', '-unsupported-allow-new-glibc', '-appimage', '-verbose=2'],
) to my
Does anyone have an alternative idea? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You could make it optional behind: linuxdeployqt = find_program('linuxdeployqt-x86_64.AppImage', required: false)
if linuxdeployqt.found()
custom_target(........)
endif No option needed, but instead it allows running You may also want to use an alias_target() to allow running |
Beta Was this translation helpful? Give feedback.
-
I realized that what I'm trying to do is actually packaging, not building, so I ended up with the following structure: # meson.build
project('gui-qt', 'cpp',)
qt5 = import('qt5')
qt5_dep = dependency('qt5')
gui = executable(
'gui',
[ 'src/gui.cpp' ],
dependencies : qt5_dep,
install: true,
install_dir : '/usr/bin/',
)
install_data(
'appdir/gui.desktop',
install_dir : '/usr/share/applications/'
)
install_data(
'appdir/gui.png',
install_dir : '/usr/share/icons/hicolor/128x128/apps/'
) and then running
which neatly separates building and packaging. |
Beta Was this translation helpful? Give feedback.
I realized that what I'm trying to do is actually packaging, not building, so I ended up with the following structure:
and then running