There is no way to set build type (--debug or --release) in qt.deploy.flags passed to windeployqt. There is a logic inside xmake where it internally set build type passed to windeployqt determined by general build type.
But there is need to pass custom debug or release option to windeployqt when the general project build type is set to debug, but Qt is build as a release (most of the cases it's release). In this case, passing --debug to windeployqt led to the following error:
PS D:\dev\cpp\qt6-example> xmake install -o build/install -v
installing qt6-example ..
installing qt6-example to build/install ..
> copy build\bin\qt6-example.exe to build\install\bin
C:\Qt\mingw\bin\windeployqt.exe --force --verbose=1 --debug build\install\bin\qt6-example.exe
D:\dev\cpp\qt6-example\build\install\bin\qt6-example.exe 64 bit, debug executable
Adding in plugin type generic for module: Qt6Gui
Adding in plugin type iconengines for module: Qt6Gui
Adding in plugin type imageformats for module: Qt6Gui
Adding in plugin type platforminputcontexts for module: Qt6Gui
Adding in plugin type platforms for module: Qt6Gui
Adding in plugin type styles for module: Qt6Widgets
Direct dependencies: Qt6Core Qt6Gui Qt6Widgets
All dependencies : Qt6Core Qt6Gui Qt6Widgets
To be deployed : Qt6Core Qt6Gui Qt6Widgets
Unable to find the platform plugin.
checking for sudo ... no
error: install failed, execv(C:\Qt\mingw\bin\windeployqt.exe --force --verbose=1 --debug build\install\bin\qt6-example.exe) failed(1)
When I set, for example: set_values("qt.deploy.flags", {"--release"}) it leads to duplicated build type options (... --debug --release ...) passed to windeployqt:
Flags passed via set_values("qt.deploy.flags", {"--release"}) should have priority over default flags (--debug or --release) added internally by xmake and not led to duplicated options.
Project Configuration
add_rules("mode.debug", "mode.release")
set_config("mode", "debug") -- Set default mode to debug
add_rules("plugin.compile_commands.autoupdate", {outputdir = "build"}) -- Generate compile_commands.json
set_targetdir("$(buildir)/bin")
set_languages("c++20")
if is_plat("mingw") then
add_ldflags("-static")
end
set_values("qt.deploy.flags", {"--release"})
target("qt6-example")
add_rules("qt.widgetapp")
add_frameworks("QtNetwork")
add_files(
"main.cpp",
"mainwindow.cpp",
"mainwindow.h",
"mainwindow.ui",
"resources.qrc"
)
Additional Information and Error Logs
xmake install log
```
PS D:\dev\cpp\qt6-example> xmake install -o build/install -v
installing qt6-example ..
installing qt6-example to build/install ..
> copy build\bin\qt6-example.exe to build\install\bin
C:\Qt\mingw\bin\windeployqt.exe --force --verbose=1 --debug build\install\bin\qt6-example.exe
D:\dev\cpp\qt6-example\build\install\bin\qt6-example.exe 64 bit, debug executable
Adding in plugin type generic for module: Qt6Gui
Adding in plugin type iconengines for module: Qt6Gui
Adding in plugin type imageformats for module: Qt6Gui
Adding in plugin type platforminputcontexts for module: Qt6Gui
Adding in plugin type platforms for module: Qt6Gui
Adding in plugin type styles for module: Qt6Widgets
Direct dependencies: Qt6Core Qt6Gui Qt6Widgets
All dependencies : Qt6Core Qt6Gui Qt6Widgets
To be deployed : Qt6Core Qt6Gui Qt6Widgets
Unable to find the platform plugin.
checking for sudo ... no
error: install failed, execv(C:\Qt\mingw\bin\windeployqt.exe --force --verbose=1 --debug build\install\bin\qt6-example.exe) failed(1)
```
Xmake Version
2.9.3
Operating System Version and Architecture
Windows 11 Pro 23H2 22631.3880
Describe Bug
There is no way to set build type (
--debug
or--release
) inqt.deploy.flags
passed to windeployqt. There is a logic inside xmake where it internally set build type passed to windeployqt determined by general build type.But there is need to pass custom debug or release option to windeployqt when the general project build type is set to debug, but Qt is build as a release (most of the cases it's release). In this case, passing --debug to windeployqt led to the following error:
When I set, for example:
set_values("qt.deploy.flags", {"--release"})
it leads to duplicated build type options (... --debug --release ...) passed to windeployqt:Expected Behavior
Flags passed via
set_values("qt.deploy.flags", {"--release"})
should have priority over default flags (--debug or --release) added internally by xmake and not led to duplicated options.Project Configuration
Additional Information and Error Logs
xmake install log
``` PS D:\dev\cpp\qt6-example> xmake install -o build/install -v installing qt6-example .. installing qt6-example to build/install .. > copy build\bin\qt6-example.exe to build\install\bin C:\Qt\mingw\bin\windeployqt.exe --force --verbose=1 --debug build\install\bin\qt6-example.exe D:\dev\cpp\qt6-example\build\install\bin\qt6-example.exe 64 bit, debug executable Adding in plugin type generic for module: Qt6Gui Adding in plugin type iconengines for module: Qt6Gui Adding in plugin type imageformats for module: Qt6Gui Adding in plugin type platforminputcontexts for module: Qt6Gui Adding in plugin type platforms for module: Qt6Gui Adding in plugin type styles for module: Qt6Widgets Direct dependencies: Qt6Core Qt6Gui Qt6Widgets All dependencies : Qt6Core Qt6Gui Qt6Widgets To be deployed : Qt6Core Qt6Gui Qt6Widgets Unable to find the platform plugin. checking for sudo ... no error: install failed, execv(C:\Qt\mingw\bin\windeployqt.exe --force --verbose=1 --debug build\install\bin\qt6-example.exe) failed(1) ```