Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into creature_icons
Browse files Browse the repository at this point in the history
  • Loading branch information
MillhioreBT committed Apr 16, 2024
2 parents ea7a5f6 + 2cdf1de commit c9e5608
Show file tree
Hide file tree
Showing 156 changed files with 2,974 additions and 2,583 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ IncludeCategories:
Priority: 2
IndentWidth: 4
SpacesBeforeTrailingComments: 1
Standard: c++20
TabWidth: 4
UseTab: ForIndentation
...
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MYSQL_HOST=127.0.0.1
MYSQL_USER=forgottenserver
MYSQL_PASSWORD=
MYSQL_DATABASE=forgottenserver
MYSQL_SOCK=
MYSQL_PORT=
23 changes: 22 additions & 1 deletion .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ on:
- CMakeLists.txt
- CMakePresets.json

workflow_dispatch:

jobs:
build-ubuntu:
name: ubuntu-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
matrix:
buildtype: [Debug, Release]
Expand All @@ -31,6 +38,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: +security-extended,security-and-quality
if: ${{ matrix.buildtype }} == "Debug"

- name: Get latest CMake
# Using 'latest' branch, the latest CMake is installed.
uses: lukka/get-cmake@latest
Expand All @@ -39,7 +54,7 @@ jobs:
run: >
sudo apt update -q &&
sudo apt install -yq build-essential libluajit-5.1-dev libmysqlclient-dev
libboost-system-dev libboost-iostreams-dev
libboost-system-dev libboost-iostreams-dev libboost-locale-dev
libpugixml-dev libcrypto++-dev libfmt-dev
- name: Build with cmake
Expand All @@ -49,6 +64,12 @@ jobs:
buildPresetAdditionalArgs: "['--config ${{ matrix.buildtype }}']"
configurePreset: default

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"
if: ${{ matrix.buildtype }} == "Debug"

- name: Upload artifact binary
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ jobs:

- name: Run vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 501db0f17ef6df184fcdbfbe0f87cde2313b6ab1

- name: Build with CMake
uses: lukka/run-cmake@v10
Expand Down
90 changes: 0 additions & 90 deletions .github/workflows/codeql.yml

This file was deleted.

64 changes: 0 additions & 64 deletions .github/workflows/coverity.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/release-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:

- name: Run vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 501db0f17ef6df184fcdbfbe0f87cde2313b6ab1

- name: Build with CMake
uses: lukka/run-cmake@v10
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ jobs:
test:
runs-on: ubuntu-latest

env:
CC: gcc
CXX: g++

steps:
- uses: actions/checkout@v3

Expand All @@ -21,13 +17,13 @@ jobs:
run: >
sudo apt update -q &&
sudo apt install -yq git build-essential libluajit-5.1-dev libmysqlclient-dev
libboost-system-dev libboost-iostreams-dev libboost-test-dev
libboost-system-dev libboost-iostreams-dev libboost-locale-dev libboost-test-dev
libpugixml-dev libcrypto++-dev libfmt-dev
- name: Build with CMake
uses: lukka/run-cmake@v10
with:
buildPreset: default
configurePreset: default
configurePresetAdditionalArgs: "['-G Ninja', '-DENABLE_TESTING=ON']"
configurePresetAdditionalArgs: "['-G Ninja', '-DBUILD_TESTING=ON']"
testPreset: default
27 changes: 21 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# or when letting CMake start vcpkg at configure/generate time.
# Note: this logic must happen before PROJECT command.
if (DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "The vcpkg triplet")
set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "The vcpkg triplet")
endif()

project(tfs CXX)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

if (NOT WIN32)
add_compile_options(-Wall -Werror -pipe -fvisibility=hidden)
add_compile_options(-Wall -Wextra -Wnon-virtual-dtor -Wold-style-cast -pedantic -Werror -pipe -fvisibility=hidden)
endif ()

if (CMAKE_COMPILER_IS_GNUCXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fno-strict-aliasing)
endif ()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-Wimplicit-fallthrough -Wmove)
endif ()

# Find packages.
find_package(cryptopp CONFIG)
if (CryptoPP_FOUND) # vcpkg-provided cmake package called CryptoPP
Expand Down Expand Up @@ -61,9 +65,13 @@ if (NOT FORCE_LUAJIT)
find_package(Lua REQUIRED)
endif ()

find_package(Boost 1.66.0 REQUIRED COMPONENTS system iostreams)
if (APPLE)
find_package(Iconv REQUIRED)
endif()

find_package(Boost 1.66.0 REQUIRED COMPONENTS system iostreams locale)

option(ENABLE_TESTING "Build unit tests" OFF)
option(BUILD_TESTING "Build unit tests" OFF)

include_directories(${Boost_INCLUDE_DIRS} ${Crypto++_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${PUGIXML_INCLUDE_DIR})

Expand All @@ -74,7 +82,8 @@ add_subdirectory(src)
add_executable(tfs ${tfs_MAIN})
target_link_libraries(tfs tfslib)

if (ENABLE_TESTING)
if (BUILD_TESTING)
message(STATUS "Building unit tests")
enable_testing()
add_subdirectory(src/tests)
endif()
Expand Down Expand Up @@ -106,4 +115,10 @@ if(NOT SKIP_GIT)
endif()
### END Git Version ###

# Option to disable unity builds
option(ENABLE_UNITY_BUILD "Enable unity build" ON)
if(ENABLE_UNITY_BUILD)
set_target_properties(tfslib PROPERTIES UNITY_BUILD ON)
endif()

target_precompile_headers(tfs PUBLIC src/otpch.h)
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FROM alpine:3.17.3
# crypto++ is in edge/community
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ \
boost-iostreams \
boost-locale \
boost-system \
crypto++ \
fmt \
Expand Down
8 changes: 0 additions & 8 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ premiumToCreateMarketOffer = true
checkExpiredMarketOffersEachMinutes = 60
maxMarketOffersAtATimePerPlayer = 100

-- MySQL
mysqlHost = "127.0.0.1"
mysqlUser = "forgottenserver"
mysqlPass = ""
mysqlDatabase = "forgottenserver"
mysqlPort = 3306
mysqlSock = ""

-- Misc.
-- NOTE: classicAttackSpeed set to true makes players constantly attack at regular
-- intervals regardless of other actions such as item (potion) use. This setting
Expand Down
Loading

0 comments on commit c9e5608

Please sign in to comment.