Skip to content

fix gbk

fix gbk #65

name: CMake
on:
push:
tags:
- "*"
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha
- name: Export Actions runtime info for Actions caching
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.8.3'
#cache: true # It never successfully found cache from previous runs, disabling it
- name: Initialize MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Configure Qt6 path
shell: bash
run: |
echo "QT_DIR=$QT_ROOT_DIR" | sed 's/\\/\//g' >> $GITHUB_ENV
echo "QT6_DIR=$QT_ROOT_DIR" | sed 's/\\/\//g' >> $GITHUB_ENV
echo "GH_WORKSPACE=${{github.workspace}}" | sed 's/\\/\//g' >> $GITHUB_ENV
- name: Verify Qt Installation
shell: bash
run: |
echo "QT_DIR: $QT6_DIR"
ls -l "$QT6_DIR/lib/cmake/Qt6"
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 478939b61bfc6aa9faf4ab18b5e2495f18ac1fea # Grabbed on 2025-03-18 23:50 +0800
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Build Vcpkg packages
shell: cmd
working-directory: ${{github.workspace}}/vcpkg
run: |
vcpkg.exe install --x-manifest-root=../scripts/vcpkg-manifest --x-install-root=./installed --binarysource="clear;x-gha,readwrite" --triplet=x64-windows
env:
CMAKE_PREFIX_PATH: ${{env.QT_DIR}}
QT_DIR: ${{env.QT_DIR}}
Qt6_DIR: ${{env.QT_DIR}}
VCPKG_KEEP_ENV_VARS: 'CMAKE_PREFIX_PATH;QT_DIR;Qt6_DIR'
- name: Install OnnxRuntime
shell: cmd
working-directory: ${{github.workspace}}/src/libs
run: |
cmake -Dep=dml -P ../../scripts/setup-onnxruntime.cmake
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
shell: bash
working-directory: ${{github.workspace}}
run: cmake -B ${{env.GH_WORKSPACE}}/build -G Ninja -DBUILD_TESTS:BOOL=FALSE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.GH_WORKSPACE}}/deploy -DCMAKE_PREFIX_PATH=${{env.QT_DIR}}/lib/cmake/Qt6/ -DCMAKE_TOOLCHAIN_FILE=${{env.GH_WORKSPACE}}/vcpkg/scripts/buildsystems/vcpkg.cmake -DONNXRUNTIME_ENABLE_DML=ON
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --target all
- name: Deploy
run: cmake --build ${{github.workspace}}/build --target install
- name: Set Commit ID
shell: bash
working-directory: ${{github.workspace}}/build
run: |
BUILD_DATE=$(TZ='Asia/Shanghai' date +'%Y-%m-%d')
SHORT_HASH=$(git log --format="%H" -n 1 | head -c 7)
VERSION="${BUILD_DATE}-${SHORT_HASH}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dataset-tools-msvc2022-x64-${{env.VERSION}}
path: ${{github.workspace}}/deploy
- name: Compress release archive
shell: bash
working-directory: ${{env.GH_WORKSPACE}}/deploy/
run: |
7z a dataset-tools-msvc2022-x64-${{env.VERSION}}.zip ./*
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{env.GH_WORKSPACE}}/deploy/dataset-tools-msvc2022-x64-${{env.VERSION}}.zip