From e6ca94c2dfbba7c4cf79ff9a9ee89432016bde69 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Thu, 23 Jun 2022 04:04:35 +0000 Subject: [PATCH] Compile with tcc --- Makefile | 14 ++++++++------ source/engine/engine.c | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 12168f3..c68ddea 100755 --- a/Makefile +++ b/Makefile @@ -10,7 +10,9 @@ endif UNAME_P != uname -m #CC specifies which compiler we're using -CC = musl-clang -std=c99 +CC = tcc -std=c99 + +MUSL = /usr/local/musl/include ifeq ($(DEBUG), 1) DEFFALGS += -DDEBUG @@ -78,7 +80,7 @@ WARNING_FLAGS = #-Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wno-unused #COMPILER_FLAGS = $(includeflag) -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c -MMD -MP $< -o $@ COMPILER_FLAGS = $(includeflag) -I/usr/local/include -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c $< -o $@ -LIBPATH = -L./bin +LIBPATH = -L./bin -L/usr/local/lib -L/usr/local/lib/tcc ifeq ($(UNAME), Windows_NT) LINKER_FLAGS = -static -DSDL_MAIN_HANDLED @@ -87,17 +89,17 @@ ifeq ($(UNAME), Windows_NT) CLIBS = glew32 EXT = .exe else - LINKER_FLAGS = - ELIBS = editor engine glfw3 m pthread + LINKER_FLAGS = -fPIC -rdynamic + ELIBS = editor engine glfw3 m c tcc tcc1 CLIBS = EXT = endif ELIBS != $(call prefix, $(ELIBS), -l) -CLIBS != $(call prefix, $(CLIBS), -l) +#CLIBS != $(call prefix, $(CLIBS), -l) #LELIBS = -Wl,-Bstatic $(ELIBS)# -Wl,-Bdynamic $(CLIBS) -LELIBS = $(ELIBS) #$(CLIBS) +LELIBS = $(ELIBS) $(CLIBS) objects = $(bsobjects) $(eobjects) $(pinobjects) DEPENDS = $(objects:.o=.d) diff --git a/source/engine/engine.c b/source/engine/engine.c index 6439c0c..21cf662 100755 --- a/source/engine/engine.c +++ b/source/engine/engine.c @@ -40,11 +40,12 @@ void error_callback(int error, const char *description) void engine_init() { + glfwSetErrorCallback(error_callback); /* Initialize GLFW */ if (!glfwInit()) { printf("Could not init GLFW\n"); } - glfwSetErrorCallback(error_callback); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);