summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2026-04-01 23:29:57 +0800
committerruki <[email protected]>2026-04-01 23:29:57 +0800
commiteedaa8c079ee0eb4cf9175db5c51f11c2748dcfd (patch)
tree60595dd04b81c7c6bf74f8ddb6d52292b397febf /xmake
parentf416451b312c06a3b9d48ea389450dfa9b11d376 (diff)
improve utils.replace
Diffstat (limited to 'xmake')
-rw-r--r--xmake/rules/utils/replace/xmake.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmake/rules/utils/replace/xmake.lua b/xmake/rules/utils/replace/xmake.lua
index 47340cb1a..da04a0720 100644
--- a/xmake/rules/utils/replace/xmake.lua
+++ b/xmake/rules/utils/replace/xmake.lua
@@ -45,6 +45,11 @@ rule("utils.replace")
-- get the replaced file path
local replacefile = target:autogenfile(sourcefile)
+ -- add the original source directory as includedir for the replaced file,
+ -- so that relative #include paths still work
+ local sourcedir = path.directory(path.absolute(sourcefile))
+ target:fileconfig_add(replacefile, {includedirs = sourcedir})
+
-- replace the sourcefile in the build sourcebatch,
-- so that the compiler uses the replaced file instead of the original
for _, sourcebatch in pairs(target:sourcebatches()) do