Installing and running the game - SC-SGS/surviving-sarntal GitHub Wiki
You can use the included scripts to install all the dependencies needed to run the game. If you are interested in developing the game, see the section below.
If you only want to run the game, you can use the user_setup.sh
script to install the needed packages. You only need to run the following command.
source build-utils/user_setup.sh
The script is platform-agnostic and should work on most platforms. Below you can see some more platform specific information and how to install the needed packages manually.
You will need Homebrew to install the packages.
If you do not have Homebrew installed, you can do it from here or run the user_setup.sh
script to install it.
Install the following packages with Homebrew:
brew install cmake sdl2
If have already installed sdl2, make sure to not install it again with another version, because then the build script does not work. On MacOS you also have to make sure the cmake can find the location of your SDL2 installation. Our cmake script uses the following bash line to determine the location. You can run the line yourself to make sure everything is in order.
brew info sdl2 | grep 'Cellar/sdl2' | awk '{print $1}'
The output should be something like /opt/homebrew/Cellar/sdl2/2.30.7
The following packages will be installed with the scripts:
- build-essential
- cmake
- xorg-dev
- libsdl2-dev
You can do this manually by running the following commands:
sudo apt-get update
sudo apt-get install -y build-essential cmake xorg-dev libsdl2-dev
Having installed the dependencies, execute the run.sh script in order to run the game.
source build-utils/run.sh
Notice that building and running the game using this script will create a cmake-build-debug directory.
It does not however, clear previous builds.
Depending on the configuration of your IDE, this may lead to conflicts when switching between running from terminal using this script and running from your IDE.
Usually, this problem is easily resolved by deleting the ./cmake-build-debug
directory.
If you wish to take part in the development of the game, you will also need the following tools and libraries. Make sure you have installed the needed dependencies for running the game before continuing.
- clang-tidy
- clang-format
- git
- pre-commit
- python3
- lcov
You will need Homebrew to install the needed dependencies. For more information, see the above section on installing the game.
You can install the packages manually by running the following command.
brew install clang-tidy clang-format git pre-commit python3 lcov
You can install the packages manually by running the following command.
sudo apt-get update
sudo apt-get install -y clang-tidy clang-format git pre-commit python3 lcov
There are multiple options for testing the game at your disposal. To execute the unit tests with coverage, run
source build-utils/test.sh
Test coverage can be generated via
source build-utils/test_coverage.sh
To run with coverage, run
source build-utils/run_with_cov.sh
To get a combined coverage report, run
source build-utils/test_and_run_with_cov.sh
The coverage reports are saved as cmake-build-debug/coverage/reports/index.html
and can be opened with any browser and some IDEs.
The test.sh
script does not delete a previous ./cmake-build-debug
directory, which may cause conflicts (see section on running).
The coverage scripts always remove previous build directories.