aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2025-12-10 17:16:12 +0100
committervimene <vincent.menegaux@gmail.com>2025-12-10 17:16:12 +0100
commitc666035bc6a51e4dd76daebefffaf8bbc951977c (patch)
treedabb19c541ef66faebb508ba3a06642737e31a3f /src
parent625d18a6053e28762c77efd3dd0d79fc01b0b0ef (diff)
downloadengine-c666035bc6a51e4dd76daebefffaf8bbc951977c.tar.gz
improved autotools usage
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am38
-rw-r--r--src/engine.cpp10
2 files changed, 43 insertions, 5 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..5a3b41d
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,38 @@
+bin_PROGRAMS = engine
+
+engine_SOURCES = \
+ engine.cpp \
+ renderer.h renderer.cpp \
+ obj_parser.h obj_parser.cpp \
+ fb/fb.h fb/chfb.h fb/chfb.cpp fb/pixfb.h fb/pixfb.cpp \
+ math/vector.h \
+ math/mat4.h \
+ math/quat.h \
+ math/tform.h \
+ o3d/mesh.h o3d/mesh.cpp \
+ o3d/obj3d.h \
+ o3d/vertex_data.h \
+ o3d/vertex.h \
+ o3d/deriv_vertex.h \
+ o3d/tri.h \
+ o3d/tri_deriv.h o3d/tri_deriv.cpp \
+ o3d/camera.h \
+ o3d/scene.h \
+ ctrl/keyboard.h \
+ ctrl/mouse.h
+engine_CPPFLAGS = -std=gnu++23 -Wall -Wextra
+engine_LDFLAGS = -std=gnu++23 -Wall -Wextra
+
+engine_CPPFLAGS += -DDATADIR='"$(datadir)"'
+
+# 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)
+
+if HAVE_NCURSES
+engine_CPPFLAGS += $(NCURSES_CFLAGS)
+engine_LDADD += $(NCURSES_LIBS)
+endif
diff --git a/src/engine.cpp b/src/engine.cpp
index da28f75..2acba89 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -19,7 +19,7 @@
#include <GLFW/glfw3.h>
#include <vulkan/vk_enum_string_helper.h>
-#ifdef ENABLE_NCURSES
+#ifdef HAVE_NCURSES
#include <ncurses.h>
#endif
@@ -106,7 +106,7 @@ static void scene_main(Renderer<FrameBuffer>& renderer, const Matrix4& final_tra
},
#elif GAME == GAME_SUZANNE
{
- engine::parse_object("../assets/suzanne.obj"),
+ engine::parse_object(DATADIR "/assets/suzanne.obj"),
{
Vector3(0.f, 0.f, 0.f),
Quaternion::one(),
@@ -123,7 +123,7 @@ static void scene_main(Renderer<FrameBuffer>& renderer, const Matrix4& final_tra
}
},
{
- engine::parse_object("../assets/suzanne.obj"),
+ engine::parse_object(DATADIR "/assets/suzanne.obj"),
{
Vector3(0.f, 1.f, 0.f),
Quaternion::one(),
@@ -184,7 +184,7 @@ static void scene_main(Renderer<FrameBuffer>& renderer, const Matrix4& final_tra
}
}
-#ifdef ENABLE_NCURSES
+#ifdef HAVE_NCURSES
#define MKEY_ESC 27
static int main_term() {
@@ -521,7 +521,7 @@ int main(int argc, char *argv[]) {
print_usage(std::cout);
return EXIT_SUCCESS;
case MODE_TERM:
-#ifdef ENABLE_NCURSES
+#ifdef HAVE_NCURSES
return main_term();
#else
std::cerr << "Error: ncurses was not enabled during compilation." << std::endl;