commit 7e8508fa101ead3ed90493e594b67c375c01dfe4
parent 6e3f26b3f451dc4623d8e9d9b137f427a1b6f3e3
Author: William Casarin <jb55@jb55.com>
Date: Mon, 4 Oct 2021 08:56:42 -0700
tinycc support
Diffstat:
4 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
@@ -5,14 +5,22 @@ PREFIX ?= /usr/local
# release build lol
DEFS= -DGLFW_INCLUDE_NONE -DNDEBUG -Og -g
-CFLAGS = $(DEFS) -Isrc -Wall -Werror -Wextra -std=c99 \
- -Wno-unused-function \
- -Wno-unused-parameter \
- -Wno-unused-variable \
- -Wmissing-field-initializers \
- -Wno-cast-align \
- -Wno-padded
-LDFLAGS = -lSDL2 -lGL -lm
+TINYCC_CFLAGS=-DSTBI_NO_SIMD -DSDL_DISABLE_IMMINTRIN_H $(shell pkg-config --cflags sdl2 gl x11)
+TINYCC_LDFLAGS=$(shell pkg-config --libs sdl2 gl) \
+ $(shell pkg-config --libs-only-L x11 xcb xau xdmcp xext xcursor xrender xfixes xinerama xi xrandr xscrnsaver xxf86vm)
+
+
+CFLAGS = $(DEFS) -Isrc \
+ $(TINYCC_CFLAGS) \
+ -Wall -Werror -Wextra -std=c99 \
+ -Wno-unused-function \
+ -Wno-unused-parameter \
+ -Wno-unused-variable \
+ -Wmissing-field-initializers \
+ -Wno-cast-align \
+ -Wno-padded
+
+LDFLAGS = $(TINYCC_LDFLAGS) -lSDL2 -lGL -lm
SRC=src
SRCS=$(wildcard $(SRC)/*.c)
@@ -75,4 +83,4 @@ TAGS:
tags:
ctags $(SRCS) $(HEADERS)
-.PHONY: TAGS
+.PHONY: TAGS tags
diff --git a/src/hires.c b/src/hires.c
@@ -1,7 +1,7 @@
#include <time.h>
#include "common.h"
-#include <SDL2/SDL.h>
+#include <SDL.h>
double hires_time_in_seconds() {
double ticks_per_sec = (double)SDL_GetPerformanceFrequency();
diff --git a/src/input.h b/src/input.h
@@ -3,7 +3,7 @@
#ifndef POLYADVENT_INPUT_H
#define POLYADVENT_INPUT_H
-#include <SDL2/SDL.h>
+#include <SDL.h>
#include "common.h"
/* enum key_state { */
diff --git a/src/shader.c b/src/shader.c
@@ -30,7 +30,7 @@ static char *cached_file_contents(const char *filename) {
return (char*)file_contents(filename, &len);
}
-static char *strsep(char **stringp, const char *delim) {
+static char *o_strsep(char **stringp, const char *delim) {
if (*stringp == NULL) { return NULL; }
char *token_start = *stringp;
*stringp = strpbrk(token_start, delim);
@@ -45,7 +45,7 @@ static char **resolve_imports(char *contents, int *nlines, int level) {
char *resolved_contents;
char fname_buf[32] = {0};
- while ((line = strsep(&contents, "\n"))) {
+ while ((line = o_strsep(&contents, "\n"))) {
nline++;
int line_len = contents - line;
int size = sizeof("#include");