Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt deploy for Windows #1145

Merged
merged 6 commits into from Dec 17, 2020
Merged

Qt deploy for Windows #1145

merged 6 commits into from Dec 17, 2020

Conversation

SirLynix
Copy link
Member

@SirLynix SirLynix commented Dec 16, 2020

xmake currently supports qt deploying for android and macos, a similar tool exists for windows (windeployqt.exe) and this PR adds support for it.

It's based on qt.deploy.macos which is the closest from what exists on Windows.

Here's an output I got by using it:

checking for vswhere.exe ... C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
C:\Projets\Libs\Qt\5.15.0\msvc2019_64\bin\windeployqt.exe --force --verbose=1 test_qt\bin\BurgWarMapEditor.exe
C:\Projets\Burgwar\BurgWar\test_qt\bin\BurgWarMapEditor.exe 64 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Direct dependencies: Qt5Core Qt5Gui Qt5Widgets
All dependencies   : Qt5Core Qt5Gui Qt5Widgets
To be deployed     : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESv2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Updating vc_redist.x64.exe.
Creating directory C:/Projets/Burgwar/BurgWar/test_qt/bin/iconengines.
Updating qsvgicon.dll.
Creating directory C:/Projets/Burgwar/BurgWar/test_qt/bin/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory C:/Projets/Burgwar/BurgWar/test_qt/bin/platforms.
Updating qwindows.dll.
Creating directory C:/Projets/Burgwar/BurgWar/test_qt/bin/styles.
Updating qwindowsvistastyle.dll.
Creating C:\Projets\Burgwar\BurgWar\test_qt\bin\translations...
Creating qt_ar.qm...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
Creating qt_zh_TW.qm...

Please note this PR has still some problems/questions I couldn't fix by myself:

  • I'm searching for the app file (.exe) using
    local installfile = path.join(target:installdir(), "bin", target:basename() .. ".exe")

is this correct?

  • I tried to keep the progression print but it seems opt doesn't exist
    -- trace progress info
    -- progress.show(opt.progress, "${color.build.target}generating.qt.app %s.app", target:basename())
  • windeployqt.exe will try to fetch some files from Visual Studio to copy a runtime installer, and it needs a VCINSTALLDIR env for that, I did something that works for me but should be improved:
    -- do deploy
    local vs_studio = find_vstudio()

    -- Find Visual Studio
    local installDir = path.join(vs_studio["2019"].vcvarsall[target:arch()].VSInstallDir, "VC")
    os.addenv("VCINSTALLDIR", installDir)
  • Instead of deploying everytime the application is built, I'm deploying only on installation. I did this because the deploying takes some time. So I'm not sure if it should be done on build or install.
  • I did it also for the qt.console rule, as the fact it's a console application doesn't prevent it from needing Qt DLL and suchs.

Here you are!

@waruqi waruqi changed the base branch from dev to toolchain December 17, 2020 01:43
@waruqi waruqi changed the base branch from toolchain to dev December 17, 2020 01:53
@waruqi waruqi merged commit 4560dba into xmake-io:dev Dec 17, 2020
@waruqi
Copy link
Member

waruqi commented Dec 17, 2020

Thanks!

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.

None yet

2 participants