Skip to content

Add Qt pack support#7071

Merged
waruqi merged 12 commits intodevfrom
qt
Nov 28, 2025
Merged

Add Qt pack support#7071
waruqi merged 12 commits intodevfrom
qt

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Nov 27, 2025

#6873

qtapp ruki$ xmake pack -f dmg
checking for Xcode directory ... /Applications/Xcode.app
checking for SDK version of Xcode for macosx (x86_64) ... 15.2
checking for Minimal target version of Xcode for macosx (x86_64) ... 15.2
checking for Qt SDK version ... 5.15.2
packing build/xpack/qtapp/qtapp-macosx-x86_64-v1.0.0.dmg ..
pack ok
image
PS D:\projects\personal\xmake\tests\plugins\pack\qtapp> xmake pack -f nsis
packing build\xpack\qtapp\qtapp-windows-x64-v1.0.0.exe
image

@waruqi waruqi added this to the v3.0.6 milestone Nov 27, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @waruqi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces comprehensive support for packaging Qt applications using Xmake's xpack feature. It provides a new, fully configured Qt widget application example that demonstrates how to define an Xmake project, build a Qt application, and then package it into various distribution formats for different operating systems. This significantly simplifies the deployment workflow for Qt developers using Xmake, offering a streamlined way to create distributable application bundles.

Highlights

  • New Qt Application Example: A complete example of a Qt widget application has been added under tests/plugins/pack/qtapp/, demonstrating basic Qt UI and application structure.
  • Xpack Integration for Qt: The xmake.lua for the new Qt example showcases xpack configuration, enabling packaging into multiple formats like NSIS, DMG, AppImage, ZIP, and TAR.GZ.
  • Dynamic Icon Selection: The xpack configuration includes logic to dynamically select application icons based on the target packaging format (e.g., PNG for AppImage, ICO for others).
  • Xmake Rule Enhancements: Core Xmake Qt rules (qt.widgetapp, qt.widgetapp_static, qt.quickapp, qt.quickapp_static) have been updated to include on_installcmd("installcmd"), facilitating their integration with the xpack packaging system.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for packaging Qt applications using xpack. It introduces a new test case with a simple Qt widget application and updates the xmake Qt rules to include installation commands for xpack. The changes are logical and follow the PR's goal. I've identified a couple of areas for improvement regarding code redundancy and maintainability, with suggestions to make the build scripts cleaner and easier to manage in the future.

Comment on lines +8 to +11
add_headerfiles("src/*.h")
add_files("src/*.cpp")
add_files("src/mainwindow.ui")
add_files("src/mainwindow.h")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is some redundancy in how files are added to the qtapp target. The header file src/mainwindow.h is included by the glob in add_headerfiles on line 8, and then added explicitly with add_files on line 11. For Qt projects, headers containing Q_OBJECT macros need to be processed by the Meta-Object Compiler (moc), and adding them via add_files is the correct way to ensure this. The add_headerfiles call is therefore redundant for mainwindow.h. You can simplify this section to remove the redundancy and improve conciseness.

    add_files("src/*.cpp", "src/mainwindow.ui", "src/mainwindow.h")

after_install("mingw", "install.mingw")

-- install application for xpack
on_installcmd("installcmd")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The line on_installcmd("installcmd") is being added to four different rules (qt.widgetapp, qt.widgetapp_static, qt.quickapp, qt.quickapp_static). This contributes to a larger block of duplicated code for deployment and installation hooks that is repeated across these rules. To improve maintainability and avoid future inconsistencies, it would be beneficial to refactor this common logic into a single helper function. This function can then be called from each of the relevant rules.

For example, you could define a local function:

local function add_qt_app_install_hooks()
    -- deploy application
    after_build("android", "deploy.android")
    after_build("macosx", "deploy.macosx")

    -- install application for android
    on_install("android", "install.android")
    after_install("windows", "install.windows")
    after_install("mingw", "install.mingw")

    -- install application for xpack
    on_installcmd("installcmd")
end

And then call add_qt_app_install_hooks() inside each of the four rules instead of repeating the block of code.

@waruqi waruqi mentioned this pull request Nov 28, 2025
@waruqi waruqi merged commit ec0c0d4 into dev Nov 28, 2025
65 checks passed
@waruqi waruqi deleted the qt branch November 28, 2025 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant