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

Support ARM64 hosts #273

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ jobs:
qt:
tools-only-build: true
add-tools-to-path: false
- os: ubuntu-24.04-arm
qt:
version: "6.8.1"
requested: "6.8.1"
modules: qtwebengine qtpositioning qtwebchannel


steps:
Expand Down Expand Up @@ -123,7 +128,7 @@ jobs:
dir: ${{ matrix.dir }}
modules: ${{ matrix.qt.modules }}
version: ${{ matrix.qt.requested }}
tools: tools_ifw tools_qtcreator,qt.tools.qtcreator
tools: tools_ifw tools_qtcreator_gui,qt.tools.qtcreator_gui
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name seems to have changed a while back; tools_qtcreator doesn't exist for ARM64 Linux and references version 9.0 on other platforms. tools_qtcreator_gui is for the latest version (15.0 at the moment).

cache: ${{ matrix.cache == 'cached' }}

- name: Install Qt with options and specified aqtversion
Expand All @@ -134,7 +139,7 @@ jobs:
dir: ${{ matrix.dir }}
modules: ${{ matrix.qt.modules }}
version: ${{ matrix.qt.requested }}
tools: tools_ifw tools_qtcreator,qt.tools.qtcreator
tools: tools_ifw tools_qtcreator_gui,qt.tools.qtcreator_gui
cache: ${{ matrix.cache == 'cached' }}

- name: Test QT_ROOT_DIR
Expand Down Expand Up @@ -228,7 +233,7 @@ jobs:
with:
dir: ${{ matrix.dir }}
tools-only: true
tools: tools_ifw tools_qtcreator,qt.tools.qtcreator tools_cmake tools_ninja tools_conan
tools: tools_ifw tools_qtcreator_gui,qt.tools.qtcreator_gui tools_cmake tools_ninja tools_conan
add-tools-to-path: ${{ matrix.qt.add-tools-to-path }}
cache: ${{ matrix.cache == 'cached' }}

Expand All @@ -240,7 +245,7 @@ jobs:
set -x

# tools_ifw: use `archivegen` to test that Tools/QtInstallerFramework/4.7/bin is added to path
# tools_qtcreator: use `qbs` to test that Tools/QtCreator/bin or "Qt Creator.app/Contents/MacOS/" is added to path
# tools_qtcreator_gui: use `qbs` to test that Tools/QtCreator/bin or "Qt Creator.app/Contents/MacOS/" is added to path
# tools_cmake: test that Tools/CMake/bin or Tools/CMake/CMake.app/Contents/bin is added to path
# tools_ninja: test that Tools/Ninja is added to path
# tools_conan: test that Tools/Conan is added to path
Expand Down Expand Up @@ -270,7 +275,7 @@ jobs:
[[ -e "../Qt/Tools/Conan/conan" ]]

# tools_ifw: use `archivegen` to test that Tools/QtInstallerFramework/4.7/bin is not added to path
# tools_qtcreator: use `qbs` to test that Tools/QtCreator/bin or "Qt Creator.app/Contents/MacOS/" is not added to path
# tools_qtcreator_gui: use `qbs` to test that Tools/QtCreator/bin or "Qt Creator.app/Contents/MacOS/" is not added to path
# tools_cmake: test that Tools/CMake/bin or Tools/CMake/CMake.app/Contents/bin is not added to path
# tools_ninja: test that Tools/Ninja is not added to path
# tools_conan: test that Tools/Conan is not added to path
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This is the host platform of the Qt version you will be installing. It's unlikel

For example, if you are building on Linux and targeting desktop, you would set host to `linux`. If you are building on Linux and targeting android, you would set host to `linux` also. The host platform is the platform that your application will build on, not its target platform.

Possible values: `windows`, `mac`, or `linux`
Possible values: `windows`, `windows_arm64`, `mac`, `linux` or `linux_arm64`

Defaults to the current platform it is being run on.

Expand Down Expand Up @@ -64,6 +64,8 @@ Windows w/ Qt >= 5.15 && Qt < 6.8: `win64_msvc2019_64`

