mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-07-22 14:40:41 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a665e6042b | |||
| eda78f7e57 | |||
| f0861f7927 | |||
| 5efbbaa901 | |||
| 38494bb33a | |||
| a89b51ca50 | |||
| b4d6f90012 |
+29
-58
@@ -2,33 +2,16 @@ name: Linux
|
|||||||
|
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||||
VCPKG_FORCE_SYSTEM_BINARIES: 1
|
|
||||||
CMAKE_BUILD_TYPE: "Release"
|
CMAKE_BUILD_TYPE: "Release"
|
||||||
DEBIAN_FRONTEND: "noninteractive"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
x86_64-matrix:
|
debian-11-build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- distro: debian
|
|
||||||
version: 11
|
|
||||||
- distro: debian
|
|
||||||
version: 12
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 22.04
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 20.04
|
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.distro }}:${{ matrix.version }}
|
image: debian:11
|
||||||
steps:
|
steps:
|
||||||
- name: get-cmake
|
|
||||||
uses: lukka/get-cmake@v3.28.1
|
|
||||||
|
|
||||||
- name: Export GitHub Actions cache environment variables
|
- name: Export GitHub Actions cache environment variables
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
@@ -47,59 +30,43 @@ jobs:
|
|||||||
|
|
||||||
- name: Git config safe directory
|
- name: Git config safe directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1.5-git-safe.sh
|
run: bash ./scripts/debian-11/1.5-git-safe.sh
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1-install-deps.sh
|
run: bash ./scripts/debian-11/1-install-deps.sh
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
run: bash ./scripts/debian-11/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
||||||
|
|
||||||
- name: Build Server
|
- name: Build Server
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/3-build.sh
|
run: bash ./scripts/debian-11/3-build.sh
|
||||||
|
|
||||||
- name: Archive server artifact
|
- name: Archive server artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: BeamMP-Server.${{ matrix.distro }}.${{ matrix.version }}.x86_64
|
name: BeamMP-Server-debian
|
||||||
path: ./bin/BeamMP-Server
|
path: ./bin/BeamMP-Server
|
||||||
|
|
||||||
- name: Archive server debug info artifact
|
- name: Archive server debug info artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: debuginfo.${{ matrix.distro }}.${{ matrix.version }}.x86_64
|
name: BeamMP-Server-debian.debug
|
||||||
path: ./bin/BeamMP-Server.debug
|
path: ./bin/BeamMP-Server.debug
|
||||||
|
|
||||||
- name: Build Tests
|
- name: Build Tests
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/3-build-tests.sh
|
run: bash ./scripts/debian-11/3-build-tests.sh
|
||||||
|
|
||||||
- name: Install Runtime Dependencies
|
- name: Install Runtime Dependencies
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/4-install-runtime-deps.sh
|
run: bash ./scripts/debian-11/4-install-runtime-deps.sh
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ./bin/BeamMP-Server-tests
|
run: ./bin/BeamMP-Server-tests
|
||||||
|
|
||||||
arm64-matrix:
|
ubuntu-22-04-build:
|
||||||
runs-on: [Linux, ARM64]
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
VCPKG_DEFAULT_TRIPLET: "arm64-linux"
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- distro: debian
|
|
||||||
version: 11
|
|
||||||
- distro: debian
|
|
||||||
version: 12
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 22.04
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 20.04
|
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.distro }}:${{ matrix.version }}
|
image: ubuntu:22.04
|
||||||
steps:
|
steps:
|
||||||
- name: get-cmake
|
|
||||||
uses: lukka/get-cmake@v3.28.1
|
|
||||||
|
|
||||||
- name: Export GitHub Actions cache environment variables
|
- name: Export GitHub Actions cache environment variables
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
@@ -118,35 +85,39 @@ jobs:
|
|||||||
|
|
||||||
- name: Git config safe directory
|
- name: Git config safe directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1.5-git-safe.sh
|
run: bash ./scripts/ubuntu-22.04/1.5-git-safe.sh
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1-install-deps.sh
|
run: bash ./scripts/ubuntu-22.04/1-install-deps.sh
|
||||||
|
|
||||||
|
- name: Setup vcpkg
|
||||||
|
uses: lukka/run-vcpkg@v11
|
||||||
|
with:
|
||||||
|
runVcpkgInstall: true
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
run: bash ./scripts/ubuntu-22.04/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
||||||
|
|
||||||
- name: Build Server
|
- name: Build Server
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/3-build.sh
|
run: bash ./scripts/ubuntu-22.04/3-build.sh
|
||||||
|
|
||||||
- name: Archive server artifact
|
- name: Archive server artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: BeamMP-Server.${{ matrix.distro }}.${{ matrix.version }}.arm64
|
name: BeamMP-Server-ubuntu
|
||||||
path: ./bin/BeamMP-Server
|
path: ./bin/BeamMP-Server
|
||||||
|
|
||||||
- name: Archive server debug info artifact
|
- name: Archive server debug info artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: debuginfo.${{ matrix.distro }}.${{ matrix.version }}.arm64
|
name: BeamMP-Server-ubuntu.debug
|
||||||
path: ./bin/BeamMP-Server.debug
|
path: ./bin/BeamMP-Server.debug
|
||||||
|
|
||||||
- name: Build Tests
|
- name: Build Tests
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/3-build-tests.sh
|
run: bash ./scripts/ubuntu-22.04/3-build-tests.sh
|
||||||
|
|
||||||
- name: Install Runtime Dependencies
|
- name: Install Runtime Dependencies
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/4-install-runtime-deps.sh
|
run: bash ./scripts/ubuntu-22.04/4-install-runtime-deps.sh
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ./bin/BeamMP-Server-tests
|
run: ./bin/BeamMP-Server-tests
|
||||||
|
|
||||||
@@ -8,7 +8,6 @@ on:
|
|||||||
env:
|
env:
|
||||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||||
CMAKE_BUILD_TYPE: "Release"
|
CMAKE_BUILD_TYPE: "Release"
|
||||||
DEBIAN_FRONTEND: "noninteractive"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-release:
|
create-release:
|
||||||
@@ -28,30 +27,18 @@ jobs:
|
|||||||
draft: false
|
draft: false
|
||||||
prerelease: true
|
prerelease: true
|
||||||
body: |
|
body: |
|
||||||
Files included in this release are:
|
Files included in this release:
|
||||||
- `BeamMP-Server.$DISTRO.$DISTROVERSION.$ARCH` for linux builds, for example `BeamMP-Server.debian.11.x86_64` for the Debian 11 build for x86_64. All require `liblua5.3` to be installed.
|
- `BeamMP-Server.exe` is the windows build. You need to install the [Visual C++ Redistributables](https://aka.ms/vs/17/release/vc_redist.x64.exe) to run this.
|
||||||
- `BeamMP-Server.exe` for the Windows build (x86_64). You need to install the [Visual C++ Redistributables](https://aka.ms/vs/17/release/vc_redist.x64.exe) to run this.
|
- `BeamMP-Server-debian` is a Debian 11 build, requires `liblua5.3-0`.
|
||||||
|
- `BeamMP-Server-ubuntu` is a Ubuntu 22.04 build, requires `liblua5.3-0`.
|
||||||
|
|
||||||
x86_64-matrix:
|
upload-release-files-debian-11:
|
||||||
|
name: Build and upload Debian 11 Release Files
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: create-release
|
needs: create-release
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- distro: debian
|
|
||||||
version: 11
|
|
||||||
- distro: debian
|
|
||||||
version: 12
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 22.04
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 20.04
|
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.distro }}:${{ matrix.version }}
|
image: debian:11
|
||||||
steps:
|
steps:
|
||||||
- name: get-cmake
|
|
||||||
uses: lukka/get-cmake@v3.28.1
|
|
||||||
|
|
||||||
- name: Export GitHub Actions cache environment variables
|
- name: Export GitHub Actions cache environment variables
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
@@ -70,16 +57,21 @@ jobs:
|
|||||||
|
|
||||||
- name: Git config safe directory
|
- name: Git config safe directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1.5-git-safe.sh
|
run: bash ./scripts/debian-11/1.5-git-safe.sh
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1-install-deps.sh
|
run: bash ./scripts/debian-11/1-install-deps.sh
|
||||||
|
|
||||||
|
- name: Setup vcpkg
|
||||||
|
uses: lukka/run-vcpkg@v11
|
||||||
|
with:
|
||||||
|
runVcpkgInstall: true
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
run: bash ./scripts/debian-11/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
||||||
|
|
||||||
- name: Build Server
|
- name: Build Server
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/3-build.sh
|
run: bash ./scripts/debian-11/3-build.sh
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
id: upload-release-asset
|
id: upload-release-asset
|
||||||
@@ -87,9 +79,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
asset_name: BeamMP-Server.${{ matrix.distro }}.${{ matrix.version }}.x86_64
|
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: ./bin/BeamMP-Server
|
asset_path: ./bin/BeamMP-Server
|
||||||
|
asset_name: BeamMP-Server-debian
|
||||||
asset_content_type: application/x-elf
|
asset_content_type: application/x-elf
|
||||||
|
|
||||||
- name: Upload Debug Info
|
- name: Upload Debug Info
|
||||||
@@ -98,34 +90,18 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
asset_name: debuginfo.${{ matrix.distro }}.${{ matrix.version }}.x86_64
|
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: ./bin/BeamMP-Server.debug
|
asset_path: ./bin/BeamMP-Server.debug
|
||||||
|
asset_name: debuginfo-debian.debug
|
||||||
asset_content_type: application/x-elf
|
asset_content_type: application/x-elf
|
||||||
|
|
||||||
arm64-matrix:
|
upload-release-files-ubuntu-22-04:
|
||||||
runs-on: [Linux, ARM64]
|
name: Build and upload Ubuntu 22.04 Release Files
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
needs: create-release
|
needs: create-release
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- distro: debian
|
|
||||||
version: 11
|
|
||||||
- distro: debian
|
|
||||||
version: 12
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 22.04
|
|
||||||
- distro: ubuntu
|
|
||||||
version: 20.04
|
|
||||||
env:
|
|
||||||
VCPKG_DEFAULT_TRIPLET: "arm64-linux"
|
|
||||||
VCPKG_FORCE_SYSTEM_BINARIES: 1
|
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.distro }}:${{ matrix.version }}
|
image: ubuntu:22.04
|
||||||
steps:
|
steps:
|
||||||
- name: get-cmake
|
|
||||||
uses: lukka/get-cmake@v3.28.1
|
|
||||||
|
|
||||||
- name: Export GitHub Actions cache environment variables
|
- name: Export GitHub Actions cache environment variables
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
@@ -144,16 +120,16 @@ jobs:
|
|||||||
|
|
||||||
- name: Git config safe directory
|
- name: Git config safe directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1.5-git-safe.sh
|
run: bash ./scripts/ubuntu-22.04/1.5-git-safe.sh
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/1-install-deps.sh
|
run: bash ./scripts/ubuntu-22.04/1-install-deps.sh
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
run: bash ./scripts/ubuntu-22.04/2-configure.sh '-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake'
|
||||||
|
|
||||||
- name: Build Server
|
- name: Build Server
|
||||||
run: bash ./scripts/${{ matrix.distro }}-${{ matrix.version }}/3-build.sh
|
run: bash ./scripts/ubuntu-22.04/3-build.sh
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
id: upload-release-asset
|
id: upload-release-asset
|
||||||
@@ -161,9 +137,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
asset_name: BeamMP-Server.${{ matrix.distro }}.${{ matrix.version }}.arm64
|
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: ./bin/BeamMP-Server
|
asset_path: ./bin/BeamMP-Server
|
||||||
|
asset_name: BeamMP-Server-ubuntu
|
||||||
asset_content_type: application/x-elf
|
asset_content_type: application/x-elf
|
||||||
|
|
||||||
- name: Upload Debug Info
|
- name: Upload Debug Info
|
||||||
@@ -172,9 +148,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
asset_name: debuginfo.${{ matrix.distro }}.${{ matrix.version }}.arm64
|
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: ./bin/BeamMP-Server.debug
|
asset_path: ./bin/BeamMP-Server.debug
|
||||||
|
asset_name: debuginfo-ubuntu.debug
|
||||||
asset_content_type: application/x-elf
|
asset_content_type: application/x-elf
|
||||||
|
|
||||||
upload-release-files-windows:
|
upload-release-files-windows:
|
||||||
|
|||||||
+2
-2
@@ -48,7 +48,7 @@ set(PRJ_HEADERS
|
|||||||
include/TScopedTimer.h
|
include/TScopedTimer.h
|
||||||
include/TServer.h
|
include/TServer.h
|
||||||
include/VehicleData.h
|
include/VehicleData.h
|
||||||
include/Env.h
|
include/Update.h
|
||||||
)
|
)
|
||||||
# add all source files (.cpp) to this, except the one with main()
|
# add all source files (.cpp) to this, except the one with main()
|
||||||
set(PRJ_SOURCES
|
set(PRJ_SOURCES
|
||||||
@@ -71,7 +71,7 @@ set(PRJ_SOURCES
|
|||||||
src/TScopedTimer.cpp
|
src/TScopedTimer.cpp
|
||||||
src/TServer.cpp
|
src/TServer.cpp
|
||||||
src/VehicleData.cpp
|
src/VehicleData.cpp
|
||||||
src/Env.cpp
|
src/Update.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(Lua REQUIRED)
|
find_package(Lua REQUIRED)
|
||||||
|
|||||||
@@ -52,22 +52,20 @@ You can find precompiled binaries under [Releases](https://github.com/BeamMP/Bea
|
|||||||
|
|
||||||
On Linux, you need some dependencies to **build** the server (on Windows, you don't):
|
On Linux, you need some dependencies to **build** the server (on Windows, you don't):
|
||||||
|
|
||||||
|
For Debian, Ubuntu and others you can find scripts that do this in `scripts/`.
|
||||||
|
|
||||||
```
|
```
|
||||||
liblua5.3-dev curl zip unzip tar cmake make git g++
|
liblua5.3-dev curl zip unzip tar cmake make git g++
|
||||||
```
|
```
|
||||||
|
|
||||||
You can install these with your distribution's package manager. You will need sudo or need root for ONLY this step.
|
The names of each package may change depending on your platform. See in `scripts/` or use a search engine to find out what they're called for you.
|
||||||
|
|
||||||
The names of each package may change depending on your platform.
|
|
||||||
|
|
||||||
If you are building for ARM (like aarch64), you need to run `export VCPKG_FORCE_SYSTEM_BINARIES=1` before the following commands.
|
|
||||||
|
|
||||||
You can build on **Windows, Linux** or other platforms by following these steps:
|
You can build on **Windows, Linux** or other platforms by following these steps:
|
||||||
|
|
||||||
1. Check out the repository with git: `git clone --recursive https://github.com/BeamMP/BeamMP-Server`.
|
1. Check out the repository with git: `git clone --recursive https://github.com/BeamMP/BeamMP-Server`.
|
||||||
2. Go into the directory `cd BeamMP-Server`.
|
2. Go into the directory `cd BeamMP-Server`.
|
||||||
3. Run CMake `cmake -S . -B bin -DCMAKE_BUILD_TYPE=Release` - this can take a few minutes and may take a lot of disk space and bandwidth.
|
3. Run CMake `cmake -S . -B bin -DCMAKE_BUILD_TYPE=Release` - this can take a few minutes and may take a lot of disk space and bandwidth.
|
||||||
4. Build via `cmake --build bin --parallel --config Release -t BeamMP-Server`.
|
4. Build via `cmake --build bin --parallel -t BeamMP-Server`.
|
||||||
5. Your executable can be found in `bin/`.
|
5. Your executable can be found in `bin/`.
|
||||||
|
|
||||||
When you make changes to the code, you only have to run step 4 again.
|
When you make changes to the code, you only have to run step 4 again.
|
||||||
|
|||||||
Vendored
+1
-1
Submodule deps/commandline updated: b2a29733f9...0ff46d25b1
+1
-1
@@ -134,7 +134,7 @@ private:
|
|||||||
static inline std::mutex mShutdownHandlersMutex {};
|
static inline std::mutex mShutdownHandlersMutex {};
|
||||||
static inline std::deque<TShutdownHandler> mShutdownHandlers {};
|
static inline std::deque<TShutdownHandler> mShutdownHandlers {};
|
||||||
|
|
||||||
static inline Version mVersion { 3, 2, 2 };
|
static inline Version mVersion { 3, 2, 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
void SplitString(std::string const& str, const char delim, std::vector<std::string>& out);
|
void SplitString(std::string const& str, const char delim, std::vector<std::string>& out);
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <optional>
|
|
||||||
#include <string>
|
|
||||||
namespace Env {
|
|
||||||
|
|
||||||
enum class Key {
|
|
||||||
// provider settings
|
|
||||||
PROVIDER_UPDATE_MESSAGE,
|
|
||||||
};
|
|
||||||
|
|
||||||
std::optional<std::string> Get(Key key);
|
|
||||||
|
|
||||||
std::string_view ToString(Key key);
|
|
||||||
|
|
||||||
}
|
|
||||||
+2
-2
@@ -26,7 +26,7 @@ public:
|
|||||||
void ForEachClient(const std::function<bool(std::weak_ptr<TClient>)>& Fn);
|
void ForEachClient(const std::function<bool(std::weak_ptr<TClient>)>& Fn);
|
||||||
size_t ClientCount() const;
|
size_t ClientCount() const;
|
||||||
|
|
||||||
void GlobalParser(const std::weak_ptr<TClient>& Client, std::vector<uint8_t>&& Packet, TPPSMonitor& PPSMonitor, TNetwork& Network);
|
static void GlobalParser(const std::weak_ptr<TClient>& Client, std::vector<uint8_t>&& Packet, TPPSMonitor& PPSMonitor, TNetwork& Network);
|
||||||
static void HandleEvent(TClient& c, const std::string& Data);
|
static void HandleEvent(TClient& c, const std::string& Data);
|
||||||
RWMutex& GetClientMutex() const { return mClientsMutex; }
|
RWMutex& GetClientMutex() const { return mClientsMutex; }
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ private:
|
|||||||
static bool ShouldSpawn(TClient& c, const std::string& CarJson, int ID);
|
static bool ShouldSpawn(TClient& c, const std::string& CarJson, int ID);
|
||||||
static bool IsUnicycle(TClient& c, const std::string& CarJson);
|
static bool IsUnicycle(TClient& c, const std::string& CarJson);
|
||||||
static void Apply(TClient& c, int VID, const std::string& pckt);
|
static void Apply(TClient& c, int VID, const std::string& pckt);
|
||||||
void HandlePosition(TClient& c, const std::string& Packet);
|
static void HandlePosition(TClient& c, const std::string& Packet);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BufferView {
|
struct BufferView {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace Update {
|
||||||
|
|
||||||
|
[[noreturn]] void PerformUpdate(const std::string& InvokedAs);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,4 +4,4 @@ set -ex
|
|||||||
|
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
|
||||||
apt-get install -y liblua5.3-0 liblua5.3-dev curl zip unzip tar cmake make git g++ ninja-build
|
apt-get install -y liblua5.3-0 liblua5.3-dev curl zip unzip tar cmake make git g++
|
||||||
|
|||||||
@@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
./vcpkg/bootstrap-vcpkg.sh
|
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON
|
||||||
|
|
||||||
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
apt-get update -y
|
|
||||||
|
|
||||||
apt-get install -y liblua5.3-0 liblua5.3-dev curl zip unzip tar cmake make git g++ ninja-build
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
git config --global --add safe.directory $(pwd)
|
|
||||||
git config --global --add safe.directory $(pwd)/vcpkg
|
|
||||||
git config --global --add safe.directory $(pwd)/deps/commandline
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
./vcpkg/bootstrap-vcpkg.sh
|
|
||||||
|
|
||||||
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
cmake --build bin --parallel -t BeamMP-Server-tests
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
cmake --build bin --parallel -t BeamMP-Server
|
|
||||||
|
|
||||||
objcopy --only-keep-debug bin/BeamMP-Server bin/BeamMP-Server.debug
|
|
||||||
objcopy --add-gnu-debuglink bin/BeamMP-Server bin/BeamMP-Server.debug
|
|
||||||
|
|
||||||
strip -s bin/BeamMP-Server
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
apt-get update -y
|
|
||||||
|
|
||||||
apt-get install -y liblua5.3-0 curl
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
apt-get update -y
|
|
||||||
|
|
||||||
apt-get install -y liblua5.3-0 liblua5.3-dev curl zip unzip tar cmake make git g++ ninja-build
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
git config --global --add safe.directory $(pwd)
|
|
||||||
git config --global --add safe.directory $(pwd)/vcpkg
|
|
||||||
git config --global --add safe.directory $(pwd)/deps/commandline
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
./vcpkg/bootstrap-vcpkg.sh
|
|
||||||
|
|
||||||
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
cmake --build bin --parallel -t BeamMP-Server-tests
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
cmake --build bin --parallel -t BeamMP-Server
|
|
||||||
|
|
||||||
objcopy --only-keep-debug bin/BeamMP-Server bin/BeamMP-Server.debug
|
|
||||||
objcopy --add-gnu-debuglink bin/BeamMP-Server bin/BeamMP-Server.debug
|
|
||||||
|
|
||||||
strip -s bin/BeamMP-Server
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
apt-get update -y
|
|
||||||
|
|
||||||
apt-get install -y liblua5.3-0 curl
|
|
||||||
|
|
||||||
@@ -4,4 +4,4 @@ set -ex
|
|||||||
|
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
|
||||||
apt-get install -y liblua5.3-0 liblua5.3-dev curl zip unzip tar cmake make git g++ ninja-build
|
apt-get install -y liblua5.3-0 liblua5.3-dev curl zip unzip tar cmake make git g++
|
||||||
|
|||||||
@@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
./vcpkg/bootstrap-vcpkg.sh
|
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON
|
||||||
|
|
||||||
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON
|
|
||||||
|
|||||||
Executable → Regular
-2
@@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
vcpkg add port lua
|
|
||||||
|
|
||||||
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DBeamMP-Server_ENABLE_LTO=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static
|
cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DBeamMP-Server_ENABLE_LTO=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static
|
||||||
|
|||||||
+1
-3
@@ -53,9 +53,9 @@ std::string TClient::GetCarPositionRaw(int Ident) {
|
|||||||
try {
|
try {
|
||||||
return mVehiclePosition.at(size_t(Ident));
|
return mVehiclePosition.at(size_t(Ident));
|
||||||
} catch (const std::out_of_range& oor) {
|
} catch (const std::out_of_range& oor) {
|
||||||
beammp_debugf("Failed to get vehicle position for {}: {}", Ident, oor.what());
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TClient::Disconnect(std::string_view Reason) {
|
void TClient::Disconnect(std::string_view Reason) {
|
||||||
@@ -146,8 +146,6 @@ std::optional<std::weak_ptr<TClient>> GetClient(TServer& Server, int ID) {
|
|||||||
MaybeClient = CPtr;
|
MaybeClient = CPtr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
beammp_debugf("Found an expired client while looking for id {}", ID);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-7
@@ -1,10 +1,8 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
#include "Env.h"
|
|
||||||
#include "TConsole.h"
|
#include "TConsole.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <fmt/core.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
@@ -203,11 +201,8 @@ void Application::CheckForUpdates() {
|
|||||||
auto MyVersion = ServerVersion();
|
auto MyVersion = ServerVersion();
|
||||||
auto RemoteVersion = Version(VersionStrToInts(Response));
|
auto RemoteVersion = Version(VersionStrToInts(Response));
|
||||||
if (IsOutdated(MyVersion, RemoteVersion)) {
|
if (IsOutdated(MyVersion, RemoteVersion)) {
|
||||||
std::string RealVersionString = std::string("v") + RemoteVersion.AsString();
|
std::string RealVersionString = RemoteVersion.AsString();
|
||||||
const std::string DefaultUpdateMsg = "NEW VERSION IS OUT! Please update to the new version ({}) of the BeamMP-Server! Download it here: https://beammp.com/! For a guide on how to update, visit: https://wiki.beammp.com/en/home/server-maintenance#updating-the-server";
|
beammp_warn(std::string(ANSI_YELLOW_BOLD) + "NEW VERSION IS OUT! Please update to the new version (v" + RealVersionString + ") of the BeamMP-Server! Download it here: https://beammp.com/! For a guide on how to update, visit: https://wiki.beammp.com/en/home/server-maintenance#updating-the-server" + std::string(ANSI_RESET));
|
||||||
auto UpdateMsg = Env::Get(Env::Key::PROVIDER_UPDATE_MESSAGE).value_or(DefaultUpdateMsg);
|
|
||||||
UpdateMsg = fmt::vformat(std::string_view(UpdateMsg), fmt::make_format_args(RealVersionString));
|
|
||||||
beammp_warnf("{}{}{}", ANSI_YELLOW_BOLD, UpdateMsg, ANSI_RESET);
|
|
||||||
} else {
|
} else {
|
||||||
if (FirstTime) {
|
if (FirstTime) {
|
||||||
beammp_info("Server up-to-date!");
|
beammp_info("Server up-to-date!");
|
||||||
|
|||||||
-20
@@ -1,20 +0,0 @@
|
|||||||
#include "Env.h"
|
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
std::optional<std::string> Env::Get(Env::Key key) {
|
|
||||||
auto StrKey = ToString(key);
|
|
||||||
auto Value = std::getenv(StrKey.data());
|
|
||||||
if (!Value || std::string_view(Value).empty()) {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
return Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string_view Env::ToString(Env::Key key) {
|
|
||||||
switch (key) {
|
|
||||||
case Key::PROVIDER_UPDATE_MESSAGE:
|
|
||||||
return "BEAMMP_PROVIDER_UPDATE_MESSAGE";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
+3
-3
@@ -120,9 +120,9 @@ void TConfig::FlushToFile() {
|
|||||||
data["Misc"][StrHideUpdateMessages.data()] = Application::Settings.HideUpdateMessages;
|
data["Misc"][StrHideUpdateMessages.data()] = Application::Settings.HideUpdateMessages;
|
||||||
SetComment(data["Misc"][StrHideUpdateMessages.data()].comments(), " Hides the periodic update message which notifies you of a new server version. You should really keep this on and always update as soon as possible. For more information visit https://wiki.beammp.com/en/home/server-maintenance#updating-the-server. An update message will always appear at startup regardless.");
|
SetComment(data["Misc"][StrHideUpdateMessages.data()].comments(), " Hides the periodic update message which notifies you of a new server version. You should really keep this on and always update as soon as possible. For more information visit https://wiki.beammp.com/en/home/server-maintenance#updating-the-server. An update message will always appear at startup regardless.");
|
||||||
data["Misc"][StrSendErrors.data()] = Application::Settings.SendErrors;
|
data["Misc"][StrSendErrors.data()] = Application::Settings.SendErrors;
|
||||||
SetComment(data["Misc"][StrSendErrors.data()].comments(), " If SendErrors is `true`, the server will send helpful info about crashes and other issues back to the BeamMP developers. This info may include your config, who is on your server at the time of the error, and similar general information. This kind of data is vital in helping us diagnose and fix issues faster. This has no impact on server performance. You can opt-out of this system by setting this to `false`");
|
SetComment(data["Misc"][StrSendErrors.data()].comments(), " You can turn on/off the SendErrors message you get on startup here");
|
||||||
data["Misc"][StrSendErrorsMessageEnabled.data()] = Application::Settings.SendErrorsMessageEnabled;
|
data["Misc"][StrSendErrorsMessageEnabled.data()] = Application::Settings.SendErrorsMessageEnabled;
|
||||||
SetComment(data["Misc"][StrSendErrorsMessageEnabled.data()].comments(), " You can turn on/off the SendErrors message you get on startup here");
|
SetComment(data["Misc"][StrSendErrorsMessageEnabled.data()].comments(), " If SendErrors is `true`, the server will send helpful info about crashes and other issues back to the BeamMP developers. This info may include your config, who is on your server at the time of the error, and similar general information. This kind of data is vital in helping us diagnose and fix issues faster. This has no impact on server performance. You can opt-out of this system by setting this to `false`");
|
||||||
std::stringstream Ss;
|
std::stringstream Ss;
|
||||||
Ss << "# This is the BeamMP-Server config file.\n"
|
Ss << "# This is the BeamMP-Server config file.\n"
|
||||||
"# Help & Documentation: `https://wiki.beammp.com/en/home/server-maintenance`\n"
|
"# Help & Documentation: `https://wiki.beammp.com/en/home/server-maintenance`\n"
|
||||||
@@ -313,6 +313,6 @@ std::string TConfig::TagsAsPrettyArray() const {
|
|||||||
for (size_t i = 0; i < TagsArray.size() - 1; ++i) {
|
for (size_t i = 0; i < TagsArray.size() - 1; ++i) {
|
||||||
Pretty += '\"' + TagsArray[i] + "\", ";
|
Pretty += '\"' + TagsArray[i] + "\", ";
|
||||||
}
|
}
|
||||||
Pretty += '\"' + TagsArray.at(TagsArray.size() - 1) + "\"";
|
Pretty += '\"' + TagsArray.at(TagsArray.size()-1) + "\"";
|
||||||
return Pretty;
|
return Pretty;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -601,7 +601,7 @@ std::pair<sol::table, std::string> TLuaEngine::StateThreadData::Lua_GetPositionR
|
|||||||
return Result;
|
return Result;
|
||||||
} else {
|
} else {
|
||||||
// return std::make_tuple(sol::lua_nil, sol::make_object(StateView, "Client expired"));
|
// return std::make_tuple(sol::lua_nil, sol::make_object(StateView, "Client expired"));
|
||||||
Result.second = "No such player";
|
Result.second = "Client expired";
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -101,7 +101,7 @@ void TNetwork::UDPServerMain() {
|
|||||||
Client->SetUDPAddr(client);
|
Client->SetUDPAddr(client);
|
||||||
Client->SetIsConnected(true);
|
Client->SetIsConnected(true);
|
||||||
Data.erase(Data.begin(), Data.begin() + 2);
|
Data.erase(Data.begin(), Data.begin() + 2);
|
||||||
mServer.GlobalParser(ClientPtr, std::move(Data), mPPSMonitor, *this);
|
TServer::GlobalParser(ClientPtr, std::move(Data), mPPSMonitor, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -552,7 +552,7 @@ void TNetwork::TCPClient(const std::weak_ptr<TClient>& c) {
|
|||||||
Client->Disconnect("TCPRcv failed");
|
Client->Disconnect("TCPRcv failed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mServer.GlobalParser(c, std::move(res), mPPSMonitor, *this);
|
TServer::GlobalParser(c, std::move(res), mPPSMonitor, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QueueSync.joinable())
|
if (QueueSync.joinable())
|
||||||
|
|||||||
+24
-89
@@ -7,7 +7,6 @@
|
|||||||
#include <TLuaPlugin.h>
|
#include <TLuaPlugin.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <optional>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
@@ -52,30 +51,6 @@ TEST_CASE("GetPidVid") {
|
|||||||
CHECK_EQ(pid, 10);
|
CHECK_EQ(pid, 10);
|
||||||
CHECK_EQ(vid, 12);
|
CHECK_EQ(vid, 12);
|
||||||
}
|
}
|
||||||
SUBCASE("Valid doubledigit 2") {
|
|
||||||
const auto MaybePidVid = GetPidVid("10-2");
|
|
||||||
CHECK(MaybePidVid);
|
|
||||||
auto [pid, vid] = MaybePidVid.value();
|
|
||||||
|
|
||||||
CHECK_EQ(pid, 10);
|
|
||||||
CHECK_EQ(vid, 2);
|
|
||||||
}
|
|
||||||
SUBCASE("Valid doubledigit 3") {
|
|
||||||
const auto MaybePidVid = GetPidVid("33-23");
|
|
||||||
CHECK(MaybePidVid);
|
|
||||||
auto [pid, vid] = MaybePidVid.value();
|
|
||||||
|
|
||||||
CHECK_EQ(pid, 33);
|
|
||||||
CHECK_EQ(vid, 23);
|
|
||||||
}
|
|
||||||
SUBCASE("Valid doubledigit 4") {
|
|
||||||
const auto MaybePidVid = GetPidVid("3-23");
|
|
||||||
CHECK(MaybePidVid);
|
|
||||||
auto [pid, vid] = MaybePidVid.value();
|
|
||||||
|
|
||||||
CHECK_EQ(pid, 3);
|
|
||||||
CHECK_EQ(vid, 23);
|
|
||||||
}
|
|
||||||
SUBCASE("Empty string") {
|
SUBCASE("Empty string") {
|
||||||
const auto MaybePidVid = GetPidVid("");
|
const auto MaybePidVid = GetPidVid("");
|
||||||
CHECK(!MaybePidVid);
|
CHECK(!MaybePidVid);
|
||||||
@@ -105,17 +80,6 @@ TEST_CASE("GetPidVid") {
|
|||||||
TServer::TServer(const std::vector<std::string_view>& Arguments) {
|
TServer::TServer(const std::vector<std::string_view>& Arguments) {
|
||||||
beammp_info("BeamMP Server v" + Application::ServerVersionString());
|
beammp_info("BeamMP Server v" + Application::ServerVersionString());
|
||||||
Application::SetSubsystemStatus("Server", Application::Status::Starting);
|
Application::SetSubsystemStatus("Server", Application::Status::Starting);
|
||||||
if (Arguments.size() > 1) {
|
|
||||||
Application::Settings.CustomIP = Arguments[0];
|
|
||||||
size_t n = std::count(Application::Settings.CustomIP.begin(), Application::Settings.CustomIP.end(), '.');
|
|
||||||
auto p = Application::Settings.CustomIP.find_first_not_of(".0123456789");
|
|
||||||
if (p != std::string::npos || n != 3 || Application::Settings.CustomIP.substr(0, 3) == "127") {
|
|
||||||
Application::Settings.CustomIP.clear();
|
|
||||||
beammp_warn("IP Specified is invalid! Ignoring");
|
|
||||||
} else {
|
|
||||||
beammp_info("server started with custom IP");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Application::SetSubsystemStatus("Server", Application::Status::Good);
|
Application::SetSubsystemStatus("Server", Application::Status::Good);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +203,6 @@ void TServer::GlobalParser(const std::weak_ptr<TClient>& Client, std::vector<uin
|
|||||||
PPSMonitor.IncrementInternalPPS();
|
PPSMonitor.IncrementInternalPPS();
|
||||||
Network.SendToAll(LockedClient.get(), Packet, false, false);
|
Network.SendToAll(LockedClient.get(), Packet, false, false);
|
||||||
HandlePosition(*LockedClient, StringPacket);
|
HandlePosition(*LockedClient, StringPacket);
|
||||||
return;
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -414,7 +377,7 @@ void TServer::Apply(TClient& c, int VID, const std::string& pckt) {
|
|||||||
|
|
||||||
FoundPos = VD.find('{');
|
FoundPos = VD.find('{');
|
||||||
if (FoundPos == std::string::npos) {
|
if (FoundPos == std::string::npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VD = VD.substr(FoundPos);
|
VD = VD.substr(FoundPos);
|
||||||
rapidjson::Document Veh, Pack;
|
rapidjson::Document Veh, Pack;
|
||||||
@@ -448,63 +411,35 @@ void TServer::InsertClient(const std::shared_ptr<TClient>& NewClient) {
|
|||||||
(void)mClients.insert(NewClient);
|
(void)mClients.insert(NewClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PidVidData {
|
void TServer::HandlePosition(TClient& c, const std::string& Packet) {
|
||||||
int PID;
|
|
||||||
int VID;
|
|
||||||
std::string Data;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::optional<PidVidData> ParsePositionPacket(const std::string& Packet) {
|
|
||||||
if (Packet.size() < 3) {
|
if (Packet.size() < 3) {
|
||||||
// invalid packet
|
// invalid packet
|
||||||
return std::nullopt;
|
return;
|
||||||
}
|
}
|
||||||
// Zp:PID-VID:DATA
|
// Zp:serverVehicleID:data
|
||||||
|
// Zp:0:data
|
||||||
std::string withoutCode = Packet.substr(3);
|
std::string withoutCode = Packet.substr(3);
|
||||||
|
auto NameDataSep = withoutCode.find(':', 2);
|
||||||
|
if (NameDataSep == std::string::npos || NameDataSep < 2) {
|
||||||
|
// invalid packet
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// FIXME: ensure that -2 does what it should... it seems weird.
|
||||||
|
std::string ServerVehicleID = withoutCode.substr(2, NameDataSep - 2);
|
||||||
|
if (NameDataSep + 1 > withoutCode.size()) {
|
||||||
|
// invalid packet
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::string Data = withoutCode.substr(NameDataSep + 1);
|
||||||
|
|
||||||
// parse veh ID
|
// parse veh ID
|
||||||
if (auto DataBeginPos = withoutCode.find('{'); DataBeginPos != std::string::npos && DataBeginPos != 0) {
|
auto MaybePidVid = GetPidVid(ServerVehicleID);
|
||||||
// separator is :{, so position of { minus one
|
if (MaybePidVid) {
|
||||||
auto PidVidOnly = withoutCode.substr(0, DataBeginPos - 1);
|
int PID = -1;
|
||||||
auto MaybePidVid = GetPidVid(PidVidOnly);
|
int VID = -1;
|
||||||
if (MaybePidVid) {
|
// FIXME: check that the VID and PID are valid, so that we don't waste memory
|
||||||
int PID = -1;
|
std::tie(PID, VID) = MaybePidVid.value();
|
||||||
int VID = -1;
|
|
||||||
// FIXME: check that the VID and PID are valid, so that we don't waste memory
|
|
||||||
std::tie(PID, VID) = MaybePidVid.value();
|
|
||||||
|
|
||||||
std::string Data = withoutCode.substr(DataBeginPos);
|
c.SetCarPosition(VID, Data);
|
||||||
return PidVidData {
|
|
||||||
.PID = PID,
|
|
||||||
.VID = VID,
|
|
||||||
.Data = Data,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// invalid packet
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// invalid packet
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("ParsePositionPacket") {
|
|
||||||
const auto TestData = R"({"tim":10.428000331623,"vel":[-2.4171722121385e-05,-9.7184734153252e-06,-7.6420763232237e-06],"rot":[-0.0001296154171915,0.0031575385950029,0.98994906610295,0.14138903660382],"rvel":[5.3640324636461e-05,-9.9824529946024e-05,5.1664064641372e-05],"pos":[-0.27281248907838,-0.20515357944633,0.49695488960431],"ping":0.032999999821186})";
|
|
||||||
SUBCASE("All the pids and vids") {
|
|
||||||
for (int pid = 0; pid < 100; ++pid) {
|
|
||||||
for (int vid = 0; vid < 100; ++vid) {
|
|
||||||
std::optional<PidVidData> MaybeRes = ParsePositionPacket(fmt::format("Zp:{}-{}:{}", pid, vid, TestData));
|
|
||||||
CHECK(MaybeRes.has_value());
|
|
||||||
CHECK_EQ(MaybeRes.value().PID, pid);
|
|
||||||
CHECK_EQ(MaybeRes.value().VID, vid);
|
|
||||||
CHECK_EQ(MaybeRes.value().Data, TestData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TServer::HandlePosition(TClient& c, const std::string& Packet) {
|
|
||||||
if (auto Parsed = ParsePositionPacket(Packet); Parsed.has_value()) {
|
|
||||||
c.SetCarPosition(Parsed.value().VID, Parsed.value().Data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+249
@@ -0,0 +1,249 @@
|
|||||||
|
#include "Update.h"
|
||||||
|
#include "Common.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <boost/predef.h>
|
||||||
|
#include <cerrno>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <httplib.h>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
#if defined(__linux)
|
||||||
|
#include <unistd.h>
|
||||||
|
#elif defined(WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static bool ProgressReport(uint64_t current, uint64_t total) {
|
||||||
|
if (current == total) {
|
||||||
|
fmt::print("100% ({:.2f} / {:.2f} KiB)\n", float(current) / 1024.0f, float(total) / 1024.0f);
|
||||||
|
}
|
||||||
|
if (total != 0) {
|
||||||
|
auto percent = (float(current) / float(total)) * 100.0f;
|
||||||
|
fmt::print("{:3.0f}% ({:.2f} / {:.2f} KiB)\r", percent, float(current) / 1024.0f, float(total) / 1024.0f);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update::PerformUpdate(const std::string& InvokedAs) {
|
||||||
|
using json = nlohmann::json;
|
||||||
|
namespace http = httplib;
|
||||||
|
|
||||||
|
constexpr auto GH = "api.github.com";
|
||||||
|
std::string ReleasesAPI = "/repos/BeamMP/BeamMP-Server/releases";
|
||||||
|
|
||||||
|
http::Headers APIHeaders {};
|
||||||
|
APIHeaders.emplace("X-GitHub-Api-Version", "2022-11-28");
|
||||||
|
APIHeaders.emplace("Accept", "application/vnd.github+json");
|
||||||
|
|
||||||
|
http::SSLClient c(GH);
|
||||||
|
c.set_read_timeout(std::chrono::seconds(30));
|
||||||
|
|
||||||
|
beammp_infof("Checking for latest release...");
|
||||||
|
// check if there is a new release
|
||||||
|
auto Res = c.Get(ReleasesAPI + "/latest", APIHeaders);
|
||||||
|
if (!Res || Res->status < 200 || Res->status >= 300) {
|
||||||
|
beammp_errorf("Failed to fetch latest release: {}", to_string(Res.error()));
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Version NewVersion { 0, 0, 0 };
|
||||||
|
|
||||||
|
json ReleaseInfo;
|
||||||
|
|
||||||
|
try {
|
||||||
|
ReleaseInfo = json::parse(Res->body);
|
||||||
|
|
||||||
|
std::string TagName = ReleaseInfo["tag_name"].get<std::string>();
|
||||||
|
if (!TagName.starts_with("v") || std::count(TagName.begin(), TagName.end(), '.') != 2) {
|
||||||
|
beammp_errorf("Invalid version provided by GitHub: '{}', exiting", TagName);
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
TagName = TagName.substr(1);
|
||||||
|
auto Tag = Application::VersionStrToInts(TagName);
|
||||||
|
NewVersion = Version { Tag[0], Tag[1], Tag[2] };
|
||||||
|
beammp_infof("Latest release is v{}", NewVersion.AsString());
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
beammp_errorf("Failed to fetch latest release info from GitHub");
|
||||||
|
beammp_errorf("Error: {}", e.what());
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if the new release is patch, minor or major
|
||||||
|
auto Current = Application::ServerVersion();
|
||||||
|
|
||||||
|
bool MajorOutdated = NewVersion.major > Current.major;
|
||||||
|
bool MinorOutdated = !MajorOutdated && Application::IsOutdated(Current, NewVersion);
|
||||||
|
|
||||||
|
if (!MajorOutdated && !MinorOutdated) {
|
||||||
|
beammp_infof("BeamMP-Server is already the latest version (v{})!", Current.AsString());
|
||||||
|
std::exit(0);
|
||||||
|
} else {
|
||||||
|
beammp_infof("New update available, updating from v{} to v{}", Current.AsString(), NewVersion.AsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Arch = "";
|
||||||
|
|
||||||
|
#if BOOST_ARCH_ARM && BOOST_ARCH_WORD_BITS == 64
|
||||||
|
Arch = "arm64";
|
||||||
|
#elif BOOST_ARCH_X86_64
|
||||||
|
Arch = "x86_64";
|
||||||
|
#else
|
||||||
|
beammp_errorf("The current architecture is not supported, please update manually.");
|
||||||
|
std::exit(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::string Postfix = {};
|
||||||
|
// figure out current platform
|
||||||
|
#if WIN32
|
||||||
|
beammp_infof("Current platform is Windows");
|
||||||
|
Postfix = ".exe";
|
||||||
|
#elif __linux
|
||||||
|
beammp_infof("Current platform is Linux, checking distribution");
|
||||||
|
const std::string OsReleasePath = "/etc/os-release";
|
||||||
|
|
||||||
|
std::string DistroID = "";
|
||||||
|
std::string DistroVersion = "";
|
||||||
|
|
||||||
|
if (fs::exists(OsReleasePath)) {
|
||||||
|
std::ifstream OsRelease(OsReleasePath);
|
||||||
|
std::string Line {};
|
||||||
|
while (std::getline(OsRelease, Line)) {
|
||||||
|
if (Line.starts_with("ID=")) {
|
||||||
|
DistroID = Line.substr(3);
|
||||||
|
} else if (Line.starts_with("VERSION_ID=\"")) {
|
||||||
|
DistroVersion = Line.substr(strlen("VERSION_ID=\""));
|
||||||
|
// skip closing quote
|
||||||
|
DistroVersion = DistroVersion.substr(0, DistroVersion.size() - 1);
|
||||||
|
} else if (Line.starts_with("VERSION_ID=")) {
|
||||||
|
DistroVersion = Line.substr(strlen("VERSION_ID="));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
beammp_infof("Distribution: {} {}", DistroID, DistroVersion);
|
||||||
|
|
||||||
|
std::string Distro = {};
|
||||||
|
if (DistroVersion.empty()) {
|
||||||
|
Distro = DistroID;
|
||||||
|
} else {
|
||||||
|
Distro = DistroID + "." + DistroVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
Postfix = fmt::format(".{}.{}", Distro, Arch);
|
||||||
|
#else
|
||||||
|
beammp_infof("BeamMP doesn't provide binaries for this OS, please update manually");
|
||||||
|
std::exit(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
beammp_infof("Looking for BeamMP-Server{}", Postfix);
|
||||||
|
|
||||||
|
// check if the release exists for that platform
|
||||||
|
std::string DownloadURL = "";
|
||||||
|
try {
|
||||||
|
for (const auto& Asset : ReleaseInfo.at("assets")) {
|
||||||
|
if (Asset.at("name").get<std::string>() == "BeamMP-Server" + Postfix) {
|
||||||
|
DownloadURL = Asset.at("browser_download_url");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
beammp_errorf("Failed to parse GitHub API's release assets: {}", e.what());
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
if (DownloadURL.empty()) {
|
||||||
|
beammp_infof("BeamMP doesn't provide binaries for this platform or distribution (release 'BeamMP-Server{}' not found in the release assets), please update manually", Postfix);
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// download urls exist, ask if the user wants to do a major update
|
||||||
|
if (MajorOutdated) {
|
||||||
|
beammp_warnf("The update from v{} to v{} is a major update, which is likely to *break* any Lua Plugins. Please make sure you have read the release notes at {} before proceeding!", Current.AsString(), NewVersion.AsString(), ReleaseInfo.at("html_url").get<std::string>());
|
||||||
|
#if !defined(WIN32)
|
||||||
|
if (!isatty(STDIN_FILENO)) {
|
||||||
|
beammp_errorf("Refusing to do a major version update non-interactively. Run this again in a TTY or update manually");
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
fmt::print("\n");
|
||||||
|
int ch;
|
||||||
|
do {
|
||||||
|
fmt::print("Do you wish to proceed with this update? [y/n] ");
|
||||||
|
std::string Input;
|
||||||
|
std::getline(std::cin, Input);
|
||||||
|
if (Input.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ch = Input.at(0);
|
||||||
|
} while (tolower(ch) != 'y' && tolower(ch) != 'n');
|
||||||
|
if (tolower(ch) == 'n') {
|
||||||
|
beammp_error("Cancelling update");
|
||||||
|
std::exit(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
beammp_info("Downloading latest release from github.com...");
|
||||||
|
|
||||||
|
http::SSLClient DlClient("github.com");
|
||||||
|
DlClient.set_follow_location(true);
|
||||||
|
auto ReleaseRes = DlClient.Get(DownloadURL.substr(strlen("https://github.com")), ProgressReport);
|
||||||
|
|
||||||
|
if (!ReleaseRes || ReleaseRes->status < 200 || ReleaseRes->status >= 300) {
|
||||||
|
beammp_errorf("Failed to fetch binary: {}. Please update manually", to_string(ReleaseRes.error()));
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
beammp_info("Download complete!");
|
||||||
|
|
||||||
|
auto Temp = InvokedAs + ".temp";
|
||||||
|
beammp_infof("Creating '{}'", Temp);
|
||||||
|
FILE* Out = std::fopen(Temp.c_str(), "w+");
|
||||||
|
if (!Out) {
|
||||||
|
beammp_errorf("Failed to update executable, because a temporary file couldn't be created: {}", std::strerror(errno));
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
auto n = std::fwrite(ReleaseRes->body.data(), 1, ReleaseRes->body.size(), Out);
|
||||||
|
if (n != ReleaseRes->body.size()) {
|
||||||
|
beammp_errorf("Failed to update executable, because a temporary file couldn't be written to: {}", std::strerror(errno));
|
||||||
|
std::fclose(Out);
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
std::fclose(Out);
|
||||||
|
|
||||||
|
#if defined(__linux)
|
||||||
|
beammp_infof("Removing '{}'", InvokedAs);
|
||||||
|
struct stat st;
|
||||||
|
if (stat(InvokedAs.c_str(), &st) != 0) {
|
||||||
|
// shouldn't happen at this point
|
||||||
|
beammp_errorf("Failed to stat original executable: {}", std::strerror(errno));
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
auto Ret = unlink(InvokedAs.c_str());
|
||||||
|
if (Ret != 0) {
|
||||||
|
beammp_errorf("Failed to remove executable: {}", std::strerror(errno));
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
beammp_infof("Replacing '{}' with '{}'", InvokedAs, Temp);
|
||||||
|
fs::rename(Temp, InvokedAs);
|
||||||
|
if (chmod(InvokedAs.c_str(), st.st_mode) != 0) {
|
||||||
|
beammp_warnf("Failed to set file mode to 0{:o}: {}. File may not be executable.", st.st_mode, std::strerror(errno));
|
||||||
|
}
|
||||||
|
#elif defined(WIN32)
|
||||||
|
auto DeleteMe = InvokedAs + ".delete_me";
|
||||||
|
std::filesystem::rename(InvokedAs, DeleteMe);
|
||||||
|
std::filesystem::rename(Temp, InvokedAs);
|
||||||
|
int Attr = GetFileAttributesA(DeleteMe.c_str());
|
||||||
|
if ((Attr & FILE_ATTRIBUTE_HIDDEN) == 0) {
|
||||||
|
SetFileAttributesA(DeleteMe.c_str(), Attr | FILE_ATTRIBUTE_HIDDEN);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
beammp_error("Not implemented");
|
||||||
|
std::exit(4);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// make sure the user knows that it was a success, on windows wait for return???
|
||||||
|
|
||||||
|
beammp_infof("SUCCESSFULLY UPDATED to v{}. Please launch the server manually to start the new version!", NewVersion.AsString());
|
||||||
|
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
@@ -11,7 +11,9 @@
|
|||||||
#include "TPluginMonitor.h"
|
#include "TPluginMonitor.h"
|
||||||
#include "TResourceManager.h"
|
#include "TResourceManager.h"
|
||||||
#include "TServer.h"
|
#include "TServer.h"
|
||||||
|
#include "Update.h"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@@ -33,6 +35,9 @@ ARGUMENTS:
|
|||||||
including the path given in --config.
|
including the path given in --config.
|
||||||
--version
|
--version
|
||||||
Prints version info and exits.
|
Prints version info and exits.
|
||||||
|
--update
|
||||||
|
Starts an interactive update to the newest
|
||||||
|
version of BeamMP-Server.
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
BeamMP-Server --config=../MyWestCoastServerConfig.toml
|
BeamMP-Server --config=../MyWestCoastServerConfig.toml
|
||||||
@@ -72,6 +77,7 @@ int BeamMPServerMain(MainArguments Arguments) {
|
|||||||
ArgsParser Parser;
|
ArgsParser Parser;
|
||||||
Parser.RegisterArgument({ "help" }, ArgsParser::NONE);
|
Parser.RegisterArgument({ "help" }, ArgsParser::NONE);
|
||||||
Parser.RegisterArgument({ "version" }, ArgsParser::NONE);
|
Parser.RegisterArgument({ "version" }, ArgsParser::NONE);
|
||||||
|
Parser.RegisterArgument({ "update" }, ArgsParser::NONE);
|
||||||
Parser.RegisterArgument({ "config" }, ArgsParser::HAS_VALUE);
|
Parser.RegisterArgument({ "config" }, ArgsParser::HAS_VALUE);
|
||||||
Parser.RegisterArgument({ "working-directory" }, ArgsParser::HAS_VALUE);
|
Parser.RegisterArgument({ "working-directory" }, ArgsParser::HAS_VALUE);
|
||||||
Parser.Parse(Arguments.List);
|
Parser.Parse(Arguments.List);
|
||||||
@@ -86,6 +92,15 @@ int BeamMPServerMain(MainArguments Arguments) {
|
|||||||
Application::Console().WriteRaw("BeamMP-Server v" + Application::ServerVersionString());
|
Application::Console().WriteRaw("BeamMP-Server v" + Application::ServerVersionString());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (Parser.FoundArgument({ "update" })) {
|
||||||
|
Update::PerformUpdate(Arguments.InvokedAs);
|
||||||
|
return 123;
|
||||||
|
}
|
||||||
|
// check that there is no old update file
|
||||||
|
auto OldFile = Arguments.InvokedAs + ".delete_me";
|
||||||
|
if (fs::exists(OldFile)) {
|
||||||
|
fs::remove(OldFile);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ConfigPath = "ServerConfig.toml";
|
std::string ConfigPath = "ServerConfig.toml";
|
||||||
if (Parser.FoundArgument({ "config" })) {
|
if (Parser.FoundArgument({ "config" })) {
|
||||||
|
|||||||
+1
-1
Submodule vcpkg updated: 8397227251...72010900b7
+7
-7
@@ -2,18 +2,18 @@
|
|||||||
"name": "server",
|
"name": "server",
|
||||||
"version-string": "0.1.0",
|
"version-string": "0.1.0",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"fmt",
|
||||||
|
"doctest",
|
||||||
"boost-asio",
|
"boost-asio",
|
||||||
|
"boost-variant",
|
||||||
"boost-spirit",
|
"boost-spirit",
|
||||||
"boost-uuid",
|
"boost-uuid",
|
||||||
"boost-variant",
|
|
||||||
"cpp-httplib",
|
"cpp-httplib",
|
||||||
"doctest",
|
"toml11",
|
||||||
"fmt",
|
|
||||||
"libzip",
|
"libzip",
|
||||||
|
"rapidjson",
|
||||||
"nlohmann-json",
|
"nlohmann-json",
|
||||||
"openssl",
|
"openssl",
|
||||||
"rapidjson",
|
"sol2"
|
||||||
"sol2",
|
|
||||||
"toml11"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user