-
Notifications
You must be signed in to change notification settings - Fork 144
WIP: support std module #522
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,6 +141,9 @@ def _get_cxx_include_directories(repository_ctx, print_resource_dir_supported, c | |
|
|
||
| return inc_directories | ||
|
|
||
| def _get_share_libcxx_v1_dir(repository_ctx, cc, additional_flags = []): | ||
| return repository_ctx.execute([cc, "-print-resource-dir"] + additional_flags).stdout.strip() + "/../../../share/libc++/v1" | ||
|
|
||
| def _is_compiler_option_supported(repository_ctx, cc, option): | ||
| """Checks that `option` is supported by the C compiler. Doesn't %-escape the option.""" | ||
| result = repository_ctx.execute([ | ||
|
|
@@ -608,6 +611,11 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overridden_tools): | |
| extra_flags_per_feature["use_module_maps"] = ["-Xclang", "-fno-cxx-modules"] | ||
|
|
||
| write_builtin_include_directory_paths(repository_ctx, cc, builtin_include_directories) | ||
| if is_clang: | ||
| libcxx_v1_dir = _get_share_libcxx_v1_dir(repository_ctx, cc) | ||
| files = repository_ctx.execute(["ls", libcxx_v1_dir]).stdout.strip().split("\n") | ||
| for file in files: | ||
| repository_ctx.symlink(libcxx_v1_dir + "/" + file, file) | ||
| repository_ctx.template( | ||
| "BUILD", | ||
| paths["@rules_cc//cc/private/toolchain:BUILD.tpl"], | ||
|
|
@@ -767,5 +775,13 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overridden_tools): | |
| "-D__TIME__=\\\"redacted\\\"", | ||
| ], | ||
| ), | ||
| "%{std_module}": """ | ||
| cc_library( | ||
| name = "std_modules", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that the std module has to be passed into the If it's common for folks to import |
||
| srcs = glob(["std/**"]), | ||
| module_interfaces = ["std.cppm"], | ||
| features = ["cpp_modules"], | ||
| ) | ||
| """, | ||
| }, | ||
| ) | ||
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
repository_ctx.path(...).readdir()instead to list files within Starlark.