aboutsummaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2026-02-15 15:11:49 +0100
committervimene <vincent.menegaux@gmail.com>2026-02-15 15:11:49 +0100
commit7536dd705d121ed3a49b7e4b05af88fd241d1674 (patch)
tree5ed271fd91c76360319e49c79883f969fafad283 /Makefile.am
parent950f577a5b82c72fd2acdfa81cbac1db3f177fc6 (diff)
downloadengine-7536dd705d121ed3a49b7e4b05af88fd241d1674.tar.gz
more improvements in builds setup
- moved slang shaders to spvshaders to separate software and hardware shaders - split Makefile.am into Makefile.am, src/Makefile.am and src/spvshaders/Makefile.am - build shaders as DATA primary, instead of both PROGRAMS and SCRIPTS, which greatly simplifies building. Before that, we had to first build them as PROGRAMS, and then copy them as SCRIPTS to remove executable extensions (i.e. ".exe" for Windows) - changed final executable dir from enginedir to bindir, which makes automake see it as an exec instead of data - compute relative paths from C++, which makes it possible to change dirs arbitrarily when running make while still having a relocatable executable - updated README.md to reflect changes in dirs - use AX_COMPARE_VERSION() to simplify checking if Vulkan headers version is correct - factored out most of paths computation in engine::path_utils::Paths
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am88
1 files changed, 3 insertions, 85 deletions
diff --git a/Makefile.am b/Makefile.am
index 1930529..6e7a500 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,27 +1,9 @@
+include common.am
+
+SUBDIRS = src src/spvshaders
EXTRA_DIST = m4/NOTES
ACLOCAL_AMFLAGS = -Im4 --install
-# TODO: right now, the source tree and the install tree must share the same structure, which is very
-# bad, because for example this causes "src" to be used as a final directory
-# TODO: make variable for each subdirectory name, instead of copying it everywhere
-# TODO: we shouldn't have everything in a single Makefile.am
-if DEBUG
-ASSETS_DIR_CPP = $(srcdir)/assets
-ASSETS_OBJS_DIR_CPP = $(srcdir)/assets/objs
-ASSETS_TEXTURES_DIR_CPP = $(srcdir)/assets/textures
-SHADERS_DIR_CPP = $(builddir)
-else
-ASSETS_DIR_CPP = assets
-ASSETS_OBJS_DIR_CPP = assets/objs
-ASSETS_TEXTURES_DIR_CPP = assets/textures
-SHADERS_DIR_CPP = shaders
-endif
-
-enginedir = $(datarootdir)/engine
-assetsdir = $(enginedir)/assets
-assets_objsdir = $(assetsdir)/objs
-assets_texturesdir = $(assetsdir)/textures
-shadersdir = $(enginedir)/shaders
assets_objs_DATA = \
assets/objs/suzanne.obj \
assets/objs/viking_room.obj
@@ -41,67 +23,3 @@ EXTRA_DIST += $(assets_objs_DATA) $(assets_textures_DATA)
# comes from here https://sketchfab.com/3d-models/viking-room-a49f1b8e4f5c4ecf9e1fe7d81915ad38,
# modified by the author(s) of the vulkan tutorials (see
# https://docs.vulkan.org/tutorial/latest/08_Loading_models.html#_sample_mesh)
-
-engine_PROGRAMS = engine
-shaders_SCRIPTS = shader.spv
-noinst_PROGRAMS = shader.spv.rmext
-CLEANFILES = shader.spv shader.spv.rmext
-
-engine_SOURCES = \
- src/engine.cpp \
- src/renderer.hpp src/renderer.cpp \
- src/obj_parser.hpp src/obj_parser.cpp \
- src/vulkan_utils.hpp \
- src/path_utils.hpp src/path_utils.cpp \
- src/stb_image.h \
- src/stb_image.cpp \
- src/fb/fb.hpp \
- src/fb/chfb.hpp src/fb/chfb.cpp \
- src/fb/pixfb.hpp src/fb/pixfb.cpp \
- src/math/utils.hpp \
- src/math/vector.hpp \
- src/math/mat4.hpp \
- src/math/quat.hpp \
- src/math/tform.hpp \
- src/o3d/mesh.hpp src/o3d/mesh.cpp \
- src/o3d/obj3d.hpp \
- src/o3d/vertex.hpp \
- src/o3d/deriv_vertex.hpp \
- src/o3d/tri.hpp \
- src/o3d/tri_deriv.hpp \
- src/o3d/polygon.hpp \
- src/o3d/camera.hpp \
- src/o3d/scene.hpp \
- src/ctrl/keyboard.hpp \
- src/ctrl/mouse.hpp \
- src/shaders/shaders.hpp \
- src/shaders/simple_shaders.hpp src/shaders/simple_shaders.cpp
-
-shader_spv_rmext_SOURCES = src/shaders/shader.slang
-
-engine_CPPFLAGS = -std=gnu++23 -Wall -Wextra -I'$(srcdir)/src' \
- -DASSETS_DIR='"$(ASSETS_DIR_CPP)"' \
- -DASSETS_OBJS_DIR='"$(ASSETS_OBJS_DIR_CPP)"' \
- -DASSETS_TEXTURES_DIR='"$(ASSETS_TEXTURES_DIR_CPP)"' \
- -DSHADERS_DIR='"$(SHADERS_DIR_CPP)"' \
- $(GLFW3_CFLAGS) $(VULKAN_CFLAGS)
-if !DEBUG
-engine_CPPFLAGS += -DNDEBUG
-endif
-engine_LDFLAGS = -std=gnu++23 -Wall -Wextra
-engine_LDADD = $(GLFW3_LIBS) $(VULKAN_LIBS)
-
-if HAVE_NCURSES
-engine_CPPFLAGS += $(NCURSES_CFLAGS)
-engine_LDADD += $(NCURSES_LIBS)
-endif
-
-src/engine-stb_image.$(OBJEXT): CXXFLAGS += -Wno-unused-but-set-variable
-
-shader_spv_rmext_SLANGFLAGS = -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name -entry vert_main -entry frag_main
-
-shader.spv.rmext$(EXEEXT): src/shaders/shader.slang
- $(SLANGC) $(shader_spv_rmext_SLANGFLAGS) -o $@ $<
-
-shader.spv: shader.spv.rmext$(EXEEXT)
- cp -f $< $@