Skip to content

Commit

Permalink
Merge branch 'main' into dudantas/support-to-protocol-8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Apr 16, 2024
2 parents 9470cde + 0f6cc07 commit 2903e01
Show file tree
Hide file tree
Showing 1,667 changed files with 18,581 additions and 94,853 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
Expand All @@ -42,7 +43,6 @@ BraceWrapping:
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
Expand Down
26 changes: 3 additions & 23 deletions .github/workflows/analysis-sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
name: Analysis - SonarCloud

on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
paths:
- "src/**"

Expand All @@ -20,14 +21,6 @@ jobs:

steps:
- uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}

- uses: actions/checkout@v3
if: ${{ github.event_name == 'push' }}
with:
fetch-depth: 0

Expand Down Expand Up @@ -73,20 +66,7 @@ jobs:
mkdir -p build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DOPTIONS_ENABLE_CCACHE=ON -DSPEED_UP_BUILD_UNITY=OFF -S . -B build
- name: Run PR sonar-scanner
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
--define sonar.cfamily.compile-commands=build/compile_commands.json \
--define sonar.pullrequest.key=${{ github.event.pull_request.number }} \
--define sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} \
--define sonar.pullrequest.base=${{ github.event.pull_request.base_ref }}
- name: Run sonar-scanner
if: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/build-windows-solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
MAKEFLAGS: "-j 2"
GITHUB_WORKSPACE: ${{ github.workspace }}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_TRIPLET: x64-windows

jobs:
cancel-runs:
Expand Down Expand Up @@ -50,13 +53,25 @@ jobs:

- name: Install vcpkg
run: |
$vcpkgJson = Get-Content .\vcpkg.json -Raw | ConvertFrom-Json
$vcpkgCommitId = $vcpkgJson.'builtin-baseline'.Trim()
Write-Host "vcpkg commit ID: $vcpkgCommitId"
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
./vcpkg integrate install
git checkout $vcpkgCommitId
.\bootstrap-vcpkg.bat
.\vcpkg integrate install
- name: Print useful paths
run: |
Write-Host "Workspace: $env:GITHUB_WORKSPACE"
Write-Host "Vcpkg Path: $env:GITHUB_WORKSPACE\vcpkg"
Write-Host "Triplet: ${{ matrix.triplet }}"
- name: Build project
run: msbuild.exe /p:VcpkgEnableManifest=true /p:Configuration=Debug /p:Platform=x64 /p:VcpkgRoot=$env:GITHUB_WORKSPACE/vcpkg vcproj/canary.sln
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
run: msbuild.exe /p:VcpkgEnableManifest=true /p:Configuration=Debug /p:Platform=x64 /p:GITHUB_WORKSPACE="$env:GITHUB_WORKSPACE" vcproj/canary.sln

- name: Upload artifacts
uses: actions/upload-artifact@main
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,15 @@ config.lua
config_canary.lua
client_assertions.txt
.env
otservbr.otbm
canary.otbm
otservbr-custom.otbm

# Extensions
*.ini
*.otb
*.exe
*.manifest
*.otbm
*.rar
*-house.xml
*-monster.xml
Expand Down
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
# VCPKG
# cmake -DCMAKE_TOOLCHAIN_FILE=/opt/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake ..
# Needed libs is in file vcpkg.json
# Windows required libs: .\vcpkg install --triplet x64-windows asio pugixml spdlog curl jsoncpp protobuf parallel-hashmap magic-enum mio luajit libmariadb mpir abseil
# Windows required libs: .\vcpkg install --triplet x64-windows asio pugixml spdlog curl protobuf parallel-hashmap magic-enum mio luajit libmariadb mpir abseil
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
Expand Down Expand Up @@ -48,11 +48,18 @@ include(LoggingHelper)
option(OPTIONS_ENABLE_CCACHE "Enable ccache" OFF)
option(OPTIONS_ENABLE_SCCACHE "Use sccache to speed up compilation process" OFF)
option(OPTIONS_ENABLE_IPO "Check and Enable interprocedural optimization (IPO/LTO)" ON)
option(FEATURE_METRICS "Enable metrics feature" OFF)

# *****************************************************************************
# Options Code
# *****************************************************************************

