-
CMake 3.7 or later
-
Windows
- Environment variable
SDL2DIR
is set to extracted SDL2 development libraries directory e.g.SDL2DIR=C:\Users\Public\Downloads\SDL2-2.0.16
- Instructions: https://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvc2019/index.php
- Environment variable
-
Linux
- SDL2 >= 2.0
- All installation instructions can be found here
Note that for Linux, an
apt
orapt-get
installation is preferred to building from source.
- Clone this repo.
- Make a build directory in the top level directory:
mkdir build && cd build
- For Default Asteroids Game
3.1 Compile:cmake .. && make
3.2 Run it:./AsteroidsGame
. - For Snake Game
4.1 Compile:cmake -DSNAKE=ON .. && make
4.2 Run it:./SnakeGame
.
- Default Game build is Asteroids Game. For Snake game provide option -DSNAKE
cmake -G "Visual Studio 16 2019" -B.\build
cmake --build .\build
- Build or build and install in single step
rmdir /q /s build & cmake -G "Visual Studio 16 2019" -B.\build && cmake --build .\build && cmake --install .\build --config Debug
-
Run
- build\install\AsteroidsGame.exe
-
Building Snake game in single step
rmdir /q /s build & cmake -G "Visual Studio 16 2019" -DSNAKE=ON -B.\build && cmake --build .\build && cmake --install .\build --config Debug
- Run
- build\install\SnakeGame.exe
- Default Game build is Asteroids Game. For Snake game provide option -DSNAKE
rm -rf build && cmake -Bbuild && cmake --build build
- Build or build and install in single step
rm -rf build && cmake -Bbuild && cmake --build build && cmake --install build
- Build or build and install Snake Game in single step
rm -rf build && cmake -DSNAKE=ON -Bbuild && cmake --build build && cmake --install build