From 1f76815be0e7ec87adde3afa9b28a3d8253e9a5f Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sat, 27 Apr 2024 23:56:00 +0300 Subject: [PATCH] added CMake source in XMake --- code/XMake/CMake.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 code/XMake/CMake.lua diff --git a/code/XMake/CMake.lua b/code/XMake/CMake.lua new file mode 100644 index 0000000..7675d9b --- /dev/null +++ b/code/XMake/CMake.lua @@ -0,0 +1,22 @@ +add_rules("mode.debug", "mode.release") + +package("foo") + add_deps("cmake") + set_sourcedir(path.join(os.scriptdir(), "foo")) + on_install(function (package) + local configs = {} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + end) + on_test(function (package) + assert(package:has_cfuncs("add", {includes = "foo.h"})) + end) +package_end() + +add_requires("foo") + +target("demo") + set_kind("binary") + add_files("src/main.c") + add_packages("foo")