diff options
| author | ruki <[email protected]> | 2022-08-03 23:54:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-08-03 23:54:18 +0800 |
| commit | e387de53870b6ac9432a6599d9904910b088bc7c (patch) | |
| tree | dfce3101044f0ebee0643c1b0f70bf12f3d2a291 | |
| parent | d1de4d49e4ae33ea5364bc996a64622fa59af9eb (diff) | |
remove tailing spaces
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang.lua | 38 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/common.lua | 20 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc.lua | 48 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc.lua | 14 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/xmake.lua | 6 |
5 files changed, 63 insertions, 63 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index 49dbee0a2..666eb2135 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -62,34 +62,34 @@ function check_module_support(target) end function toolchain_include_directories(target) - local includedirs = _g.includedirs - if includedirs == nil then + local includedirs = _g.includedirs + if includedirs == nil then includedirs = {} - local gcc, toolname = target:tool("cc") - assert(toolname, "clang") - - local _, result = try {function () return os.iorunv(gcc, {"-E", "-Wp,-v", "-xc", os.nuldev()}) end} - if result then - for _, line in ipairs(result:split("\n", {plain = true})) do - line = line:trim() - if os.isdir(line) then + local gcc, toolname = target:tool("cc") + assert(toolname, "clang") + + local _, result = try {function () return os.iorunv(gcc, {"-E", "-Wp,-v", "-xc", os.nuldev()}) end} + if result then + for _, line in ipairs(result:split("\n", {plain = true})) do + line = line:trim() + if os.isdir(line) then table.append(includedirs, line) - break - elseif line:startswith("End") then - break - end - end + break + elseif line:startswith("End") then + break + end + end end _g.includedirs = includedirs or {} - end + end return includedirs end function generate_dependencies(target, sourcebatch, opt) local cachedir = common.get_cache_dir(target) - for _, sourcefile in ipairs(sourcebatch.sourcefiles) do + for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local dependfile = target:dependfile(sourcefile) depend.on_changed(function() progress.show(opt.progress, "${color.build.object}generating.cxx.module.deps %s", sourcefile) @@ -229,7 +229,7 @@ function build_modules(target, batchcmds, objectfiles, modules, opt) batchcmds:set_depcache(target:dependfile(bmifile)) table.join2(flag, { modulefileflag .. bmifile }) - end + end batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args)) batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, bmifiles, {"-c", "-o", objectfile})) @@ -381,4 +381,4 @@ function has_headerunitsupport(target) _g.support_headerunits = support_headerunits or false end return support_headerunits -end
\ No newline at end of file +end diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index e706f4e81..176d89c4b 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -88,7 +88,7 @@ _g.stl_headers = { function get_stl_headers() return hashset.from(_g.stl_headers) -end +end function is_stl_header(header) return get_stl_headers():has(header) @@ -120,7 +120,7 @@ function patch_sourcebatch(target, sourcebatch, opt) sourcebatch.objectfiles = sourcebatch.objectfiles or {} sourcebatch.dependfiles = sourcebatch.dependfiles or {} - for _, sourcefile in ipairs(sourcebatch.sourcefiles) do + for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local objectfile = target:objectfile(sourcefile) local dependfile = target:dependfile(objectfile) table.insert(sourcebatch.objectfiles, objectfile) @@ -215,9 +215,9 @@ function parse_dependency_data(target, moduleinfos, opt) local name = provide["logical-name"] .. get_bmi_ext(target) name:replace(":", "-") - m.provides[provide["logical-name"] ] = { - bmi = path.join(cachedir, name), - sourcefile = moduleinfo.sourcefile + m.provides[provide["logical-name"] ] = { + bmi = path.join(cachedir, name), + sourcefile = moduleinfo.sourcefile } end end @@ -250,7 +250,7 @@ function parse_dependency_data(target, moduleinfos, opt) } end end - end + end return modules end @@ -306,7 +306,7 @@ function sort_modules_by_dependencies(objectfiles, modules) local output = {} local nodes = {} - for _, objectfile in ipairs(objectfiles) do + for _, objectfile in ipairs(objectfiles) do local m = modules[objectfile] if m.provides then @@ -332,7 +332,7 @@ end function find_angle_header_file(target, file) -- check if the header is in subtarget - + local modules_support if target:has_tool("cxx", "clang", "clangxx") then modules_support = import("clang") @@ -420,7 +420,7 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile) if module_name then table.append(rule.outputs, module_name .. get_bmi_ext(target)) - + local provide = {} provide["logical-name"] = module_name provide["source-path"] = path.absolute(sourcefile, project.directory()) @@ -436,4 +436,4 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile) local jsondata = json.encode(output) io.writefile(jsonfile, jsondata) -end
\ No newline at end of file +end diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua index 0c8027b6e..db29c1bef 100644 --- a/xmake/rules/c++/modules/modules_support/gcc.lua +++ b/xmake/rules/c++/modules/modules_support/gcc.lua @@ -73,27 +73,27 @@ end -- provide toolchain include dir for stl headerunit when p1689 is not supported function toolchain_include_directories(target) - local includedirs = _g.includedirs - if includedirs == nil then + local includedirs = _g.includedirs + if includedirs == nil then includedirs = {} - - local gcc, toolname = target:tool("cc") - assert(toolname, "gcc") - - local _, result = try {function () return os.iorunv(gcc, {"-E", "-Wp,-v", "-xc", os.nuldev()}) end} - if result then - for _, line in ipairs(result:split("\n", {plain = true})) do - line = line:trim() - if os.isdir(line) then + + local gcc, toolname = target:tool("cc") + assert(toolname == "gcc") + + local _, result = try {function () return os.iorunv(gcc, {"-E", "-Wp,-v", "-xc", os.nuldev()}) end} + if result then + for _, line in ipairs(result:split("\n", {plain = true})) do + line = line:trim() + if os.isdir(line) then table.append(includedirs, line) - break - elseif line:startswith("End") then - break - end - end - end + break + elseif line:startswith("End") then + break + end + end + end _g.includedirs = includedirs or {} - end + end return includedirs end @@ -107,7 +107,7 @@ function generate_dependencies(target, sourcebatch, opt) local depfileflag = get_depfileflag(target) local depoutputflag = get_depoutputflag(target) - for _, sourcefile in ipairs(sourcebatch.sourcefiles) do + for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local dependfile = target:dependfile(sourcefile) depend.on_changed(function() progress.show(opt.progress, "${color.build.object}generating.cxx.module.deps %s", sourcefile) @@ -124,9 +124,9 @@ function generate_dependencies(target, sourcebatch, opt) local dfile = path.translate(path.join(outdir, path.filename(sourcefile) .. ".d")) local args = {sourcefile, "-MD", "-MT", jsonfile, "-MF", dfile, depfileflag .. jsonfile, trtbdflag, depoutputfile .. target:objectfile(sourcefile), "-o", ifile} - + os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args), {envs = vcvars}) - else + else common.fallback_generate_dependencies(target, jsonfile, sourcefile) end @@ -154,7 +154,7 @@ function generate_headerunits(target, batchcmds, sourcebatch, opt) local objectfile = target:objectfile(file) - local outdir + local outdir if headerunit.type == ":quote" then outdir = path.join(cachedir, path.directory(path.relative(headerunit.path, project.directory()))) else @@ -210,7 +210,7 @@ end -- build module files function build_modules(target, batchcmds, objectfiles, modules, opt) local cachedir = common.get_cache_dir(target) - + local compinst = target:compiler("cxx") local mapper_file = get_module_mapper() @@ -235,7 +235,7 @@ function build_modules(target, batchcmds, objectfiles, modules, opt) batchcmds:set_depmtime(os.mtime(bmifile)) batchcmds:set_depcache(target:dependfile(bmifile)) end - end + end batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args)) diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index 1851d678c..ca7ca19e7 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -90,9 +90,9 @@ function generate_dependencies(target, sourcebatch, opt) local scandependenciesflag = get_scandependenciesflag(target) local cachedir = common.get_cache_dir(target) - local common_args = {"/TP", scandependenciesflag} + local common_args = {"/TP", scandependenciesflag} - for _, sourcefile in ipairs(sourcebatch.sourcefiles) do + for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local dependfile = target:dependfile(sourcefile) depend.on_changed(function () progress.show(opt.progress, "${color.build.object}generating.cxx.module.deps %s", sourcefile) @@ -106,7 +106,7 @@ function generate_dependencies(target, sourcebatch, opt) if scandependenciesflag then local args = {jsonfile, sourcefile, "/Fo" .. target:objectfile(sourcefile)} - + os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args), {envs = vcvars}) else common.fallback_generate_dependencies(target, jsonfile, sourcefile) @@ -117,7 +117,7 @@ function generate_dependencies(target, sourcebatch, opt) return { moduleinfo = dependinfo } end, {dependfile = dependfile, files = {sourcefile}}) end -end +end -- generate target header units function generate_headerunits(target, batchcmds, sourcebatch, opt) @@ -198,7 +198,7 @@ end -- build module files function build_modules(target, batchcmds, objectfiles, modules, opt) local cachedir = common.get_cache_dir(target) - + local compinst = target:compiler("cxx") local toolchain = target:toolchain("msvc") local vcvars = toolchain:config("vcvars") @@ -237,7 +237,7 @@ function build_modules(target, batchcmds, objectfiles, modules, opt) batchcmds:set_depcache(target:dependfile(bmifile)) flag = {referenceflag, name .. "=" .. path.filename(bmifile)} - end + end batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args, bmi_args), {envs = vcvars}) @@ -339,7 +339,7 @@ function get_headerunitflag(target) local headerunitflag = _g.headerunitflag if headerunitflag == nil then local compinst = target:compiler("cxx") - if compinst:has_flags("/headerUnit:quote", "cxxflags", {flagskey = "cl_header_unit_quote"}) and + if compinst:has_flags("/headerUnit:quote", "cxxflags", {flagskey = "cl_header_unit_quote"}) and compinst:has_flags("/headerUnit:angle", "cxxflags", {flagskey = "cl_header_unit_angle"}) then headerunitflag = "/headerUnit" end diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index 313d932f9..785e8fed5 100644 --- a/xmake/rules/c++/modules/xmake.lua +++ b/xmake/rules/c++/modules/xmake.lua @@ -53,7 +53,7 @@ rule("c++.build.modules") rule("c++.build.modules.dependencies") - before_build(function(target, opt) + before_build(function(target, opt) if not target:data("cxx.has_modules") then return end @@ -141,7 +141,7 @@ rule("c++.build.modules.install") end local sourcebatch = target:sourcebatches()["c++.build.modules.install"] - if sourcebatch then + if sourcebatch then target:add("installfiles", sourcebatch.sourcefiles, {prefixdir = "include"}) end - end)
\ No newline at end of file + end) |
