-
-
Notifications
You must be signed in to change notification settings - Fork 816
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
Add support for libstdc++ standard library modules #5869
Conversation
return nil | ||
end | ||
|
||
local modules_json = json.decode(io.readfile(modules_json_path)) |
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.
You can use json.loadfile
return os.iorunv(compinst:program(), {"-print-file-name=libstdc++.modules.json"}, {envs = compinst:runenvs()}) | ||
end | ||
} | ||
modules_json_path = modules_json_path:trim() |
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.
modules_json_path maybe nil,
if modules_json_path then
modules_json_path = modules_json_path:trim()
if os.isfile(modules_json_path) then
return modules_json_path
end
end
if not path.is_absolute(module_file_path) then | ||
module_file_path = path.join(modules_json_dir, module_file_path) | ||
end | ||
table.join2(std_module_files, {module_file_path}) |
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.
table.insert(std_module_files, module_file_path)
it will break ci. https://github.com/xmake-io/xmake/actions/runs/12023662331 |
if target:policy("build.c++.gcc.modules.cxx11abi") then | ||
|
||
-- libstdc++ std modules cannot compile with -D_GLIBCXX_USE_CXX11_ABI=0 | ||
if target:policy("build.c++.modules.std") or target:policy("build.c++.gcc.modules.cxx11abi") then |
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.
it will break
An installed source form of module std and std.compat has been merged into gcc trunk branch. It's time to add support for them.
[Bug 106852](c++lib-std-module) - Implement C++23 P2465R3 Standard Library Modules std and std.compat
GCC provides a
libstdc++.modules.json
file alongsidelibstdc++.so
, which tells the build system where the files are. We can also find this file with :Content in the json may looks like this:
The structure of this json file is basicly the same as the one provided by llvm.
Known issue
Currently, these two files cannot compile with
-D_GLIBCXX_USE_CXX11_ABI=0
option, so I set ths macro to1
if a target is compile with std modules. This issue may related to #2716 and #3855 .