aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac23
-rw-r--r--src/Makefile.am13
-rw-r--r--src/engine.cpp2
-rw-r--r--src/stb_image.c2
4 files changed, 27 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index 8a2c3d4..aae39c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,23 @@ AS_IF([test "x$VULKAN_SDK" != x], [AC_MSG_RESULT([yes])], [
AC_LANG([C])
CFLAGS_save="$CFLAGS"
LIBS_save="$LIBS"
+
+CFLAGS="$STB_CFLAGS"
+LIBS="$LIBS $STB_LIBS"
+AC_MSG_CHECKING([for STBI version 1])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([
+#define STB_IMAGE_IMPLEMENTATION
+#include <stb_image.h>
+dnl
+dnl we are not really checking for stbi version, this is to check if the header is truly included
+dnl without problems
+],[if (STBI_VERSION != 1) exit(1)])], [AC_MSG_RESULT([yes])], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([STBI not found, or wrong version (1 required)])
+])
+AC_SUBST([STB_CFLAGS])
+AC_SUBST([STB_LIBS])
+
CFLAGS="$VULKAN_CFLAGS"
LIBS="$LIBS $VULKAN_LIBS"
AC_MSG_CHECKING([for Vulkan version 1.4.313])
@@ -38,12 +55,12 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_MSG_RESULT([no])
AC_MSG_ERROR([Vulkan not found, or wrong version (1.4.313 required)])
])
-CFLAGS="$CFLAGS_save"
-LIBS="$LIBS_save"
-
AC_SUBST([VULKAN_CFLAGS])
AC_SUBST([VULKAN_LIBS])
+CFLAGS="$CFLAGS_save"
+LIBS="$LIBS_save"
+
PKG_HAVE_DEFINE_WITH_MODULES([NCURSES], [ncurses >= 6.4.20230625])
AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index ad18692..88e4ee3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,6 +9,7 @@ engine_SOURCES = \
renderer.hpp renderer.cpp \
obj_parser.hpp obj_parser.cpp \
vulkan_utils.hpp \
+ stb_image.c \
fb/chfb.hpp fb/chfb.cpp fb/pixfb.hpp fb/pixfb.cpp \
math/vector.hpp \
math/mat4.hpp \
@@ -25,17 +26,9 @@ engine_SOURCES = \
o3d/scene.hpp \
ctrl/keyboard.hpp \
ctrl/mouse.hpp
-engine_CPPFLAGS = -std=gnu++23 -Wall -Wextra
+engine_CPPFLAGS = -std=gnu++23 -Wall -Wextra -DDATADIR='"$(datadir)"' -DSHADERSDIR='"$(shadersdir)"' $(GLFW3_CFLAGS) $(STB_CFLAGS) $(VULKAN_CFLAGS)
engine_LDFLAGS = -std=gnu++23 -Wall -Wextra
-
-engine_CPPFLAGS += -DDATADIR='"$(datadir)"' -DSHADERSDIR='"$(shadersdir)"'
-
-# Not sure why they are needed
-engine_LDADD =# -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi
-engine_CPPFLAGS += $(GLFW3_CFLAGS)
-engine_LDADD += $(GLFW3_LIBS)
-engine_CPPFLAGS += $(VULKAN_CFLAGS)
-engine_LDADD += $(VULKAN_LIBS)
+engine_LDADD = $(GLFW3_LIBS) $(STB_LIBS) $(VULKAN_LIBS)
if HAVE_NCURSES
engine_CPPFLAGS += $(NCURSES_CFLAGS)
diff --git a/src/engine.cpp b/src/engine.cpp
index 792b99f..4ab8c60 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -26,6 +26,8 @@
#include <GLFW/glfw3.h>
#include <vulkan/vk_enum_string_helper.h>
+#include <stb_image.h>
+
#ifdef HAVE_NCURSES
#include <ncurses.h>
#endif
diff --git a/src/stb_image.c b/src/stb_image.c
new file mode 100644
index 0000000..9177288
--- /dev/null
+++ b/src/stb_image.c
@@ -0,0 +1,2 @@
+#define STB_IMAGE_IMPLEMENTATION
+#include <stb_image.h>