Skip to content

add note on how to build Chimera for Windows XP #192

add note on how to build Chimera for Windows XP

add note on how to build Chimera for Windows XP #192

Workflow file for this run

name: build
# Run manually and each time anything is pushed or a PR is made
# Will only create a release for tagged commits
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
name: "Build Chimera"
runs-on: ubuntu-22.04
steps:
- name: "Install deps"
run: |-
sudo apt-get update
sudo apt-get install -y software-properties-common gnupg build-essential mingw-w64 cmake python3 p7zip-full curl git zstd
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed to generate a valid build number
- name: "Compile"
env:
# Enable stack protection
LDFLAGS: -fstack-protector
run: |-
# Make CMake toolchain file
printf '%s\n' \
'set(CMAKE_SYSTEM_NAME Windows)' \
'set(TOOLCHAIN i686-w64-mingw32)' \
'set(CMAKE_C_COMPILER ${TOOLCHAIN}-gcc-posix)' \
'set(CMAKE_CXX_COMPILER ${TOOLCHAIN}-g++-posix)' \
'set(CMAKE_RC_COMPILER ${TOOLCHAIN}-windres)' \
'set(CMAKE_AR ${TOOLCHAIN}-gcc-ar-posix)' \
'set(CMAKE_RANLIB ${TOOLCHAIN}-gcc-ranlib-posix)' \
'set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN})' \
'set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)' \
'set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)' \
'set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)' \
'set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)' \
> toolchain.cmake
cmake . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=build
cd build
make -j $(nproc)
# Strip symbols from the DLL if building a tagged commit
- name: "Strip symbols"
if: "startsWith(github.ref, 'refs/tags/')"
run: |-
i686-w64-mingw32-strip ./build/strings.dll
- name: "Package"
id: package
run: |-
7z a -mx=9 chimera.7z LICENSE README.md chimera.ini fonts ./build/strings.dll
# Set some variables to use when uploading the package
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "SHA=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
# Upload an artifact if building an untagged commit
- name: "Upload artifact"
if: "!startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: chimera-${{ steps.package.outputs.SHA }}
path: ./chimera.7z
# Create a release and upload the build if building a tagged commit
# NOTE: the create-release and upload-release-asset actions are
# unmaintained, but should keep working for the forseeable future
- name: "Create release"
id: create_release
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package.outputs.VERSION }}
release_name: Chimera v${{ steps.package.outputs.VERSION }}
draft: false
prerelease: false
- name: "Upload build"
uses: actions/upload-release-asset@v1
if: "startsWith(github.ref, 'refs/tags/')"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./chimera.7z
asset_name: chimera-${{ steps.package.outputs.VERSION }}.${{ steps.package.outputs.SHA }}.7z
asset_content_type: application/x-7z-compressed