Skip to content

Commit 5db2db7

Browse files
authored
Merge branch 'master' into textdraw-limits
2 parents eff31fe + f8058db commit 5db2db7

19 files changed

Lines changed: 326 additions & 144 deletions

File tree

.github/workflows/build.yml

Lines changed: 173 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
jobs:
3434
build-windows:
3535
name: Windows build
36-
runs-on: windows-latest
36+
runs-on: windows-2022
3737

3838
strategy:
3939
matrix:
@@ -58,7 +58,7 @@ jobs:
5858
- name: Setup Python
5959
uses: actions/setup-python@v4
6060
with:
61-
python-version: '3.10'
61+
python-version: "3.10"
6262

6363
- name: Install CMake
6464
uses: lukka/get-cmake@latest
@@ -68,15 +68,15 @@ jobs:
6868
- name: Install latest conan
6969
run: |
7070
python -m pip install --upgrade pip
71-
pip install -v "conan==1.57.0"
71+
pip install conan
7272
7373
- name: Try to restore conan cache
7474
id: conan-cache-restore
7575
uses: actions/cache/restore@v3
7676
env:
7777
cache-name: cache-conan-modules
7878
with:
79-
path: ~/.conan/data
79+
path: ~/.conan2/p
8080
key: conan-windows-${{ matrix.arch }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
8181

8282
- name: Generate build files
@@ -85,15 +85,15 @@ jobs:
8585
$env:OMP_BUILD_COMMIT=$(git rev-parse HEAD)
8686
mkdir build
8787
cd build
88-
cmake -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} .. -A ${{ matrix.arch }} -T "ClangCL"
88+
cmake -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} .. -A ${{ matrix.arch }} -T "ClangCL"
8989
9090
- name: Try to save conan cache
9191
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
9292
uses: actions/cache/save@v3
9393
env:
9494
cache-name: cache-conan-modules
9595
with:
96-
path: ~/.conan/data
96+
path: ~/.conan2/p
9797
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
9898

