about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--CMakeLists.txt18
-rw-r--r--Makefile17
l---------README.31
-rw-r--r--cards.32
-rw-r--r--cards.c2
-rw-r--r--cards.h2
-rwxr-xr-xconfigure8
-rw-r--r--dump.c2
-rw-r--r--example.c7
10 files changed, 28 insertions, 36 deletions
diff --git a/.gitignore b/.gitignore
index 0ca9d1f..eb62ecc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,5 @@
 *.bmp
-*.o
 CARDS.DLL
 FREECELL.EXE
 SOL.EXE
-config.mk
-dump
-example
+build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..9a40c37
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(cards C)
+
+find_package(SDL2 REQUIRED)
+
+if(NOT MSVC)
+	add_compile_options(-Wall -Wextra -pedantic)
+endif()
+
+add_library(cards STATIC cards.c)
+target_link_libraries(cards SDL2::SDL2)
+
+add_executable(example EXCLUDE_FROM_ALL example.c)
+target_link_libraries(example cards SDL2::SDL2main)
+
+add_executable(dump EXCLUDE_FROM_ALL dump.c)
+target_link_libraries(dump cards)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 488245d..0000000
--- a/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-CFLAGS += -std=c99 -Wall -Wextra -Wpedantic
-
-include config.mk
-
-BINS = dump example
-
-all: ${BINS}
-
-${BINS}: cards.o
-
-.o:
-	${CC} ${LDFLAGS} $< cards.o ${LDLIBS} -o $@
-
-cards.o dump.o example.o: cards.h
-
-clean:
-	rm -f ${BINS} *.o *.bmp
diff --git a/README.3 b/README.3
deleted file mode 120000
index d57bc52..0000000
--- a/README.3
+++ /dev/null
@@ -1 +0,0 @@
-cards.3
\ No newline at end of file
diff --git a/cards.3 b/cards.3
index 26c142c..fd46051 100644
--- a/cards.3
+++ b/cards.3
@@ -228,4 +228,4 @@ documented at
 .El
 .
 .Sh AUTHORS
-.An C. McEnroe Aq Mt june@causal.agency
+.An June McEnroe Aq Mt june@causal.agency
diff --git a/cards.c b/cards.c
index ddc5b86..c9467f3 100644
--- a/cards.c
+++ b/cards.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2019  June McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
diff --git a/cards.h b/cards.h
index 9625cb8..89baf5d 100644
--- a/cards.h
+++ b/cards.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2019  June McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
diff --git a/configure b/configure
deleted file mode 100755
index ba1718c..0000000
--- a/configure
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-set -eu
-cflags=$(pkg-config --cflags sdl2)
-ldlibs=$(pkg-config --libs sdl2)
-cat > config.mk << EOF
-CFLAGS += ${cflags}
-LDLIBS += ${ldlibs}
-EOF
diff --git a/dump.c b/dump.c
index 127d6b1..3e39292 100644
--- a/dump.c
+++ b/dump.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2019  June McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
diff --git a/example.c b/example.c
index 8790d65..036a44a 100644
--- a/example.c
+++ b/example.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2019  June McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -39,7 +39,10 @@ enum {
 	WindowHeight = MarginY + 4 * DeltaY,
 };
 
-int main(void) {
+int main(int argc, char *argv[]) {
+	(void)argc;
+	(void)argv;
+
 	if (SDL_Init(SDL_INIT_VIDEO) < 0) err("SDL_Init");
 
 	struct SDL_RWops *rw = SDL_RWFromFile("CARDS.DLL", "rb");