From 0910cdbf081c1cbec24a216a3ec8487cb7305e7d Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 28 Sep 2024 07:21:21 -0500 Subject: [PATCH] Add `xmake` build support --- xmake.lua | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 xmake.lua diff --git a/xmake.lua b/xmake.lua new file mode 100644 index 0000000..e356235 --- /dev/null +++ b/xmake.lua @@ -0,0 +1,51 @@ +-- set project +set_project("nifly") +set_languages("c++17") +set_license("GPL-3.0") + +-- define options +option("tests", { default = false, description = "Enable tests" }) + +-- require packages +add_requires("half", "miniball") + +if has_config("tests") then + add_requires("catch2 v2.13.10") +end + +-- define targets +target("nifly", function() + set_kind("static") + + -- bind package dependencies + add_packages("half", "miniball", { public = true }) + + -- add all source files + add_files("src/**.cpp") + + -- add all header files + add_includedirs("include", { public = true }) + add_headerfiles("include/(**.hpp)", { prefixdir = "nifly" }) + + -- add flags + add_cxxflags("cl::/Zc:inline", "cl::/bigobj") +end) + +if has_config("tests") then + target("nifly-tests", function() + -- add target dependencies + add_deps("nifly") + + -- bind package dependencies + add_packages("catch2") + + -- add all source files, except TestNifFileOptional + add_files("tests/*.cpp|TestNifFileOptional.cpp") + + -- add all header files + add_includedirs("tests") + + -- set run directory + set_rundir("tests") + end) +end