From 6247fa5bbcd153e1997507aa41e724efda2f1536 Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Tue, 27 Sep 2022 17:36:27 +0200 Subject: [PATCH] Fix building with MinGW 11.2.0 on Windows, add it into CI/CD --- .github/workflows/main.yml | 27 +++++++++++++++++++++++---- common/filesystem.h | 2 +- common/kaitai/kaitaistream.cpp | 4 ++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e87c220..305de7e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -87,7 +87,7 @@ jobs: - name: Build everything run: ninja -C build-meson - build_win: + build_windows: name: Build on Windows runs-on: windows-2019 steps: @@ -115,7 +115,7 @@ jobs: - name: Configure UEFIExtract shell: bash working-directory: ${{runner.workspace}}/build/UEFIExtract - run: cmake -G "Visual Studio 16 2019" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIExtract/ + run: cmake -G "Visual Studio 16 2019" -T "v141_xp" ../../UEFITool/UEFIExtract/ - name: Build UEFIExtract working-directory: ${{runner.workspace}}/build/UEFIExtract @@ -135,7 +135,7 @@ jobs: - name: Configure UEFIFind shell: bash working-directory: ${{runner.workspace}}/build/UEFIFind - run: cmake -G "Visual Studio 16 2019" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIFind/ + run: cmake -G "Visual Studio 16 2019" -T "v141_xp" ../../UEFITool/UEFIFind/ - name: Build UEFIFind working-directory: ${{runner.workspace}}/build/UEFIFind @@ -186,6 +186,25 @@ jobs: tag: ${{ github.ref }} file_glob: true + build_windows_mingw: + name: Build on Windows with MinGW + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: '6.3.1' + host: 'windows' + target: 'desktop' + arch: 'win64_mingw' + + - name: Build everything using CMake and MinGW + run: | + cmake -G "MinGW Makefiles" -B build . + cmake --build build -j + analyze_coverity: env: PROJECT_TYPE: TOOL @@ -262,7 +281,7 @@ jobs: run: | plog-converter -t sarif -o pvs-report.sarif PVS-Studio.log - - name: Publish PVS-Studio report + - name: Publish PVS-Studio report uses: github/codeql-action/upload-sarif@v2 with: sarif_file: pvs-report.sarif diff --git a/common/filesystem.h b/common/filesystem.h index 0666d4a..c6afb35 100644 --- a/common/filesystem.h +++ b/common/filesystem.h @@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -#ifdef WIN32 +#if defined(_WIN32) || defined(__MINGW32__) #include #include static inline bool isExistOnFs(const UString & path) { diff --git a/common/kaitai/kaitaistream.cpp b/common/kaitai/kaitaistream.cpp index 95ece45..6f8112f 100644 --- a/common/kaitai/kaitaistream.cpp +++ b/common/kaitai/kaitaistream.cpp @@ -12,8 +12,8 @@ #define __BYTE_ORDER BYTE_ORDER #define __BIG_ENDIAN BIG_ENDIAN #define __LITTLE_ENDIAN LITTLE_ENDIAN -// Windows with MS compiler -#elif defined(_MSC_VER) +// Windows with MS or MinGW compilers +#elif defined(_MSC_VER) || defined(__MINGW32__) #include #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321