Skip to content

Commit

Permalink
feat: fix build scripts and their documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenapte committed Feb 6, 2024
1 parent 73d8721 commit 103659f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 99 deletions.
43 changes: 0 additions & 43 deletions BallanceMMO.sln

This file was deleted.

102 changes: 46 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ BallanceMMO is a project which brings online experiences to Ballance.

## Dependencies or build tools

- CMake 3.12 or later: Generate makefile for server
- CMake 3.12 or later: Generate makefiles
- A build tool like GNU Make, Ninja: Build server binary
- A compiler with core C++20 feature support
- This project has been successfully compiled under:
Expand All @@ -52,15 +52,13 @@ BallanceMMO is a project which brings online experiences to Ballance.

## Building server

### Linux/macOS

1. Clone this repo __RECURSIVELY__

```commandline
git clone https://github.com/Swung0x48/BallanceMMO.git --recursive
```

2. Install OpenSSL and Protobuf
2. ***(Linux/macOS)*** Install OpenSSL and Protobuf

- Debian/Ubuntu

Expand Down Expand Up @@ -88,33 +86,44 @@ BallanceMMO is a project which brings online experiences to Ballance.

3. Building!

- Ninja
+ **Linux/macOS**
- Ninja

```commandline
chmod +x build.sh
./build.sh
cd build
ninja
```
```commandline
chmod +x build_server.sh
./build_server.sh
cd build
ninja
```

- GNU Make
- GNU Make

```commandline
chmod +x build.sh
./build.sh -G
cd build
make
```
```commandline
chmod +x build_server.sh
./build_server.sh -G
cd build
make
```

You may also want to supply command line arguments such as `-DCMAKE_BUILD_TYPE=Release` when running `build.sh`, to specify the build type.
You may also want to supply command line arguments such as `-DCMAKE_BUILD_TYPE=Release` when running `build.sh`, to specify the build type.

If CMake failed to find openssl for some reason, you may need to specify path to openssl yourself.
If CMake failed to find openssl for some reason, you may need to specify path to openssl yourself.

For example:
For example:

```commandline
$ ./build.sh -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl@1.1/"
```
```commandline
$ ./build_server.sh -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl@1.1/"
```

+ **Windows**

We're using vcpkg to take care of our dependencies on Windows. It should be automatically called during CMake setup.

```commandline
> .\build_server.bat
```

Open and compile the generated Visual Studio Solution file in `build_server` after finishing this, and you should be fine to go.

4. Run your server!

Expand Down Expand Up @@ -145,57 +154,38 @@ BallanceMMO is a project which brings online experiences to Ballance.

## Building client (Game Mod)

### Windows

On Windows, we can use the vcpkg package manager. The following instructions assume that you will follow the steps and fetch vcpkg as a submodule. If you want to install vcpkg somewhere else, you're on your own.

__Warning Beforehand__: DO NOT upgrade (cancel when prompted) when Visual Studio asks you to upgrade the solution/project on first launch. It will wipe include directories which has been set in the project file (wtf Microsoft???). Don't worry, following steps will guide you to switch to your already-set-up msvc toolchain.

1. Install/Modify Visual Studio
1. Install/Modify Visual Studio and CMake
- In `Workload` tab, make sure you have installed `Desktop Development with C++`.
- __IMPORTANT!__ In `Language pack` tab, make sure you have installed `English`.

2. Bootstrap vcpkg
- In a `Visual Studio Developer PowerShell`/`Visual Studio Developer Command Prompt`

```commandline
cd submodule\vcpkg
.\bootstrap-vcpkg.bat
```

3. Build the prerequisites using vcpkg
```commandline
cd submodule\vcpkg
.\bootstrap-vcpkg.bat
```

3. Generate the Visual Studio project file with CMake
- CMake will automatically call vcpkg to take care of our dependecies during the setup.
- This is the step where vcpkg will fail if you haven't got your English language pack installed. (Again, wtf Microsoft???)

```commandline
> .\vcpkg --overlay-ports=..\GameNetworkingSockets\vcpkg_ports install gamenetworkingsockets
```

You may also try

```commandline
> .\vcpkg --overlay-ports=..\GameNetworkingSockets\vcpkg_ports install gamenetworkingsockets[core,libsodium]
> .\build.bat
```

if openssl fails to compile.

4. Install vcpkg integrate so that Visual Studio will pick up installed packages

```commandline
> vcpkg integrate install
```

5. Extract BML Dev pack and [Boost Library](https://www.boost.org/users/download/), and place the following:
4. Extract BML Dev pack and [Boost Library](https://www.boost.org/users/download/), and place the following:
- *BML*:
- include\BML -> BallanceMMOClient\include\BML
- lib\Debug -> BallanceMMOClient\lib\BML\Debug
- lib\Release -> BallanceMMOClient\lib\BML\Release
- *Boost*:
- boost -> BallanceMMOClient\include\boost

6. Open the Visual Studio project file `BallanceMMO.sln`.
- DO NOT upgrade the project(cancel) when prompted! (Yet again, wtf Microsoft???)

7. In `Solution Explorer` panel, Right click on the project `BallanceMMOClient`, select `Properties`.

8. Navigate to `Configuration Properties` - `General` - `Platform toolset`, select your toolset of your choice (tested under `v142`(Visual Studio 2019)/`v143`(Visual Studio 2022)), then press `OK`.
5. Open the Visual Studio project file `BallanceMMO.sln`, which could be found in the `build` directory.

9. Build the project!
6. Build the project!
1 change: 1 addition & 0 deletions build_server.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmake . -Bbuild_server -A x64 -DVIRTOOLS_SDK_FETCH_FROM_GIT=OFF -DBUILD_SERVER=ON -DBUILD_CLIENT=OFF -DYAML_BUILD_SHARED_LIBS=ON %*
File renamed without changes.

0 comments on commit 103659f

Please sign in to comment.