This repository was archived by the owner on Jan 21, 2026. It is now read-only.
forked from Garey27/sm-debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
219 lines (190 loc) · 7.58 KB
/
cmake.yml
File metadata and controls
219 lines (190 loc) · 7.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: Build SourcePawn and SourceMod Debugger
on:
pull_request:
workflow_dispatch:
push:
tags: ['*']
jobs:
build_sourcepawn:
name: Build SourcePawn
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- windows-latest
steps:
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 clang
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Checkout SourceMod
uses: actions/checkout@v4
with:
repository: alliedmodders/sourcemod
path: sourcemod
submodules: recursive
- name: Switch to debug symbol sourcepawn branch
working-directory: sourcemod/sourcepawn
run: |
git remote add peace https://github.com/peace-maker/sourcepawn.git
git fetch peace
git switch debug_api_symbols
git submodule update --init --recursive
- name: Install dependencies
run: |
python -m pip install wheel
pip install git+https://github.com/alliedmodders/ambuild
- name: Compile SourcePawn VM
working-directory: sourcemod/sourcepawn
run: |
python configure.py --enable-optimize --targets x86,x86_64
ambuild objdir
- name: Rename and Organize SourcePawn VM Files
shell: bash
run: |
mkdir -p "${{ github.workspace }}/sourcepawn-output/addons/sourcemod/bin/x64"
if [ "${{ runner.os }}" == "Linux" ]; then
cp sourcemod/sourcepawn/objdir/libsourcepawn/linux-x86/libsourcepawn.so "${{ github.workspace }}/sourcepawn-output/addons/sourcemod/bin/sourcepawn.jit.x86.so"
cp sourcemod/sourcepawn/objdir/libsourcepawn/linux-x86_64/libsourcepawn.so "${{ github.workspace }}/sourcepawn-output/addons/sourcemod/bin/x64/sourcepawn.vm.so"
else
cp sourcemod/sourcepawn/objdir/libsourcepawn/windows-x86/libsourcepawn.dll "${{ github.workspace }}/sourcepawn-output/addons/sourcemod/bin/sourcepawn.jit.x86.dll"
cp sourcemod/sourcepawn/objdir/libsourcepawn/windows-x86_64/libsourcepawn.dll "${{ github.workspace }}/sourcepawn-output/addons/sourcemod/bin/x64/sourcepawn.vm.dll"
fi
- name: Upload SourcePawn artifacts
uses: actions/upload-artifact@v4
with:
name: sourcepawn-${{ matrix.os }}
path: sourcepawn-output
build_sm_debugger:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo add-apt-repository 'deb http://mirror.yandex.ru/ubuntu/ hirsute main universe' -y
#sudo apt-get update
sudo apt-get --assume-yes install curl zip unzip tar pkg-config \
gcc-11-multilib g++-11-multilib ninja-build cmake tree libasio-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 10
- name: Install Windows Dependencies
if: runner.os == 'Windows'
run: |
choco install ninja
- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: Update vcpkg Baseline
shell: bash
run: |
if [ -f vcpkg.json ]; then
VCPKG_COMMIT=$(git -C dep/vcpkg rev-parse HEAD)
if [[ "$RUNNER_OS" == "Windows" ]]; then
powershell -Command "\
\$json = Get-Content vcpkg.json | ConvertFrom-Json; \
\$json | Add-Member -NotePropertyName 'builtin-baseline' -NotePropertyValue '$VCPKG_COMMIT' -Force; \
\$json | ConvertTo-Json | Set-Content vcpkg.json"
else
# Simpler approach for Linux/macOS
sed -i "s/\"builtin-baseline\":[^,}]*/\"builtin-baseline\": \"$VCPKG_COMMIT\"/" vcpkg.json
fi
cat vcpkg.json
fi
- name: Install vcpkg
working-directory: ${{github.workspace}}
shell: bash
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
cp cmake/x86-linux-sm.cmake dep/vcpkg/triplets/x86-linux-sm.cmake
./dep/vcpkg/bootstrap-vcpkg.sh -musl
./dep/vcpkg/vcpkg install --triplet x86-linux-sm --debug
else
./dep/vcpkg/bootstrap-vcpkg.bat -disableMetrics
./dep/vcpkg/vcpkg install --triplet x86-windows-static
fi
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: |
rm -rf build
cmake -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="./dep/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=x86-linux-sm \
-DCMAKE_CXX_FLAGS_INIT="-m32" \
-DCMAKE_C_FLAGS_INIT="-m32"
cmake --build build -j
tree .
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
working-directory: ${{github.workspace}}
shell: pwsh
run: |
cmake -B build -G Ninja `
-DCMAKE_TOOLCHAIN_FILE="./dep/vcpkg/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x86-windows-static
cmake --build build --config Release --parallel
tree ${{github.workspace}}
- name: Deploy artifacts
uses: actions/upload-artifact@v4
with:
name: sm_debugger-${{ matrix.os }}
path: ${{github.workspace}}/build/sm_debugger.ext.${{ runner.os == 'Linux' && 'so' || 'dll' }}
publish:
name: Publish Release
runs-on: ubuntu-latest
needs: [build_sourcepawn, build_sm_debugger]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: sm_debugger-*
path: artifacts
- name: Download SourcePawn artifacts
uses: actions/download-artifact@v4
with:
pattern: sourcepawn-*
path: sourcepawn-artifacts
- name: Archive artifacts
run: |
# Create all required directories
mkdir -p addons/sourcemod/extensions
mkdir -p addons/sourcemod/bin
mkdir -p addons/sourcemod/bin/x64
# Copy debugger extensions
cp artifacts/sm_debugger-*/* addons/sourcemod/extensions/
# Copy SourcePawn binaries for both platforms
cp -r sourcepawn-artifacts/sourcepawn-ubuntu-22.04/addons/sourcemod/bin/* addons/sourcemod/bin/
cp -r sourcepawn-artifacts/sourcepawn-windows-latest/addons/sourcemod/bin/* addons/sourcemod/bin/
# Create autoload file
touch addons/sourcemod/extensions/sm_debugger.autoload
# Create zip archive
7z a -tzip sm_debugger-bin-${RELEASE_VERSION}.zip addons
- name: Release
uses: softprops/action-gh-release@v2
with:
files: sm_debugger-bin-*.zip