aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampus <hampus@hampusmat.com>2021-12-14 00:03:15 +0100
committerHampus <hampus@hampusmat.com>2021-12-14 00:03:15 +0100
commit828c6563124baeff4d80aeefd15b6bbfd7ff86a2 (patch)
tree7f31639810ee2c667f6864a724d76323c75ed933
parent88d8be06f3e5411db6faa59db12210b6079f7d21 (diff)
build: use cmake
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt7
-rw-r--r--Makefile18
-rw-r--r--README.md9
-rw-r--r--src/CMakeLists.txt7
5 files changed, 22 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index a0d1759..5acb669 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-mazerator
-.vscode \ No newline at end of file
+build
+.vscode
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..a817aba
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.0.0)
+
+set(CMAKE_C_STANDARD 11)
+
+project(mazerator_project C)
+
+add_subdirectory(src)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index f4b0180..0000000
--- a/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-TARGET=mazerator
-SRCS=$(TARGET).c maze.c position_stack.c utils.c
-CC=gcc
-CFLAGS=-Wall
-CFLAGS_DEBUG=-fdiagnostics-color=always -g
-
-all: $(TARGET)
-
-$(TARGET): $(TARGET).c
- $(CC) $(CFLAGS) -O2 $(SRCS) -o $(TARGET)
-
-.PHONY: debug clean
-
-debug: $(TARGET).c
- $(CC) $(CFLAGS) $(CFLAGS_DEBUG) $(SRCS) -o $(TARGET)
-
-clean:
- $(RM) $(TARGET)
diff --git a/README.md b/README.md
index 19fb84c..2be5385 100644
--- a/README.md
+++ b/README.md
@@ -6,16 +6,19 @@ Building
--------
It's simple. Just run
- make
+ $ mkdir build
+ $ cd build
+ $ cmake ..
+ $ make
Usage
-----
Run
- ./mazerator
+ $ ./bin/mazerator
You can get information about options and such by running
- ./mazerator --help
+ $ ./bin/mazerator --help
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..090164c
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,7 @@
+project(mazerator C)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../bin)
+
+add_executable(mazerator mazerator.c maze.c utils.c position_stack.c)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")