From a62b2d5c9e6bbbac3664fb333633a238f10e114a Mon Sep 17 00:00:00 2001 From: RandomBrushes Date: Thu, 1 Jan 2026 16:47:51 +0100 Subject: [PATCH 1/3] Cross-compile Win32 binaries on Linux. Also remove the untested MacOS builds. --- .github/workflows/create-artifacts.yml | 77 +++++++------------------- CMakeLists.txt | 2 +- main.cc | 4 ++ 3 files changed, 25 insertions(+), 58 deletions(-) diff --git a/.github/workflows/create-artifacts.yml b/.github/workflows/create-artifacts.yml index eb987e5..43a3f2c 100644 --- a/.github/workflows/create-artifacts.yml +++ b/.github/workflows/create-artifacts.yml @@ -3,7 +3,7 @@ name: build on: [push, pull_request] jobs: - linux_build: + linux_and_mingw_build: runs-on: ubuntu-latest env: CXX: g++ @@ -18,6 +18,9 @@ jobs: - name: Install 32-bit libraries run: | sudo apt install -y g++-multilib zlib1g:i386 libsnappy-dev:i386 liblz4-1:i386 + - name: Install mingw + run: | + sudo apt install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 - name: Checkout uses: actions/checkout@v4 - name: Build 64 bit @@ -43,63 +46,23 @@ jobs: with: name: qpakman-linux32 path: ./build-lin32/qpakman - - macos_build: - runs-on: macos-13 - env: - CXX: clang++ - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build + - name: Build static Win32 executable with MinGW32 run: | - mkdir build-macos && cd build-macos - cmake ../ + mkdir build-win32 && cd build-win32 + cmake -G "Unix Makefiles" \ + -DCMAKE_SYSTEM_NAME=Windows \ + -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc \ + -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ \ + -DCMAKE_FIND_ROOT_PATH=/usr/i686-w64-mingw32 \ + -DCMAKE_EXE_LINKER_FLAGS="-static -static-libgcc -static-libstdc++" \ + -DCMAKE_CXX_FLAGS="-static -static-libgcc -static-libstdc++" \ + -DCMAKE_BUILD_TYPE=Release \ + ../ cmake --build . - - name: Archive qpakman macOS - uses: actions/upload-artifact@v4 - with: - name: qpakman-macos - path: ./build-macos/qpakman - - windows_build: - runs-on: windows-2022 - env: - VCPKG_VERSION: 120deac3062162151622ca4860575a33844ba10b - vcpkg_packages: zlib - strategy: - matrix: - config: - - { - arch: x86, - generator: "-G'Visual Studio 17 2022' -A Win32", - vcpkg_triplet: x86-windows-static, - artifact_name: windows32 - } - - { - arch: x64, - generator: "-G'Visual Studio 17 2022' -A x64", - vcpkg_triplet: x64-windows-static, - artifact_name: windows64 - } - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Run vcpkg - uses: lukka/run-vcpkg@v7 - with: - vcpkgArguments: zlib - vcpkgDirectory: '${{ github.workspace }}\vcpkg' - appendedCacheKey: ${{ matrix.config.vcpkg_triplet }} - vcpkgGitCommitId: ${{ env.VCPKG_VERSION }} - vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }} - - name: Build - run: | - mkdir build-${{ matrix.config.vcpkg_triplet }} && cd build-${{ matrix.config.vcpkg_triplet }} - cmake ${{matrix.config.generator}} -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="${{ matrix.config.vcpkg_triplet }}" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" ../ - cmake --build . --config Release - - name: Archive qpakman Windows + cd ../ + - name: Archive qpakman win32 uses: actions/upload-artifact@v4 with: - name: qpakman-${{ matrix.config.artifact_name }} - path: ./build-${{ matrix.config.vcpkg_triplet }}/Release/qpakman.exe + name: qpakman-win32 + path: ./build-win32/qpakman.exe + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index bc90519..0a11678 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ add_executable(qpakman im_gen.cc im_mip.cc im_format.cc im_tex.cc archive.cc pakfile.cc main.cc) -if(WIN32) +if(WIN32 AND MSVC) # include setargv.obj for file wildcard expansion # https://learn.microsoft.com/en-us/cpp/c-language/expanding-wildcard-arguments set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} setargv.obj") diff --git a/main.cc b/main.cc index 9815394..8b96ccd 100644 --- a/main.cc +++ b/main.cc @@ -31,6 +31,10 @@ #define VERSION "0.67" +#ifdef __MINGW32__ +// force-enable wildcard expansion for mingw builds +int _dowildcard = -1; +#endif std::string output_name; From dbb3984e4c1c0c99411a3f854758b4cbfadf8b76 Mon Sep 17 00:00:00 2001 From: RandomBrushes Date: Thu, 1 Jan 2026 17:27:49 +0100 Subject: [PATCH 2/3] re-introduce MacOS build --- .github/workflows/create-artifacts.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-artifacts.yml b/.github/workflows/create-artifacts.yml index 43a3f2c..db2caf0 100644 --- a/.github/workflows/create-artifacts.yml +++ b/.github/workflows/create-artifacts.yml @@ -65,4 +65,21 @@ jobs: with: name: qpakman-win32 path: ./build-win32/qpakman.exe - \ No newline at end of file + + macos_build: + runs-on: macos-15 + env: + CXX: clang++ + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build + run: | + mkdir build-macos && cd build-macos + cmake ../ + cmake --build . + - name: Archive qpakman macOS + uses: actions/upload-artifact@v4 + with: + name: qpakman-macos + path: ./build-macos/qpakman \ No newline at end of file From 4861c14d80741befbfcf2ace24885c9bc0453f84 Mon Sep 17 00:00:00 2001 From: RandomBrushes Date: Thu, 1 Jan 2026 17:30:04 +0100 Subject: [PATCH 3/3] increase cmake_minimum_required --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a11678..236348c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.5) project(QPAKMAN CXX)