Repository navigation
ci(build): Add MinGW-w64 i686 cross-compilation to CI workflow #3552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
988b9a6
c48e661
6466fa4
8de43fd
79addaa
8564f5c
b36276c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: Build MinGW-w64 | ||
|
|
||
| # WARNING: Do not declare permissions in this reusable workflow. | ||
| # Declare the required permissions in each calling job: | ||
| # contents: read - required for all builds. | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| game: | ||
| required: true | ||
| type: string | ||
| description: "Game to build (Generals or GeneralsMD)" | ||
| preset: | ||
| required: true | ||
| type: string | ||
| description: "CMake preset" | ||
|
|
||
| jobs: | ||
| build: | ||
| name: ${{ inputs.preset }} | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 45 | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Install MinGW-w64 Toolchain | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y mingw-w64 cmake | ||
|
|
||
| - name: Install Wine and widl | ||
| run: | | ||
| # Add Wine repository | ||
| sudo dpkg --add-architecture i386 | ||
| sudo mkdir -pm755 /etc/apt/keyrings | ||
| sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key | ||
|
|
||
| # Determine Ubuntu codename | ||
| CODENAME=$(lsb_release -cs) | ||
|
|
||
| # Download appropriate sources file | ||
| sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/${CODENAME}/winehq-${CODENAME}.sources || { | ||
| sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources | ||
| } | ||
|
|
||
| # Update and install Wine | ||
| sudo apt-get update | ||
| sudo apt-get install -y --install-recommends winehq-stable wine-stable-dev || { | ||
| sudo apt-get install -y wine-stable-dev | ||
| } | ||
|
|
||
| - name: Cache CMake Dependencies | ||
| id: cache-cmake-deps | ||
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | ||
| with: | ||
| path: build/${{ inputs.preset }}/_deps | ||
| key: cmake-deps-mingw-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }} | ||
|
|
||
| - name: Configure ${{ inputs.game }} with CMake (${{ inputs.preset }}) | ||
| run: | | ||
| # Unset LD_LIBRARY_PATH to avoid library conflicts | ||
| unset LD_LIBRARY_PATH | ||
|
|
||
| # Configure with appropriate flags | ||
| cmake --preset ${{ inputs.preset }} \ | ||
| -DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }} \ | ||
| -DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }} \ | ||
| -DRTS_BUILD_CORE_TOOLS=OFF \ | ||
| -DRTS_BUILD_GENERALS_TOOLS=OFF \ | ||
| -DRTS_BUILD_ZEROHOUR_TOOLS=OFF \ | ||
| -DRTS_BUILD_CORE_EXTRAS=OFF \ | ||
| -DRTS_BUILD_GENERALS_EXTRAS=OFF \ | ||
| -DRTS_BUILD_ZEROHOUR_EXTRAS=OFF | ||
|
|
||
| - name: Build ${{ inputs.game }} (${{ inputs.preset }}) | ||
| run: | | ||
| # Build with parallel jobs | ||
| cmake --build build/${{ inputs.preset }} --target ${{ inputs.game == 'Generals' && 'g_generals' || 'z_generals' }} -j$(nproc) | ||
|
|
||
| - name: Collect ${{ inputs.game }} Artifacts | ||
| run: | | ||
| ARTIFACTS_DIR="build/${{ inputs.preset }}/${{ inputs.game }}/artifacts" | ||
| mkdir -p "$ARTIFACTS_DIR" | ||
|
|
||
| # Copy executables, DLLs, and debug symbols | ||
| find build/${{ inputs.preset }}/Core build/${{ inputs.preset }}/${{ inputs.game }} -path "$ARTIFACTS_DIR" -prune -o -type f \( -name "*.exe" -o -name "*.dll" -o -name "*.exe.debug" \) -exec cp -t "$ARTIFACTS_DIR" {} + | ||
|
|
||
| - name: Upload ${{ inputs.game }} ${{ inputs.preset }} Artifact | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: ${{ inputs.game }}-${{ inputs.preset }} | ||
| path: build/${{ inputs.preset }}/${{ inputs.game }}/artifacts | ||
| retention-days: 30 | ||
| if-no-files-found: error |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1077,6 +1077,12 @@ target_link_libraries(g_gameengine PUBLIC | |
| g_wwvegas | ||
| ) | ||
|
|
||
| # The engine calls functions that are implemented in the engine device, such as OSDisplaySetBusyState. | ||
| # Declaring this circular dependency lets linkers that read static libraries in order resolve them. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we remove this dependency? How many are there?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i counted at least 3 calls that go from the engine into the device library
The msvc linker searches all libraries, so it finds them in any order removing these calls means moving them behind interfaces in engine code can we rather do that in a separate pr? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Separate change.
Remove ReloadAllTextures and just call And for
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. opened the three changes as separate prs
OSDisplayWarningBox has no callers, so it does not need the device library at link time. I left it as it is. I can remove it in another PR if you want. After these are merged I will rebase this PR and remove this line. |
||
| target_link_libraries(g_gameengine INTERFACE | ||
| g_gameenginedevice | ||
| ) | ||
|
|
||
| target_precompile_headers(g_gameengine PRIVATE | ||
| [["Precompiled/BasePrecomp.h"]] # Must be first | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.