From 5c4b98ecca5a0c437a1bb5679e4046f752ed1a42 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 2 Dec 2025 22:49:56 +0800 Subject: improve c++/objc++ rules --- xmake/rules/c++/xmake.lua | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'xmake/rules/c++/xmake.lua') diff --git a/xmake/rules/c++/xmake.lua b/xmake/rules/c++/xmake.lua index e0673837d..23e5f27bc 100644 --- a/xmake/rules/c++/xmake.lua +++ b/xmake/rules/c++/xmake.lua @@ -20,31 +20,19 @@ rule("c.build") set_sourcekinds("cc") - add_deps("c.build.pcheader", "c.build.optimization", "c.build.sanitizer") - on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) + add_deps("c.build.pcheader") on_config(function (target) - -- https://github.com/xmake-io/xmake/issues/4621 - if target:is_plat("windows") and target:is_static() and target:has_tool("cc", "tcc") then - target:set("extension", ".a") - target:set("prefixname", "lib") - end + import("rules.c++.config")(target, "cc") end) + on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) rule("c++.build") set_sourcekinds("cxx") - add_deps("c++.build.pcheader", "c++.build.modules", "c++.build.optimization", "c++.build.sanitizer") - on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) + add_deps("c++.build.pcheader", "c++.build.modules") on_config(function (target) - -- enable c++ exceptions by default - if target:is_plat("windows") and not target:get("exceptions") then - target:set("exceptions", "cxx") - end - -- https://github.com/xmake-io/xmake/issues/4621 - if target:is_plat("windows") and target:is_static() and target:has_tool("cxx", "tcc") then - target:set("extension", ".a") - target:set("prefixname", "lib") - end + import("rules.c++.config")(target, "cxx") end) + on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) rule("c") -- cgit v1.3.1 From ca52efa1eff5af56e0dc9197616e709ce1b97a25 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 2 Dec 2025 22:59:28 +0800 Subject: fix rules --- xmake/rules/c++/xmake.lua | 4 ++-- xmake/rules/objc++/xmake.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'xmake/rules/c++/xmake.lua') diff --git a/xmake/rules/c++/xmake.lua b/xmake/rules/c++/xmake.lua index 23e5f27bc..dbb24451d 100644 --- a/xmake/rules/c++/xmake.lua +++ b/xmake/rules/c++/xmake.lua @@ -22,7 +22,7 @@ rule("c.build") set_sourcekinds("cc") add_deps("c.build.pcheader") on_config(function (target) - import("rules.c++.config")(target, "cc") + import("config")(target, "cc") end) on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) @@ -30,7 +30,7 @@ rule("c++.build") set_sourcekinds("cxx") add_deps("c++.build.pcheader", "c++.build.modules") on_config(function (target) - import("rules.c++.config")(target, "cxx") + import("config")(target, "cxx") end) on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) diff --git a/xmake/rules/objc++/xmake.lua b/xmake/rules/objc++/xmake.lua index 321aa131a..23cdc3faa 100644 --- a/xmake/rules/objc++/xmake.lua +++ b/xmake/rules/objc++/xmake.lua @@ -23,7 +23,7 @@ rule("objc.build") set_sourcekinds("mm") add_deps("objc.build.pcheader") on_config(function (target) - import("rules.objc++.config")(target, "mm") + import("config")(target, "mm") end) on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) @@ -32,7 +32,7 @@ rule("objc++.build") set_sourcekinds("mxx") add_deps("objc++.build.pcheader") on_config(function (target) - import("rules.objc++.config")(target, "mxx") + import("config")(target, "mxx") end) on_build_files("private.action.build.object", {jobgraph = true, batch = true, distcc = true}) -- cgit v1.3.1