Skip to content

Remove C++ flags from xmake configuration #43

Remove C++ flags from xmake configuration

Remove C++ flags from xmake configuration #43

Workflow file for this run

# Based on CanerKaraca20 build script
name: Build ModelExtras
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
actions-cache-folder: .xmake-cache
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y wget gnupg software-properties-common lsb-release g++-mingw-w64-i686
# Download LLVM installer script
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
# Install Clang 23
sudo ./llvm.sh 23
- name: Verify Clang
run: |
clang --version
clang++ --version
- name: Get latest plugin-sdk commit
id: plugin-sdk-ref
run: |
echo "sha=$(git ls-remote https://github.com/user-grinch/plugin-sdk-mingw.git HEAD | cut -f1)" >> "$GITHUB_OUTPUT"
- name: Restore plugin-sdk cache
id: plugin-sdk-cache
uses: actions/cache@v5
with:
path: plugin-sdk
key: plugin-sdk-${{ steps.plugin-sdk-ref.outputs.sha }}-i686-w64-mingw32
- name: Build plugin-sdk
if: steps.plugin-sdk-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/user-grinch/plugin-sdk-mingw.git plugin-sdk
cd plugin-sdk
git checkout "${{ steps.plugin-sdk-ref.outputs.sha }}"
mkdir -p output/lib
for dir in shared plugin_sa safetyhook; do
find "$dir" -type d -exec mkdir -p "obj/{}" \;
done
FLAGS="-I. -Ishared -Ishared/game -Iplugin_sa -Iplugin_sa/game_sa -Iplugin_sa/game_sa/rw -Isafetyhook -DGTASA -DPLUGIN_SGV_10US -DRW"
CLANG_FLAGS="--target=i686-w64-mingw32 -fpermissive -fcommon -fms-extensions -Wno-microsoft-include -Wno-invalid-offsetof -Wno-builtin-macro-redefined -O2 -D__cpp_concepts=202202L"
find shared plugin_sa safetyhook -name '*.cpp' -print0 | \
xargs -0 -P$(nproc) -I{} clang++-23 $CLANG_FLAGS -std=c++2b $FLAGS -c {} -o obj/{}.o
find safetyhook -name '*.c' -print0 | \
xargs -0 -P$(nproc) -I{} clang-23 $CLANG_FLAGS $FLAGS -c {} -o obj/{}.o
find obj -name '*.o' | xargs i686-w64-mingw32-ar rcs output/lib/libplugin.a
echo "PLUGIN_SDK_DIR=$GITHUB_WORKSPACE/plugin-sdk" >> "$GITHUB_ENV"
- name: Use cached plugin-sdk
if: steps.plugin-sdk-cache.outputs.cache-hit == 'true'
run: echo "PLUGIN_SDK_DIR=$GITHUB_WORKSPACE/plugin-sdk" >> "$GITHUB_ENV"
- name: Build ModelExtras with xmake
run: |
xmake f -m release \
--mingw=/usr \
--cc=clang-23 \
--cxx=clang++-23 \
-c -y
xmake -j$(nproc)
- name: Prepare artifact files
run: |
mkdir -p artifact/ModelExtras
cp build/mingw/x86/release/ModelExtras.asi artifact/ModelExtras.asi
cp resource/dist/ModelExtras.ini artifact/ModelExtras.ini
cp -r resource/dist/ModelExtras/* artifact/ModelExtras/
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ModelExtras-Test-Build
path: |
artifact/ModelExtras.asi
artifact/ModelExtras.ini
artifact/ModelExtras/**