Windows w/ Qt >= 6.8: `win64_msvc2022_64`

Windows (ARM64) w/ Qt >= 6.8: `win64_msvc2022_arm64`

Android: `android_armv7`

### `dir`
Expand Down
30 changes: 21 additions & 9 deletions action/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,23 @@ const flaggedList = (flag: string, listArgs: readonly string[]): string[] => {
return listArgs.length ? [flag, ...listArgs] : [];
};

const locateQtArchDir = (installDir: string): [string, boolean] => {
const locateQtArchDir = (installDir: string, host: string): [string, boolean] => {
// For 6.4.2/gcc, qmake is at 'installDir/6.4.2/gcc_64/bin/qmake'.
// This makes a list of all the viable arch directories that contain a qmake file.
const qtArchDirs = glob
.sync(`${installDir}/[0-9]*/*/bin/qmake*`)
.map((s) => path.resolve(s, "..", ".."));

// For Qt6 mobile and wasm installations, and Qt6 Windows on ARM installations,
// For Qt6 mobile and wasm installations, and Qt6 Windows on ARM cross-compiled installations,
// a standard desktop Qt installation must exist alongside the requested architecture.
// In these cases, we must select the first item that ends with 'android*', 'ios', 'wasm*' or 'msvc*_arm64'.
const requiresParallelDesktop = qtArchDirs.filter((archPath) => {
const archDir = path.basename(archPath);
const versionDir = path.basename(path.join(archPath, ".."));
return (
versionDir.match(/^6\.\d+\.\d+$/) && archDir.match(/^(android.*|ios|wasm.*|msvc.*_arm64)$/)
versionDir.match(/^6\.\d+\.\d+$/) &&
(archDir.match(/^(android.*|ios|wasm.*)$/) ||
(archDir.match(/^msvc.*_arm64$/) && host !== "windows_arm64"))
);
});
if (requiresParallelDesktop.length) {
Expand All @@ -106,7 +108,7 @@ const isAutodesktopSupported = async (): Promise<boolean> => {
};

class Inputs {
readonly host: "windows" | "mac" | "linux";
readonly host: "windows" | "windows_arm64" | "mac" | "linux" | "linux_arm64";
readonly target: "desktop" | "android" | "ios";
readonly version: string;
readonly arch: string;
Expand Down Expand Up @@ -144,24 +146,32 @@ class Inputs {
if (!host) {
switch (process.platform) {
case "win32": {
this.host = "windows";
this.host = process.arch === "arm64" ? "windows_arm64" : "windows";
break;
}
case "darwin": {
this.host = "mac";
break;
}
default: {
this.host = "linux";
this.host = process.arch === "arm64" ? "linux_arm64" : "linux";
break;
}
}
} else {
// Make sure host is one of the allowed values
if (host === "windows" || host === "mac" || host === "linux") {
if (
host === "windows" ||
host === "windows_arm64" ||
host === "mac" ||
host === "linux" ||
host === "linux_arm64"
) {
this.host = host;
} else {
throw TypeError(`host: "${host}" is not one of "windows" | "mac" | "linux"`);
throw TypeError(
`host: "${host}" is not one of "windows" | "windows_arm64" | "mac" | "linux" | "linux_arm64"`
);
}
}

Expand Down Expand Up @@ -200,6 +210,8 @@ class Inputs {
} else {
this.arch = "win64_msvc2017_64";
}
} else if (this.host === "windows_arm64") {
this.arch = "win64_msvc2022_arm64";
}
}

Expand Down Expand Up @@ -457,7 +469,7 @@ const run = async (): Promise<void> => {
}
// Set environment variables/outputs for binaries
if (inputs.isInstallQtBinaries) {
const [qtPath, requiresParallelDesktop] = locateQtArchDir(inputs.dir);
const [qtPath, requiresParallelDesktop] = locateQtArchDir(inputs.dir, inputs.host);
// Set outputs
core.setOutput("qtPath", qtPath);

Expand Down
Loading