Skip to content

Commit

Permalink
Merge branch 'master' into use-auto-desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
jurplel authored May 13, 2023
2 parents 1b15628 + 6f7dd7e commit 6cf14df
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 11 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ jobs:
run: |
cd tests/TestWithModules
for /f "delims=" %%d in ( 'vswhere.exe -latest -property installationPath' ) do @( call "%%d\VC\Auxiliary\Build\vcvars64.bat" )
IF "%QT_VERSION:~0,1%"=="5" ( dir %Qt5_DIR%\lib\cmake ) ELSE ( dir %Qt6_DIR%\lib\cmake )
IF "%QT_VERSION:~0,1%"=="5" ( dir %Qt5_DIR% ) ELSE ( dir %QT_ROOT_DIR%\lib\cmake )
qmake
cmake -S . -B ./build
shell: cmd

- name: Configure test project on unix
Expand All @@ -138,11 +139,12 @@ jobs:
run: |
cd tests/TestWithModules
if [[ $QT_VERSION == 6* ]]; then
ls "$Qt6_DIR/lib/cmake"
ls "${QT_ROOT_DIR}/lib/cmake"
else
ls "$Qt5_DIR/lib/cmake"
ls "${Qt5_DIR}"
fi
qmake
cmake -S . -B ./build
shell: bash

- name: Install source
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Possible values: `desktop`, `android`, `ios`, or `winrt`
Default: `desktop`

### `arch`
This is the target architecture that your program will be built for. This is only used for Windows and Android.
This is the target architecture that your program will be built for.

**Linux x86 packages are not supported by this action.** Qt does not offer pre-built Linux x86 packages. Please consider using your distro's repository or building it manually.

Expand All @@ -67,7 +67,8 @@ Android: `android_armv7`
### `dir`
This is the directory prefix that Qt will be installed to.

For example, if you set dir to `${{ github.workspace }}/example/`, your bin folder will be located at `$GITHUB_WORKSPACE/example/Qt/5.15.2/{arch}/bin`. When possible, access your Qt directory through the `Qt5_DIR` or `Qt6_DIR` environment variable.
For example, if you set dir to `${{ github.workspace }}/example/`, your bin folder will be located at `$GITHUB_WORKSPACE/example/Qt/5.15.2/{arch}/bin`.
When possible, access your Qt directory through the `QT_ROOT_DIR` environment variable; this will point to `$GITHUB_WORKSPACE/example/Qt/5.15.2/{arch}` in this case.

Default: `$RUNNER_WORKSPACE` (this is one folder above the starting directory)

Expand Down Expand Up @@ -260,9 +261,13 @@ Example value: `--external 7z`
## More info
For more in-depth and certifiably up-to-date documentation, check the documentation for aqtinstall [here](https://aqtinstall.readthedocs.io/en/latest/getting_started.html).

The Qt bin directory is appended to your `path` environment variable. `Qt5_DIR`/`Qt6_DIR` is also set appropriately for cmake.
The Qt bin directory is appended to your `path` environment variable.
`Qt5_DIR` is also set appropriately for CMake if you are using Qt 5.
In addition, `QT_PLUGIN_PATH`, `QML2_IMPORT_PATH`, `PKG_CONFIG_PATH` and `LD_LIBRARY_PATH` are set accordingly. `IQTA_TOOLS` is set to the "Tools" directory if tools are installed as well.

Since the Qt bin directory is in your `path`, you will not need to set the `CMAKE_PREFIX_PATH` CMake variable.
If you wish to do so, you can set it to either `${QT_ROOT_DIR}` or to `${QT_ROOT_DIR}/lib/cmake`.

Big thanks to the [aqtinstall](https://github.com/miurahr/aqtinstall/) developer for making this easy. Please go support [miurahr](https://github.com/miurahr/aqtinstall), he did all of the hard work here ([his liberapay](https://liberapay.com/miurahr)).

This action is distributed under the [MIT license](LICENSE).
Expand Down
6 changes: 6 additions & 0 deletions README_upgrade_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
worked properly. As long as you are using `aqtinstall v3` or higher, the new version of `install-qt-action` will do
that automatically, so you can remove the second step where you add the parallel desktop version of Qt.
If you don't, your workflow will install desktop Qt twice.
* Added the `QT_ROOT_DIR` environment variable that points to the root of the Qt installation.
This variable points to the same directory as the old `Qt5_DIR` and `Qt6_DIR` variables.
* Changed `Qt5_DIR` environment variable, so that it points to `${QT_ROOT_DIR}/lib/cmake`, as required by CMake.
If your action uses this variable for any other purpose, you should update it to use `QT_ROOT_DIR` instead.
* Removed the `Qt5_Dir` and `Qt6_DIR` environment variables, because they are not used by CMake.
If your action uses these variables, you should update them to use `QT_ROOT_DIR` instead.

## v3
* Updated `aqtinstall` to version 2.1.* by default.
Expand Down
9 changes: 4 additions & 5 deletions action/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ const run = async (): Promise<void> => {
const dependencies = [
"build-essential",
"libgl1-mesa-dev",
"libgstreamer-gl1.0-0",
"libpulse-dev",
"libxcb-glx0",
"libxcb-icccm4",
Expand Down Expand Up @@ -413,13 +414,11 @@ const run = async (): Promise<void> => {
if (process.platform !== "win32") {
setOrAppendEnvVar("PKG_CONFIG_PATH", nativePath(`${qtPath}/lib/pkgconfig`));
}
// If less than qt6, set qt5_dir variable, otherwise set qt6_dir variable
// If less than qt6, set Qt5_DIR variable
if (compareVersions(inputs.version, "<", "6.0.0")) {
core.exportVariable("Qt5_Dir", qtPath); // Incorrect name that was fixed, but kept around so it doesn't break anything
core.exportVariable("Qt5_DIR", qtPath);
} else {
core.exportVariable("Qt6_DIR", qtPath);
core.exportVariable("Qt5_DIR", nativePath(`${qtPath}/lib/cmake`));
}
core.exportVariable("QT_ROOT_DIR", qtPath);
core.exportVariable("QT_PLUGIN_PATH", nativePath(`${qtPath}/plugins`));
core.exportVariable("QML2_IMPORT_PATH", nativePath(`${qtPath}/qml`));
core.addPath(nativePath(`${qtPath}/bin`));
Expand Down
26 changes: 26 additions & 0 deletions tests/TestWithModules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.1.0)

project(whatspoppin VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()

if(DEFINED ENV{Qt5_DIR})
find_package(Qt5 COMPONENTS WebEngineWidgets REQUIRED)
add_executable(whatspoppin main.cpp)
target_link_libraries(whatspoppin Qt5::WebEngineWidgets)
else()
find_package(Qt6 REQUIRED COMPONENTS Core WebEngineWidgets)
qt_standard_project_setup()
add_executable(whatspoppin main.cpp)
target_link_libraries(whatspoppin PRIVATE Qt::WebEngineWidgets Qt6::Core)
endif()

0 comments on commit 6cf14df

Please sign in to comment.