From 57453e7c479bd4a47b7ebfeb2d56f3eac90e269d Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Mon, 16 Jan 2023 14:03:13 +0100 Subject: Revert "Add support of -fmodule-output on llvm >= 16" This reverts commit 06b1bf2bbfb88188e2a79eb6a42afbb345737dc1. --- core/src/tbox/tbox | 2 +- xmake/rules/c++/modules/modules_support/clang.lua | 35 ++++------------------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox index 513f0f363..52742ef75 160000 --- a/core/src/tbox/tbox +++ b/core/src/tbox/tbox @@ -1 +1 @@ -Subproject commit 513f0f36384c540002787c7362ede4efaf104d8a +Subproject commit 52742ef752bd65eb663e8751244991419c7d30b4 diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index a6e195e22..5680c1eac 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -179,39 +179,29 @@ function _build_modulefile(target, sourcefile, opt) -- init flags local common_args = opt.common_args local requiresflags = opt.requiresflags - local moduleoutputflag = get_moduleoutputflag(target) -- trace progress.show(opt.progress, "${color.build.object}compiling.module.$(mode) %s", opt.provide and opt.provide.name or sourcefile) local bmifile - local compileflags = {} local bmiflags if opt.provide then bmifile = opt.provide.bmifile - - if moduleoutputflag then - compileflags = table.join("-x", "c++-module", moduleoutputflag .. bmifile, compflags, common_args, requiresflags) - else - bmiflags = table.join("-x", "c++-module", "--precompile", compflags, common_args, requiresflags) - end - end - - if bmiflags then + bmiflags = table.join("-x", "c++-module", "--precompile", compflags, common_args, requiresflags) vprint(compinst:compcmd(sourcefile, bmifile, {compflags = bmiflags, rawargs = true})) end - compileflags = table.join2(compileflags, compflags, common_args, requiresflags or {}) - vprint(compinst:compcmd(bmifile or sourcefile, objectfile, {compflags = compileflags, rawargs = true})) + local objflags = table.join(compflags, common_args, requiresflags or {}, (bmifile == nil) and {"-x", "c++"} or {}) + vprint(compinst:compcmd(bmifile or sourcefile, objectfile, {compflags = objflags, rawargs = true})) if not dryrun then -- do compile dependinfo.files = {} - if bmiflags then + if opt.provide then assert(compinst:compile(sourcefile, bmifile, {dependinfo = dependinfo, compflags = bmiflags})) end - assert(compinst:compile(bmiflags and bmifile or sourcefile, objectfile, {compflags = compileflags})) + assert(compinst:compile(bmifile or sourcefile, objectfile, {compflags = objflags})) -- update files and values to the dependent file dependinfo.values = depvalues @@ -791,7 +781,7 @@ function has_headerunitsupport(target) local support_headerunits = _g.support_headerunits if support_headerunits == nil then local compinst = target:compiler("cxx") - local modulesflag, moduletsflag = get_modulesflag(target) + local modulesflag, modulestsflag = get_modulesflag(target) if compinst:has_flags(modulesflag or moduletsflag .. " -std=c++20 -x c++-user-header", "cxxflags", {flagskey = "clang_user_header_unit_support", tryrun = true}) and compinst:has_flags(modulesflag or moduletsflag .. " -std=c++20 -x c++-system-header", "cxxflags", {flagskey = "clang_system_header_unit_support", tryrun = true}) then support_headerunits = true @@ -813,19 +803,6 @@ function has_clangscandepssupport(target) return support_clangscandeps or nil end -function get_moduleoutputflag(target) - local moduleoutputflag = _g.moduleoutputflag - if moduleoutputflag == nil then - local compinst = target:compiler("cxx") - local clang = find_tool("clang", {version = true}) - if compinst:has_flags("-fmodule-output=", "cxxflags", {flagskey = "clang_module_output", tryrun = true}) and semver.compare(clang.version, "16.0") >= 0 then - moduleoutputflag = "-fmodule-output=" - end - _g.moduleoutputflag = moduleoutputflag or false - end - return moduleoutputflag or nil -end - function get_requiresflags(target, requires) local flags = {} -- add deps required module flags -- cgit v1.3.1