if(FEATURE_METRIC)
log_option_enabled("metrics")
else ()
log_option_disabled("metrics")
endif ()

# === CCACHE ===
if(OPTIONS_ENABLE_CCACHE)
find_program(CCACHE ccache)
Expand Down Expand Up @@ -113,7 +120,6 @@ option(RUN_TESTS_AFTER_BUILD "Run tests when building" OFF) # By default, tests
# *****************************************************************************
# Add project
# *****************************************************************************
add_subdirectory(src/protobuf)
add_subdirectory(src)

if(BUILD_TESTS)
Expand Down
79 changes: 31 additions & 48 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,29 @@
},
"configurePresets": [
{
"name": "windows-release",
"displayName": "Windows - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"name": "base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"BUILD_STATIC_LIBRARY": "ON",
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"OPTIONS_ENABLE_SCCACHE": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": ["Windows"]
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
"SPEED_UP_BUILD_UNITY": "ON",
"OPTIONS_ENABLE_SCCACHE": "ON",
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "linux-release",
"displayName": "Linux - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"name": "windows-release",
"inherits": "base",
"displayName": "Windows - Release",
"description": "Windows Release Build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"BUILD_STATIC_LIBRARY": "ON",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"OPTIONS_ENABLE_CCACHE": "ON",
"RUN_TESTS_AFTER_BUILD": "OFF"
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
"architecture": {
"value": "x64",
"strategy": "external"
}
},
{
Expand All @@ -69,10 +42,6 @@
"DEBUG_LOG": "ON",
"BUILD_STATIC_LIBRARY": "OFF",
"VCPKG_TARGET_TRIPLET": "x64-windows"
},
"architecture": {
"value": "x64",
"strategy": "external"
}
},
{
Expand All @@ -86,10 +55,24 @@
"ASAN_ENABLED": "OFF",
"BUILD_STATIC_LIBRARY": "OFF",
"VCPKG_TARGET_TRIPLET": "x64-windows"
}
},
{
"name": "linux-release",
"inherits": "base",
"displayName": "Linux - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"RUN_TESTS_AFTER_BUILD": "OFF"
},
"architecture": {
"value": "x64",
"strategy": "external"
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ other open-source initiatives.
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" alt="JetBrains" width="150" />
</a>

## Project supported by [TNT Cloud](https://tntcloudbr.com.br/)

Thanks for supporting our open-source project with your game cloud hosting services.

<a href="https://tntcloudbr.com.br/">
<img src="https://tntcloudbr.com.br/logo.png" alt="TNT Cloud - Game Hosting" width="300" />
</a>

### Partners

[![Supported by OTServ Brasil](https://raw.githubusercontent.com/otbr/otserv-brasil/main/otbr.png)](https://forums.otserv.com.br)
10 changes: 7 additions & 3 deletions cmake/modules/BaseConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)

# *****************************************************************************
# CMake Features
# *****************************************************************************
Expand Down Expand Up @@ -29,10 +31,11 @@ find_package(ZLIB REQUIRED)
find_package(absl CONFIG REQUIRED)
find_package(asio CONFIG REQUIRED)
find_package(eventpp CONFIG REQUIRED)
find_package(jsoncpp CONFIG REQUIRED)
find_package(magic_enum CONFIG REQUIRED)
find_package(opentelemetry-cpp CONFIG REQUIRED)
find_package(prometheus-cpp CONFIG REQUIRED)
if(FEATURE_METRICS)
find_package(opentelemetry-cpp CONFIG REQUIRED)
find_package(prometheus-cpp CONFIG REQUIRED)
endif()
find_package(mio REQUIRED)
find_package(pugixml CONFIG REQUIRED)
find_package(spdlog REQUIRED)
Expand Down Expand Up @@ -69,6 +72,7 @@ option(DEBUG_LOG "Enable Debug Log" OFF)
option(ASAN_ENABLED "Build this target with AddressSanitizer" OFF)
option(BUILD_STATIC_LIBRARY "Build using static libraries" OFF)
option(SPEED_UP_BUILD_UNITY "Compile using build unity for speed up build" ON)
option(USE_PRECOMPILED_HEADER "Compile using precompiled header" ON)

# === ASAN ===
if(ASAN_ENABLED)
Expand Down
Loading

0 comments on commit 2903e01

Please sign in to comment.