Skip to content

Commit 15fed75

Browse files
committed
Add support for the external_include_paths feature
1 parent f6b21a0 commit 15fed75

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

toolchain/zig_cc_toolchain.bzl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,37 @@ def _zig_cc_toolchain_config_impl(ctx):
161161
],
162162
)
163163

164+
# https://github.com/bazelbuild/rules_cc/blob/6fd317b2ae0534a29db7085605b0262849e62f93/cc/private/toolchain/unix_cc_toolchain_config.bzl#L1099
165+
external_include_paths_feature = feature(
166+
name = "external_include_paths",
167+
flag_sets = [
168+
flag_set(
169+
actions = compile_and_link_actions + [
170+
# This is the subset of rest_compile_actions that was also
171+
# included in rules_cc's external_include_paths feature.
172+
ACTION_NAMES.preprocess_assemble,
173+
ACTION_NAMES.linkstamp_compile,
174+
ACTION_NAMES.cpp_header_parsing,
175+
ACTION_NAMES.cpp_module_compile,
176+
ACTION_NAMES.clif_match,
177+
],
178+
flag_groups = [
179+
flag_group(
180+
flags = ["-isystem", "%{external_include_paths}"],
181+
iterate_over = "external_include_paths",
182+
expand_if_available = "external_include_paths",
183+
),
184+
],
185+
),
186+
],
187+
)
188+
164189
features = [
165190
compile_and_link_flags,
166191
default_linker_flags,
167192
supports_dynamic_linker,
168193
strip_debug_symbols_feature,
194+
external_include_paths_feature,
169195
] + _compilation_mode_features(ctx)
170196

171197
artifact_name_patterns = [

0 commit comments

Comments
 (0)