diff --git a/.github/workflows/windows-msys2.yml b/.github/workflows/windows-msys2.yml new file mode 100644 index 0000000000..5458e4f8c2 --- /dev/null +++ b/.github/workflows/windows-msys2.yml @@ -0,0 +1,131 @@ +name: Windows MSYS2 Build + +on: + push: + branches: + - master + - windows_msys2 + pull_request: + branches: + - master + - windows_msys2 + +env: + BUILD_TYPE: Release + +jobs: + build: + name: Windows MSYS2 + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup MSYS2 + uses: msys2/setup-msys2@v2 + with: + msystem: ucrt64 + update: true + install: >- + wget + zip + + - name: Update MSYS2 and Install Dependencies + shell: msys2 {0} + run: | + dependencies=( + "mingw-w64-ucrt-x86_64-cmake" + "mingw-w64-ucrt-x86_64-extra-cmake-modules" + "mingw-w64-ucrt-x86_64-ninja" + "mingw-w64-ucrt-x86_64-toolchain" + "mingw-w64-ucrt-x86_64-gcc" + "mingw-w64-ucrt-x86_64-openssl" + "mingw-w64-ucrt-x86_64-gtest" + "make" + "cmake" + ) + pacman -Syu --noconfirm "${dependencies[@]}" + + - name: Build Workflow + shell: msys2 {0} + run: | + mkdir -p build + cmake \ + -B build \ + -G Ninja \ + -S . \ + -DCMAKE_BUILD_TYPE=Release + ninja -C build + + - name: Build Tutorial + shell: msys2 {0} + run: | + cd tutorial + mkdir -p build + cmake \ + -B build \ + -G Ninja \ + -S . \ + -DCMAKE_BUILD_TYPE=Release + ninja -C build + + - name: Build and Run Tests (Optional) + shell: msys2 {0} + continue-on-error: true + run: | + cd test + mkdir -p build + cmake \ + -B build \ + -G Ninja \ + -S . \ + -DCMAKE_BUILD_TYPE=Release + ninja -C build check + cd build + ctest --output-on-failure + + - name: Get Version + id: version + shell: bash + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + else + VERSION=$(date +%Y%m%d-%H%M%S) + fi + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version: $VERSION" + + - name: Package Workflow + shell: msys2 {0} + run: | + mkdir -p artifacts + VERSION="${{ steps.version.outputs.version }}" + if [ -d "_lib" ] && [ -d "_include" ]; then + mkdir -p workflow_windows_msys2_${VERSION} + cp -r _lib _include workflow_windows_msys2_${VERSION}/ + zip -r artifacts/workflow_windows_msys2_${VERSION}.zip workflow_windows_msys2_${VERSION} + rm -rf workflow_windows_msys2_${VERSION} + fi + + - name: Generate Checksums + shell: pwsh + run: | + cd artifacts + Get-ChildItem -File | ForEach-Object { + $hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash + "$hash $($_.Name)" | Out-File -Append -Encoding utf8 SHA256SUMS.txt + } + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: workflow-windows-msys2 + path: | + artifacts/workflow_windows_msys2_*.zip + artifacts/SHA256SUMS.txt + if-no-files-found: error + diff --git a/.gitignore b/.gitignore index 1c8e465dc7..3f3b7c6663 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,5 @@ _include _lib .vscode -build.cmake \ No newline at end of file +build.cmake +build \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index faf63ee209..eb4da001ad 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -47,7 +47,7 @@ endif () if (MINGW) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pipe -std=gnu90") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++14 -fexceptions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++17 -fexceptions") elseif (WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /wd4200") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4200 /Zc:__cplusplus /std:c++14")