9999
- name: Build
@@ -161,7 +161,7 @@ jobs:
161161
env:
162162
cache-name: cache-conan-modules
163163
with:
164-
path: docker/conan/data
164+
path: docker/conan2/p
165165
key: conan-linux-${{ matrix.arch }}-${{ matrix.ssl }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
166166

167167
- name: Build
@@ -175,7 +175,7 @@ jobs:
175175
env:
176176
cache-name: cache-conan-modules
177177
with:
178-
path: docker/conan/data
178+
path: docker/conan2/p
179179
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
180180

181181
- name: Create a build archive
@@ -241,64 +241,176 @@ jobs:
241241
ssl: [dynamic, static]
242242

243243
steps:
244-
- uses: actions/checkout@v4
245-
with:
246-
clean: true
247-
submodules: recursive
248-
fetch-depth: 0
249-
250-
- name: Declare build output variables
251-
id: vars
252-
shell: bash
253-
env:
254-
HEAD_REF: ${{ github.head_ref || github.ref_name }}
255-
run: |
256-
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
257-
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
258-
259-
- name: Try to restore conan cache
260-
id: conan-cache-restore
261-
uses: actions/cache/restore@v3
262-
env:
263-
cache-name: cache-conan-modules
264-
with:
265-
path: docker/conan/data
266-
key: conan-linux-${{ matrix.arch }}-${{ matrix.ssl }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
267-
268-
- name: Run ARM build
269-
uses: pguyot/arm-runner-action@v2.5.2
270-
with:
271-
base_image: ${{ matrix.arch == 'arm32' && 'raspios_lite' || 'raspios_lite_arm64' }}:2022-04-04
272-
image_additional_mb: 10000
273-
bind_mount_repository: true
274-
cpu: cortex-a7
275-
commands: |
244+
- uses: actions/checkout@v4
245+
with:
246+
clean: true
247+
submodules: recursive
248+
fetch-depth: 0
249+
250+
- name: Declare build output variables
251+
id: vars
252+
shell: bash
253+
env:
254+
HEAD_REF: ${{ github.head_ref || github.ref_name }}
255+
run: |
256+
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
257+
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
258+
259+
- name: Try to restore conan cache
260+
id: conan-cache-restore
261+
uses: actions/cache/restore@v3
262+
env:
263+
cache-name: cache-conan-modules
264+
with:
265+
path: docker/conan2/p
266+
key: conan-linux-${{ matrix.arch }}-${{ matrix.ssl }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
267+
268+
- name: Run ARM build
269+
uses: pguyot/arm-runner-action@v2.5.2
270+
with:
271+
base_image: ${{ matrix.arch == 'arm32' && 'raspios_lite' || 'raspios_lite_arm64' }}:2022-04-04
272+
image_additional_mb: 10000
273+
bind_mount_repository: true
274+
cpu: cortex-a7
275+
commands: |
276276
apt update && apt install -y ninja-build clang-11 python3-pip libstdc++6 libc6
277277
pip install --upgrade pip setuptools wheel
278-
pip3 install --user -v "conan==1.59.0"
278+
pip3 install --user conan
279279
pip3 install --user -v "cmake==3.23.3"
280280
export CC=/usr/bin/clang-11
281281
export CXX=/usr/bin/clang++-11
282282
export PATH=~/.local/bin:${PATH}
283-
mkdir -p docker/conan/data
284-
mkdir ~/.conan
285-
mv docker/conan/data ~/.conan
283+
mkdir -p docker/conan2/p
284+
mkdir -p ~/.conan2
285+
mv docker/conan2/p ~/.conan2
286286
cmake -S . -B build -G Ninja -DTARGET_BUILD_ARCH=${{ matrix.arch == 'arm32' && 'armv7' || 'armv8' }} -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} -DSHARED_OPENSSL=${{ matrix.ssl == 'dynamic' }} -DSTATIC_STDCXX=true -DBUILD_SERVER=1 -DBUILD_ABI_CHECK_TOOL=0
287287
cmake --build build --config ${{ steps.vars.outputs.build_config }} --parallel $(nproc)
288-
mv ~/.conan/data docker/conan
289-
290-
- name: Upload build artifacts
291-
uses: actions/upload-artifact@v4
292-
with:
293-
name: open.mp-linux-${{ matrix.arch }}${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${{ steps.vars.outputs.build_version }}
294-
path: build/Output/${{ steps.vars.outputs.build_config }}/Server
295-
if-no-files-found: error
296-
297-
- name: Try to save conan cache
298-
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
299-
uses: actions/cache/save@v3
300-
env:
301-
cache-name: cache-conan-modules
302-
with:
303-
path: docker/conan/data
304-
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
288+
mv ~/.conan2/p docker/conan2
289+
290+
- name: Upload build artifacts
291+
uses: actions/upload-artifact@v4
292+
with:
293+
name: open.mp-linux-${{ matrix.arch }}${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${{ steps.vars.outputs.build_version }}
294+
path: build/Output/${{ steps.vars.outputs.build_config }}/Server
295+
if-no-files-found: error
296+
297+
- name: Try to save conan cache
298+
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
299+
uses: actions/cache/save@v3
300+
env:
301+
cache-name: cache-conan-modules
302+
with:
303+
path: docker/conan2/p
304+
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
305+
306+
build-macos-arm:
307+
name: macOS ARM build
308+
runs-on: macos-latest
309+
310+
strategy:
311+
matrix:
312+
ssl: [dynamic, static]
313+
314+
steps:
315+
- uses: actions/checkout@v4
316+
with:
317+
clean: true
318+
submodules: recursive
319+
fetch-depth: 0
320+
321+
- name: Declare build output variables
322+
id: vars
323+
shell: bash
324+
env:
325+
HEAD_REF: ${{ github.head_ref || github.ref_name }}
326+
run: |
327+
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> "$GITHUB_OUTPUT"
328+
echo "build_config=RelWithDebInfo" >> "$GITHUB_OUTPUT"
329+
echo "build_shared=${{ matrix.ssl == 'dynamic' }}" >> $GITHUB_OUTPUT
330+
echo "build_server=1" >> "$GITHUB_OUTPUT"
331+
echo "build_tools=0" >> "$GITHUB_OUTPUT"
332+
echo "build_target_arch=arm64" >> "$GITHUB_OUTPUT"
333+
334+
- name: Install CMake
335+
uses: lukka/get-cmake@latest
336+
with:
337+
cmakeVersion: "3.31.8"
338+
339+
- name: Install build dependencies
340+
shell: bash
341+
run: |
342+
brew update
343+
brew install ninja
344+
345+
python3 -m venv "$RUNNER_TEMP/conan-venv"
346+
source "$RUNNER_TEMP/conan-venv/bin/activate"
347+
348+
python -m pip install --upgrade pip
349+
python -m pip install conan
350+
351+
echo "$RUNNER_TEMP/conan-venv/bin" >> "$GITHUB_PATH"
352+
353+
conan --version
354+
cmake --version
355+
ninja --version
356+
clang --version
357+
358+
- name: Restore Conan cache
359+
id: conan-cache-restore
360+
uses: actions/cache/restore@v4
361+
with:
362+
path: ~/.conan2/p
363+
key: conan-macos-arm64-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
364+
365+
- name: Configure
366+
shell: bash
367+
run: |
368+
export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
369+
export MACOSX_DEPLOYMENT_TARGET="11.0"
370+
export CFLAGS="-isysroot ${SDKROOT}"
371+
export CXXFLAGS="-isysroot ${SDKROOT}"
372+
export LDFLAGS="-isysroot ${SDKROOT}"
373+
374+
cmake -S . -B build \
375+
-G Ninja \
376+
-DCMAKE_OSX_SYSROOT="${SDKROOT}" \
377+
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
378+
-DTARGET_BUILD_ARCH=${{ steps.vars.outputs.build_target_arch }} \
379+
-DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} \
380+
-DSHARED_OPENSSL=${{ steps.vars.outputs.build_shared }} \
381+
-DSTATIC_STDCXX=false \
382+
-DBUILD_SERVER=${{ steps.vars.outputs.build_server }} \
383+
-DBUILD_ABI_CHECK_TOOL=${{ steps.vars.outputs.build_tools }}
384+
385+
- name: Build
386+
shell: bash
387+
run: |
388+
cmake --build build \
389+
--config ${{ steps.vars.outputs.build_config }} \
390+
--parallel "$(sysctl -n hw.logicalcpu)"
391+
392+
- name: Save Conan cache
393+
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
394+
uses: actions/cache/save@v4
395+
with:
396+
path: ~/.conan2/p
397+
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
398+
399+
- name: Create build archive
400+
id: build
401+
shell: bash
402+
run: |
403+
version="${{ steps.vars.outputs.build_version }}"
404+
artifact_name="open.mp-macos-arm${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${version}"
405+
406+
echo "artifact_name=${artifact_name}" >> "$GITHUB_OUTPUT"
407+
408+
cd "build/Output/${{ steps.vars.outputs.build_config }}"
409+
tar -cJvf "${artifact_name}.tar.xz" "Server"
410+
411+
- name: Upload build artifacts
412+
uses: actions/upload-artifact@v4
413+
with:
414+
name: ${{ steps.build.outputs.artifact_name }}
415+
path: build/Output/${{ steps.vars.outputs.build_config }}/${{ steps.build.outputs.artifact_name }}.tar.xz
416+
if-no-files-found: error

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ __pycache__/
296296
*.i
297297
.vscode/
298298
/docker/conan/
299+
/docker/conan2/
299300
/docker/data/
300301
/buildlinux/*
301302
**/CMakeFiles/*

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if(MSVC)
1919
add_link_options("/LARGEADDRESSAWARE")
2020
# Use strict intermediate floating-point precision
2121
add_compile_options("/fp:strict")
22+
add_compile_options("/MP")
2223
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
2324
add_compile_options("/arch:SSE2")
2425
endif()

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
## Tools
2828

2929
* [CMake 3.19+](https://cmake.org/)
30-
* [Conan 1.57+](https://conan.io/) (You can't use conan v2.x, so may need to [download directly from github releases](https://github.com/conan-io/conan/releases) or install it using `pip3 install conan==1.57.0`)
30+
* [Conan 2.x](https://conan.io/) (Install it using `pip install conan` or `pip3 install conan`)
3131

3232
## Tools on Windows
3333

@@ -58,11 +58,11 @@ cmake --build . --config RelWithDebInfo
5858

5959
## Building on Mac
6060

61-
If you install conan via brew you must ensure you get the correct version; however, the cmake-conan script will not detect it from the default install location. You must therefore also alias it elsewhere:
61+
If you install conan via brew the cmake-conan script will not detect it from the default install location. You must therefore also alias it elsewhere:
6262

6363
```bash
64-
brew install conan@1
65-
sudo ln -s /usr/local/opt/conan@1/bin/conan /usr/local/bin/conan
64+
brew install conan
65+
sudo ln -s /usr/local/opt/conan/bin/conan /usr/local/bin/conan
6666
cd open.mp
6767
mkdir build
6868
cd build

Server/Components/CAPI/Impl/GangZones/APIs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ OMP_CAPI(GangZone_Create, objectPtr(float minx, float miny, float maxx, float ma
4646
OMP_CAPI(GangZone_Destroy, bool(objectPtr gangzone))
4747
{
4848
POOL_ENTITY_RET(gangzones, IGangZone, gangzone, gz, false);
49+
int legacyID = gangzones->toLegacyID(gz->getID());
4950
gangzones->release(gz->getID());
50-
gangzones->releaseLegacyID(gangzones->toLegacyID(gz->getID()));
51+
gangzones->releaseLegacyID(legacyID);
5152
return true;
5253
}
5354

Server/Components/CAPI/Impl/Pickups/APIs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ OMP_CAPI(Pickup_AddStatic, bool(int model, int type, float x, float y, float z,
6262
OMP_CAPI(Pickup_Destroy, bool(objectPtr pickup))
6363
{
6464
POOL_ENTITY_RET(pickups, IPickup, pickup, p, false);
65+
int legacyID = pickups->toLegacyID(p->getID());
6566
pickups->release(p->getID());
66-
pickups->releaseLegacyID(pickups->toLegacyID(p->getID()));
67+
pickups->releaseLegacyID(legacyID);
6768
return true;
6869
}
6970

0 commit comments

Comments
 (0)