Skip to content

Update cmake-single-platform.yml #4

Update cmake-single-platform.yml

Update cmake-single-platform.yml #4

name: CMake with GCC on Windows
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: windows-latest
steps:
# 检出代码
- uses: actions/checkout@v4
# 安装 MinGW(g++)
- name: Install MinGW
run: |
choco install mingw
# 配置 CMake 使用 g++ 编译器
- name: Configure CMake with g++
run: |
# 配置 CMake 使用 MinGW 编译器
set CC=gcc
set CXX=g++
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=C:/tools/mingw/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/tools/mingw/bin/g++.exe
# 编译项目
- name: Build with CMake
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# 运行测试
- name: Run tests
run: ./build/tests --gtest_color=auto