aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt7
-rw-r--r--main.c2
-rw-r--r--readme.md15
4 files changed, 16 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..567609b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..89a43d3
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.6)
+project(Asteroids)
+
+find_package(SDL2 REQUIRED)
+include_directories(${SDL2_INCLUDE_DIRS})
+add_executable(Asteroids main.c)
+target_link_libraries(Asteroids ${SDL2_LIBRARIES} m)
diff --git a/main.c b/main.c
index a80e1fb..2faeeda 100644
--- a/main.c
+++ b/main.c
@@ -19,7 +19,7 @@
#include <stdbool.h>
#include <math.h>
-#include <SDL2/SDL.h>
+#include <SDL.h>
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600
diff --git a/readme.md b/readme.md
index 87b2125..114a846 100644
--- a/readme.md
+++ b/readme.md
@@ -4,14 +4,13 @@ Simple Asteroids clone in C as an exercise in game development.
* Requires [SDL2](https://libsdl.org) for input and drawing.
-* Compiles with gcc or clang. Can compile on Windows with clang or mingw. Visual Studio is not supported.
+* Compiles with gcc or clang. Can compile on Windows with clang or mingw. MSVC is not supported.
-In order to compile, the SDL2 development libraries are needed.
+## Building
-* Debian, Ubuntu, Raspbian: `sudo apt install libsdl2-dev`
+This project is built with [CMake](https://cmake.org). On Windows, CMake must be manually configured to locate the include and library paths for SDL2.
-* Red Hat, Fedora, CentOS: `sudo yum install SDL2-devel`
-
-* Arch: `sudo pacman -S sdl2`
-
-* macOS (with [Homebrew](https://brew.sh)): `brew install sdl2`
+Simplest way to build on most \*nix systems:
+ 1. `mkdir build && cd build`
+ 2. `cmake ..`
+ 3. `make`