summaryrefslogtreecommitdiff
path: root/xmake.lua
diff options
context:
space:
mode:
authorChuyan Zhang <chuyan@ucsb.edu>2024-10-03 19:49:47 -0700
committerChuyan Zhang <chuyan@ucsb.edu>2024-10-03 19:49:47 -0700
commite59529d3f55b9128f798a7f02a7288f96bdaf9a4 (patch)
treeabdbb571e1dfa46ea85921135434bdfc6a6d11b9 /xmake.lua
parent4bb8fd5ac5c07e8756ae097e7f5d7f34697bc914 (diff)
downloadiris-e59529d3f55b9128f798a7f02a7288f96bdaf9a4.tar.gz
iris-e59529d3f55b9128f798a7f02a7288f96bdaf9a4.zip
use xmake build & scene load wip
Diffstat (limited to 'xmake.lua')
-rw-r--r--xmake.lua78
1 files changed, 78 insertions, 0 deletions
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