用于ARM上的Qt for Windows

Qt现在可以在WindowsonARM(WoA)上运行,但主要作为部署目标,需要x64机器构建后部署。Qt公司计划提供WoA作为开发主机的全面支持。用户可以使用ARM64版VisualStudio2022和ninja构建Qt。目前,QtCreator可在WoA上运行,但本机WoA包和安装程序还在开发中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Qt for Windows on ARM

用于ARM上的Qt for Windows

June 02, 2023 by Oliver Wolff | Comments

​2023年6月2日作者:Oliver Wolff |评论

While the use of an ARM-based platform on desktops quickly became the "next big thing" in the macOS world a while ago, the situation in the Microsoft Windows ecosystem is a bit different. One of the values of the Windows platform is a long retention of established architectures. Due to this, an adoption of a "new" architecture is slower on Windows. Even though Windows on ARM provides emulation for running x64 binaries, there is a performance cost for this. Some of our users ask to provide native support for Windows on ARM (WoA). In this blogpost, you will learn what is available today and get insights on where we want to go.

虽然不久前,在台式机上使用基于ARM的平台很快成为macOS世界的“下一件大事”,但微软Windows生态系统的情况有点不同。Windows平台的价值之一是长期保留已建立的体系结构。因此,在Windows上采用“新”体系结构的速度较慢。尽管ARM上的Windows提供了运行x64二进制文件的模拟,但这也会带来性能成本。我们的一些用户要求为ARM(WoA)上的Windows提供本机支持。在这篇博客文章中,您将了解今天的可用内容,并了解我们的发展方向。

Current situation

当前情况

We did quite some work to make Qt run well on WoA. A few things were not trivial. Today, it is possible to use Qt for development and run Qt apps on WoA as a deployment target. This means that applications have to be built using an x64 Windows machine and then deployed to the WoA target. This approach has been in tech preview for a while now, and we still lack several features like proper tooling from Qt Creator and a proper deployment strategy. This is also due to native underlying tooling not providing enablers for us to hook into.

我们做了相当多的工作,使Qt在WoA上运行良好。有几件事并非小事。如今,可以使用Qt进行开发,并在WoA上运行Qt应用程序作为部署目标。这意味着应用程序必须使用x64 Windows机器构建,然后部署到WoA目标。这种方法已经在技术预览中出现了一段时间,我们仍然缺乏一些功能,如Qt Creator的适当工具和适当的部署策略。这也是由于本地底层工具没有为我们提供挂钩的支持因素。

At the same time, this approach is not what most users want when they are using an ARM64 Windows machine. Unlike mobile phones or embedded devices, these WoA machines can be used as development hosts so that the application development itself happens on these machines.

同时,当大多数用户使用ARM64 Windows机器时,这种方法并不是他们想要的。与手机或嵌入式设备不同,这些WoA机器可以用作开发主机,因此应用程序开发本身就发生在这些机器上。

The plan

计划

Instead of supporting WoA as a deployment target, we aim for full support as a development host.

我们的目标不是作为部署目标支持WoA,而是作为开发主机提供全面支持。

Using ARM64 machines directly to develop the applications is what users want to do.

直接使用ARM64机器来开发应用程序是用户想要做的。

What you can do today

你今天能做什么

Building Qt natively for ARM64 is not much different from building Qt for an x64 machine. Having installed Visual Studio 2022 (17.4 or higher) on their ARM64 devices, users can just configure Qt using an ARM64 MSVC developer prompt and build it using ninja.

为ARM64原生构建Qt与为x64机器构建Qt没有太大区别。在他们的ARM64设备上安装了Visual Studio 2022(17.4或更高版本)后,用户只需使用ARM64 MSVC开发者提示配置Qt,并使用ninja构建它。

  • Install Visual Studio 2022 (including ninja) and git on your ARM64 machine
  • 在ARM64机器上安装Visual Studio 2022(包括ninja)和git
  • Either open an "ARM64 Native Tools Command Prompt for VS 2022" or call '"<Path to Visual Studio>\VC\Auxiliary\Build\vcvarsall.bat" arm64' from a cmd shell/Windows Terminal
  • 打开“ARM64 Native Tools Command Prompt for VS 2022”或从cmd shell/Windows Terminal调用“<Visual Studio路径>\VC\Axiliary\Build\vcvarsall.bat”ARM64'
  • Clone git://code.qt.io/qt/qt5.git into <Qt Source Dir>
  • 克隆git://code.qt.io/qt/qt5.git进入<Qt源目录>
  • Follow the instructions from our "Building Qt6 from Git" manual
  • ​遵循我们的“从Git构建Qt6”手册中的说明

