小编Ali*_*178的帖子

在 GitHub Actions 中构建基于 Qt/cmake 的项目

我在我的项目中使用 Qt 5.12.11。由于我想在linux和win上都使用该软件,所以我选择了gcc编译器(我使用MSYS2,所以gcc是10.3.0)。本地构建对于 linux 和 win 都可以,但是通过 GitHub Actions 构建无法找到 qt(无论我是否设置 CMAKE_PREFIX_PATH 或 Qt5_DIR)。

所以这就是我被困了一段时间的地方。有没有人遇到过这样的问题或者对此有什么想法?

github 操作看起来像

name: Build

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

env:
  BUILD_TYPE: Release

jobs:
  build:
    runs-on: windows-latest
    defaults:
        run:
            shell: msys2 {0}

    steps:
      - uses: msys2/setup-msys2@v2
        with:
            install: mingw-w64-x86_64-toolchain
            msystem: mingw64
            release: false

      - name: Install Qt
        uses: jurplel/install-qt-action@v2
        with:
          version: '5.12.11'
          host: 'windows'
          target: 'desktop'
          arch: 'win64_mingw73'
          dir: '${{github.workspace}}/qt/'
          install-deps: 'true'

      - name: List files in Qt
        run: find …
Run Code Online (Sandbox Code Playgroud)

c++ qt cmake msys2 github-actions

8
推荐指数
1
解决办法
3090
查看次数

标签 统计

c++ ×1

cmake ×1

github-actions ×1

msys2 ×1

qt ×1