summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-01-19 20:51:03 -0500
committerJune McEnroe <june@causal.agency>2022-01-19 20:51:03 -0500
commit74276efb806fb548dc2dff23b3c6526160172b04 (patch)
tree160bcae5d9825eaec751c0fb920b220710598120
parentReplace build system with cmake (diff)
parentReplace build system with cmake (diff)
downloadwep-74276efb806fb548dc2dff23b3c6526160172b04.tar.gz
wep-74276efb806fb548dc2dff23b3c6526160172b04.zip
Merge commit '344497630ac9ef2d46287cd574472ce369694076'
-rw-r--r--cards/.gitignore5
-rw-r--r--cards/CMakeLists.txt18
-rw-r--r--cards/Makefile17
-rwxr-xr-xcards/configure8
-rw-r--r--cards/example.c5
5 files changed, 23 insertions, 30 deletions
diff --git a/cards/.gitignore b/cards/.gitignore
index 0ca9d1f..eb62ecc 100644
--- a/cards/.gitignore
+++ b/cards/.gitignore
@@ -1,8 +1,5 @@
 *.bmp
-*.o
 CARDS.DLL
 FREECELL.EXE
 SOL.EXE
-config.mk
-dump
-example
+build/
diff --git a/cards/CMakeLists.txt b/cards/CMakeLists.txt
new file mode 100644
index 0000000..06ae91f
--- /dev/null
+++ b/cards/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(cards)
+
+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/cards/Makefile b/cards/Makefile
deleted file mode 100644
index 488245d..0000000
--- a/cards/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/cards/configure b/cards/configure
deleted file mode 100755
index ba1718c..0000000
--- a/cards/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/cards/example.c b/cards/example.c
index 8790d65..859adc1 100644
--- a/cards/example.c
+++ b/cards/example.c
@@ -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");