From 828c6563124baeff4d80aeefd15b6bbfd7ff86a2 Mon Sep 17 00:00:00 2001 From: Hampus Date: Tue, 14 Dec 2021 00:03:15 +0100 Subject: build: use cmake --- .gitignore | 4 ++-- CMakeLists.txt | 7 +++++++ Makefile | 18 ------------------ README.md | 9 ++++++--- src/CMakeLists.txt | 7 +++++++ 5 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile create mode 100644 src/CMakeLists.txt 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") -- cgit v1.2.3-18-g5258