Skip to content

Commit

Permalink
initial fix for bazel-contrib#1271, set_file_prefix_map attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-michaux committed Sep 12, 2024
1 parent b25485b commit 2a5a528
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions foreign_cc/cmake.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def _cmake_impl(ctx):
create_configure_script = _create_configure_script,
tools_data = tools_data,
cmake_path = cmake_data.path,
set_file_prefix_map = ctx.attr.set_file_prefix_map,
)

return cc_external_rule_impl(ctx, attrs)
Expand All @@ -203,6 +204,10 @@ def _create_configure_script(configureParameters):
flags = get_flags_info(ctx, "<TARGET>")
no_toolchain_file = ctx.attr.cache_entries.get("CMAKE_TOOLCHAIN_FILE") or not ctx.attr.generate_crosstool_file

if attrs.set_file_prefix_map:
flags.cc.append("-ffile-prefix-map=$EXT_BUILD_ROOT=.")
flags.cxx.append("-ffile-prefix-map=$EXT_BUILD_ROOT=.")

cmake_commands = []

configuration = "Debug" if is_debug_mode(ctx) else "Release"
Expand Down Expand Up @@ -401,6 +406,14 @@ def _attrs():
mandatory = False,
default = "",
),
"set_file_prefix_map": attr.bool(
doc = (
"Use -ffile-prefix-map with the intention to remove the sandbox path from " +\
"debug symbols"
),
mandatory = False,
default = False
),
})
return attrs

Expand Down

0 comments on commit 2a5a528

Please sign in to comment.