Skip to content

Commit

Permalink
Merge pull request #366 from Totto16/msys_support
Browse files Browse the repository at this point in the history
Add MSYS2 CI.
  • Loading branch information
ColinH authored Sep 15, 2024
2 parents 3bf9d44 + 8171fc4 commit f420443
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 8 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/msys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: msys2

on:
push:
paths-ignore:
- 'README.md'
- 'doc/**'
pull_request:
paths-ignore:
- 'README.md'
- 'doc/**'

jobs:
msys2:
strategy:
fail-fast: false
matrix:
platform:
- 'UCRT64'
- 'CLANG64'
build_type: [Debug, Release]

defaults:
run:
shell: msys2 {0}

runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.platform}}
install: >-
bison
dos2unix
git
pacboy: >-
cc:p
cmake:p
ninja:p
pkgconf:p
update: true

- run: cmake -E make_directory build
shell: msys2 {0}

- working-directory: build/
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

- working-directory: build/
run: cmake --build .

- working-directory: build/
run: ctest --output-on-failure
9 changes: 2 additions & 7 deletions include/tao/pegtl/internal/read_file_stdio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
[[nodiscard]] inline std::FILE* read_file_open( const std::filesystem::path& path )
{
errno = 0;
#if defined( _MSC_VER )
#if defined( _MSC_VER ) || defined( __MINGW32__ )
std::FILE* file;
if( ::_wfopen_s( &file, path.c_str(), L"rb" ) == 0 ) {
return file;
Expand All @@ -37,12 +37,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
std::terminate();
#endif
#else
#if defined( __MINGW32__ )
if( auto* file = std::fopen( path.string().c_str(), "rb" ) )
#else
if( auto* file = std::fopen( path.c_str(), "rbe" ) )
#endif
{
if( auto* file = std::fopen( path.c_str(), "rbe" ) ) {
return file;
}
#if defined( __cpp_exceptions )
Expand Down
2 changes: 1 addition & 1 deletion src/test/pegtl/verify_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "test.hpp"

#if defined( _MSC_VER )
#if defined( _MSC_VER ) || defined( __MINGW32__ )
#define TAO_PEGTL_TEST_FILENAME u"src/test/pegtl/file_äöü𝄞_data.txt"
#else
#define TAO_PEGTL_TEST_FILENAME "src/test/pegtl/file_äöü𝄞_data.txt"
Expand Down

0 comments on commit f420443

Please sign in to comment.