summaryrefslogtreecommitdiff
path: root/xmake.lua
diff options
context:
space:
mode:
authorLeon Kang <2090093273@qq.com>2024-10-03 21:04:37 -0700
committerLeon Kang <2090093273@qq.com>2024-10-03 21:04:37 -0700
commit1f47c662a07ec83d4033b1a5f4b48dd8dfa58b7b (patch)
treecfb8941b80d1bc672bf25dba3ca716a1e0bc0823 /xmake.lua
parentc1ceb18d1c6d8af1266fc9cb9233e2328dd4d723 (diff)
parente59529d3f55b9128f798a7f02a7288f96bdaf9a4 (diff)
downloadiris-1f47c662a07ec83d4033b1a5f4b48dd8dfa58b7b.tar.gz
iris-1f47c662a07ec83d4033b1a5f4b48dd8dfa58b7b.zip
Merge branch 'main' into windows-build
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