diff options
| author | ruki <[email protected]> | 2022-08-05 00:45:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-08-05 00:45:59 +0800 |
| commit | 88c91ec3ff285ba148a04a01e8e32bdf2b186dc5 (patch) | |
| tree | d0faca1f84258772053d25b85f8fe228228bdb0a /xmake/rules/c++/modules/modules_support | |
| parent | fc011e7ae96d00c209550022ce44f66ec002a474 (diff) | |
use projectdir var
Diffstat (limited to 'xmake/rules/c++/modules/modules_support')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc.lua | 14 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc.lua | 3 |
3 files changed, 12 insertions, 8 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index c53716d51..00434ef81 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -143,6 +143,7 @@ function generate_headerunits(target, batchcmds, headerunits, opt) local objectfiles = {} local public_flags = {} local private_flags = {} + local projectdir = os.projectdir() for _, headerunit in ipairs(headerunits) do if not headerunit.stl then local file = path.relative(headerunit.path, target:scriptdir()) @@ -150,7 +151,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 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) diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index 37bcf0b89..02c48524f 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -131,13 +131,14 @@ function generate_headerunits(target, batchcmds, headerunits, opt) local objectfiles = {} local public_flags = {} local private_flags = {} + local projectdir = os.projectdir() for _, headerunit in ipairs(headerunits) do if not headerunit.stl then local file = path.relative(headerunit.path, target:scriptdir()) local objectfile = target:objectfile(file) local outputdir if headerunit.type == ":quote" then - outputdir = path.join(cachedir, path.directory(path.relative(headerunit.path, project.directory()))) + outputdir = path.join(cachedir, path.directory(path.relative(headerunit.path, projectdir))) else outputdir = path.join(cachedir, path.directory(headerunit.path):sub(3)) end |