The resulting Qt build can then be used to any Qt applications. qt-cmake.bat from <Qt Install Dir>/bin is a great helper script for that purpose. Just call qt-cmake.bat followed by "ninja/cmake --build" to build your Qt applications.

由此产生的Qt构建可以用于任何Qt应用程序。<Qt安装目录>/bin中的Qt-cmake.bat是一个很好的帮助脚本。只需调用qt-cmake.bat,然后再调用“ninja/cmake--build”即可构建qt应用程序。

Using this approach, you can build Qt Creator. You can also install Qt Creator using Qt's official online installers. Doing the latter, you will end up using an emulated Qt Creator, but this should be enough for a quick look on how to use your ARM64 Qt.

使用这种方法,可以构建Qt Creator。也可以使用Qt的官方在线安装程序安装Qt Creator。如果执行后者,最终将使用模拟的Qt Creator,但这应该足以快速了解如何使用ARM64 Qt。

In either of these two Qt Creator variants you can just register your Qt version(s) and set the kit(s) accordingly. With that, you should be ready to develop your Qt applications targetting Windows on ARM64 natively.

在这两种Qt Creator变体中的任何一种中,都可以注册您的Qt版本并相应地设置套件。有了这一点,应该准备好在ARM64上以Windows为目标开发Qt应用程序。

What is missing?

缺少什么?

There might be some minor issues when using Qt Creator on your ARM64 Windows machine, but most functionality should just work.

在ARM64 Windows机器上使用Qt Creator时可能会出现一些小问题,但大多数功能应该都能正常工作。

At the moment, we do not test native WoA packages in our CI infrastructure. We are working on the setup there and hope to give an update on that soon.

目前,我们还没有在CI基础设施中测试本机WoA包。我们正在那里进行设置,并希望很快提供最新情况。

As our CI system is also used to build our Qt packages, we do not have native packages for Windows on ARM for installation via the Qt Maintenance Tool right now. This fact should change as soon as the work on our CI system to support WoA builds will be completed.

由于我们的CI系统也用于构建我们的Qt软件包,我们目前没有用于ARM上Windows的本机软件包可通过Qt维护工具进行安装。一旦我们支持WoA构建的CI系统工作完成,这一事实就会改变。

Last but not least, we are missing native installers for Windows on ARM. As installers are built in CI, the same as with the previous point applies here.

最后但同样重要的是,我们缺少ARM上Windows的本机安装程序。由于安装程序是在CI中构建的,因此与前面的要点相同。

We are still considering whether to use ARM64 or ARM64EC as our "native ARM64 architecture". ARM64EC will probably give more flexibility when it comes to dependencies, and the performance impact might not be too big. We still have to do more research on this topic though. Perhaps we will cover this topic in more detail in an upcoming blog post.

​我们仍在考虑是否使用ARM64或ARM64EC作为我们的“原生ARM64架构”。在依赖性方面,ARM64EC可能会提供更大的灵活性,并且对性能的影响可能不会太大。尽管如此,我们仍然需要对这个话题进行更多的研究。也许我们会在即将发布的博客文章中更详细地介绍这个话题。

Summary

总结

Qt basically works natively on Windows on ARM. It is usable to build and run native Qt applications for your ARM64 devices but you will have to build Qt yourself. We, the Qt Company, still have some work to do to make the developer experience come up to par with the rest of our offering though.

Qt基本上在ARM上的Windows上原生运行。它可以为ARM64设备构建和运行本机Qt应用程序,但您必须自己构建Qt。尽管如此,我们Qt公司仍有一些工作要做,以使开发人员的体验与我们提供的其他产品不相上下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值