From 7bc188ee576d24d898ca7965f9fe4f68dfb2e23c Mon Sep 17 00:00:00 2001 From: Totto16 Date: Sun, 11 Aug 2024 15:26:57 +0200 Subject: [PATCH 1/2] add msys2 CI --- .github/workflows/msys.yml | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/msys.yml diff --git a/.github/workflows/msys.yml b/.github/workflows/msys.yml new file mode 100644 index 000000000..9618e9ce2 --- /dev/null +++ b/.github/workflows/msys.yml @@ -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 From 7af83c86efa069d0ab34609b503e5ad0d147c62a Mon Sep 17 00:00:00 2001 From: Totto16 Date: Sun, 11 Aug 2024 17:15:21 +0200 Subject: [PATCH 2/2] fix #365 use wide strings with msys, since its windows and working without wstrings fails in some tests cases --- include/tao/pegtl/internal/read_file_stdio.hpp | 9 ++------- src/test/pegtl/verify_file.hpp | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/tao/pegtl/internal/read_file_stdio.hpp b/include/tao/pegtl/internal/read_file_stdio.hpp index 2d50c4798..29210cf1d 100644 --- a/include/tao/pegtl/internal/read_file_stdio.hpp +++ b/include/tao/pegtl/internal/read_file_stdio.hpp @@ -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; @@ -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 ) diff --git a/src/test/pegtl/verify_file.hpp b/src/test/pegtl/verify_file.hpp index 7f6aee32c..bddf8b220 100644 --- a/src/test/pegtl/verify_file.hpp +++ b/src/test/pegtl/verify_file.hpp @@ -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"