jurplel / install-qt-action

Install Qt on your Github Actions workflows with just one simple action
MIT License
459 stars 78 forks source link

How to use cmake to build Qt ? #106

Closed joshion closed 2 years ago

joshion commented 2 years ago

See also "D:/a/Decade/Decade/build/CMakeFiles/CMakeOutput.log". CMake did not find one.

Could not find a package configuration file provided by "Qt5" with any of the following names:

Qt5Config.cmake
qt5-config.cmake

Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"

It seems that the "tool_cmake" has not been installed, how to install it?

pzhlkj6612 commented 2 years ago

Hi. Please try this:

    - uses: jurplel/install-qt-action@v2
      with:
        tools: 'tools_cmake,3.21.1,qt.tools.cmake.win64'

These information can be found in https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_cmake/Updates.xml .

joshion commented 2 years ago
  steps:
    - name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
         ...
    - name: Pull source code
      # This step must be the first step cause it would clean the workspace
      uses: actions/checkout@v2

I have figure it out, cause the "actions/checkout@v2" would clean the workspace, so the correct it as

  steps:
    - name: Pull source code
      # This step must be the first step cause it would clean the workspace
      uses: actions/checkout@v2

    - name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
         ...

The true rule need to remember: NO coding when you are full of sleepness

pzhlkj6612 commented 2 years ago

the "actions/checkout@v2" would clean the workspace

Well, it's true, but I think the problem behind it is that you are using the dir parameter:

    steps:
    - name: Install Qt
      uses: joshion/install-qt-action@v2
      with:
        ...
        dir: '${{github.workspace}}/3rdlibs'
        ...

From: https://github.com/joshion/Decade/blob/c07d8cdb6d9a63a6ce6d42c0139c02a5eb052560/.github/workflows/cmake.yml#L30

The default installation destination of Qt is not in ${{github.workspace}} , but $RUNNER_WORKSPACE (see code or dir § README. I cannot find it in GitHub Docs, though). If there is no special purpose, you can omit that parameter, then the installed Qt will not be affected by "actions/checkout@v2".