Compare commits
45 Commits
master
...
refactor/s
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fd1e582156 | ||
![]() |
920b6a78c5 | ||
![]() |
34bdb49db9 | ||
![]() |
f54a204a7d | ||
![]() |
b1a2d74b54 | ||
![]() |
d16dccf994 | ||
![]() |
2e69ccedea | ||
![]() |
b01e7da68d | ||
![]() |
008d25cfb2 | ||
![]() |
f4c9ed691c | ||
![]() |
cc397167ab | ||
![]() |
8f15bc2117 | ||
![]() |
bf36dd4b1f | ||
![]() |
fc242d0472 | ||
![]() |
f41a80ca59 | ||
![]() |
eadff3366d | ||
![]() |
9636aa020d | ||
![]() |
5c2718de03 | ||
![]() |
1b3357611b | ||
![]() |
b3f6ad41ba | ||
![]() |
c789cdbadd | ||
![]() |
98ac59a940 | ||
![]() |
f73e6658ca | ||
![]() |
d98166383c | ||
![]() |
b1520ea969 | ||
![]() |
ee456d8af6 | ||
![]() |
1545d483c0 | ||
![]() |
b6ce15af00 | ||
![]() |
1f474a62cf | ||
![]() |
9024cc7ef8 | ||
![]() |
026c014eb2 | ||
![]() |
26dee6891b | ||
![]() |
258a8e6be0 | ||
![]() |
48b0b082b6 | ||
![]() |
6ae46a7bf8 | ||
![]() |
855cf12007 | ||
![]() |
ae862453bd | ||
![]() |
c11d73d6a8 | ||
![]() |
ff86c7b9d1 | ||
![]() |
e1b9b0d9b3 | ||
![]() |
b3c47f043e | ||
![]() |
c69587c2e7 | ||
![]() |
95ee5d04e6 | ||
![]() |
28383ee332 | ||
![]() |
857f335729 |
24
.github/workflows/analysis_codeql.yml
vendored
24
.github/workflows/analysis_codeql.yml
vendored
@ -18,6 +18,8 @@ on:
|
||||
# This workflow should run when a file in a source directory has been modified.
|
||||
- 'src/**'
|
||||
- '3rdparty/**'
|
||||
# This workflow should run whenever a CMake related file has been modified
|
||||
- '**/CMakeLists.txt'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
@ -31,8 +33,6 @@ jobs:
|
||||
# The ubuntu-latest label currently points to ubuntu-20.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-latest]
|
||||
# Older versions of GCC are not available via unaltered aptitude repo lists.
|
||||
gcc: ['10']
|
||||
# We run build checks for both Renewal and PRE-Renewal
|
||||
mode: ['PRE','RE']
|
||||
|
||||
@ -64,10 +64,10 @@ jobs:
|
||||
|
||||
- name: Update & Install packages
|
||||
# Ubuntu runners already have most of the packages rAthena requires to build.
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2204-Readme.md
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
|
||||
sudo apt install zlib1g-dev libpcre3-dev
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
@ -77,16 +77,16 @@ jobs:
|
||||
# ?? If the Autobuild fails above, remove it and uncomment the following
|
||||
# three lines and modify them (or add more) to build your code if your
|
||||
# project uses a compiled language
|
||||
- name: Command - configure
|
||||
env:
|
||||
CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }} --enable-prere=${{ env.PRERE }} --enable-buildbot=yes'
|
||||
run: ./configure $CONFIGURE_FLAGS
|
||||
- name: Create build directory
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Command - make clean
|
||||
run: make clean
|
||||
- name: Configure CMake
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake .. -DENABLE_PRERENEWAL=${{env.PRERE}} -DENABLE_EXTRA_BUILDBOT_CODE=ON
|
||||
|
||||
- name: Command - make server
|
||||
run: make server
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake --build . -j2 --target server
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
54
.github/workflows/build_servers_clang.yml
vendored
54
.github/workflows/build_servers_clang.yml
vendored
@ -1,54 +0,0 @@
|
||||
name: Build servers with Clang
|
||||
# build_servers_clang.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths:
|
||||
# Always trigger all Github Actions if an action or something CI related was changed
|
||||
- '.github/workflows/**'
|
||||
- 'tools/ci/**'
|
||||
# This workflow should run when a file in a source directory has been modified.
|
||||
- 'src/**'
|
||||
- '3rdparty/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Github Actions checks for '[ci skip]', '[skip ci]', '[no ci]', '[skip actions]', or '[actions skip]' but not a hyphenated version.
|
||||
# It's a catch-all incase a Pull Request has been opened and someone is on auto-pilot.
|
||||
if: "!contains(github.event.head_commit.message, 'ci-skip')"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
# The ubuntu-latest label currently points to ubuntu-22.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-20.04]
|
||||
# Version list can be found on https://github.com/marketplace/actions/install-clang
|
||||
clang: ['6.0', '7', '8', '9', '10', '11'] #, '12', '13']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Clang
|
||||
uses: egor-tensin/setup-clang@v1
|
||||
with:
|
||||
version: ${{ matrix.clang }}
|
||||
platform: x64
|
||||
|
||||
- name: Command - configure
|
||||
env:
|
||||
CONFIGURE_FLAGS: 'CC=clang-${{ matrix.clang }} CXX=clang++-${{ matrix.clang }} --enable-buildbot=yes'
|
||||
run: ./configure $CONFIGURE_FLAGS
|
||||
|
||||
- name: Command - make clean
|
||||
run: make clean
|
||||
|
||||
- name: Command - make all
|
||||
run: make all
|
61
.github/workflows/build_servers_gcc.yml
vendored
61
.github/workflows/build_servers_gcc.yml
vendored
@ -1,61 +0,0 @@
|
||||
name: Build servers with GCC
|
||||
# build_servers_gcc.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths:
|
||||
# Always trigger all Github Actions if an action or something CI related was changed
|
||||
- '.github/workflows/**'
|
||||
- 'tools/ci/**'
|
||||
# This workflow should run when a file in a source directory has been modified.
|
||||
- 'src/**'
|
||||
- '3rdparty/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Github Actions checks for '[ci skip]', '[skip ci]', '[no ci]', '[skip actions]', or '[actions skip]' but not a hyphenated version.
|
||||
# It's a catch-all incase a Pull Request has been opened and someone is on auto-pilot.
|
||||
if: "!contains(github.event.head_commit.message, 'ci-skip')"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
# The ubuntu-latest label currently points to ubuntu-22.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-latest]
|
||||
# Older versions of GCC are not available via unaltered aptitude repo lists.
|
||||
gcc: ['9', '10', '11', '12']
|
||||
# GCC 13 was removed from 22.04, include it as a separate job
|
||||
include:
|
||||
- os: ubuntu-24.04
|
||||
gcc: 13
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Update & Install packages
|
||||
# Ubuntu runners already have most of the packages rAthena requires to build.
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
|
||||
|
||||
- name: Command - configure
|
||||
env:
|
||||
CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }}'
|
||||
# -Werror: to treat all warnings as errors
|
||||
# -Wno-error=builtin-declaration-mismatch: otherwise ./configure checks fail
|
||||
run: ./configure $CONFIGURE_FLAGS --enable-buildbot=yes CXXFLAGS='-Werror -Wno-error=builtin-declaration-mismatch'
|
||||
|
||||
- name: Command - make clean
|
||||
run: make clean
|
||||
|
||||
- name: Command - make all
|
||||
run: make all
|
28
.github/workflows/build_servers_modes.yml
vendored
28
.github/workflows/build_servers_modes.yml
vendored
@ -18,6 +18,8 @@ on:
|
||||
# This workflow should run when a file in a source directory has been modified.
|
||||
- 'src/**'
|
||||
- '3rdparty/**'
|
||||
# This workflow should run whenever a CMake related file has been modified
|
||||
- '**/CMakeLists.txt'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -30,8 +32,6 @@ jobs:
|
||||
# The ubuntu-latest label currently points to ubuntu-22.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-latest]
|
||||
# Older versions of GCC are not available via unaltered aptitude repo lists.
|
||||
gcc: ['11']
|
||||
# We run build checks for both Renewal and PRE-Renewal
|
||||
mode: ['PRE','RE']
|
||||
|
||||
@ -42,18 +42,18 @@ jobs:
|
||||
- name: Variable Parsing - PRE
|
||||
if: ${{ matrix.mode == 'PRE' }}
|
||||
run: |
|
||||
echo "PRERE=yes" >> $GITHUB_ENV
|
||||
echo "PRERE=ON" >> $GITHUB_ENV
|
||||
- name: Variable Parsing - RE
|
||||
if: ${{ matrix.mode == 'RE' }}
|
||||
run: |
|
||||
echo "PRERE=no" >> $GITHUB_ENV
|
||||
echo "PRERE=OFF" >> $GITHUB_ENV
|
||||
|
||||
- name: Update & Install packages
|
||||
# Ubuntu runners already have most of the packages rAthena requires to build.
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2204-Readme.md
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
|
||||
sudo apt install zlib1g-dev libpcre3-dev
|
||||
|
||||
- name: Start MySQL
|
||||
run: sudo systemctl start mysql.service
|
||||
@ -61,16 +61,16 @@ jobs:
|
||||
- name: Setup Database and import table data
|
||||
run: ./tools/ci/sql.sh
|
||||
|
||||
- name: Command - configure
|
||||
env:
|
||||
CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }} --enable-prere=${{ env.PRERE }} --enable-buildbot=yes'
|
||||
run: ./configure $CONFIGURE_FLAGS
|
||||
- name: Create build directory
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Command - make clean
|
||||
run: make clean
|
||||
- name: Configure CMake
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake .. -DENABLE_PRERENEWAL=${{env.PRERE}} -DENABLE_EXTRA_BUILDBOT_CODE=ON
|
||||
|
||||
- name: Command - make server
|
||||
run: make server
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake --build . -j2 --target server
|
||||
|
||||
- name: Run Once - login-server
|
||||
run: ./login-server --run-once
|
||||
|
48
.github/workflows/build_servers_msbuild.yml
vendored
48
.github/workflows/build_servers_msbuild.yml
vendored
@ -1,48 +0,0 @@
|
||||
name: Build servers with MSVS
|
||||
# build_servers_msbuild.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths:
|
||||
# Always trigger all Github Actions if an action or something CI related was changed
|
||||
- '.github/workflows/**'
|
||||
- 'tools/ci/**'
|
||||
# This workflow should run when a file in a source directory has been modified.
|
||||
- 'src/**'
|
||||
- '3rdparty/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Github Actions checks for '[ci skip]', '[skip ci]', '[no ci]', '[skip actions]', or '[actions skip]' but not a hyphenated version.
|
||||
# It's a catch-all incase a Pull Request has been opened and someone is on auto-pilot.
|
||||
if: "!contains(github.event.head_commit.message, 'ci-skip')"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
# The windows-latest label currently points to windows-2019.
|
||||
# Available: windows-2016, windows-2019 and windows-2022
|
||||
os: [windows-latest]
|
||||
# We run build checks for both Renewal and PRE-Renewal
|
||||
mode: ['PRE', 'RE']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Build solution in Debug
|
||||
if: ${{ matrix.mode == 'PRE' }}
|
||||
run: msbuild rAthena.sln -t:rebuild -property:Configuration=Debug /p:DefineConstants="BUILDBOT%3BPRERE" /warnaserror
|
||||
|
||||
- name: Build solution in Debug
|
||||
if: ${{ matrix.mode == 'RE' }}
|
||||
run: msbuild rAthena.sln -t:rebuild -property:Configuration=Debug /p:DefineConstants="BUILDBOT" /warnaserror
|
@ -18,6 +18,8 @@ on:
|
||||
# This workflow should run when a file in a source directory has been modified.
|
||||
- 'src/**'
|
||||
- '3rdparty/**'
|
||||
# This workflow should run whenever a CMake related file has been modified
|
||||
- '**/CMakeLists.txt'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -30,8 +32,6 @@ jobs:
|
||||
# The ubuntu-latest label currently points to ubuntu-22.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-latest]
|
||||
# Older versions of GCC are not available via unaltered aptitude repo lists.
|
||||
gcc: ['11']
|
||||
# We run build checks for both Renewal and PRE-Renewal
|
||||
mode: ['PRE','RE']
|
||||
# Check build success for different packet-versions
|
||||
@ -44,18 +44,18 @@ jobs:
|
||||
- name: Variable Parsing - PRE
|
||||
if: ${{ matrix.mode == 'PRE' }}
|
||||
run: |
|
||||
echo "PRERE=yes" >> $GITHUB_ENV
|
||||
echo "PRERE=ON" >> $GITHUB_ENV
|
||||
- name: Variable Parsing - RE
|
||||
if: ${{ matrix.mode == 'RE' }}
|
||||
run: |
|
||||
echo "PRERE=no" >> $GITHUB_ENV
|
||||
echo "PRERE=OFF" >> $GITHUB_ENV
|
||||
|
||||
- name: Update & Install packages
|
||||
# Ubuntu runners already have most of the packages rAthena requires to build.
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
|
||||
sudo apt install zlib1g-dev libpcre3-dev
|
||||
|
||||
- name: Start MySQL
|
||||
run: sudo systemctl start mysql.service
|
||||
@ -63,13 +63,13 @@ jobs:
|
||||
- name: Setup Database and import table data
|
||||
run: ./tools/ci/sql.sh
|
||||
|
||||
- name: Command - configure
|
||||
env:
|
||||
CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }} --enable-prere=${{ env.PRERE }} --enable-packetver=${{ matrix.packetver }} --enable-buildbot=yes'
|
||||
run: ./configure $CONFIGURE_FLAGS
|
||||
- name: Create build directory
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Command - make clean
|
||||
run: make clean
|
||||
- name: Configure CMake
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake .. -DENABLE_PRERENEWAL=${{env.PRERE}} -DPACKETVER=${{matrix.packetver}} -DENABLE_EXTRA_BUILDBOT_CODE=ON
|
||||
|
||||
- name: Command - make all
|
||||
run: make all
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake --build . -j2
|
||||
|
26
.github/workflows/build_servers_vip.yml
vendored
26
.github/workflows/build_servers_vip.yml
vendored
@ -18,6 +18,8 @@ on:
|
||||
# This workflow should run when a file in a source directory has been modified.
|
||||
- 'src/**'
|
||||
- '3rdparty/**'
|
||||
# This workflow should run whenever a CMake related file has been modified
|
||||
- '**/CMakeLists.txt'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -30,8 +32,6 @@ jobs:
|
||||
# The ubuntu-latest label currently points to ubuntu-22.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-latest]
|
||||
# Older versions of GCC are not available via unaltered aptitude repo lists.
|
||||
gcc: ['11']
|
||||
# We run build checks for both Renewal and PRE-Renewal
|
||||
mode: ['PRE', 'RE']
|
||||
|
||||
@ -42,18 +42,18 @@ jobs:
|
||||
- name: Variable Parsing - PRE
|
||||
if: ${{ matrix.mode == 'PRE' }}
|
||||
run: |
|
||||
echo "PRERE=yes" >> $GITHUB_ENV
|
||||
echo "PRERE=ON" >> $GITHUB_ENV
|
||||
- name: Variable Parsing - RE
|
||||
if: ${{ matrix.mode == 'RE' }}
|
||||
run: |
|
||||
echo "PRERE=no" >> $GITHUB_ENV
|
||||
echo "PRERE=OFF" >> $GITHUB_ENV
|
||||
|
||||
- name: Update & Install packages
|
||||
# Ubuntu runners already have most of the packages rAthena requires to build.
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
|
||||
sudo apt install zlib1g-dev libpcre3-dev
|
||||
|
||||
- name: Start MySQL
|
||||
run: sudo systemctl start mysql.service
|
||||
@ -61,16 +61,16 @@ jobs:
|
||||
- name: Setup Database and import table data
|
||||
run: ./tools/ci/sql.sh
|
||||
|
||||
- name: Command - configure
|
||||
env:
|
||||
CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }} --enable-prere=${{ env.PRERE }} --enable-buildbot=yes --enable-vip=yes'
|
||||
run: ./configure $CONFIGURE_FLAGS
|
||||
- name: Create build directory
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Command - make clean
|
||||
run: make clean
|
||||
- name: Configure CMake
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake .. -DENABLE_PRERENEWAL=${{env.PRERE}} -DENABLE_EXTRA_BUILDBOT_CODE=ON -DENABLE_VIP=ON
|
||||
|
||||
- name: Command - make server
|
||||
run: make server
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake --build . -j2 --target server
|
||||
|
||||
- name: Run Once - login-server
|
||||
run: ./login-server --run-once
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: Build servers with CMake
|
||||
# build_servers_cmake.yml
|
||||
name: Build servers on Windows
|
||||
# build_servers_windows.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
|
||||
@ -29,25 +29,19 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
# The ubuntu-latest label currently points to ubuntu-22.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-latest]
|
||||
os: [windows-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Install latest CMake.
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Create build directory
|
||||
run: mkdir cbuild
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Create Unix Makefiles
|
||||
run: |
|
||||
cd cbuild
|
||||
cmake -G "Unix Makefiles" ..
|
||||
- name: Configure CMake
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake ..
|
||||
|
||||
- name: Command - make
|
||||
run: |
|
||||
cd cbuild
|
||||
make
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . -j2 --target server tools
|
36
.github/workflows/npc_db_validation.yml
vendored
36
.github/workflows/npc_db_validation.yml
vendored
@ -21,6 +21,8 @@ on:
|
||||
# This workflow should run when a file in either the db/ or npc/ directory has been modified.
|
||||
- 'db/**'
|
||||
- 'npc/**'
|
||||
# This workflow should run whenever a CMake related file has been modified
|
||||
- '**/CMakeLists.txt'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -33,8 +35,6 @@ jobs:
|
||||
# The ubuntu-latest label currently points to ubuntu-22.04.
|
||||
# Available: ubuntu-22.04, ubuntu-20.04
|
||||
os: [ubuntu-latest]
|
||||
# Only a single version of GCC is required for validating NPC scripts and database changes.
|
||||
gcc: ['11']
|
||||
# We run build checks for both Renewal and PRE-Renewal
|
||||
mode: ['PRE', 'RE']
|
||||
|
||||
@ -45,18 +45,18 @@ jobs:
|
||||
- name: Variable Parsing - PRE
|
||||
if: ${{ matrix.mode == 'PRE' }}
|
||||
run: |
|
||||
echo "PRERE=yes" >> $GITHUB_ENV
|
||||
echo "PRERE=ON" >> $GITHUB_ENV
|
||||
- name: Variable Parsing - RE
|
||||
if: ${{ matrix.mode == 'RE' }}
|
||||
run: |
|
||||
echo "PRERE=no" >> $GITHUB_ENV
|
||||
echo "PRERE=OFF" >> $GITHUB_ENV
|
||||
|
||||
- name: Update & Install packages
|
||||
# Ubuntu runners already have most of the packages rAthena requires to build.
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2204-Readme.md
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
|
||||
sudo apt install zlib1g-dev libpcre3-dev
|
||||
|
||||
- name: Start MySQL
|
||||
run: sudo systemctl start mysql.service
|
||||
@ -64,24 +64,20 @@ jobs:
|
||||
- name: Setup Database and import table data
|
||||
run: ./tools/ci/sql.sh
|
||||
|
||||
- name: Command - configure
|
||||
env:
|
||||
CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }} --enable-prere=${{ env.PRERE }} --enable-buildbot=yes'
|
||||
run: ./configure $CONFIGURE_FLAGS
|
||||
- name: Create build directory
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Configure CMake
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake .. -DENABLE_PRERENEWAL=${{env.PRERE}} -DENABLE_EXTRA_BUILDBOT_CODE=ON
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: cmake --build . -j2 --target map-server
|
||||
|
||||
# npc.sh enables all NPC scripts in the custom and test folders.
|
||||
- name: Enable All NPCs for Testing
|
||||
run: ./tools/ci/npc.sh
|
||||
|
||||
- name: Command - make clean
|
||||
run: make clean
|
||||
|
||||
# Create import directories
|
||||
- name: Command - make import
|
||||
run: make import
|
||||
|
||||
- name: Command - make map
|
||||
run: make map
|
||||
|
||||
- name: Run Once - map-server
|
||||
run: ./map-server --run-once
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -139,6 +139,12 @@ Thumbs.db
|
||||
/yamlupgrade.bat
|
||||
/navigenerator.bat
|
||||
|
||||
# Linux script tools
|
||||
/athena-start.sh
|
||||
# /function.sh
|
||||
# /install.sh
|
||||
# /uninstall.sh
|
||||
|
||||
# dlls
|
||||
/libmysql.dll
|
||||
/pcre8.dll
|
||||
|
48
3rdparty/httplib/CMakeLists.txt
vendored
48
3rdparty/httplib/CMakeLists.txt
vendored
@ -1,38 +1,18 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
add_library(httplib STATIC)
|
||||
|
||||
if ( NOT ENABLE_WEB_SERVER )
|
||||
return()
|
||||
endif( NOT ENABLE_WEB_SERVER )
|
||||
target_sources(httplib PRIVATE "httplib.cc")
|
||||
|
||||
SET (this_target httplib)
|
||||
PROJECT(${this_target})
|
||||
target_include_directories(httplib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
find_path ( HTTPLIB_INCLUDE_DIRS "httplib.h"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
NO_DEFAULT_PATH )
|
||||
|
||||
find_path ( HTTPLIB_SOURCE_DIR "httplib.cc"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
NO_DEFAULT_PATH )
|
||||
|
||||
mark_as_advanced( HTTPLIB_INCLUDE_DIRS )
|
||||
mark_as_advanced( HTTPLIB_SOURCE_DIR )
|
||||
|
||||
set ( HTTPLIB_HEADERS
|
||||
"${HTTPLIB_INCLUDE_DIRS}/httplib.h"
|
||||
CACHE INTERNAL "httplib headers" )
|
||||
|
||||
set ( HTTPLIB_SOURCES
|
||||
"${HTTPLIB_SOURCE_DIR}/httplib.cc"
|
||||
CACHE INTERNAL "httplib sources" )
|
||||
|
||||
set ( HTTPLIB_DEFINITIONS
|
||||
"-std=c++11"
|
||||
CACHE INTERNAL "http definitions" )
|
||||
include_directories( ${HTTPLIB_INCLUDE_DIRS} ${HTTPLIB_SOURCE_DIR} )
|
||||
|
||||
ADD_LIBRARY( ${this_target} STATIC ${HTTPLIB_SOURCES} )
|
||||
|
||||
if (NOT WIN32)
|
||||
target_compile_definitions(${this_target} PUBLIC "CPPHTTPLIB_SEND_FLAGS=MSG_NOSIGNAL")
|
||||
if(NOT WIN32)
|
||||
target_compile_definitions(httplib PUBLIC "CPPHTTPLIB_SEND_FLAGS=MSG_NOSIGNAL")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_sources(httplib PRIVATE "httplib.h")
|
||||
set_target_properties(httplib PROPERTIES FOLDER "3rdparty")
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_WEB_SERVER)
|
||||
set_target_properties(httplib PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
endif()
|
||||
|
8
3rdparty/json/CMakeLists.txt
vendored
8
3rdparty/json/CMakeLists.txt
vendored
@ -1,7 +1,3 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
add_library(json INTERFACE)
|
||||
|
||||
set (JSON_INCLUDE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
CACHE INTERNAL "json include dir" )
|
||||
|
||||
mark_as_advanced( JSON_INCLUDE_DIRS )
|
||||
target_include_directories(json INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
52
3rdparty/libconfig/CMakeLists.txt
vendored
52
3rdparty/libconfig/CMakeLists.txt
vendored
@ -1,29 +1,27 @@
|
||||
|
||||
find_path( LIBCONFIG_INCLUDE_DIRS "libconfig.h"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
NO_DEFAULT_PATH )
|
||||
find_path( LIBCONFIG_SOURCE_DIR "libconfig.c"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
NO_DEFAULT_PATH )
|
||||
mark_as_advanced( LIBCONFIG_INCLUDE_DIRS )
|
||||
mark_as_advanced( LIBCONFIG_SOURCE_DIR )
|
||||
add_library(libconfig STATIC)
|
||||
|
||||
set( LIBCONFIG_HEADERS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/grammar.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/libconfig.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/parsectx.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/scanctx.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/scanner.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/strbuf.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/wincompat.h"
|
||||
CACHE INTERNAL "libconfig headers" )
|
||||
set( LIBCONFIG_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/grammar.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/libconfig.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/scanctx.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/scanner.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/strbuf.c"
|
||||
CACHE INTERNAL "libconfig sources" )
|
||||
set( LIBCONFIG_DEFINITIONS
|
||||
"-DLIBCONFIG_STATIC"
|
||||
CACHE INTERNAL "libconfig definitions" )
|
||||
target_sources(libconfig PRIVATE
|
||||
"grammar.c"
|
||||
"libconfig.c"
|
||||
"scanctx.c"
|
||||
"scanner.c"
|
||||
"strbuf.c"
|
||||
)
|
||||
|
||||
target_include_directories(libconfig PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
target_compile_definitions(libconfig PUBLIC "-DLIBCONFIG_STATIC")
|
||||
|
||||
if(WIN32)
|
||||
target_sources(libconfig PRIVATE
|
||||
"grammar.h"
|
||||
"libconfig.h"
|
||||
"parsectx.h"
|
||||
"scanctx.h"
|
||||
"scanner.h"
|
||||
"strbuf.h"
|
||||
"wincompat.h"
|
||||
)
|
||||
set_target_properties(libconfig PROPERTIES FOLDER "3rdparty")
|
||||
endif()
|
||||
|
7
3rdparty/rapidyaml/CMakeLists.txt
vendored
7
3rdparty/rapidyaml/CMakeLists.txt
vendored
@ -95,6 +95,7 @@ endif()
|
||||
|
||||
c4_add_dev_targets()
|
||||
|
||||
add_custom_target(ryml-uninstall
|
||||
"${CMAKE_COMMAND}" -P "${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake"
|
||||
)
|
||||
# rathena
|
||||
if(WIN32)
|
||||
set_target_properties(ryml PROPERTIES FOLDER "3rdparty")
|
||||
endif()
|
||||
|
12
3rdparty/rapidyaml/ext/c4core/CMakeLists.txt
vendored
12
3rdparty/rapidyaml/ext/c4core/CMakeLists.txt
vendored
@ -78,13 +78,6 @@ endif()
|
||||
set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp)
|
||||
list(TRANSFORM C4CORE_SRC_FILES PREPEND "${C4CORE_SRC_DIR}/" OUTPUT_VARIABLE C4CORE_SRC_FILES_FULL)
|
||||
|
||||
add_custom_target(c4core-amalgamate
|
||||
python ${CMAKE_CURRENT_LIST_DIR}/tools/amalgamate.py ${C4CORE_AMALGAMATED}
|
||||
COMMENT "${CMAKE_CURRENT_LIST_DIR}/tools/amalgamate.py ${C4CORE_AMALGAMATED}"
|
||||
BYPRODUCTS ${C4CORE_AMALGAMATED}
|
||||
DEPENDS ${C4CORE_SRC_FILES_FULL}
|
||||
)
|
||||
|
||||
c4_add_library(c4core
|
||||
INC_DIRS
|
||||
$<BUILD_INTERFACE:${C4CORE_SRC_DIR}> $<INSTALL_INTERFACE:include>
|
||||
@ -105,3 +98,8 @@ c4_install_exports()
|
||||
c4_add_dev_targets()
|
||||
|
||||
c4_pack_project(TYPE LIBRARY)
|
||||
|
||||
# rathena
|
||||
if(WIN32)
|
||||
set_target_properties(c4core PROPERTIES FOLDER "3rdparty")
|
||||
endif()
|
||||
|
159
3rdparty/yaml-cpp/CMakeLists.txt
vendored
159
3rdparty/yaml-cpp/CMakeLists.txt
vendored
@ -1,87 +1,78 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
set(YAML_HEADERS
|
||||
"yaml.h"
|
||||
"traits.h"
|
||||
"stlemitter.h"
|
||||
"parser.h"
|
||||
"ostream_wrapper.h"
|
||||
"null.h"
|
||||
"noncopyable.h"
|
||||
"noexcept.h"
|
||||
"mark.h"
|
||||
"exceptions.h"
|
||||
"eventhandler.h"
|
||||
"emitterstyle.h"
|
||||
"emittermanip.h"
|
||||
"emitter.h"
|
||||
"emitterdef.h"
|
||||
"emitfromevents.h"
|
||||
"dll.h"
|
||||
"depthguard.h"
|
||||
"binary.h"
|
||||
"anchor.h"
|
||||
"node/type.h"
|
||||
"node/ptr.h"
|
||||
"node/parse.h"
|
||||
"node/node.h"
|
||||
"node/iterator.h"
|
||||
"node/impl.h"
|
||||
"node/emit.h"
|
||||
"node/convert.h"
|
||||
"contrib/graphbuilder.h"
|
||||
"contrib/anchordict.h"
|
||||
)
|
||||
list(TRANSFORM YAML_HEADERS PREPEND "include/yaml-cpp/")
|
||||
|
||||
## start setting
|
||||
SET (this_target yaml-cpp)
|
||||
PROJECT(${this_target})
|
||||
set(YAML_SOURCES
|
||||
"binary.cpp"
|
||||
"convert.cpp"
|
||||
"depthguard.cpp"
|
||||
"directives.cpp"
|
||||
"emit.cpp"
|
||||
"emitfromevents.cpp"
|
||||
"emitter.cpp"
|
||||
"emitterstate.cpp"
|
||||
"emitterutils.cpp"
|
||||
"exceptions.cpp"
|
||||
"exp.cpp"
|
||||
"memory.cpp"
|
||||
"nodebuilder.cpp"
|
||||
"node.cpp"
|
||||
"node_data.cpp"
|
||||
"nodeevents.cpp"
|
||||
"null.cpp"
|
||||
"ostream_wrapper.cpp"
|
||||
"parse.cpp"
|
||||
"parser.cpp"
|
||||
"regex_yaml.cpp"
|
||||
"scanner.cpp"
|
||||
"scanscalar.cpp"
|
||||
"scantag.cpp"
|
||||
"scantoken.cpp"
|
||||
"simplekey.cpp"
|
||||
"singledocparser.cpp"
|
||||
"stream.cpp"
|
||||
"tag.cpp"
|
||||
"contrib/graphbuilderadapter.cpp"
|
||||
"contrib/graphbuilder.cpp"
|
||||
)
|
||||
list(TRANSFORM YAML_SOURCES PREPEND "src/")
|
||||
|
||||
find_path( YAML_INCLUDE_DIRS "yaml-cpp/yaml.h"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
NO_DEFAULT_PATH )
|
||||
find_path( YAML_SOURCE_DIR "regex_yaml.cpp"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
NO_DEFAULT_PATH )
|
||||
mark_as_advanced( YAML_INCLUDE_DIRS )
|
||||
mark_as_advanced( YAML_SOURCE_DIR )
|
||||
add_library(yaml-cpp STATIC EXCLUDE_FROM_ALL ${YAML_SOURCES})
|
||||
|
||||
set( YAML_HEADERS
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/yaml.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/traits.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/stlemitter.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/parser.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/ostream_wrapper.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/null.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/noncopyable.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/noexcept.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/mark.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/exceptions.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/eventhandler.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitterstyle.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emittermanip.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitter.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitterdef.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitfromevents.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/dll.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/depthguard.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/binary.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/anchor.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/type.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/ptr.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/parse.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/node.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/iterator.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/impl.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/emit.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/convert.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/contrib/graphbuilder.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/contrib/anchordict.h"
|
||||
CACHE INTERNAL "yaml headers" )
|
||||
set( YAML_SOURCES
|
||||
"${YAML_SOURCE_DIR}/binary.cpp"
|
||||
"${YAML_SOURCE_DIR}/convert.cpp"
|
||||
"${YAML_SOURCE_DIR}/depthguard.cpp"
|
||||
"${YAML_SOURCE_DIR}/directives.cpp"
|
||||
"${YAML_SOURCE_DIR}/emit.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitfromevents.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitter.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitterstate.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitterutils.cpp"
|
||||
"${YAML_SOURCE_DIR}/exceptions.cpp"
|
||||
"${YAML_SOURCE_DIR}/exp.cpp"
|
||||
"${YAML_SOURCE_DIR}/memory.cpp"
|
||||
"${YAML_SOURCE_DIR}/nodebuilder.cpp"
|
||||
"${YAML_SOURCE_DIR}/node.cpp"
|
||||
"${YAML_SOURCE_DIR}/node_data.cpp"
|
||||
"${YAML_SOURCE_DIR}/nodeevents.cpp"
|
||||
"${YAML_SOURCE_DIR}/null.cpp"
|
||||
"${YAML_SOURCE_DIR}/ostream_wrapper.cpp"
|
||||
"${YAML_SOURCE_DIR}/parse.cpp"
|
||||
"${YAML_SOURCE_DIR}/parser.cpp"
|
||||
"${YAML_SOURCE_DIR}/regex_yaml.cpp"
|
||||
"${YAML_SOURCE_DIR}/scanner.cpp"
|
||||
"${YAML_SOURCE_DIR}/scanscalar.cpp"
|
||||
"${YAML_SOURCE_DIR}/scantag.cpp"
|
||||
"${YAML_SOURCE_DIR}/scantoken.cpp"
|
||||
"${YAML_SOURCE_DIR}/simplekey.cpp"
|
||||
"${YAML_SOURCE_DIR}/singledocparser.cpp"
|
||||
"${YAML_SOURCE_DIR}/stream.cpp"
|
||||
"${YAML_SOURCE_DIR}/tag.cpp"
|
||||
"${YAML_SOURCE_DIR}/contrib/graphbuilderadapter.cpp"
|
||||
"${YAML_SOURCE_DIR}/contrib/graphbuilder.cpp"
|
||||
CACHE INTERNAL "yaml sources" )
|
||||
set( YAML_DEFINITIONS
|
||||
"-std=c++11"
|
||||
CACHE INTERNAL "yaml definitions" )
|
||||
include_directories(${YAML_INCLUDE_DIRS} ${YAML_SOURCE_DIR})
|
||||
#message(STATUS "YAML_INCLUDE_DIRS : ${YAML_INCLUDE_DIRS}, YAML_SOURCE_DIR=${YAML_SOURCE_DIR}")
|
||||
ADD_LIBRARY(${this_target} STATIC ${YAML_SOURCES} )
|
||||
target_compile_definitions(${this_target} PUBLIC "-DYAML_CPP_STATIC_DEFINE")
|
||||
target_include_directories(yaml-cpp PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
target_compile_definitions(yaml-cpp PUBLIC "-DYAML_CPP_STATIC_DEFINE")
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(yaml-cpp PROPERTIES FOLDER "3rdparty")
|
||||
endif()
|
||||
|
693
CMakeLists.txt
693
CMakeLists.txt
@ -1,630 +1,105 @@
|
||||
#####################################################################
|
||||
#
|
||||
# "Getting Started with CMake", a tutorial video by Eric Wing.
|
||||
# Part 1 of 6: http://www.youtube.com/watch?v=CLvZTyji_Uw
|
||||
# Part 2 of 6: http://www.youtube.com/watch?v=gUW-RrRQjEg
|
||||
# Part 3 of 6: http://www.youtube.com/watch?v=sz6cPhbuTk4
|
||||
# Part 4 of 6: http://www.youtube.com/watch?v=JICZOkyNXbg
|
||||
# Part 5 of 6: http://www.youtube.com/watch?v=lAiuLHy4dCk
|
||||
# Part 6 of 6: http://www.youtube.com/watch?v=fAtJNzDZdH8
|
||||
#
|
||||
# You can use notepad++ for syntax highlighting.
|
||||
# Naming conventions:
|
||||
# WITH_* : option to use an external package or not
|
||||
# ENABLE_* : option to use an internal feature/code or not
|
||||
# HAVE_* : internal variable indicating if we have and are using something
|
||||
#
|
||||
# Maintainers: Flavio J. Saraiva (feel free to send complaints or suggestions)
|
||||
# flaviojs @ rAthena forum/irc
|
||||
# flaviojs2005 \A-T/ gmail <D.o,T> com
|
||||
# lightaisme \A-T/ gmail <D.o,T> com
|
||||
#
|
||||
#####################################################################
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
project(rAthena)
|
||||
|
||||
# Configure CMake Modules
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake")
|
||||
|
||||
|
||||
#cmake_minimum_required( VERSION 2.8.4 )
|
||||
# Functional changes from 2.8.3 to 2.8.4:
|
||||
# string(SUBSTRING) works with length -1 as "rest of string"
|
||||
# changes to some CPack generators
|
||||
# CYGWIN no longer defines WIN32
|
||||
# CMP0017: Prefer files from the CMake module directory when including from there.
|
||||
# Update to 3.1 for CMAKE_CXX_STANDARD cross support definition
|
||||
set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
|
||||
cmake_minimum_required( VERSION 3.1 )
|
||||
project( rAthena )
|
||||
if( CYGWIN )
|
||||
unset( WIN32 )
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 17) # C++17...
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
|
||||
#set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
|
||||
# options
|
||||
set(PACKETVER 20211103 CACHE STRING "Sets the PACKETVER define of the servers (see src/common/mmo.hpp)")
|
||||
set(MAXCONN CACHE STRING "Sets the MAXCONN define of the servers. (see src/common/socket.hpp)")
|
||||
option(ENABLE_PRERENEWAL "Whether or not to enable Pre-renewal (default=OFF)" OFF)
|
||||
option(ENABLE_WEB_SERVER "Build web-server (default=ON)" ON)
|
||||
option(ENABLE_RDTSC "Enable RDTSC instruction as a timing source (default=OFF)" OFF)
|
||||
option(ENABLE_EXTRA_DEBUG_CODE "Enable extra debug code (default=OFF)" OFF)
|
||||
option(ENABLE_MEMMGR "Enable memory manager (default=ON)" ON)
|
||||
# TODO(vstumpf): If no one uses this, we can just remove it
|
||||
# set(ENABLE_MEMORY "system" CACHE STRING "Enable memory library (default=system)")
|
||||
option(ENABLE_PROFILER "Enable profiler (default=OFF)" OFF)
|
||||
option(ENABLE_EXTRA_BUILDBOT_CODE "Enable extra buildbot code (default=OFF)" OFF)
|
||||
option(ENABLE_EPOLL "Use epoll instead of select (default=OFF)" OFF)
|
||||
option(ENABLE_VIP "Enable VIP system (default=OFF)" OFF)
|
||||
|
||||
#actually this might be misleading for arm...
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
|
||||
set(architecture x86)
|
||||
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set(architecture x64)
|
||||
else()
|
||||
message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P})" )
|
||||
endif()
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
set(CMAKE_RELEASE_POSTFIX "r")
|
||||
|
||||
# Set a default build type if none was specified
|
||||
set(default_build_type "Release")
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||
STRING "Choose the type of build." FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||
STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE)
|
||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(ENABLE_MSVC_PARALLEL ON CACHE STRING "\
|
||||
Enables /MP flag for parallel builds using MSVC. Specify an integer value to control \
|
||||
the number of threads used (Only works on versions of Visual Studio). Setting to ON \
|
||||
lets the toolchain decide how many threads to use. Set to OFF to disable /MP completely." )
|
||||
|
||||
if(ENABLE_MSVC_PARALLEL)
|
||||
if(ENABLE_MSVC_PARALLEL GREATER 0)
|
||||
string(APPEND CMAKE_C_FLAGS " /MP${ENABLE_MSVC_PARALLEL}")
|
||||
string(APPEND CMAKE_CXX_FLAGS " /MP${ENABLE_MSVC_PARALLEL}")
|
||||
else()
|
||||
string(APPEND CMAKE_C_FLAGS " /MP")
|
||||
string(APPEND CMAKE_CXX_FLAGS " /MP")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Prevent building in the source directory by default
|
||||
#
|
||||
option( ALLOW_SAME_DIRECTORY "Allow CMake to build in the source directory." OFF )
|
||||
if( ALLOW_SAME_DIRECTORY )
|
||||
elseif( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" )
|
||||
message( FATAL_ERROR
|
||||
"Do not use the source directory to build your files, instead delete CMakeCache.txt, create a separate folder and build there.\n"
|
||||
"Example: (build in subdir 'build' and install to source dir)\n"
|
||||
" rm -f CMakeCache.txt\n"
|
||||
" mkdir build\n"
|
||||
" cd build\n"
|
||||
" cmake -G\"Unix Makefiles\" -DINSTALL_TO_SOURCE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\n"
|
||||
" make install\n"
|
||||
" cd ..\n"
|
||||
" rm -rf build\n"
|
||||
"To skip this check, set ALLOW_SAME_DIRECTORY to ON (-DALLOW_SAME_DIRECTORY=ON)" )
|
||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||
message( FATAL_ERROR
|
||||
"Do not use the source directory to build your files, instead delete CMakeCache.txt, create a separate folder and build there.\n"
|
||||
"Example: (build in subdir 'build' and install to source dir)\n"
|
||||
" rm -f CMakeCache.txt\n"
|
||||
" mkdir build\n"
|
||||
" cd build\n"
|
||||
" cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\n"
|
||||
" make install\n"
|
||||
" cd ..\n"
|
||||
" rm -rf build\n")
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Global stuff
|
||||
#
|
||||
set( GLOBAL_LIBRARIES ${LINK_LIBRARIES} CACHE INTERNAL "" )# list (comma separated values)
|
||||
set( GLOBAL_INCLUDE_DIRS ${INCLUDE_DIRECTORIES} CACHE INTERNAL "" )# list (comma separated values)
|
||||
set( GLOBAL_DEFINITIONS ${COMPILE_DEFINITIONS} CACHE INTERNAL "" )# string (space separated values -DFOO=bar)
|
||||
mark_as_advanced( GLOBAL_LIBRARIES GLOBAL_INCLUDE_DIRS GLOBAL_DEFINITIONS )
|
||||
if( WIN32 )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DFD_SETSIZE=4096" )
|
||||
endif()
|
||||
if( MSVC )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} "oldnames.lib" "ws2_32.lib" )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE" )
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -fno-strict-aliasing" )
|
||||
#set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -O2" ); #need more test to enable this
|
||||
if(WIN32)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# 3rd party
|
||||
#
|
||||
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmake CACHE INTERNAL "" )
|
||||
include( CheckCSourceCompiles )
|
||||
include( CheckCSourceRuns )
|
||||
include( CheckIncludeFile )
|
||||
include( CheckFunctionExists )
|
||||
include( FindFunctionLibrary )
|
||||
include( TestBigEndian )
|
||||
# Configure C++ Standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
|
||||
#
|
||||
# PACKETVER
|
||||
#
|
||||
set( PACKETVER CACHE STRING "Sets the PACKETVER define of the servers. (see src/common/mmo.h)" )
|
||||
if( PACKETVER )
|
||||
list( APPEND GLOBAL_DEFINITIONS PACKETVER=${PACKETVER} )
|
||||
# Set build directories
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(WIN32)
|
||||
set(RuntimeOutputDir "${CMAKE_BINARY_DIR}/..")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${RuntimeOutputDir})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${RuntimeOutputDir})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${RuntimeOutputDir})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${RuntimeOutputDir})
|
||||
|
||||
if (MSVC AND NOT MSVC_VERSION VERSION_LESS 142)
|
||||
add_link_options($<$<CONFIG:Debug>:/INCREMENTAL>)
|
||||
add_compile_options($<$<CONFIG:Debug>:/ZI>)
|
||||
endif()
|
||||
add_compile_definitions($<$<CONFIG:DEBUG>:_ITERATOR_DEBUG_LEVEL=0>)
|
||||
endif()
|
||||
|
||||
add_subdirectory(db)
|
||||
add_subdirectory(conf)
|
||||
add_subdirectory(3rdparty)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tools)
|
||||
|
||||
#
|
||||
# Find git
|
||||
#
|
||||
message( STATUS "Detecting git" )
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
if(GIT_VERSION_STRING)
|
||||
message(STATUS "Found git : ${GIT_EXECUTABLE} version (${GIT_VERSION_STRING})")
|
||||
else()
|
||||
message(STATUS "Found git : ${GIT_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(GetGitVersion)
|
||||
get_git_version()
|
||||
|
||||
#include(GetSvnVersion)
|
||||
#get_svn_version(SVN_VERSION)
|
||||
#message( STATUS "SVN_VERSION: ${SVN_VERSION}" )
|
||||
|
||||
|
||||
#
|
||||
# threads
|
||||
#
|
||||
message( STATUS "Detecting threads library" )
|
||||
set( CMAKE_THREAD_PREFER_PTHREAD 1 )
|
||||
find_package(Threads REQUIRED)
|
||||
if( CMAKE_THREAD_LIBS_INIT )
|
||||
message( STATUS "Adding global library: ${CMAKE_THREAD_LIBS_INIT}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
||||
endif()
|
||||
message( STATUS "Detecting threads library - done" )
|
||||
|
||||
message( STATUS "Check if supporting Thread local storage (TLS)" )
|
||||
file( READ "${CMAKE_SOURCE_DIR}/3rdparty/cmake/tests/HAVE_TLS.c" _SOURCE )
|
||||
CHECK_C_SOURCE_RUNS( "${_SOURCE}" HAVE_TLS )
|
||||
if( HAVE_TLS )
|
||||
message( STATUS "Check for TLS- yes" )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DHAVE_TLS" )
|
||||
else()
|
||||
message( STATUS "Check for TLS - no" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# math library (FreeBSD/Linux/Solaris)
|
||||
#
|
||||
if( NOT WIN32 )
|
||||
message( STATUS "Detecting math library (m)" )
|
||||
CHECK_INCLUDE_FILE( math.h HAVE_MATH_H )
|
||||
if( NOT HAVE_MATH_H )
|
||||
message( FATAL_ERROR "math.h not found" )
|
||||
endif()
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
find_function_library( floor FUNCTION_FLOOR_LIBRARIES m )
|
||||
if( FUNCTION_FLOOR_LIBRARIES )
|
||||
message( STATUS "Adding global library: ${FUNCTION_FLOOR_LIBRARIES}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_FLOOR_LIBRARIES} )
|
||||
endif()
|
||||
message( STATUS "Detecting math library (m) - done" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# dynamic loading library (Linux)
|
||||
#
|
||||
if( NOT WIN32 )
|
||||
message( STATUS "Detecting dynamic loading library (dl)" )
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
find_function_library( dlopen FUNCTION_DLOPEN_LIBRARIES dl )
|
||||
if( FUNCTION_DLOPEN_LIBRARIES )
|
||||
message( STATUS "Adding global library: ${FUNCTION_DLOPEN_LIBRARIES}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_DLOPEN_LIBRARIES} )
|
||||
endif()
|
||||
message( STATUS "Detecting dynamic loading library (dl) - done" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# networking library (Solaris/MinGW)
|
||||
#
|
||||
if( NOT MSVC )
|
||||
message( STATUS "Detecting networking library (socket/nsl/ws2_32)" )
|
||||
#set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
#find_function_library( bind FUNCTION_BIND_LIBRARIES socket ws2_32 )
|
||||
#if( FUNCTION_BIND_LIBRARIES )
|
||||
# message( STATUS "Adding global library: ${FUNCTION_BIND_LIBRARIES}" )
|
||||
# set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_BIND_LIBRARIES} )
|
||||
#endif()
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
find_function_library( gethostbyname FUNCTION_GETHOSTBYNAME_LIBRARIES nsl )
|
||||
if( FUNCTION_GETHOSTBYNAME_LIBRARIES )
|
||||
message( STATUS "Adding global library: ${FUNCTION_GETHOSTBYNAME_LIBRARIES}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_GETHOSTBYNAME_LIBRARIES} )
|
||||
endif()
|
||||
message( STATUS "Detecting networking library (socket/nsl/ws2_32) - done" )
|
||||
endif()
|
||||
|
||||
#
|
||||
# enable web server?
|
||||
#
|
||||
option( ENABLE_WEB_SERVER "Build web-server (default=ON)" ON )
|
||||
|
||||
#
|
||||
# Test for big endian
|
||||
#
|
||||
TEST_BIG_ENDIAN( BIG_ENDIAN )
|
||||
if( NOT DEFINED BIG_ENDIAN )
|
||||
message( WARNING "unable to determine endianness, only LITTLE ENDIAN is supported" )
|
||||
elseif( BIG_ENDIAN )
|
||||
message( FATAL_ERROR "bigendian is not supported" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Test monotonic clock
|
||||
#
|
||||
# CLOCK_MONOTONIC clock for clock_gettime
|
||||
# Normally defines _POSIX_TIMERS > 0 and _POSIX_MONOTONIC_CLOCK (for posix
|
||||
# compliant systems) and __FreeBSD_cc_version >= 500005 (for FreeBSD
|
||||
# >= 5.1.0, which does not have the posix defines (ref. r11983)) would be
|
||||
# checked but some systems define them even when they do not support it
|
||||
# (ref. bugreport:1003).
|
||||
#
|
||||
message( STATUS "Check for monotonic clock" )
|
||||
find_library( RT_LIBRARY rt )# (optional, rt on Debian)
|
||||
mark_as_advanced( RT_LIBRARY )
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} ${RT_LIBRARY} )
|
||||
file( READ "${CMAKE_SOURCE_DIR}/3rdparty/cmake/tests/HAVE_MONOTONIC_CLOCK.c" _SOURCE )
|
||||
CHECK_C_SOURCE_RUNS( "${_SOURCE}" HAVE_MONOTONIC_CLOCK )
|
||||
if( HAVE_MONOTONIC_CLOCK )
|
||||
message( STATUS "Check for monotonic clock - yes" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${RT_LIBRARY} )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DHAVE_MONOTONIC_CLOCK" )
|
||||
else()
|
||||
message( STATUS "Check for monotonic clock - no" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Test if function exists:
|
||||
# setrlimit - used to set the socket limit
|
||||
# strnlen - string length with upper scan bound
|
||||
# getpid - process id
|
||||
# gettid - thread id
|
||||
#
|
||||
CHECK_FUNCTION_EXISTS( setrlimit HAVE_SETRLIMIT )
|
||||
CHECK_FUNCTION_EXISTS( strnlen HAVE_STRNLEN )
|
||||
CHECK_FUNCTION_EXISTS( getpid HAVE_GETPID )
|
||||
CHECK_FUNCTION_EXISTS( gettid HAVE_GETTID )
|
||||
foreach( define HAVE_SETRLIMIT HAVE_STRNLEN HAVE_GETPID HAVE_GETTID )
|
||||
if( ${define} )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -D${define}" )
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
#
|
||||
# Use RDTSC instruction as a timing source (time stamp counter on x86 since Pentium) (default=OFF)
|
||||
#
|
||||
# Enable it when you've timing issues. (ex: in conjunction with XEN or Other Virtualization mechanisms)
|
||||
# Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
|
||||
# (On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual how to disable it)
|
||||
#
|
||||
option( ENABLE_RDTSC "use RDTSC instruction as a timing source (default=OFF)" OFF )
|
||||
if( ENABLE_RDTSC )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DENABLE_RDTSC" )
|
||||
message( STATUS "Enabled RDTSC as a timing source" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Enable extra debug code (default=OFF)
|
||||
#
|
||||
option( ENABLE_EXTRA_DEBUG_CODE "enable extra debug code (default=OFF)" OFF )
|
||||
if( ENABLE_EXTRA_DEBUG_CODE )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DDEBUG" )
|
||||
message( STATUS "Enabled extra DEBUG code" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Enable EPOLL (default=OFF)
|
||||
# Only for Linux
|
||||
#
|
||||
option( ENABLE_EXTRA_SOCKET_POLL "enable SOCKET_EPOLL (default=OFF)" OFF )
|
||||
if( ENABLE_EXTRA_SOCKET_POLL )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DSOCKET_EPOLL" )
|
||||
message( STATUS "Enabled SOCKET_EPOLL" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Enable builtin memory manager (default=default)
|
||||
#
|
||||
set( MEMMGR_OPTIONS "default;yes;no" )
|
||||
set( ENABLE_MEMMGR "default" CACHE STRING "enable builtin memory manager: ${MEMMGR_OPTIONS} (default=default)" )
|
||||
set_property( CACHE ENABLE_MEMMGR PROPERTY STRINGS ${MEMMGR_OPTIONS} )
|
||||
if( ENABLE_MEMMGR STREQUAL "default" )
|
||||
# use source code default
|
||||
elseif( ENABLE_MEMMGR STREQUAL "yes" )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DUSE_MEMMGR" )
|
||||
message( STATUS "Enabled the builtin memory manager" )
|
||||
elseif( ENABLE_MEMMGR STREQUAL "no" )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DNO_MEMMGR" )
|
||||
message( STATUS "Disabled the builtin memory manager" )
|
||||
else()
|
||||
message( FATAL_ERROR "invalid option ENABLE_MEMMGR=${ENABLE_MEMMGR} (valid options: ${MEMMGR_OPTIONS})" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Enable memory library (default=system)
|
||||
#
|
||||
set( MEMORY_OPTIONS "system;memwatch;dmalloc;gcollect" )
|
||||
set( ENABLE_MEMORY "system" CACHE STRING "enable memory library: ${MEMORY_OPTIONS} (default=system)" )
|
||||
set_property( CACHE ENABLE_MEMORY PROPERTY STRINGS ${MEMORY_OPTIONS} )
|
||||
if( ENABLE_MEMORY STREQUAL "system" )
|
||||
# use system functions
|
||||
|
||||
elseif( ENABLE_MEMORY STREQUAL "memwatch" )
|
||||
CHECK_INCLUDE_FILE( memwatch.h HAVE_MEMWATCH_H )
|
||||
find_library( MEMWATCH_LIBRARY memwatch )
|
||||
mark_as_advanced( MEMWATCH_LIBRARY )
|
||||
if( HAVE_MEMWATCH_H AND MEMWATCH_LIBRARY )
|
||||
message( STATUS "Adding global library: ${MEMWATCH_LIBRARY}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${MEMWATCH_LIBRARY} )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DMEMWATCH" )
|
||||
message( STATUS "Enabled the memory library memwatch" )
|
||||
else()
|
||||
message( FATAL_ERROR "Failed to enable the memory library memwatch" )
|
||||
endif()
|
||||
|
||||
elseif( ENABLE_MEMORY STREQUAL "dmalloc" )
|
||||
CHECK_INCLUDE_FILE( dmalloc.h HAVE_DMALLOC_H )
|
||||
find_library( DMALLOC_LIBRARY dmalloc )
|
||||
mark_as_advanced( DMALLOC_LIBRARY )
|
||||
if( HAVE_DMALLOC_H AND DMALLOC_LIBRARY )
|
||||
message( STATUS "Adding global library: ${DMALLOC_LIBRARY}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${DMALLOC_LIBRARY} )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DDMALLOC -DDMALLOC_FUNC_CHECK" )
|
||||
message( STATUS "Enabled the memory library dmalloc" )
|
||||
else()
|
||||
message( FATAL_ERROR "Failed to enable the memory library dmalloc" )
|
||||
endif()
|
||||
|
||||
elseif( ENABLE_MEMORY STREQUAL "gcollect" )
|
||||
CHECK_INCLUDE_FILE( gc.h HAVE_GC_H )
|
||||
find_library( GC_LIBRARY gc )
|
||||
mark_as_advanced( GC_LIBRARY )
|
||||
if( HAVE_GC_H AND GC_LIBRARY )
|
||||
message( STATUS "Adding global library: ${GC_LIBRARY}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${GC_LIBRARY} )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DGCOLLECT" )
|
||||
message( STATUS "Enabled the memory library gcollect" )
|
||||
else()
|
||||
message( FATAL_ERROR "Failed to enable the memory library gcollect" )
|
||||
endif()
|
||||
|
||||
else()
|
||||
message( FATAL_ERROR "invalid option ENABLE_MEMORY=${ENABLE_MEMORY} (valid options: ${MEMORY_OPTIONS})" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Enable profiler (default=none)
|
||||
#
|
||||
set( PROFILER_OPTIONS "none;gprof" )
|
||||
set( ENABLE_PROFILER "none" CACHE STRING "enable profiler: ${PROFILER_OPTIONS} (default=none)" )
|
||||
set_property( CACHE ENABLE_PROFILER PROPERTY STRINGS ${PROFILER_OPTIONS} )
|
||||
if( ENABLE_PROFILER STREQUAL "none" )
|
||||
# no profiler
|
||||
|
||||
elseif( ENABLE_PROFILER STREQUAL "gprof" )
|
||||
if( CMAKE_C_COMPILER_ID STREQUAL "GNU" )
|
||||
if( NOT HAVE_GPROF_FLAGS )
|
||||
set_property( CACHE CMAKE_C_FLAGS PROPERTY VALUE "${CMAKE_C_FLAGS} -pg" )
|
||||
set_property( CACHE CMAKE_EXE_LINKER_FLAGS PROPERTY VALUE "${CMAKE_EXE_LINKER_FLAGS} -pg" )
|
||||
set( HAVE_GPROF_FLAGS ON CACHE INTERNAL "" )
|
||||
endif()
|
||||
message( STATUS "Enabled the profiler gprof" )
|
||||
else()
|
||||
message( FATAL_ERROR "Failed to enable the profiler gprof - not GNU" )
|
||||
endif()
|
||||
|
||||
else()
|
||||
message( FATAL_ERROR "invalid option ENABLE_PROFILER=${ENABLE_PROFILER} (valid options: ${PROFILER_OPTIONS})" )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Enable extra buildbot code (default=OFF)
|
||||
#
|
||||
option( ENABLE_EXTRA_BUILDBOT_CODE "enable extra buildbot code (default=OFF)" OFF )
|
||||
if( ENABLE_EXTRA_BUILDBOT_CODE )
|
||||
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DBUILDBOT" )
|
||||
message( STATUS "Enabled extra BUILDBOT code" )
|
||||
endif()
|
||||
|
||||
|
||||
#####################################################################
|
||||
# package stuff
|
||||
#
|
||||
set( CPACK_PACKAGE_NAME "rAthena" )
|
||||
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "MMORPG server package" )
|
||||
set( CPACK_PACKAGE_VERSION ${SVNVERSION} )
|
||||
set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE )
|
||||
#set( CPACK_MONOLITHIC_INSTALL ON )
|
||||
include( CPACK OPTIONAL RESULT_VARIABLE HAVE_CPACK )
|
||||
if( HAVE_CPACK )
|
||||
option( WITH_CPACK "enable building packages with CPack ('package' target)" ON )
|
||||
endif()
|
||||
if( NOT WITH_CPACK )
|
||||
# empty replacements
|
||||
macro( cpack_add_component_group )
|
||||
endmacro()
|
||||
macro( cpack_add_component )
|
||||
endmacro()
|
||||
message( STATUS "Disabled package creation" )
|
||||
endif()
|
||||
|
||||
set( Runtime "Runtime files" CACHE INTERNAL "" )
|
||||
set( Runtime_base "configurations, dbs, npcs, docs, ..." CACHE INTERNAL "" )
|
||||
set( Runtime_templates "conf/import and save (generated from conf/import-tmpl and save-tmpl)" CACHE INTERNAL "" )
|
||||
cpack_add_component_group( Runtime DESCRIPTION ${Runtime} DISPLAY_NAME "Runtime" )
|
||||
cpack_add_component( Runtime_base DESCRIPTION ${Runtime_base} DISPLAY_NAME "Base files" GROUP Runtime )
|
||||
cpack_add_component( Runtime_templates DESCRIPTION ${Runtime_templates} DISPLAY_NAME "Base templates" GROUP Runtime )
|
||||
|
||||
set( Development "Development files" CACHE INTERNAL "" )
|
||||
set( Development_base "projects, 3rdparty, sources, templates" CACHE INTERNAL "" )
|
||||
cpack_add_component_group( Development DESCRIPTION ${Development} DISPLAY_NAME "Development" )
|
||||
cpack_add_component( Development_base DESCRIPTION ${Development_base} DISPLAY_NAME "Base files" GROUP Development )
|
||||
|
||||
|
||||
#
|
||||
# install stuff
|
||||
#
|
||||
option( INSTALL_COMPONENT_RUNTIME "install/package files needed to run the project" ON )
|
||||
option( INSTALL_COMPONENT_DEVELOPMENT "install/package files needed to build the project" OFF )
|
||||
option( INSTALL_TO_PATH "copy files to INSTALL_PATH" OFF )
|
||||
option( INSTALL_TO_SOURCE "copy files to source directory, skips what is already there (${CMAKE_CURRENT_SOURCE_DIR})" OFF )
|
||||
option( INSTALL_TO_SUBDIR "copy files to subdirectory (${CMAKE_CURRENT_BINARY_DIR}/install)" OFF )
|
||||
set( INSTALL_PATH "${CMAKE_INSTALL_PREFIX}" CACHE STRING "install path (only used when INSTALL_TO_PATH is set)" )
|
||||
mark_as_advanced( CMAKE_INSTALL_PREFIX )
|
||||
if( INSTALL_TO_PATH AND NOT ("${INSTALL_TO}" STREQUAL "path") )# changed to path
|
||||
set_property( CACHE INSTALL_TO_SOURCE INSTALL_TO_SUBDIR PROPERTY VALUE OFF )
|
||||
elseif( INSTALL_TO_SOURCE AND NOT ("${INSTALL_TO}" STREQUAL "source") )# changed to source
|
||||
set_property( CACHE INSTALL_TO_PATH INSTALL_TO_SUBDIR PROPERTY VALUE OFF )
|
||||
elseif( INSTALL_TO_SUBDIR AND NOT ("${INSTALL_TO}" STREQUAL "subdir") )# changed to subdir
|
||||
set_property( CACHE INSTALL_TO_PATH INSTALL_TO_SOURCE PROPERTY VALUE OFF )
|
||||
elseif( NOT INSTALL_TO_PATH AND NOT INSTALL_TO_SOURCE AND NOT INSTALL_TO_SUBDIR )# default
|
||||
set_property( CACHE INSTALL_TO_SUBDIR PROPERTY VALUE ON )
|
||||
endif()
|
||||
if( INSTALL_TO_PATH )
|
||||
set( INSTALL_TO "path" CACHE INTERNAL "" )
|
||||
set_property( CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${INSTALL_PATH}" )
|
||||
elseif( INSTALL_TO_SOURCE )
|
||||
set( INSTALL_TO "source" CACHE INTERNAL "" )
|
||||
set_property( CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||
elseif( INSTALL_TO_SUBDIR )
|
||||
set( INSTALL_TO "subdir" CACHE INTERNAL "" )
|
||||
set_property( CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${CMAKE_CURRENT_BINARY_DIR}/install" )
|
||||
endif()
|
||||
set( SVN_FOLDER_PATTERN "[\\.]svn" CACHE STRING "pattern of svn folder that we exclude from instalations" )
|
||||
mark_as_advanced( SVN_FOLDER_PATTERN )
|
||||
set( DEVELOPMENT_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/configure"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/configure.in"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/rAthena.sln"
|
||||
)
|
||||
set( DEVELOPMENT_DIRECTORIES
|
||||
"3rdparty"
|
||||
"conf/import-tmpl"
|
||||
"conf/msg_conf/import-tmpl"
|
||||
"db/import-tmpl"
|
||||
"src"
|
||||
)
|
||||
set( RUNTIME_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/athena-start"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/README.md"
|
||||
)
|
||||
if (WIN32)
|
||||
set (RUNTIME_FILES
|
||||
${RUNTIME_FILES}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/dbghelp.dll"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/libmysql.dll"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/pcre3.dll"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/zlib1.dll"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/charserv.bat"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/logserv.bat"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/mapserv.bat"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/runserver.bat"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/serv.bat"
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
set( RUNTIME_DIRECTORIES
|
||||
"conf"
|
||||
"db"
|
||||
"doc"
|
||||
"log"
|
||||
"npc"
|
||||
"sql-files"
|
||||
"tools"
|
||||
)
|
||||
if( INSTALL_TO_SOURCE )# skip, already in the source dir
|
||||
else()
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
install( FILES ${RUNTIME_FILES}
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_base )
|
||||
foreach( DIR IN ITEMS ${RUNTIME_DIRECTORIES} )
|
||||
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/" )
|
||||
install( DIRECTORY "${DIR}/"
|
||||
DESTINATION "${DIR}"
|
||||
COMPONENT Runtime_base
|
||||
PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE
|
||||
PATTERN "conf/import-tmpl" EXCLUDE )
|
||||
else()
|
||||
# create empty directory
|
||||
install( CODE "file(MAKE_DIRECTORY \"\${ENV}\${CMAKE_INSTALL_PREFIX}/${DIR}\")"
|
||||
COMPONENT Runtime_base )
|
||||
endif()
|
||||
endforeach()
|
||||
endif( INSTALL_COMPONENT_RUNTIME )
|
||||
if( INSTALL_COMPONENT_DEVELOPMENT )
|
||||
install( FILES ${DEVELOPMENT_FILES}
|
||||
DESTINATION "."
|
||||
COMPONENT Development_base )
|
||||
foreach( DIR IN ITEMS ${DEVELOPMENT_DIRECTORIES} )
|
||||
install( DIRECTORY "${DIR}/"
|
||||
DESTINATION "${DIR}"
|
||||
COMPONENT Development_base
|
||||
PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE )
|
||||
endforeach()
|
||||
endif( INSTALL_COMPONENT_DEVELOPMENT )
|
||||
endif()
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
# templates
|
||||
set( _TEMPLATES
|
||||
"conf/import-tmpl" "conf/import"
|
||||
"conf/msg_conf/import-tmpl" "conf/msg_conf/import"
|
||||
"db/import-tmpl" "db/import"
|
||||
)
|
||||
set( INSTALL_TEMPLATES_FILE "${CMAKE_CURRENT_BINARY_DIR}/InstallTemplates.cmake" )
|
||||
file( WRITE "${INSTALL_TEMPLATES_FILE}"
|
||||
"macro( INSTALL_TEMPLATE _SRC _DST )\n"
|
||||
" set( SRC \"${CMAKE_CURRENT_SOURCE_DIR}/\${_SRC}\" )\n"
|
||||
" set( DST \"\${CMAKE_INSTALL_PREFIX}/\${_DST}\" )\n"
|
||||
" if( EXISTS \"\${DST}\" )\n"
|
||||
" message( \"-- Already exists: \${DST}\" )\n"
|
||||
" else()\n"
|
||||
" message( \"-- Installing template: \${DST}\" )\n"
|
||||
" execute_process( COMMAND \"${CMAKE_COMMAND}\" -E copy \"\${SRC}\" \"\${DST}\" )\n"
|
||||
" endif()\n"
|
||||
"endmacro()\n"
|
||||
)
|
||||
while( _TEMPLATES )
|
||||
list( GET _TEMPLATES 0 _SRC )
|
||||
list( GET _TEMPLATES 1 _DST )
|
||||
list( REMOVE_AT _TEMPLATES 0 1 )
|
||||
if( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_SRC}" )
|
||||
file( GLOB _PATHS "${CMAKE_CURRENT_SOURCE_DIR}/${_SRC}/*" )
|
||||
foreach( _PATH IN ITEMS ${_PATHS} )
|
||||
string( REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/${_SRC}/" "" _PATH "${_PATH}" )
|
||||
if( NOT "${_PATH}" MATCHES "${SVN_FOLDER_PATTERN}" )
|
||||
list( APPEND _TEMPLATES "${_SRC}/${_PATH}" "${_DST}/${_PATH}" )
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
file( APPEND "${INSTALL_TEMPLATES_FILE}" "INSTALL_TEMPLATE( \"${_SRC}\" \"${_DST}\" )\n" )
|
||||
endif()
|
||||
endwhile()
|
||||
install( SCRIPT "${INSTALL_TEMPLATES_FILE}"
|
||||
COMPONENT Runtime_templates )
|
||||
endif( INSTALL_COMPONENT_RUNTIME )
|
||||
|
||||
|
||||
#
|
||||
# sources
|
||||
#
|
||||
set( TARGET_LIST CACHE INTERNAL "" )
|
||||
add_subdirectory( 3rdparty )
|
||||
add_subdirectory( src )
|
||||
|
||||
|
||||
#####################################################################
|
||||
# final checks and warnings
|
||||
#
|
||||
|
||||
list( LENGTH TARGET_LIST _LEN )
|
||||
if( _LEN EQUAL 0 )
|
||||
message( FATAL_ERROR "no targets available" )
|
||||
endif()
|
||||
message( STATUS "Available targets:" )
|
||||
foreach( _TARGET IN ITEMS ${TARGET_LIST} )
|
||||
message( STATUS "\t${_TARGET}" )
|
||||
endforeach()
|
||||
add_custom_target(server
|
||||
DEPENDS login-server char-server map-server web-server scripts
|
||||
)
|
||||
|
@ -224,4 +224,5 @@ case $1 in
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
echo "Using the configure scripts and ./athena-start is deprecated. Use CMake and ./athena-start.sh" 1>&2
|
||||
exit 1
|
||||
|
35
conf/CMakeLists.txt
Normal file
35
conf/CMakeLists.txt
Normal file
@ -0,0 +1,35 @@
|
||||
include(CopyImportFiles)
|
||||
|
||||
set(CONF_FILES_TO_IMPORT
|
||||
"atcommands.yml"
|
||||
"battle_conf.txt"
|
||||
"char_conf.txt"
|
||||
"groups.yml"
|
||||
"inter_conf.txt"
|
||||
"inter_server.yml"
|
||||
"log_conf.txt"
|
||||
"login_conf.txt"
|
||||
"map_conf.txt"
|
||||
"packet_conf.txt"
|
||||
"script_conf.txt"
|
||||
"web_conf.txt")
|
||||
|
||||
copy_import_files(${CMAKE_CURRENT_SOURCE_DIR}/import-tmpl/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/import
|
||||
"${CONF_FILES_TO_IMPORT}")
|
||||
|
||||
set(MSG_FILES_TO_IMPORT
|
||||
"map_msg_chn_conf.txt"
|
||||
"map_msg_eng_conf.txt"
|
||||
"map_msg_frn_conf.txt"
|
||||
"map_msg_grm_conf.txt"
|
||||
"map_msg_idn_conf.txt"
|
||||
"map_msg_mal_conf.txt"
|
||||
"map_msg_por_conf.txt"
|
||||
"map_msg_rus_conf.txt"
|
||||
"map_msg_spn_conf.txt"
|
||||
"map_msg_tha_conf.txt")
|
||||
|
||||
copy_import_files(${CMAKE_CURRENT_SOURCE_DIR}/msg_conf/import-tmpl/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/msg_conf/import
|
||||
"${MSG_FILES_TO_IMPORT}")
|
72
db/CMakeLists.txt
Normal file
72
db/CMakeLists.txt
Normal file
@ -0,0 +1,72 @@
|
||||
include(CopyImportFiles)
|
||||
|
||||
# Why do we list all the files instead of using glob?
|
||||
# This way, if we add a new file, the build system will know to regenerate
|
||||
# and the new file will be copied over.
|
||||
|
||||
set(DB_FILES_TO_IMPORT
|
||||
"abra_db.yml"
|
||||
"achievement_db.yml"
|
||||
"achievement_level_db.yml"
|
||||
"attendance.yml"
|
||||
"attr_fix.yml"
|
||||
"battleground_db.yml"
|
||||
"captcha_db.yml"
|
||||
"castle_db.yml"
|
||||
"const.yml"
|
||||
"create_arrow_db.yml"
|
||||
"elemental_db.yml"
|
||||
"enchantgrade.yml"
|
||||
"exp_guild.yml"
|
||||
"exp_homun.yml"
|
||||
"guild_skill_tree.yml"
|
||||
"homunculus_db.yml"
|
||||
"instance_db.yml"
|
||||
"item_cash.yml"
|
||||
"item_combos.yml"
|
||||
"item_db.yml"
|
||||
"item_enchant.yml"
|
||||
"item_group_db.yml"
|
||||
"item_noequip.txt"
|
||||
"item_packages.yml"
|
||||
"item_randomopt_db.yml"
|
||||
"item_randomopt_group.yml"
|
||||
"item_reform.yml"
|
||||
"job_noenter_map.txt"
|
||||
"job_stats.yml"
|
||||
"laphine_synthesis.yml"
|
||||
"laphine_upgrade.yml"
|
||||
"level_penalty.yml"
|
||||
"magicmushroom_db.yml"
|
||||
"map_cache.dat"
|
||||
"map_drops.yml"
|
||||
"map_index.txt"
|
||||
"mercenary_db.yml"
|
||||
"mob_avail.yml"
|
||||
"mob_chat_db.yml"
|
||||
"mob_db.yml"
|
||||
"mob_item_ratio.yml"
|
||||
"mob_skill_db.txt"
|
||||
"mob_summon.yml"
|
||||
"pet_db.yml"
|
||||
"produce_db.txt"
|
||||
"quest_db.yml"
|
||||
"refine.yml"
|
||||
"reputation_group.yml"
|
||||
"reputation.yml"
|
||||
"size_fix.yml"
|
||||
"skill_changematerial_db.txt"
|
||||
"skill_damage_db.txt"
|
||||
"skill_db.yml"
|
||||
"skill_nocast_db.txt"
|
||||
"skill_tree.yml"
|
||||
"spellbook_db.yml"
|
||||
"statpoint.yml"
|
||||
"status_disabled.txt"
|
||||
"status.yml"
|
||||
"stylist.yml"
|
||||
)
|
||||
|
||||
copy_import_files(${CMAKE_CURRENT_SOURCE_DIR}/import-tmpl/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/import
|
||||
"${DB_FILES_TO_IMPORT}")
|
@ -106,6 +106,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yamlupgrade", "src\tool\yam
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ryml", "3rdparty\rapidyaml\ryml.vcxproj", "{492E2981-34F4-3A6A-BFD9-46096C641203}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_DEPRECATED_USE_CMAKE_INSTEAD_", "_DEPRECATED_USE_CMAKE_INSTEAD_", "{7BDFFA26-6F88-4F5B-8B7E-3B51C9FD9BA3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -1,29 +1,16 @@
|
||||
|
||||
#
|
||||
# setup and static libraries
|
||||
#
|
||||
|
||||
set(RA_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH
|
||||
"rathena include directory"
|
||||
)
|
||||
mark_as_advanced( RA_INCLUDE_DIRS )
|
||||
mark_as_advanced(RA_INCLUDE_DIRS)
|
||||
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(login)
|
||||
add_subdirectory(char)
|
||||
add_subdirectory(map)
|
||||
add_subdirectory(web)
|
||||
|
||||
add_subdirectory( common )
|
||||
if( HAVE_common )
|
||||
option( BUILD_SERVERS "build server executables" ON )
|
||||
else()
|
||||
message( STATUS "Disabled server targets (requires common)" )
|
||||
endif()
|
||||
add_subdirectory(tool)
|
||||
|
||||
|
||||
#
|
||||
# targets
|
||||
#
|
||||
add_subdirectory( login )
|
||||
add_subdirectory( char )
|
||||
add_subdirectory( map )
|
||||
add_subdirectory( web )
|
||||
add_subdirectory( tool )
|
||||
# add_subdirectory( tool )
|
||||
|
||||
|
@ -1,40 +1,52 @@
|
||||
#
|
||||
# setup
|
||||
#
|
||||
set( CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
|
||||
add_executable(char-server)
|
||||
|
||||
target_sources(char-server PRIVATE
|
||||
"char.cpp"
|
||||
"char_clif.cpp"
|
||||
"char_cnslif.cpp"
|
||||
"char_logif.cpp"
|
||||
"char_mapif.cpp"
|
||||
"int_achievement.cpp"
|
||||
"int_auction.cpp"
|
||||
"int_clan.cpp"
|
||||
"int_elemental.cpp"
|
||||
"int_guild.cpp"
|
||||
"int_homun.cpp"
|
||||
"int_mail.cpp"
|
||||
"int_mercenary.cpp"
|
||||
"int_party.cpp"
|
||||
"int_pet.cpp"
|
||||
"int_quest.cpp"
|
||||
"int_storage.cpp"
|
||||
"inter.cpp"
|
||||
)
|
||||
|
||||
#
|
||||
# char server
|
||||
#
|
||||
if( BUILD_SERVERS )
|
||||
message( STATUS "Creating target char-server" )
|
||||
file(GLOB CHAR_HEADERS ${CHAR_SOURCE_DIR}/*.hpp)
|
||||
file(GLOB CHAR_SOURCES_CXX ${CHAR_SOURCE_DIR}/*.cpp)
|
||||
set(CHAR_SOURCES ${CHAR_SOURCES_C} ${CHAR_SOURCES_CXX})
|
||||
#message( STATUS "CHAR_SOURCES="${CHAR_SOURCES})
|
||||
set( DEPENDENCIES common )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ${RA_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
||||
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${CHAR_HEADERS} ${CHAR_SOURCES} )
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
|
||||
source_group( char FILES ${CHAR_HEADERS} ${CHAR_SOURCES} )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
if(WIN32)
|
||||
target_sources(char-server PRIVATE
|
||||
"char_clif.hpp"
|
||||
"char_cnslif.hpp"
|
||||
"char.hpp"
|
||||
"char_logif.hpp"
|
||||
"char_mapif.hpp"
|
||||
"int_achievement.hpp"
|
||||
"int_auction.hpp"
|
||||
"int_clan.hpp"
|
||||
"int_elemental.hpp"
|
||||
"inter.hpp"
|
||||
"int_guild.hpp"
|
||||
"int_homun.hpp"
|
||||
"int_mail.hpp"
|
||||
"int_mercenary.hpp"
|
||||
"int_party.hpp"
|
||||
"int_pet.hpp"
|
||||
"int_quest.hpp"
|
||||
"int_storage.hpp"
|
||||
"packets.hpp"
|
||||
)
|
||||
|
||||
#message( STATUS "char-server SOURCE_FILES=${SOURCE_FILES}")
|
||||
add_executable( char-server ${SOURCE_FILES} )
|
||||
#message( STATUS "char-server LIBRARIES=${LIBRARIES}, DEPENDENCIES=${DEPENDENCIES} DEFINITIONS=${DEFINITIONS}")
|
||||
add_dependencies( char-server ${DEPENDENCIES} )
|
||||
target_link_libraries( char-server ${LIBRARIES} ${DEPENDENCIES} )
|
||||
set_target_properties( char-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
set_target_properties(char-server PROPERTIES FOLDER "Servers")
|
||||
endif()
|
||||
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
cpack_add_component( Runtime_charserver DESCRIPTION "char-server" DISPLAY_NAME "char-server" GROUP Runtime )
|
||||
install( TARGETS char-server
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_charserver )
|
||||
endif( INSTALL_COMPONENT_RUNTIME )
|
||||
set( TARGET_LIST ${TARGET_LIST} char-server CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target char-server - done" )
|
||||
endif( BUILD_SERVERS )
|
||||
target_link_libraries(char-server PUBLIC
|
||||
common
|
||||
)
|
||||
|
@ -1,191 +1,226 @@
|
||||
include(CheckCSourceRuns)
|
||||
include(CheckFunctionExists)
|
||||
|
||||
#
|
||||
# Create version.hpp
|
||||
# Test monotonic clock
|
||||
#
|
||||
message( STATUS "Creating version.hpp" )
|
||||
if(GIT_VERSION)
|
||||
# those 2 was done in parent to produce this
|
||||
#include(GetGitVersion)
|
||||
#get_git_version()
|
||||
string(SUBSTRING ${GIT_VERSION} 0 10 SHORT_GIT_VERSION)
|
||||
string(SUBSTRING ${GIT_HEAD_VERSION} 0 10 SHORT_GIT_HEAD_VERSION)
|
||||
string(CONCAT GIT_STR_VERSIONS ${SHORT_GIT_VERSION} "_" ${SHORT_GIT_HEAD_VERSION})
|
||||
#message( STATUS "git version=${GIT_STR_VERSIONS}" )
|
||||
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.hpp
|
||||
"#ifndef SVNVERSION\n#define SVNVERSION ${GIT_STR_VERSIONS}\n#endif\n" )
|
||||
elseif( SVNVERSION )
|
||||
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.hpp
|
||||
"#ifndef SVNVERSION\n#define SVNVERSION ${SVNVERSION}\n#endif\n" )
|
||||
# CLOCK_MONOTONIC clock for clock_gettime
|
||||
# Normally defines _POSIX_TIMERS > 0 and _POSIX_MONOTONIC_CLOCK (for posix
|
||||
# compliant systems) and __FreeBSD_cc_version >= 500005 (for FreeBSD
|
||||
# >= 5.1.0, which does not have the posix defines (ref. r11983)) would be
|
||||
# checked but some systems define them even when they do not support it
|
||||
# (ref. bugreport:1003).
|
||||
#
|
||||
message(STATUS "Check for monotonic clock")
|
||||
find_library(RT_LIBRARY rt)# (optional, rt on Debian)
|
||||
mark_as_advanced(RT_LIBRARY)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} ${RT_LIBRARY})
|
||||
file(READ "${CMAKE_SOURCE_DIR}/3rdparty/cmake/tests/HAVE_MONOTONIC_CLOCK.c" _SOURCE)
|
||||
CHECK_C_SOURCE_RUNS("${_SOURCE}" HAVE_MONOTONIC_CLOCK)
|
||||
if(HAVE_MONOTONIC_CLOCK)
|
||||
message(STATUS "Check for monotonic clock - yes")
|
||||
set(MONOTONIC_CLOCK_LIBRARIES ${RT_LIBRARY})
|
||||
set(MONOTONIC_CLOCK_DEFINITIONS "-DHAVE_MONOTONIC_CLOCK")
|
||||
else()
|
||||
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.hpp "" )
|
||||
message(STATUS "Check for monotonic clock - no")
|
||||
endif()
|
||||
set( GLOBAL_INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "" )
|
||||
set( SVNVERSION ${SVNVERSION}
|
||||
CACHE STRING "SVN version of the source code" )
|
||||
if( INSTALL_COMPONENT_DEVELOPMENT )
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/version.hpp
|
||||
DESTINATION "src/common"
|
||||
COMPONENT Development_base )
|
||||
endif( INSTALL_COMPONENT_DEVELOPMENT )
|
||||
message( STATUS "Creating version.hpp - done" )
|
||||
|
||||
set( COMMON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
CACHE PATH "common source directory" )
|
||||
#message( STATUS "DEBUG COMMON_SOURCE_DIR=${COMMON_SOURCE_DIR}" )
|
||||
mark_as_advanced( COMMON_SOURCE_DIR )
|
||||
# Check ENABLE_MEMORY option
|
||||
if(ENABLE_MEMORY STREQUAL "system")
|
||||
# use the normal system functions
|
||||
else()
|
||||
message(STATUS "Feature not implemented, defaulting to system")
|
||||
endif()
|
||||
|
||||
#####################################################################
|
||||
# setup
|
||||
#
|
||||
if( WIN32 )
|
||||
set( PROJECT_LIBS Ws2_32.lib )
|
||||
|
||||
if( MSVC )
|
||||
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
add_library(minicore EXCLUDE_FROM_ALL)
|
||||
add_library(common)
|
||||
# add_library(core-tools)
|
||||
add_library(common-win INTERFACE)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(common-win INTERFACE "ws2_32.lib")
|
||||
|
||||
if(MSVC)
|
||||
target_compile_definitions(common-win INTERFACE
|
||||
_WINSOCK_DEPRECATED_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif()
|
||||
|
||||
set( COMMON_ADDITIONALL_CPP "${COMMON_SOURCE_DIR}/winapi.cpp" )
|
||||
|
||||
set( COMMON_ADDITIONALL_HPP "${COMMON_SOURCE_DIR}/winapi.hpp" )
|
||||
endif()
|
||||
|
||||
set( COMMON_ALL_HEADERS
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/version.hpp"
|
||||
"${COMMON_SOURCE_DIR}/cbasetypes.hpp"
|
||||
"${COMMON_SOURCE_DIR}/mmo.hpp"
|
||||
target_sources(common-win INTERFACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/winapi.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/winapi.hpp"
|
||||
)
|
||||
|
||||
add_library(minicore)
|
||||
target_link_libraries(minicore PUBLIC common-win)
|
||||
target_link_libraries(common PUBLIC common-win)
|
||||
endif()
|
||||
|
||||
target_sources(minicore PRIVATE
|
||||
"${COMMON_SOURCE_DIR}/core.cpp"
|
||||
"${COMMON_SOURCE_DIR}/malloc.cpp"
|
||||
"${COMMON_SOURCE_DIR}/showmsg.cpp"
|
||||
"${COMMON_SOURCE_DIR}/strlib.cpp"
|
||||
${LIBCONFIG_SOURCES} # needed by showmsg.cpp
|
||||
${COMMON_ADDITIONALL_CPP} # needed by Windows
|
||||
"core.cpp"
|
||||
"database.cpp"
|
||||
"des.cpp"
|
||||
"grfio.cpp"
|
||||
"malloc.cpp"
|
||||
"nullpo.cpp"
|
||||
"showmsg.cpp"
|
||||
"strlib.cpp"
|
||||
"utils.cpp"
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(minicore PRIVATE
|
||||
"cbasetypes.hpp"
|
||||
"core.hpp"
|
||||
"database.hpp"
|
||||
"des.hpp"
|
||||
"grfio.hpp"
|
||||
"malloc.hpp"
|
||||
"nullpo.hpp"
|
||||
"showmsg.hpp"
|
||||
"strlib.hpp"
|
||||
"utils.hpp"
|
||||
)
|
||||
set_target_properties(minicore PROPERTIES FOLDER "Core")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(minicore PRIVATE
|
||||
"-DMINICORE"
|
||||
${MONOTONIC_CLOCK_DEFINITIONS}
|
||||
)
|
||||
|
||||
target_include_directories(minicore PUBLIC
|
||||
${COMMON_SOURCE_DIR}
|
||||
${LIBCONFIG_INCLUDE_DIRS}
|
||||
${COMMON_ADDITIONALL_HPP} # needed by Windows
|
||||
"${RA_INCLUDE_DIRS}"
|
||||
"${ZLIB_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
target_link_libraries(minicore PUBLIC
|
||||
${MONOTONIC_CLOCK_LIBRARIES}
|
||||
libconfig
|
||||
ryml
|
||||
${ZLIB_LIBRARIES}
|
||||
yaml-cpp
|
||||
)
|
||||
|
||||
target_sources(common PRIVATE
|
||||
"cli.cpp"
|
||||
"conf.cpp"
|
||||
"core.cpp"
|
||||
"database.cpp"
|
||||
"db.cpp"
|
||||
"des.cpp"
|
||||
"ers.cpp"
|
||||
"grfio.cpp"
|
||||
"malloc.cpp"
|
||||
"mapindex.cpp"
|
||||
"md5calc.cpp"
|
||||
"msg_conf.cpp"
|
||||
"nullpo.cpp"
|
||||
"random.cpp"
|
||||
"showmsg.cpp"
|
||||
"socket.cpp"
|
||||
"sql.cpp"
|
||||
"strlib.cpp"
|
||||
"timer.cpp"
|
||||
"utils.cpp"
|
||||
"utilities.cpp"
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(common PRIVATE
|
||||
"cbasetypes.hpp"
|
||||
"cli.hpp"
|
||||
"conf.hpp"
|
||||
"core.hpp"
|
||||
"database.hpp"
|
||||
"db.hpp"
|
||||
"des.hpp"
|
||||
"ers.hpp"
|
||||
"grfio.hpp"
|
||||
"malloc.hpp"
|
||||
"mapindex.hpp"
|
||||
"md5calc.hpp"
|
||||
"mmo.hpp"
|
||||
"msg_conf.hpp"
|
||||
"nullpo.hpp"
|
||||
"random.hpp"
|
||||
"showmsg.hpp"
|
||||
"socket.hpp"
|
||||
"sql.hpp"
|
||||
"strlib.hpp"
|
||||
"timer.hpp"
|
||||
"utilities.hpp"
|
||||
"utils.hpp"
|
||||
)
|
||||
set_target_properties(common PROPERTIES FOLDER "Core")
|
||||
endif()
|
||||
|
||||
# defines just for common
|
||||
target_compile_definitions(common PRIVATE ${MONOTONIC_CLOCK_DEFINITIONS})
|
||||
|
||||
if(ENABLE_RDTSC)
|
||||
target_compile_definitions(common PRIVATE "-DENABLE_RDTSC")
|
||||
endif()
|
||||
|
||||
|
||||
if(ENABLE_MEMMGR)
|
||||
target_compile_definitions(common PRIVATE "-DUSE_MEMMGR")
|
||||
else()
|
||||
target_compile_definitions(common PRIVATE "-DNO_MEMMGR")
|
||||
endif()
|
||||
|
||||
# Propagated defines
|
||||
target_compile_definitions(common PUBLIC "-DPACKETVER=${PACKETVER}")
|
||||
|
||||
if(ENABLE_PRERENEWAL)
|
||||
target_compile_definitions(common PUBLIC "-DPRERE")
|
||||
endif()
|
||||
|
||||
if(ENABLE_EXTRA_DEBUG_CODE)
|
||||
target_compile_definitions(common PUBLIC "-DDEBUG")
|
||||
endif()
|
||||
|
||||
if(ENABLE_EXTRA_BUILDBOT_CODE)
|
||||
target_compile_definitions(common PUBLIC "-DBUILDBOT")
|
||||
endif()
|
||||
|
||||
if(ENABLE_EPOLL)
|
||||
target_compile_definitions(common PRIVATE "-DSOCKET_EPOLL")
|
||||
endif()
|
||||
|
||||
if(ENABLE_VIP)
|
||||
target_compile_definitions(common INTERFACE "-DVIP_ENABLE")
|
||||
endif()
|
||||
|
||||
if(MAXCONN)
|
||||
target_compile_definitions(common PUBLIC "-DMAXCONN=${MAXCONN}")
|
||||
endif()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(setrlimit HAVE_SETRLIMIT)
|
||||
if (HAVE_SETRLIMIT)
|
||||
target_compile_definitions(common PUBLIC "-DHAVE_SETRLIMIT")
|
||||
endif()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(strnlen HAVE_STRNLEN)
|
||||
if (HAVE_STRNLEN)
|
||||
target_compile_definitions(common PUBLIC "-DHAVE_STRNLEN")
|
||||
endif()
|
||||
|
||||
target_include_directories(common PUBLIC
|
||||
"${MYSQL_INCLUDE_DIRS}"
|
||||
"${ZLIB_INCLUDE_DIRS}"
|
||||
"${RA_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
target_link_libraries(common PUBLIC
|
||||
${MONOTONIC_CLOCK_LIBRARIES}
|
||||
libconfig
|
||||
ryml
|
||||
${MYSQL_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
target_compile_definitions(minicore PRIVATE "-DMINICORE" ${LIBCONFIG_DEFINITIONS})
|
||||
|
||||
#
|
||||
# common_base
|
||||
#
|
||||
if( WITH_ZLIB )
|
||||
message( STATUS "Creating target common_base" )
|
||||
set( COMMON_BASE_HEADERS
|
||||
${COMMON_ALL_HEADERS}
|
||||
"${COMMON_SOURCE_DIR}/conf.hpp"
|
||||
"${COMMON_SOURCE_DIR}/core.hpp"
|
||||
"${COMMON_SOURCE_DIR}/database.hpp"
|
||||
"${COMMON_SOURCE_DIR}/db.hpp"
|
||||
"${COMMON_SOURCE_DIR}/des.hpp"
|
||||
"${COMMON_SOURCE_DIR}/ers.hpp"
|
||||
"${COMMON_SOURCE_DIR}/grfio.hpp"
|
||||
"${COMMON_SOURCE_DIR}/malloc.hpp"
|
||||
"${COMMON_SOURCE_DIR}/mapindex.hpp"
|
||||
"${COMMON_SOURCE_DIR}/md5calc.hpp"
|
||||
"${COMMON_SOURCE_DIR}/nullpo.hpp"
|
||||
"${COMMON_SOURCE_DIR}/random.hpp"
|
||||
"${COMMON_SOURCE_DIR}/showmsg.hpp"
|
||||
"${COMMON_SOURCE_DIR}/socket.hpp"
|
||||
"${COMMON_SOURCE_DIR}/strlib.hpp"
|
||||
"${COMMON_SOURCE_DIR}/timer.hpp"
|
||||
"${COMMON_SOURCE_DIR}/utils.hpp"
|
||||
"${COMMON_SOURCE_DIR}/msg_conf.hpp"
|
||||
"${COMMON_SOURCE_DIR}/cli.hpp"
|
||||
"${COMMON_SOURCE_DIR}/utilities.hpp"
|
||||
${LIBCONFIG_HEADERS} # needed by conf.hpp/showmsg.hpp
|
||||
${COMMON_ADDITIONALL_HPP} # needed by Windows
|
||||
CACHE INTERNAL "common_base headers" )
|
||||
set( COMMON_BASE_SOURCES
|
||||
"${COMMON_SOURCE_DIR}/conf.cpp"
|
||||
"${COMMON_SOURCE_DIR}/core.cpp"
|
||||
"${COMMON_SOURCE_DIR}/database.cpp"
|
||||
"${COMMON_SOURCE_DIR}/db.cpp"
|
||||
"${COMMON_SOURCE_DIR}/des.cpp"
|
||||
"${COMMON_SOURCE_DIR}/ers.cpp"
|
||||
"${COMMON_SOURCE_DIR}/grfio.cpp"
|
||||
"${COMMON_SOURCE_DIR}/malloc.cpp"
|
||||
"${COMMON_SOURCE_DIR}/mapindex.cpp"
|
||||
"${COMMON_SOURCE_DIR}/md5calc.cpp"
|
||||
"${COMMON_SOURCE_DIR}/nullpo.cpp"
|
||||
"${COMMON_SOURCE_DIR}/random.cpp"
|
||||
"${COMMON_SOURCE_DIR}/showmsg.cpp"
|
||||
"${COMMON_SOURCE_DIR}/socket.cpp"
|
||||
"${COMMON_SOURCE_DIR}/strlib.cpp"
|
||||
"${COMMON_SOURCE_DIR}/timer.cpp"
|
||||
"${COMMON_SOURCE_DIR}/utils.cpp"
|
||||
"${COMMON_SOURCE_DIR}/msg_conf.cpp"
|
||||
"${COMMON_SOURCE_DIR}/cli.cpp"
|
||||
"${COMMON_SOURCE_DIR}/utilities.cpp"
|
||||
${LIBCONFIG_SOURCES} # needed by conf.cpp/showmsg.cpp
|
||||
${COMMON_ADDITIONALL_CPP} # needed by Windows
|
||||
CACHE INTERNAL "common_base sources" )
|
||||
set( COMMON_BASE_INCLUDE_DIRS
|
||||
${LIBCONFIG_INCLUDE_DIRS}
|
||||
${YAML_INCLUDE_DIRS}
|
||||
CACHE INTERNAL "common_base include dirs" )
|
||||
set( COMMON_BASE_DEFINITIONS
|
||||
${LIBCONFIG_DEFINITIONS}
|
||||
CACHE INTERNAL "common_base definitions" )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} yaml-cpp ryml )
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${RA_INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
||||
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
||||
|
||||
add_library( common_base ${SOURCE_FILES} )
|
||||
#message( STATUS "common_base LIBRARIES=${LIBRARIES}, DEFINITIONS=${DEFINITIONS}")
|
||||
target_link_libraries( common_base ${LIBRARIES} )
|
||||
set_target_properties( common_base PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
|
||||
set( HAVE_common_base ON CACHE INTERNAL "" )
|
||||
set( TARGET_LIST ${TARGET_LIST} common_base CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target common_base - done" )
|
||||
else()
|
||||
message( STATUS "Skipping target common_base (requires ZLIB)" )
|
||||
unset( HAVE_common_base CACHE )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# common
|
||||
#
|
||||
if( HAVE_common_base AND WITH_MYSQL )
|
||||
message( STATUS "Creating target common" )
|
||||
set( COMMON_HEADERS
|
||||
${COMMON_ALL_HEADERS}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sql.hpp"
|
||||
CACHE INTERNAL "common headers" )
|
||||
set( COMMON_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sql.cpp"
|
||||
CACHE INTERNAL "common sources" )
|
||||
set( DEPENDENCIES common_base yaml-cpp ryml )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} )
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS}" )
|
||||
set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
|
||||
source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
|
||||
|
||||
add_library( common ${SOURCE_FILES} )
|
||||
#message( STATUS "common LIBRARIES=${LIBRARIES}, DEPENDENCIES=${DEPENDENCIES} DEFINITIONS=${DEFINITIONS}")
|
||||
add_dependencies( common ${DEPENDENCIES} )
|
||||
target_link_libraries( common ${LIBRARIES} ${DEPENDENCIES} )
|
||||
set_target_properties( common PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
include_directories( ${INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} )
|
||||
|
||||
set( HAVE_common ON CACHE INTERNAL "" )
|
||||
set( TARGET_LIST ${TARGET_LIST} common CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target common - done" )
|
||||
else()
|
||||
message( FATAL_ERROR "Stopping target common (requires common_base and MYSQL)" )
|
||||
if(ENABLE_PROFILER STREQUAL "gprof")
|
||||
target_compile_options(common PUBLIC "-pg")
|
||||
target_link_libraries(common PUBLIC "-pg")
|
||||
endif()
|
||||
|
@ -1,35 +1,29 @@
|
||||
#
|
||||
# setup
|
||||
#
|
||||
set( LOGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
|
||||
add_executable(login-server)
|
||||
|
||||
# login server
|
||||
#
|
||||
if( BUILD_SERVERS )
|
||||
message( STATUS "Creating target login-server" )
|
||||
file(GLOB LOGIN_HEADERS ${LOGIN_SOURCE_DIR}/*.hpp)
|
||||
file(GLOB LOGIN_SOURCES_CXX ${LOGIN_SOURCE_DIR}/*.cpp)
|
||||
set(LOGIN_SOURCES ${LOGIN_SOURCES_C} ${LOGIN_SOURCES_CXX})
|
||||
#message( STATUS "LOGIN_SOURCES="${LOGIN_SOURCES})
|
||||
set( DEPENDENCIES common )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ${RA_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS} -DWITH_SQL" )
|
||||
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${LOGIN_HEADERS} ${LOGIN_SOURCES} )
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
|
||||
source_group( login FILES ${LOGIN_HEADERS} ${LOGIN_SOURCES} )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
target_sources(login-server PRIVATE
|
||||
"account.cpp"
|
||||
"ipban.cpp"
|
||||
"login.cpp"
|
||||
"loginchrif.cpp"
|
||||
"loginclif.cpp"
|
||||
"logincnslif.cpp"
|
||||
"loginlog.cpp"
|
||||
)
|
||||
|
||||
add_executable( login-server ${SOURCE_FILES} )
|
||||
add_dependencies( login-server ${DEPENDENCIES} )
|
||||
target_link_libraries( login-server ${LIBRARIES} ${DEPENDENCIES} )
|
||||
set_target_properties( login-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
cpack_add_component( Runtime_loginserver DESCRIPTION "login-server" DISPLAY_NAME "login-server" GROUP Runtime )
|
||||
install( TARGETS login-server
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_loginserver )
|
||||
endif( INSTALL_COMPONENT_RUNTIME )
|
||||
set( TARGET_LIST ${TARGET_LIST} login-server CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target login-server - done" )
|
||||
endif( BUILD_SERVERS )
|
||||
if(WIN32)
|
||||
target_sources(login-server PRIVATE
|
||||
"account.hpp"
|
||||
"ipban.hpp"
|
||||
"loginchrif.hpp"
|
||||
"loginclif.hpp"
|
||||
"logincnslif.hpp"
|
||||
"login.hpp"
|
||||
"loginlog.hpp"
|
||||
)
|
||||
|
||||
set_target_properties(login-server PROPERTIES FOLDER "Servers")
|
||||
endif()
|
||||
|
||||
target_link_libraries(login-server PUBLIC
|
||||
common
|
||||
)
|
||||
|
@ -1,45 +1,148 @@
|
||||
#
|
||||
# setup
|
||||
#
|
||||
set( MAP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
|
||||
set(MAP_SOURCES
|
||||
"achievement.cpp"
|
||||
"atcommand.cpp"
|
||||
"battle.cpp"
|
||||
"battleground.cpp"
|
||||
"buyingstore.cpp"
|
||||
"cashshop.cpp"
|
||||
"channel.cpp"
|
||||
"chat.cpp"
|
||||
"chrif.cpp"
|
||||
"clan.cpp"
|
||||
"clif.cpp"
|
||||
"date.cpp"
|
||||
"duel.cpp"
|
||||
"elemental.cpp"
|
||||
"guild.cpp"
|
||||
"homunculus.cpp"
|
||||
"instance.cpp"
|
||||
"intif.cpp"
|
||||
"itemdb.cpp"
|
||||
"log.cpp"
|
||||
"mail.cpp"
|
||||
"map.cpp"
|
||||
"mapreg.cpp"
|
||||
"mercenary.cpp"
|
||||
"mob.cpp"
|
||||
"navi.cpp"
|
||||
"npc.cpp"
|
||||
"npc_chat.cpp"
|
||||
"party.cpp"
|
||||
"path.cpp"
|
||||
"pc.cpp"
|
||||
"pc_groups.cpp"
|
||||
"pet.cpp"
|
||||
"quest.cpp"
|
||||
"script.cpp"
|
||||
"searchstore.cpp"
|
||||
"skill.cpp"
|
||||
"status.cpp"
|
||||
"storage.cpp"
|
||||
"trade.cpp"
|
||||
"unit.cpp"
|
||||
"vending.cpp"
|
||||
|
||||
"skills/skill.cpp"
|
||||
"skills/skillrepository.cpp"
|
||||
"skills/swordsman.cpp"
|
||||
)
|
||||
|
||||
#
|
||||
# map server
|
||||
#
|
||||
if( BUILD_SERVERS )
|
||||
message( STATUS "Creating target map-server" )
|
||||
file(GLOB MAP_HEADERS ${MAP_SOURCE_DIR}/*.hpp)
|
||||
file(GLOB MAP_SOURCES ${MAP_SOURCE_DIR}/*.cpp)
|
||||
set( DEPENDENCIES common ryml)
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES})
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ${RA_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
||||
if( WITH_PCRE )
|
||||
message( STATUS "Enabled PCRE code" )
|
||||
set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} )
|
||||
set( INCLUDE_DIRS ${INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${DEFINITIONS} -DPCRE_SUPPORT" )
|
||||
else()
|
||||
message( STATUS "Disabled PCRE code" )
|
||||
set(MAP_HEADERS
|
||||
"achievement.hpp"
|
||||
"atcommand.hpp"
|
||||
"battleground.hpp"
|
||||
"battle.hpp"
|
||||
"buyingstore.hpp"
|
||||
"cashshop.hpp"
|
||||
"channel.hpp"
|
||||
"chat.hpp"
|
||||
"chrif.hpp"
|
||||
"clan.hpp"
|
||||
"clif.hpp"
|
||||
"clif_obfuscation.hpp"
|
||||
"clif_packetdb.hpp"
|
||||
"clif_shuffle.hpp"
|
||||
"date.hpp"
|
||||
"duel.hpp"
|
||||
"elemental.hpp"
|
||||
"guild.hpp"
|
||||
"homunculus.hpp"
|
||||
"instance.hpp"
|
||||
"intif.hpp"
|
||||
"itemdb.hpp"
|
||||
"log.hpp"
|
||||
"mail.hpp"
|
||||
"map.hpp"
|
||||
"mapreg.hpp"
|
||||
"mercenary.hpp"
|
||||
"mob.hpp"
|
||||
"navi.hpp"
|
||||
"npc.hpp"
|
||||
"packets.hpp"
|
||||
"packets_struct.hpp"
|
||||
"party.hpp"
|
||||
"path.hpp"
|
||||
"pc_groups.hpp"
|
||||
"pc.hpp"
|
||||
"pet.hpp"
|
||||
"quest.hpp"
|
||||
"script_constants.hpp"
|
||||
"script.hpp"
|
||||
"searchstore.hpp"
|
||||
"skill.hpp"
|
||||
"status.hpp"
|
||||
"storage.hpp"
|
||||
"trade.hpp"
|
||||
"unit.hpp"
|
||||
"vending.hpp"
|
||||
)
|
||||
|
||||
add_executable(map-server)
|
||||
|
||||
target_sources(map-server PRIVATE ${MAP_SOURCES})
|
||||
|
||||
if(WIN32)
|
||||
target_sources(map-server PRIVATE ${MAP_HEADERS})
|
||||
set_target_properties(map-server PROPERTIES FOLDER "Servers")
|
||||
endif()
|
||||
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${MAP_HEADERS} ${MAP_SOURCES} )
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
|
||||
source_group( map FILES ${MAP_HEADERS} ${MAP_SOURCES} )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
|
||||
#message( STATUS "map-server SOURCE_FILES=${SOURCE_FILES}")
|
||||
add_executable( map-server ${SOURCE_FILES} )
|
||||
#message( STATUS "map-server LIBRARIES=${LIBRARIES}, DEPENDENCIES=${DEPENDENCIES} DEFINITIONS=${DEFINITIONS}")
|
||||
add_dependencies( map-server ${DEPENDENCIES} )
|
||||
target_link_libraries( map-server ${LIBRARIES} ${DEPENDENCIES} )
|
||||
set_target_properties( map-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
cpack_add_component( Runtime_mapserver DESCRIPTION "map-server" DISPLAY_NAME "map-server" GROUP Runtime )
|
||||
install( TARGETS map-server
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_mapserver )
|
||||
endif( INSTALL_COMPONENT_RUNTIME )
|
||||
set( TARGET_LIST ${TARGET_LIST} map-server CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target map-server - done" )
|
||||
endif( BUILD_SERVERS )
|
||||
target_link_libraries(map-server PUBLIC
|
||||
common
|
||||
${PCRE_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(map-server PUBLIC
|
||||
${PCRE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(WITH_PCRE)
|
||||
target_compile_definitions(map-server PUBLIC "-DPCRE_SUPPORT")
|
||||
endif()
|
||||
|
||||
# map-server-generator
|
||||
add_executable(map-server-generator)
|
||||
|
||||
target_sources(map-server-generator PRIVATE ${MAP_SOURCES})
|
||||
|
||||
if(WIN32)
|
||||
target_sources(map-server-generator PRIVATE ${MAP_HEADERS})
|
||||
set_target_properties(map-server-generator PROPERTIES FOLDER "Tools")
|
||||
endif()
|
||||
|
||||
set_target_properties(map-server-generator PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
target_compile_definitions(map-server-generator PUBLIC "-DMAP_GENERATOR")
|
||||
|
||||
target_link_libraries(map-server-generator PUBLIC
|
||||
common
|
||||
json
|
||||
${PCRE_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(map-server-generator PUBLIC
|
||||
${PCRE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(PCRE_FOUND)
|
||||
target_compile_definitions(map-server-generator PUBLIC "-DPCRE_SUPPORT")
|
||||
endif()
|
||||
|
14561
src/map/skill.cpp
14561
src/map/skill.cpp
File diff suppressed because it is too large
Load Diff
53
src/map/skills/skill.cpp
Normal file
53
src/map/skills/skill.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
|
||||
// For more information, see LICENCE in the main folder
|
||||
#include <common/showmsg.hpp>
|
||||
|
||||
#include "skill.hpp"
|
||||
#include "map/battle.hpp"
|
||||
#include "map/skill.hpp"
|
||||
#include "map/clif.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "map/status.hpp"
|
||||
|
||||
uint16_t Skill::getSkillId() const {
|
||||
return skill_id_;
|
||||
}
|
||||
|
||||
int Skill::castendDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const {
|
||||
throw SkillNotImplementedException(skill_id_);
|
||||
}
|
||||
|
||||
int Skill::castendNoDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const {
|
||||
throw SkillNotImplementedException(skill_id_);
|
||||
}
|
||||
|
||||
int Skill::castendPositionImpl() const {
|
||||
throw SkillNotImplementedException(skill_id_);
|
||||
}
|
||||
|
||||
int Skill::castendDamage(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const {
|
||||
try {
|
||||
return castendDamageImpl(src, target, skill_lv, tick, flag);
|
||||
} catch (SkillNotImplementedException e) {
|
||||
ShowWarning("castendDamage: %s\n", e.what());
|
||||
clif_skill_damage(src, target, tick, status_get_amotion(src), status_get_status_data(target)->dmotion, 0, abs(skill_get_num(skill_id_, skill_lv)), skill_id_, skill_lv, skill_get_hit(skill_id_));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int Skill::castendNoDamage(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const {
|
||||
try {
|
||||
return castendNoDamageImpl(src, target, skill_lv, tick, flag);
|
||||
} catch (SkillNotImplementedException e) {
|
||||
ShowWarning("castendNoDamage: %s\n", e.what());
|
||||
clif_skill_damage(src, target, tick, status_get_amotion(src), status_get_status_data(target)->dmotion, 0, abs(skill_get_num(skill_id_, skill_lv)), skill_id_, skill_lv, skill_get_hit(skill_id_));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int WeaponSkill::castendDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const {
|
||||
skill_attack(BF_WEAPON, src, src, target, skill_id_, skill_lv, tick, flag);
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
43
src/map/skills/skill.hpp
Normal file
43
src/map/skills/skill.hpp
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
|
||||
// For more information, see LICENCE in the main folder
|
||||
|
||||
#ifndef MAP_SKILL_HPP
|
||||
#define MAP_SKILL_HPP
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "map/skill.hpp"
|
||||
|
||||
class SkillNotImplementedException : public std::logic_error {
|
||||
public:
|
||||
explicit SkillNotImplementedException(const std::string &what_arg) : std::logic_error(what_arg) {};
|
||||
explicit SkillNotImplementedException(uint16_t skill_id) : std::logic_error("Skill " + std::to_string(skill_id) + " not implemented") {};
|
||||
};
|
||||
|
||||
class Skill {
|
||||
public:
|
||||
uint16_t getSkillId() const;
|
||||
|
||||
virtual ~Skill() = default;
|
||||
|
||||
explicit Skill(e_skill skillid) : skill_id_(static_cast<uint16_t>(skillid)) {};
|
||||
|
||||
int castendDamage(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const;
|
||||
int castendNoDamage(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const;
|
||||
|
||||
protected:
|
||||
virtual int castendDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const;
|
||||
virtual int castendNoDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const;
|
||||
virtual int castendPositionImpl() const;
|
||||
uint16_t skill_id_;
|
||||
};
|
||||
|
||||
class WeaponSkill : public Skill {
|
||||
public:
|
||||
explicit WeaponSkill(e_skill skill_id) : Skill(skill_id) {};
|
||||
protected:
|
||||
virtual int castendDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const override;
|
||||
};
|
||||
|
||||
#endif // MAP_SKILL_HPP
|
25
src/map/skills/skillrepository.cpp
Normal file
25
src/map/skills/skillrepository.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
|
||||
// For more information, see LICENCE in the main folder
|
||||
|
||||
#include "skillrepository.hpp"
|
||||
#include "swordsman.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
SkillRepository skillRepository;
|
||||
|
||||
const Skill& SkillRepository::getSkill(e_skill skill_id) {
|
||||
auto skill = skill_db_.find(skill_id);
|
||||
if (skill == skill_db_.end()) {
|
||||
throw SkillNotFoundException{};
|
||||
}
|
||||
return *skill->second;
|
||||
}
|
||||
|
||||
void SkillRepository::addSkill(e_skill skill_id, std::unique_ptr<Skill> skill) {
|
||||
skill_db_.emplace(skill_id, std::move(skill));
|
||||
}
|
||||
|
||||
void init_skill_repository() {
|
||||
init_swordsman_skills(skillRepository);
|
||||
}
|
25
src/map/skills/skillrepository.hpp
Normal file
25
src/map/skills/skillrepository.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
|
||||
// For more information, see LICENCE in the main folder
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "skill.hpp"
|
||||
#include "map/skill.hpp"
|
||||
|
||||
class SkillRepository {
|
||||
public:
|
||||
class SkillNotFoundException : public std::exception {};
|
||||
|
||||
const Skill& getSkill(e_skill skill_id);
|
||||
|
||||
void addSkill(e_skill skill_id, std::unique_ptr<Skill> skill);
|
||||
|
||||
private:
|
||||
std::unordered_map<e_skill, std::unique_ptr<Skill>> skill_db_;
|
||||
};
|
||||
|
||||
extern SkillRepository skillRepository;
|
||||
|
||||
void init_skill_repository();
|
56
src/map/skills/swordsman.cpp
Normal file
56
src/map/skills/swordsman.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
#include "swordsman.hpp"
|
||||
|
||||
#include "skillrepository.hpp"
|
||||
|
||||
|
||||
#include "map/battle.hpp"
|
||||
#include "map/clif.hpp"
|
||||
#include "map/mob.hpp"
|
||||
#include "map/skill.hpp"
|
||||
#include "map/status.hpp"
|
||||
#include "map/unit.hpp"
|
||||
|
||||
|
||||
Provoke::Provoke() : Skill(e_skill::SM_PROVOKE) {};
|
||||
|
||||
int Provoke::castendNoDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const {
|
||||
status_data *target_status = status_get_status_data(target);
|
||||
if (status_has_mode(target_status, MD_STATUSIMMUNE) || battle_check_undead(target_status->race, target_status->def_ele)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
map_session_data *sd = BL_CAST(BL_PC, src);
|
||||
mob_data *target_md = BL_CAST(BL_MOB, target);
|
||||
|
||||
sc_type type = skill_get_sc(skill_id_);
|
||||
// official chance is 70% + 3% per skill level + srcBaseLevel% - targetBaseLevel%
|
||||
int chance = 70 + 3 * skill_lv + status_get_lv(src) - status_get_lv(target);
|
||||
int i = sc_start(src, target, type, skill_id_ == SM_SELFPROVOKE ? 100 : chance, skill_lv, skill_get_time(skill_id_, skill_lv));
|
||||
if (!i) {
|
||||
if (sd) {
|
||||
clif_skill_fail(*sd, skill_id_);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
clif_skill_nodamage(src, target, skill_id_ == SM_SELFPROVOKE ? SM_PROVOKE : skill_id_, skill_lv, i);
|
||||
unit_skillcastcancel(target, 2);
|
||||
|
||||
if (target_md) {
|
||||
target_md->state.provoke_flag = src->id;
|
||||
mob_target(target_md, src, skill_get_range2(src, skill_id_, skill_lv, true));
|
||||
}
|
||||
|
||||
// Provoke can cause Coma even though it's a nodamage skill
|
||||
if (sd && battle_check_coma(*sd, *target, BF_MISC)) {
|
||||
status_change_start(src, target, SC_COMA, 10000, skill_lv, 0, src->id, 0, 0, SCSTART_NONE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void init_swordsman_skills(SkillRepository& repo) {
|
||||
repo.addSkill(e_skill::SM_BASH, std::make_unique<WeaponSkill>(e_skill::SM_BASH));
|
||||
repo.addSkill(e_skill::SM_PROVOKE, std::make_unique<Provoke>());
|
||||
}
|
||||
|
12
src/map/skills/swordsman.hpp
Normal file
12
src/map/skills/swordsman.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "skillrepository.hpp"
|
||||
|
||||
class Provoke : public Skill {
|
||||
public:
|
||||
Provoke();
|
||||
|
||||
virtual int castendNoDamageImpl(block_list *src, block_list *target, uint16 skill_lv, t_tick tick, int flag) const override;
|
||||
};
|
||||
|
||||
void init_swordsman_skills(SkillRepository& repo);
|
@ -1,80 +1,41 @@
|
||||
|
||||
# Define the tools interface library, all tools will inherit properties
|
||||
|
||||
add_library(tools INTERFACE)
|
||||
target_include_directories(tools INTERFACE
|
||||
${YAML_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
${RA_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_sources(tools INTERFACE
|
||||
"${COMMON_SOURCE_DIR}/utils.cpp"
|
||||
"${COMMON_SOURCE_DIR}/des.cpp"
|
||||
"${COMMON_SOURCE_DIR}/grfio.cpp"
|
||||
"${COMMON_SOURCE_DIR}/nullpo.cpp"
|
||||
"${COMMON_SOURCE_DIR}/database.cpp"
|
||||
)
|
||||
|
||||
target_compile_definitions(tools INTERFACE
|
||||
"MINICORE"
|
||||
)
|
||||
|
||||
target_link_libraries(tools INTERFACE
|
||||
${GLOBAL_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
yaml-cpp
|
||||
ryml
|
||||
minicore
|
||||
)
|
||||
|
||||
# mapcache
|
||||
message( STATUS "Creating target mapcache" )
|
||||
add_executable(mapcache)
|
||||
target_link_libraries(mapcache PRIVATE tools)
|
||||
target_link_libraries(mapcache PRIVATE minicore)
|
||||
target_sources(mapcache PRIVATE "mapcache.cpp")
|
||||
set_target_properties(mapcache PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
if(WIN32)
|
||||
set_target_properties(mapcache PROPERTIES FOLDER "Tools")
|
||||
endif()
|
||||
|
||||
|
||||
# csv2yaml
|
||||
message( STATUS "Creating target csv2yaml" )
|
||||
add_executable(csv2yaml)
|
||||
target_link_libraries(csv2yaml PRIVATE tools)
|
||||
target_link_libraries(csv2yaml PRIVATE minicore)
|
||||
target_sources(csv2yaml PRIVATE "csv2yaml.cpp")
|
||||
set_target_properties(csv2yaml PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
if(WIN32)
|
||||
set_target_properties(csv2yaml PROPERTIES FOLDER "Tools")
|
||||
target_sources(csv2yaml PRIVATE
|
||||
"csv2yaml.hpp"
|
||||
"yaml.hpp"
|
||||
)
|
||||
endif()
|
||||
|
||||
# yaml2sql
|
||||
message( STATUS "Creating target yaml2sql" )
|
||||
add_executable(yaml2sql)
|
||||
target_link_libraries(yaml2sql PRIVATE tools)
|
||||
target_link_libraries(yaml2sql PRIVATE minicore)
|
||||
target_sources(yaml2sql PRIVATE "yaml2sql.cpp")
|
||||
set_target_properties(yaml2sql PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
if(WIN32)
|
||||
set_target_properties(yaml2sql PROPERTIES FOLDER "Tools")
|
||||
endif()
|
||||
|
||||
# yamlupgrade
|
||||
message( STATUS "Creating target yamlupgrade" )
|
||||
add_executable(yamlupgrade)
|
||||
target_link_libraries(yamlupgrade PRIVATE tools)
|
||||
target_link_libraries(yamlupgrade PRIVATE minicore)
|
||||
target_sources(yamlupgrade PRIVATE "yamlupgrade.cpp")
|
||||
set_target_properties(yamlupgrade PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
if(WIN32)
|
||||
set_target_properties(yamlupgrade PROPERTIES FOLDER "Tools")
|
||||
target_sources(yamlupgrade PRIVATE
|
||||
"yamlupgrade.hpp"
|
||||
"yaml.hpp"
|
||||
)
|
||||
endif()
|
||||
|
||||
set( TARGET_LIST ${TARGET_LIST} mapcache csv2yaml yaml2sql yamlupgrade CACHE INTERNAL "" )
|
||||
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
cpack_add_component( Runtime_mapcache DESCRIPTION "mapcache generator" DISPLAY_NAME "mapcache" GROUP Runtime )
|
||||
install( TARGETS mapcache
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_mapcache
|
||||
)
|
||||
cpack_add_component( Runtime_csv2yaml DESCRIPTION "yaml converter" DISPLAY_NAME "csv2yaml" GROUP Runtime )
|
||||
install( TARGETS csv2yaml
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_csv2yaml
|
||||
)
|
||||
cpack_add_component( Runtime_yaml2sql DESCRIPTION "sql converter" DISPLAY_NAME "yaml2sql" GROUP Runtime )
|
||||
install( TARGETS yaml2sql
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_yaml2sql
|
||||
)
|
||||
cpack_add_component( Runtime_yamlupgrade DESCRIPTION "yaml upgrader" DISPLAY_NAME "yamlupgrade" GROUP Runtime )
|
||||
install( TARGETS yamlupgrade
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_yamlupgrade
|
||||
)
|
||||
install (TARGETS )
|
||||
endif( INSTALL_COMPONENT_RUNTIME )
|
||||
add_custom_target(tools DEPENDS mapcache csv2yaml yaml2sql yamlupgrade map-server-generator)
|
||||
|
@ -1,41 +1,41 @@
|
||||
#
|
||||
# setup
|
||||
#
|
||||
set( WEB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
|
||||
add_executable(web-server)
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
#
|
||||
# web server
|
||||
#
|
||||
if ( NOT ENABLE_WEB_SERVER )
|
||||
return()
|
||||
endif ( NOT ENABLE_WEB_SERVER )
|
||||
target_sources(web-server PRIVATE
|
||||
"auth.cpp"
|
||||
"charconfig_controller.cpp"
|
||||
"emblem_controller.cpp"
|
||||
"merchantstore_controller.cpp"
|
||||
"partybooking_controller.cpp"
|
||||
"sqllock.cpp"
|
||||
"userconfig_controller.cpp"
|
||||
"web.cpp"
|
||||
"webutils.cpp"
|
||||
)
|
||||
|
||||
if( BUILD_SERVERS AND ENABLE_WEB_SERVER )
|
||||
message( STATUS "Creating target web-server" )
|
||||
file(GLOB WEB_HEADERS ${WEB_SOURCE_DIR}/*.hpp)
|
||||
file(GLOB WEB_SOURCES ${WEB_SOURCE_DIR}/*.cpp)
|
||||
set( DEPENDENCIES common yaml-cpp httplib)
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES})
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ${HTTPLIB_INCLUDE_DIRS} ${JSON_INCLUDE_DIRS} ${RA_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
||||
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${WEB_HEADERS} ${WEB_SOURCES} )
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
|
||||
source_group( web FILES ${WEB_HEADERS} ${WEB_SOURCES} )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
if(WIN32)
|
||||
target_sources(web-server PRIVATE
|
||||
"auth.hpp"
|
||||
"charconfig_controller.hpp"
|
||||
"emblem_controller.hpp"
|
||||
"http.hpp"
|
||||
"merchantstore_controller.hpp"
|
||||
"partybooking_controller.hpp"
|
||||
"sqllock.hpp"
|
||||
"userconfig_controller.hpp"
|
||||
"webcnslif.hpp"
|
||||
"web.hpp"
|
||||
"webutils.hpp"
|
||||
)
|
||||
|
||||
#message( STATUS "web-server SOURCE_FILES=${SOURCE_FILES}")
|
||||
add_executable( web-server ${SOURCE_FILES} )
|
||||
#message( STATUS "web-server LIBRARIES=${LIBRARIES}, DEPENDENCIES=${DEPENDENCIES} DEFINITIONS=${DEFINITIONS}")
|
||||
add_dependencies( web-server ${DEPENDENCIES} )
|
||||
target_link_libraries( web-server ${LIBRARIES} ${DEPENDENCIES} )
|
||||
set_target_properties( web-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
cpack_add_component( Runtime_webserver DESCRIPTION "web-server" DISPLAY_NAME "web-server" GROUP Runtime )
|
||||
install( TARGETS web-server
|
||||
DESTINATION "."
|
||||
COMPONENT Runtime_webserver )
|
||||
endif( INSTALL_COMPONENT_RUNTIME )
|
||||
set( TARGET_LIST ${TARGET_LIST} web-server CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target web-server - done" )
|
||||
endif( BUILD_SERVERS AND ENABLE_WEB_SERVER)
|
||||
set_target_properties(web-server PROPERTIES FOLDER "Servers")
|
||||
endif()
|
||||
|
||||
target_link_libraries(web-server PUBLIC
|
||||
common
|
||||
httplib
|
||||
Threads::Threads
|
||||
json
|
||||
)
|
||||
|
38
tools/CMakeLists.txt
Normal file
38
tools/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
add_custom_target(scripts)
|
||||
|
||||
function(copy_to_source_dir FILENAMES)
|
||||
foreach(FILE ${FILENAMES})
|
||||
add_custom_command(
|
||||
TARGET scripts POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${FILE})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
if(WIN32)
|
||||
set(WIN_FILES_TO_COPY
|
||||
"charserv.bat"
|
||||
"csv2yaml.bat"
|
||||
"logserv.bat"
|
||||
"mapcache.bat"
|
||||
"mapserv.bat"
|
||||
"runserver.bat"
|
||||
"serv.bat"
|
||||
"webserv.bat"
|
||||
"yaml2sql.bat"
|
||||
"yamlupgrade.bat"
|
||||
"navigenerator.bat"
|
||||
)
|
||||
copy_to_source_dir("${WIN_FILES_TO_COPY}")
|
||||
else()
|
||||
set(LINUX_FILES_TO_COPY
|
||||
"athena-start.sh"
|
||||
"function.sh"
|
||||
"install.sh"
|
||||
"uninstall.sh"
|
||||
)
|
||||
|
||||
copy_to_source_dir("${LINUX_FILES_TO_COPY}")
|
||||
endif()
|
227
tools/athena-start.sh
Executable file
227
tools/athena-start.sh
Executable file
@ -0,0 +1,227 @@
|
||||
#!/bin/sh
|
||||
|
||||
#source var/function
|
||||
. ./function.sh
|
||||
inst_launch_workaround
|
||||
|
||||
PATH=./:$PATH
|
||||
LOG_DIR="./log"
|
||||
|
||||
print_start() {
|
||||
# more << EOF
|
||||
echo "rAthena is starting..."
|
||||
echo " (c) 2021 rAthena Project"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "checking..."
|
||||
#EOF
|
||||
}
|
||||
|
||||
get_status(){
|
||||
PIDFILE=.$1.pid
|
||||
if [ -e ${PIDFILE} ]; then
|
||||
PSRUN=$(pgrep -F ${PIDFILE})
|
||||
fi
|
||||
#return ${PSRUN} #seems to cause an issue for some os
|
||||
}
|
||||
|
||||
#checking if already started, launch and mark in log
|
||||
start_serv(){
|
||||
get_status $1
|
||||
if [ $2 ]; then #is logging on ?
|
||||
LOGFILE="$LOG_DIR/$1.launch.log"
|
||||
LOGRUN="$LOG_DIR/$1.log"
|
||||
FIFO="$1_fifo"
|
||||
echo "stat_serv, log is enabled"
|
||||
echo "My logfile=${LOGFILE}"
|
||||
if [ -z ${PSRUN} ]; then
|
||||
if [ -e ./${FIFO} ]; then rm "$FIFO"; fi
|
||||
mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$1" > "$FIFO" 2>&1 & PID=$!
|
||||
#"./$1" > >(tee "$LOGRUN") 2>&1 & PID=$! #bash only
|
||||
echo "$PID" > .$1.pid
|
||||
echo "Server '$1' started at $(date +"%m-%d-%H:%M-%S")" | tee ${LOGFILE}
|
||||
else
|
||||
echo "Cannot start '$1', because it is already running p${PSRUN}" | tee ${LOGFILE}
|
||||
fi
|
||||
else
|
||||
if [ -z ${PSRUN} ]; then
|
||||
./$1&
|
||||
echo "$!" > .$1.pid
|
||||
echo "Server '$1' started at $(date +"%m-%d-%H:%M-%S")"
|
||||
else
|
||||
echo "Cannot start '$1', because it is already running p${PSRUN}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
watch_serv(){
|
||||
ulimit -Sc unlimited
|
||||
|
||||
#now checking status and looping
|
||||
count=0;
|
||||
while true; do
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
LOGFILE="$LOG_DIR/$i.launch.log"
|
||||
LOGRUN="$LOG_DIR/$i.log"
|
||||
FIFO=$i"_fifo"
|
||||
|
||||
get_status ${i}
|
||||
#echo "Echo id of $i is ${PSRUN}"
|
||||
if [ -z ${PSRUN} ]; then
|
||||
count=$((count+1))
|
||||
#echo "fifo=$FIFO"
|
||||
echo "server '$i' is down"
|
||||
echo "server '$i' is down" >> ${LOGFILE}
|
||||
echo "restarting server at time at $(date +"%m-%d-%H:%M-%S")"
|
||||
echo "restarting server at time at $(date +"%m-%d-%H:%M-%S")" >> ${LOGFILE}
|
||||
if [ -e $FIFO ]; then rm $FIFO; fi
|
||||
mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$i" > "$FIFO" 2>&1 & PID=$!
|
||||
echo "$PID" > .$i.pid
|
||||
if [ $2 ] && [ $2 -lt $count ]; then break; fi
|
||||
fi
|
||||
done
|
||||
sleep $1
|
||||
done
|
||||
}
|
||||
|
||||
restart(){
|
||||
$0 stop
|
||||
if [ $1 ]; then sleep $1; fi
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
FIFO="$1_fifo"
|
||||
while true; do
|
||||
get_status ${i}
|
||||
if [ ${PSRUN} ]; then echo "'${i}' is still running p${PSRUN} waiting for the process to end"; sleep 2;
|
||||
else
|
||||
if [ -e ./${FIFO} ]; then rm "$FIFO"; fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
$0 start
|
||||
}
|
||||
|
||||
case $1 in
|
||||
'start')
|
||||
print_start
|
||||
check_files
|
||||
echo "Check complete."
|
||||
echo "Looks like a good, nice rAthena!"
|
||||
if [ "$2" = "--enlog" ]; then
|
||||
ENLOG=1
|
||||
if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi
|
||||
echo "Logging is enabled in $LOG_DIR"
|
||||
else
|
||||
echo "Logging is disabled"
|
||||
fi
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
start_serv $i $ENLOG
|
||||
done
|
||||
echo "rAthena was started."
|
||||
;;
|
||||
'watch')
|
||||
if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi
|
||||
if [ -z $2 ]; then Restart_count=10; else Restart_count=$2; fi
|
||||
if [ -z $3 ]; then Restart_sleep=3; else Restart_sleep=$3; fi
|
||||
echo "Going to watch rAthena for restart_count = $Restart_count, restart_sleep = $Restart_sleep"
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
start_serv $i 1
|
||||
done
|
||||
watch_serv $Restart_count $Restart_sleep
|
||||
echo "Watching rAthena now."
|
||||
;;
|
||||
'stop')
|
||||
for i in ${W_SRV} ${M_SRV} ${C_SRV} ${L_SRV}
|
||||
do
|
||||
PIDFILE=.${i}.pid
|
||||
if [ -e ./${PIDFILE} ]; then
|
||||
kill $(cat ${PIDFILE})
|
||||
|
||||
while true; do
|
||||
get_status ${i}
|
||||
if [ ${PSRUN} ]; then echo "'${i}' is still running p${PSRUN} waiting for the process to end"; sleep 2;
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
rm ${PIDFILE}
|
||||
fi
|
||||
done
|
||||
;;
|
||||
'restart')
|
||||
restart "$@"
|
||||
;;
|
||||
'status')
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
get_status ${i}
|
||||
if [ ${PSRUN} ]; then echo "'${i}' is running p${PSRUN}"; else echo "'${i}' seems to be down"; fi
|
||||
done
|
||||
;;
|
||||
'val_runonce')
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./$i --run-once > "log/$i.runonce.leak"
|
||||
done
|
||||
;;
|
||||
'valchk')
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./$i > "log/$i.runonce.leak"
|
||||
done
|
||||
;;
|
||||
'help')
|
||||
case $2 in
|
||||
'start')
|
||||
echo "syntax: 'start {--enlog}'"
|
||||
echo "This option will start the servers"
|
||||
echo "--enlog will write all terminal output into a log/\$servname.log file"
|
||||
;;
|
||||
'stop')
|
||||
echo "This option will shut the servers down"
|
||||
;;
|
||||
'restart')
|
||||
echo "syntax: 'restart {<delay>}'"
|
||||
echo "This option will wait for the given delay and will attempt to restart the servers afterwards"
|
||||
echo "Note: Even if the delay is over it will wait until the pid is finished before attempting to restart the servers"
|
||||
;;
|
||||
'status')
|
||||
echo "syntax: 'status'"
|
||||
echo "This option will let you know whether the server are running or not"
|
||||
echo "Note: This option is based on PID and requires that you have launched the servers with this script too"
|
||||
echo "If this was not the case please use something like 'ps ax | grep server' to check their status"
|
||||
;;
|
||||
'watch')
|
||||
echo "syntax: 'watch {<restart_interval> <restart_count>}'"
|
||||
echo "The watch option allows you to automatically restart the servers when one of them was stopped"
|
||||
echo "<restart_interval> delay in seconds before rechecking if a server is down (default 10) "
|
||||
echo "<restart_count> how many times the servers should be restarted (default 3), (-1=indefinitly)"
|
||||
;;
|
||||
'val_runonce')
|
||||
echo "syntax: 'val_runonce'"
|
||||
echo "This option will run valgrind with run-once to check the servers"
|
||||
;;
|
||||
'valchk')
|
||||
echo "syntax: 'valchk'"
|
||||
echo "This option will run valgrind with the servers"
|
||||
;;
|
||||
*)
|
||||
echo "Please specify a command you would like more info on { start | stop | restart | status | watch }"
|
||||
read -p "Enter a valid command: " readEnterKey
|
||||
$0 "help" $readEnterKey
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: athena-start { start | stop | restart | status | watch | help | val_runonce | valchk }"
|
||||
read -p "Enter a valid option: " readEnterKey
|
||||
$0 $readEnterKey
|
||||
;;
|
||||
esac
|
||||
|
||||
|
21
tools/cmake/CopyImportFiles.cmake
Normal file
21
tools/cmake/CopyImportFiles.cmake
Normal file
@ -0,0 +1,21 @@
|
||||
function(copy_import_files SRC_DIR DST_DIR FILE_LIST)
|
||||
|
||||
file(MAKE_DIRECTORY ${DST_DIR})
|
||||
|
||||
file(GLOB FILES_IMPORTED
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE ${DST_DIR}/ ${DST_DIR}/*)
|
||||
|
||||
|
||||
# message("files to import are: " "${FILE_LIST}")
|
||||
# message("Already made fs are: " "${FILES_IMPORTED}")
|
||||
|
||||
list(REMOVE_ITEM FILE_LIST ${FILES_IMPORTED})
|
||||
|
||||
# message(" rest of files are: " ${FILE_LIST})
|
||||
|
||||
foreach(FILE ${FILE_LIST})
|
||||
message("Importing ${FILE}")
|
||||
file(COPY ${SRC_DIR}/${FILE} DESTINATION ${DST_DIR})
|
||||
endforeach()
|
||||
endfunction()
|
27
tools/function.sh
Executable file
27
tools/function.sh
Executable file
@ -0,0 +1,27 @@
|
||||
L_SRV=login-server
|
||||
C_SRV=char-server
|
||||
M_SRV=map-server
|
||||
W_SRV=web-server
|
||||
INST_PATH=/opt
|
||||
PKG=rathena
|
||||
PKG_PATH="${INST_PATH}/${PKG}"
|
||||
|
||||
check_files() {
|
||||
for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
|
||||
do
|
||||
if [ ! -f ./$i ]; then
|
||||
echo "$i does not exist... exiting..."
|
||||
exit 1;
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_inst_right(){
|
||||
if [ ! -w "${INST_PATH}" ]; then echo "You must have sudo right to use this install (write/read permission in ${INST_PATH}/ )" && exit; fi
|
||||
}
|
||||
|
||||
inst_launch_workaround(){
|
||||
if [ -d "${PKG_PATH}" ]; then
|
||||
if [ "$(pwd)" != "${PKG_PATH}" ]; then cd "${PKG_PATH}"; fi
|
||||
fi
|
||||
}
|
45
tools/install.sh
Executable file
45
tools/install.sh
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
#source var/function
|
||||
. ./function.sh
|
||||
|
||||
#read -p "WARNING: This script is experimental. Press Ctrl+C to cancel or Enter to continue." readEnterKey
|
||||
|
||||
# NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this
|
||||
# separately; see below.
|
||||
TEMP=$(getopt -o d: -l destdir: -- "$@")
|
||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
eval set -- "${TEMP}"
|
||||
|
||||
eval set -- "${TEMP}"
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
(-d | --destdir) PKG_PATH="$2"; shift;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
echo "destdir = ${PKG_PATH} "
|
||||
check_inst_right
|
||||
check_files
|
||||
mkdir -p "${PKG_PATH}/bin/"
|
||||
mkdir -p "${PKG_PATH}/etc/${PKG}/"
|
||||
mkdir -p "${PKG_PATH}/usr/${PKG}/"
|
||||
mkdir -p "${PKG_PATH}/var/${PKG}/log"
|
||||
|
||||
#we copy all file into opt/ dir and treat dir like normal unix arborescence
|
||||
cp -r db/ "${PKG_PATH}/var/${PKG}/db"
|
||||
if [ -d log ]; then cp -r log/* "${PKG_PATH}/var/${PKG}/log/"; fi
|
||||
cp -r conf/ "${PKG_PATH}/etc/${PKG}/conf"
|
||||
cp -r npc/ "${PKG_PATH}/usr/${PKG}/npc"
|
||||
cp athena-start "${PKG_PATH}/"
|
||||
cp *-server* "${PKG_PATH}/bin/"
|
||||
|
||||
ln -fs "${PKG_PATH}/var/${PKG}/db/" "${PKG_PATH}/db"
|
||||
ln -fs "${PKG_PATH}/var/${PKG}/log/" "${PKG_PATH}/log"
|
||||
ln -fs "${PKG_PATH}/etc/${PKG}/conf/" "${PKG_PATH}/conf"
|
||||
ln -fs "${PKG_PATH}/usr/${PKG}/npc/" "${PKG_PATH}/npc"
|
||||
ln -fs "${PKG_PATH}/athena-start" "/usr/bin/${PKG}"
|
||||
for f in $(ls "${PKG_PATH}/bin/") ; do ln -fs "${PKG_PATH}/bin/${f}" "${PKG_PATH}/${f}"; done
|
||||
echo "Installation is done. You can now control the server with '${PKG} start'"
|
22
tools/uninstall.sh
Executable file
22
tools/uninstall.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
#source var/function
|
||||
. ./function.sh
|
||||
echo "My pkg path is ${PKG_PATH}"
|
||||
|
||||
check_inst_right
|
||||
read -p "WARNING: This script is experimental. Press Ctrl+C to cancel or Enter to continue." readEnterKey
|
||||
case $1 in
|
||||
'bin')
|
||||
echo "Starting binary cleanup"
|
||||
rm -rf "${PKG_PATH:?}"/bin/*
|
||||
echo "Binary files have been deleted"
|
||||
;;
|
||||
'all')
|
||||
echo "Starting uninstall"
|
||||
rm -rf "${PKG_PATH:?}"
|
||||
rm -rf "/usr/bin/${PKG:?}"
|
||||
echo "Uninstallation has succeed"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: Please enter a target './uninstall { all | bin }'"
|
||||
esac
|
Loading…
x
Reference in New Issue
Block a user