From e59529d3f55b9128f798a7f02a7288f96bdaf9a4 Mon Sep 17 00:00:00 2001 From: Chuyan Zhang Date: Thu, 3 Oct 2024 19:49:47 -0700 Subject: use xmake build & scene load wip --- xmake.lua | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 xmake.lua (limited to 'xmake.lua') diff --git a/xmake.lua b/xmake.lua new file mode 100644 index 0000000..1b9730f --- /dev/null +++ b/xmake.lua @@ -0,0 +1,78 @@ +add_rules("mode.debug", "mode.release") + +-- Project settings +set_project("iris_renderer") +set_version("1.0") +set_languages("c++20") + + +-- Project directories +local project_root = os.projectdir() +local src_dir = path.join(project_root, "src") +local ext_dir = path.join(project_root, "ext") + +-- ImGui target +target("imgui") + set_kind("static") + local imgui_dir = path.join(ext_dir, "imgui") + + -- Add source files + add_files( + path.join(imgui_dir, "imgui.cpp"), + path.join(imgui_dir, "imgui_demo.cpp"), + path.join(imgui_dir, "imgui_draw.cpp"), + path.join(imgui_dir, "imgui_tables.cpp"), + path.join(imgui_dir, "imgui_widgets.cpp"), + path.join(imgui_dir, "backends/imgui_impl_glfw.cpp"), + path.join(imgui_dir, "backends/imgui_impl_vulkan.cpp") + ) + + -- Add include directories + add_includedirs( + imgui_dir, + path.join(imgui_dir, "backends"), + {public = true} + ) + +-- Arguments for compilation +target("argparse") + set_kind("headeronly") + add_includedirs(path.join(ext_dir, "argparse/include"), {public = true}) + +target("tinygltf") + set_kind("headeronly") + add_includedirs(path.join(ext_dir, "tinygltf.git"), {public = true}) + add_cxxflags("-w") + +target("tinyobjloader") + set_kind("headeronly") + add_includedirs(path.join(ext_dir, "tinyobjloader"), {public = true}) + +target("stb") + set_kind("headeronly") + add_includedirs(path.join(ext_dir, "stb"), {public = true}) + +-- Main executable target +target("iris_renderer") + set_kind("binary") + add_files(path.join(src_dir, "**.cpp")) + + -- Link external libraries + add_deps("argparse", "imgui", "tinygltf", "tinyobjloader", "stb") + + -- Add libraries + add_packages("vulkansdk", "glfw", "fmt", "vulkan-memory-allocator", "spdlog", "glm") + add_syslinks("vulkan", "glfw", "fmt") + + -- OS-specific libraries (dl, pthread, X11, etc.) + if is_plat("linux") then + add_syslinks("dl", "pthread", "X11", "Xxf86vm", "Xrandr", "Xi") + end + + -- Compiler options + add_cxxflags("-Wall", "-Wextra", "-Wno-missing-field-initializers") + + -- Vulkan validation layers for debug builds + if is_mode("debug") then + add_defines("USE_VULKAN_VALIDATION_LAYERS") + end -- cgit v1.2.3-70-g09d2