-
-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate dependencies of preprocessed modules to avoid importing #ifdef import #3122
Conversation
310a2e7
to
7ead9d5
Compare
@@ -150,7 +150,16 @@ function generate_dependencies(target, sourcebatch, opt) | |||
|
|||
-- no support of p1689 atm | |||
local jsonfile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".json")) | |||
common.fallback_generate_dependencies(target, jsonfile, sourcefile) | |||
common.fallback_generate_dependencies(target, jsonfile, sourcefile, function(file) | |||
local compinst = target:compiler("cxx") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local clang, toolname = target:tool("cxx")
assert(toolname == "clang")
-- ...
os.vrunv(clang, table.join(defines, {"-E", "-x", "c++", file, "-o", ifile}))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or we can use
local compinst = compiler.load("cxx", {target = target})
local compflags = table.join("-E", "-x", "c++", compinst:compflags({target = target}))
os.vrunv(compinst:program(), table.join(compflags, "-o", ifile))
and remove it, because compflags contain them and more too.
local defines = {}
for _, define in ipairs(target:get("defines")) do
table.insert(defines, "-D" .. define)
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i did use compflags at first but when some flags that are in compflags (like -std=c++20 for clang or -fmodule-ts for gcc) prevent -E from working (the compiler try to search module imports, we don't want that)
update msvc.lua update msvc.lua update clang.lua update msvc.lua
cd31898
to
944c55a
Compare
Ah i need to take care of dependency include directories, or the preprocessing will fail
|
it's seem we can't do anything more for clang without llvm/llvm-project#51792 |
thanks! |
Maybe soon i can add support of p1689 for clang llvm/llvm-project#57293 (comment) |
No description provided.