From 344497630ac9ef2d46287cd574472ce369694076 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 19 Jan 2022 20:49:26 -0500 Subject: Replace build system with cmake --- .gitignore | 5 +---- CMakeLists.txt | 18 ++++++++++++++++++ Makefile | 17 ----------------- configure | 8 -------- example.c | 5 ++++- 5 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile delete mode 100755 configure 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..06ae91f --- /dev/null +++ b/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/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/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/example.c b/example.c index 8790d65..859adc1 100644 --- a/example.c +++ b/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"); -- cgit 1.4.1 ef='/torus/log/?h=ansi&id=72e41cb504ad641119e0d183136170711ac6c170&follow=1'>root/LICENSE (unfollow)
Commit message (Expand)Author
2017-08-24Add license to C filesJune McEnroe
2017-08-21Add nethack to index.htmlJune McEnroe
2017-08-13Clean up unnecessary kevent initializersJune McEnroe
2017-08-08Check COLOR_PAIRS in clientJune McEnroe
2017-08-08Patch termcap of rxvt-256color as wellJune McEnroe
2017-08-08Add put modeJune McEnroe
2017-08-08Remove MADV_NOSYNCJune McEnroe
2017-08-08Completely retry if a send fails during a broadcastJune McEnroe
2017-08-08Reverse order of main loopJune McEnroe
2017-08-08Turn off SIGPIPE at the socket levelJune McEnroe
2017-08-06Rewrite helpJune McEnroe
2017-08-04Use $() in snapshot.shJune McEnroe
2017-08-02Move in insert direction on ~June McEnroe
2017-08-02Preserve color on replaceJune McEnroe
2017-08-02Split tile access and modifyJune McEnroe
2017-08-01Madvise RANDOM and NOSYNCJune McEnroe
2017-07-31Fix removing clients from clientCastJune McEnroe
2017-07-31Build with debug infoJune McEnroe
2017-07-31Don't dump tiles in coreJune McEnroe
2017-07-31Use designated initializers for messagesJune McEnroe
2017-07-31Show other clients' cursorsJune McEnroe
2017-07-31Perform enter as two moves rather than a loopJune McEnroe
2017-07-31Track tile access countsJune McEnroe
2017-07-31Adjust move speed in clientJune McEnroe
2017-07-31Handle large movesJune McEnroe
2017-07-30Optimize builds for chrootJune McEnroe
2017-07-30Persist bright across color changesJune McEnroe
2017-07-30Add index.htmlJune McEnroe
2017-07-30Add snapshot.shJune McEnroe
2017-07-30Fix termcap patch for background colorsJune McEnroe
2017-07-30Update helpJune McEnroe
2017-07-30Fix help to track colorJune McEnroe
2017-07-30Support background colorsJune McEnroe
2017-07-30Track color only client-sideJune McEnroe
2017-07-30Add ostensible support for background colorsJune McEnroe
2017-07-30Add tile create and access timestampsJune McEnroe
2017-07-30Assert stable struct Tile field offsetsJune McEnroe
2017-07-30Add chroot.shJune McEnroe
2017-07-30Add ` commandJune McEnroe
2017-07-30Add sshd_configJune McEnroe
2017-07-30Add termcap patchJune McEnroe