From 435ae52352ee2e655063e3750a41abae7fca5d82 Mon Sep 17 00:00:00 2001 From: klemek Date: Sat, 13 Sep 2025 15:38:52 +0200 Subject: [PATCH] fixed includes --- .github/workflows/ci.yml | 2 +- Makefile.am | 2 +- Makefile.dev | 1 + compile_flags.txt | 3 ++- src/forge.c | 2 ++ src/glfw.h | 10 ---------- src/shaders.c | 1 + src/types.h | 3 --- src/window.c | 6 +++++- 9 files changed, 13 insertions(+), 17 deletions(-) delete mode 100644 src/glfw.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2164ea6..0147115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - name: install libs run: sudo apt install -y libglfw3-dev libgl-dev - name: gcc - run: mkdir -p build && gcc -v -Wall -Wextra -Werror src/*.c src/*.h -lglfw -lGL -lm -Iinclude + run: mkdir -p build && gcc -v -Wall -Wextra -Werror src/*.c src/*.h -lglfw -lGL -lm -Iinclude -DGLFW_INCLUDE_NONE build-release: needs: lint diff --git a/Makefile.am b/Makefile.am index f26aaeb..061ef18 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = foreign subdir-objects -Wall bin_PROGRAMS = forge forge_SOURCES = src/main.c src/args.c src/forge.c src/file.c src/window.c src/shaders.c $(top_srcdir)/include/glad/gl.h $(top_srcdir)/include/linmath.h -forge_CFLAGS = -Ofast -march=native -flto -funroll-loops -fprefetch-loop-arrays -fno-exceptions -fopenmp -I$(top_srcdir)/include +forge_CFLAGS = -Ofast -march=native -flto -funroll-loops -fprefetch-loop-arrays -fno-exceptions -fopenmp -I$(top_srcdir)/include -DGLFW_INCLUDE_NONE forge_LDADD = -lm -lGL -lglfw include_HEADERS = src/main.h src/args.h src/config.h src/types.h src/forge.h src/file.h src/constants.h src/window.h src/shaders.h \ No newline at end of file diff --git a/Makefile.dev b/Makefile.dev index ec84400..2618453 100644 --- a/Makefile.dev +++ b/Makefile.dev @@ -14,6 +14,7 @@ build: -Iinclude \ -lm -lGL -lglfw \ -Wall -Wextra \ + -DGLFW_INCLUDE_NONE \ -o build/$(TARGET) run: build diff --git a/compile_flags.txt b/compile_flags.txt index ec5adba..d165ba5 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -1 +1,2 @@ --Iinclude \ No newline at end of file +-Iinclude +-DGLFW_INCLUDE_NONE \ No newline at end of file diff --git a/src/forge.c b/src/forge.c index 87ae86e..93fbb14 100644 --- a/src/forge.c +++ b/src/forge.c @@ -1,7 +1,9 @@ +#include #include #include #include +#include #include #include "file.h" diff --git a/src/glfw.h b/src/glfw.h deleted file mode 100644 index 28e7f7b..0000000 --- a/src/glfw.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GLFW_H -#define GLFW_H - -#define GLAD_GL_IMPLEMENTATION -#include - -#define GLFW_INCLUDE_NONE -#include - -#endif \ No newline at end of file diff --git a/src/shaders.c b/src/shaders.c index 85a652a..3ca1f2e 100644 --- a/src/shaders.c +++ b/src/shaders.c @@ -1,6 +1,7 @@ #include #include +#include #include #include "constants.h" diff --git a/src/types.h b/src/types.h index 3979894..f0ccc3e 100644 --- a/src/types.h +++ b/src/types.h @@ -4,10 +4,7 @@ #include #include -#ifndef GLFW_INCLUDE_NONE -#define GLFW_INCLUDE_NONE #include -#endif #ifndef TYPES_H #define TYPES_H diff --git a/src/window.c b/src/window.c index 6a374e4..958beb3 100644 --- a/src/window.c +++ b/src/window.c @@ -1,3 +1,4 @@ +#include #include #include @@ -6,7 +7,10 @@ #include "config.h" #include "types.h" -#include "glfw.h" +#ifndef GLAD_GL_IMPLEMENTATION +#define GLAD_GL_IMPLEMENTATION +#include +#endif // TODO split into smaller functions // TODO custom struct to remove glfw in signature