summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/gcc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-05 00:45:59 +0800
committerruki <[email protected]>2022-08-05 00:45:59 +0800
commit88c91ec3ff285ba148a04a01e8e32bdf2b186dc5 (patch)
treed0faca1f84258772053d25b85f8fe228228bdb0a /xmake/rules/c++/modules/modules_support/gcc.lua
parentfc011e7ae96d00c209550022ce44f66ec002a474 (diff)
use projectdir var
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/gcc.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/gcc.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua
index afa8d249d..e46ff6d7f 100644
--- a/xmake/rules/c++/modules/modules_support/gcc.lua
+++ b/xmake/rules/c++/modules/modules_support/gcc.lua
@@ -153,6 +153,7 @@ function generate_headerunits(target, batchcmds, headerunits, opt)
-- build headerunits
local objectfiles = {}
+ local projectdir = os.projectdir()
for _, headerunit in ipairs(headerunits) do
if not headerunit.stl then
local file = path.relative(headerunit.path, target:scriptdir())
@@ -160,7 +161,7 @@ function generate_headerunits(target, batchcmds, headerunits, opt)
local outdir
if headerunit.type == ":quote" then
- outdir = path.join(cachedir, path.directory(path.relative(headerunit.path, project.directory())))
+ outdir = path.join(cachedir, path.directory(path.relative(headerunit.path, projectdir)))
else
outdir = path.join(cachedir, path.directory(headerunit.path))
end
@@ -174,14 +175,14 @@ function generate_headerunits(target, batchcmds, headerunits, opt)
os.mkdir(path.directory(objectfile))
end
- if _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, project.directory())) then
+ if _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, projectdir)) then
local args = { "-c" }
if headerunit.type == ":quote" then
table.join2(args, { "-I", path.directory(headerunit.path), "-x", "c++-user-header", headerunit.name })
- _add_module_to_mapper(mapper_file, path.join(".", path.relative(headerunit.path, project.directory())), path.absolute(bmifile, project.directory()))
+ _add_module_to_mapper(mapper_file, path.join(".", path.relative(headerunit.path, projectdir)), path.absolute(bmifile, projectdir))
elseif headerunit.type == ":angle" then
table.join2(args, { "-x", "c++-system-header", headerunit.name })
- _add_module_to_mapper(mapper_file, headerunit.name, path.absolute(bmifile, project.directory()))
+ _add_module_to_mapper(mapper_file, headerunit.name, path.absolute(bmifile, projectdir))
end
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.headerunit.bmi %s", headerunit.name)
@@ -193,7 +194,7 @@ function generate_headerunits(target, batchcmds, headerunits, opt)
end
else
local bmifile = path.join(stlcachedir, headerunit.name .. get_bmi_extension())
- if _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, project.directory())) then
+ if _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, projectdir)) then
if not os.isfile(bmifile) then
local args = { "-c", "-x", "c++-system-header", headerunit.name }
@@ -214,6 +215,7 @@ function build_modules(target, batchcmds, objectfiles, modules, opt)
local compinst = target:compiler("cxx")
local mapper_file = _get_module_mapper()
local common_args = {"-x", "c++"}
+ local projectdir = os.projectdir()
for _, objectfile in ipairs(objectfiles) do
local m = modules[objectfile]
if m then
@@ -226,7 +228,7 @@ function build_modules(target, batchcmds, objectfiles, modules, opt)
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.module.bmi %s", name)
local bmifile = provide.bmi
- if _add_module_to_mapper(mapper_file, name, path.absolute(bmifile, project.directory())) then
+ if _add_module_to_mapper(mapper_file, name, path.absolute(bmifile, projectdir)) then
table.join2(args, {"-c", provide.sourcefile})
batchcmds:add_depfiles(provide.sourcefile)