summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-10 23:22:20 +0800
committerGitHub <[email protected]>2025-12-10 23:22:20 +0800
commit245d472158edc782c4ee7ddb6d47be65270c5451 (patch)
tree4ca07a5aebef1b1d018464324bd0927e0eb99b7b
parent4bf9a07b5c5b375f16199e61bacee266025b5957 (diff)
parentd7787802f3ea77850958818e3bd827cd14b4d7dd (diff)
Merge pull request #7104 from Shiffted/fix_module_projects
Fix prepare for project generators
-rw-r--r--xmake/plugins/project/clang/compile_commands.lua1
-rw-r--r--xmake/plugins/project/clang/compile_flags.lua1
-rw-r--r--xmake/rules/c++/precompiled_header/xmake.lua8
3 files changed, 8 insertions, 2 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua
index 9435819df..a017b4a32 100644
--- a/xmake/plugins/project/clang/compile_commands.lua
+++ b/xmake/plugins/project/clang/compile_commands.lua
@@ -308,6 +308,7 @@ function make(outputdir)
local oldir = os.cd(os.projectdir())
local jsonfile = io.open(path.join(outputdir, "compile_commands.json"), "w")
os.setenv("XMAKE_IN_COMPILE_COMMANDS_PROJECT_GENERATOR", "true")
+ target_cmds.prepare_targets()
_add_targets(jsonfile)
jsonfile:close()
os.setenv("XMAKE_IN_COMPILE_COMMANDS_PROJECT_GENERATOR", nil)
diff --git a/xmake/plugins/project/clang/compile_flags.lua b/xmake/plugins/project/clang/compile_flags.lua
index e4b07ec34..07f9de38c 100644
--- a/xmake/plugins/project/clang/compile_flags.lua
+++ b/xmake/plugins/project/clang/compile_flags.lua
@@ -23,6 +23,7 @@ import("core.tool.compiler")
import("core.project.project")
import("core.language.language")
import("private.utils.target", {alias = "target_utils"})
+import("plugins.project.utils.target_cmds", {rootdir = os.programdir()})
-- make the object
function _make_object(target, flags, sourcefile, objectfile)
diff --git a/xmake/rules/c++/precompiled_header/xmake.lua b/xmake/rules/c++/precompiled_header/xmake.lua
index dc6fcb27e..a2b08fe46 100644
--- a/xmake/rules/c++/precompiled_header/xmake.lua
+++ b/xmake/rules/c++/precompiled_header/xmake.lua
@@ -23,7 +23,9 @@ rule("c.build.pcheader")
import("private.action.build.pcheader").config(target, "c", opt)
end)
before_prepare(function (target, jobgraph, opt)
- import("private.action.build.pcheader").build(target, jobgraph, "c", opt)
+ if not os.getenv("XMAKE_IN_COMPILE_COMMANDS_PROJECT_GENERATOR") then
+ import("private.action.build.pcheader").build(target, jobgraph, "c", opt)
+ end
end, {jobgraph = true})
rule("c++.build.pcheader")
@@ -32,6 +34,8 @@ rule("c++.build.pcheader")
import("private.action.build.pcheader").config(target, "cxx", opt)
end)
before_prepare(function (target, jobgraph, opt)
- import("private.action.build.pcheader").build(target, jobgraph, "cxx", opt)
+ if not os.getenv("XMAKE_IN_COMPILE_COMMANDS_PROJECT_GENERATOR") then
+ import("private.action.build.pcheader").build(target, jobgraph, "cxx", opt)
+ end
end, {jobgraph = true})