meson_to_hermetic: fix Fuchsia build

Change-Id: Ia2083cf1b6ecbc596147fe7e0d1f493937d419c5
This commit is contained in:
C Stout 2024-12-19 09:54:51 -08:00
parent 5487f7f6cf
commit edd4d06624
5 changed files with 23 additions and 17 deletions

View file

@ -1,5 +1,7 @@
# Copyright 2024 Google LLC
# SPDX-License-Identifier: Apache-2.0
build = 'bazel'
# Base project config which contain shared attributes which
# all other projects must contain / override
[base_project_config]
@ -36,8 +38,6 @@ links = []
# HEADER_LIBRARY = 3
# See meson_impl.py
build = 'bazel'
[[project_config]]
name = 'fuchsia_aarch64_drivers'
inherits_from = 'base_project_config'

View file

@ -47,6 +47,7 @@ class StaticLibrary(IncludeDirectories):
self.target_compatible_with: list[str] = []
self.local_include_dirs: list[str] = []
self.system_include_dirs: list[str] = []
self.static_libs: list[str] = []
self.whole_static_libs: list[str] = []
self.shared_libs: list[str] = []

View file

@ -50,6 +50,7 @@ def generate_build_file(translator, build_type: str):
cflags=static_lib.conlyflags,
cppflags=static_lib.cppflags,
include_directories=static_lib.local_include_dirs,
system_include_directories=static_lib.system_include_dirs,
static_libs=static_lib.static_libs,
whole_static_libs=static_lib.whole_static_libs,
shared_libs=static_lib.shared_libs,
@ -216,18 +217,14 @@ class BazelPkgConfigModule(impl.PkgConfigModule):
libraries=None,
libraries_private=None,
):
if extra_cflags is None:
extra_cflags = []
impl.fprint('# package library')
impl.fprint('cc_library(')
impl.fprint(' name = "%s",' % name)
assert type(lib) is impl.StaticLibrary
impl.fprint(' deps = [ "%s" ],' % lib.target_name)
# This line tells Bazel to use -isystem for targets that depend on this one,
# which is needed for clients that include package headers with angle brackets.
impl.fprint(' includes = [ "." ],')
impl.fprint(' visibility = [ "//visibility:public" ],')
impl.fprint(')')
sl = StaticLibrary()
sl.name = name
sl.deps = lib.target_name
sl.system_include_dirs.append(".")
sl.visibility.append('//visibility:public')
meson_translator.meson_state.static_libraries.append(sl)
class MesonTranslator:
@ -1154,7 +1151,7 @@ def custom_target(
python_custom_target = PythonCustomTarget()
python_custom_target.name = python_script_target_name
python_custom_target.main = python_script
for src in srcs:
for src in set(srcs):
if src.endswith('.py'):
python_custom_target.srcs.append(src)
for src in set(srcs):

View file

@ -7,8 +7,8 @@ cc_shared_library(
{%- for dep in deps %}
"{{ dep }}",
{%- endfor %}
]
],
visibility = [ "//visibility:public" ],
{# Fuchsia Vulkan ICDs may not have shared c++ dependency #}
user_link_flags = ["static-libstdc++"],
user_link_flags = ["-static-libstdc++"],
)

View file

@ -17,9 +17,17 @@ cc_library(
+ glob(["{{ include_dir }}"])
{%- endfor %}
,
{# Tells Bazel to use -isystem for targets that depend on this one,
which is needed for clients that include package headers with angle brackets.
#}
includes = [
{%- for include_dir in system_include_directories %}
"{{ include_dir }}"
{%- endfor %}
],
copts = [
{%- for copt in copts %}
"{{ copt }}",
'{{ copt }}',
{%- endfor %}
],
deps = [