Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 1 | // Copyright 2020 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package rust |
| 16 | |
| 17 | import ( |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 18 | "strings" |
| 19 | |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 20 | "github.com/google/blueprint" |
Stephen Crane | 12e2cb7 | 2020-08-04 12:26:10 -0700 | [diff] [blame] | 21 | "github.com/google/blueprint/proptools" |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 22 | |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 23 | "android/soong/android" |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 24 | "android/soong/cc" |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 25 | cc_config "android/soong/cc/config" |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 26 | ) |
| 27 | |
| 28 | var ( |
Ivan Lozano | ec54eec | 2020-07-22 16:48:53 -0400 | [diff] [blame] | 29 | defaultBindgenFlags = []string{""} |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 30 | |
| 31 | // bindgen should specify its own Clang revision so updating Clang isn't potentially blocked on bindgen failures. |
Stephen Hines | a3faafa | 2020-11-09 16:28:23 -0800 | [diff] [blame] | 32 | bindgenClangVersion = "clang-r399163b" |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 33 | |
Peter Collingbourne | 9a868f1 | 2020-12-30 20:23:01 -0800 | [diff] [blame^] | 34 | _ = pctx.VariableFunc("bindgenClangVersion", func(ctx android.PackageVarContext) string { |
| 35 | if override := ctx.Config().Getenv("LLVM_BINDGEN_PREBUILTS_VERSION"); override != "" { |
| 36 | return override |
| 37 | } |
| 38 | return bindgenClangVersion |
| 39 | }) |
| 40 | |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 41 | //TODO(b/160803703) Use a prebuilt bindgen instead of the built bindgen. |
Shao-Chuan Lee | aa3231c | 2020-11-05 22:20:17 +0900 | [diff] [blame] | 42 | _ = pctx.HostBinToolVariable("bindgenCmd", "bindgen") |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 43 | _ = pctx.SourcePathVariable("bindgenClang", |
Peter Collingbourne | 9a868f1 | 2020-12-30 20:23:01 -0800 | [diff] [blame^] | 44 | "${cc_config.ClangBase}/${config.HostPrebuiltTag}/${bindgenClangVersion}/bin/clang") |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 45 | _ = pctx.SourcePathVariable("bindgenLibClang", |
Peter Collingbourne | 9a868f1 | 2020-12-30 20:23:01 -0800 | [diff] [blame^] | 46 | "${cc_config.ClangBase}/${config.HostPrebuiltTag}/${bindgenClangVersion}/lib64/") |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 47 | |
| 48 | //TODO(ivanlozano) Switch this to RuleBuilder |
| 49 | bindgen = pctx.AndroidStaticRule("bindgen", |
| 50 | blueprint.RuleParams{ |
Ivan Lozano | ec54eec | 2020-07-22 16:48:53 -0400 | [diff] [blame] | 51 | Command: "CLANG_PATH=$bindgenClang LIBCLANG_PATH=$bindgenLibClang RUSTFMT=${config.RustBin}/rustfmt " + |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 52 | "$cmd $flags $in -o $out -- -MD -MF $out.d $cflags", |
| 53 | CommandDeps: []string{"$cmd"}, |
Ivan Lozano | e1e844b | 2020-07-24 15:16:30 -0400 | [diff] [blame] | 54 | Deps: blueprint.DepsGCC, |
| 55 | Depfile: "$out.d", |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 56 | }, |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 57 | "cmd", "flags", "cflags") |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 58 | ) |
| 59 | |
| 60 | func init() { |
| 61 | android.RegisterModuleType("rust_bindgen", RustBindgenFactory) |
Ivan Lozano | f6fe995 | 2020-07-22 16:30:20 -0400 | [diff] [blame] | 62 | android.RegisterModuleType("rust_bindgen_host", RustBindgenHostFactory) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | var _ SourceProvider = (*bindgenDecorator)(nil) |
| 66 | |
| 67 | type BindgenProperties struct { |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 68 | // The wrapper header file. By default this is assumed to be a C header unless the extension is ".hh" or ".hpp". |
| 69 | // This is used to specify how to interpret the header and determines which '-std' flag to use by default. |
| 70 | // |
| 71 | // If your C++ header must have some other extension, then the default behavior can be overridden by setting the |
| 72 | // cpp_std property. |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 73 | Wrapper_src *string `android:"path,arch_variant"` |
| 74 | |
| 75 | // list of bindgen-specific flags and options |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 76 | Bindgen_flags []string `android:"arch_variant"` |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 77 | |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 78 | // module name of a custom binary/script which should be used instead of the 'bindgen' binary. This custom |
| 79 | // binary must expect arguments in a similar fashion to bindgen, e.g. |
| 80 | // |
| 81 | // "my_bindgen [flags] wrapper_header.h -o [output_path] -- [clang flags]" |
| 82 | Custom_bindgen string `android:"path"` |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | type bindgenDecorator struct { |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 86 | *BaseSourceProvider |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 87 | |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 88 | Properties BindgenProperties |
| 89 | ClangProperties cc.RustBindgenClangProperties |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 90 | } |
| 91 | |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 92 | func (b *bindgenDecorator) getStdVersion(ctx ModuleContext, src android.Path) (string, bool) { |
| 93 | // Assume headers are C headers |
| 94 | isCpp := false |
| 95 | stdVersion := "" |
| 96 | |
| 97 | switch src.Ext() { |
| 98 | case ".hpp", ".hh": |
| 99 | isCpp = true |
| 100 | } |
| 101 | |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 102 | if String(b.ClangProperties.Cpp_std) != "" && String(b.ClangProperties.C_std) != "" { |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 103 | ctx.PropertyErrorf("c_std", "c_std and cpp_std cannot both be defined at the same time.") |
| 104 | } |
| 105 | |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 106 | if String(b.ClangProperties.Cpp_std) != "" { |
| 107 | if String(b.ClangProperties.Cpp_std) == "experimental" { |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 108 | stdVersion = cc_config.ExperimentalCppStdVersion |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 109 | } else if String(b.ClangProperties.Cpp_std) == "default" { |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 110 | stdVersion = cc_config.CppStdVersion |
| 111 | } else { |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 112 | stdVersion = String(b.ClangProperties.Cpp_std) |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 113 | } |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 114 | } else if b.ClangProperties.C_std != nil { |
| 115 | if String(b.ClangProperties.C_std) == "experimental" { |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 116 | stdVersion = cc_config.ExperimentalCStdVersion |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 117 | } else if String(b.ClangProperties.C_std) == "default" { |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 118 | stdVersion = cc_config.CStdVersion |
| 119 | } else { |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 120 | stdVersion = String(b.ClangProperties.C_std) |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 121 | } |
| 122 | } else if isCpp { |
| 123 | stdVersion = cc_config.CppStdVersion |
| 124 | } else { |
| 125 | stdVersion = cc_config.CStdVersion |
| 126 | } |
| 127 | |
| 128 | return stdVersion, isCpp |
| 129 | } |
| 130 | |
ThiƩbaud Weksteen | 31f1bb8 | 2020-08-27 13:37:29 +0200 | [diff] [blame] | 131 | func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) android.Path { |
| 132 | ccToolchain := ctx.RustModule().ccToolchain(ctx) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 133 | |
| 134 | var cflags []string |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 135 | var implicits android.Paths |
| 136 | |
Ivan Lozano | ddd0bdb | 2020-08-28 17:00:26 -0400 | [diff] [blame] | 137 | implicits = append(implicits, deps.depGeneratedHeaders...) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 138 | |
| 139 | // Default clang flags |
ThiƩbaud Weksteen | 682c9d7 | 2020-08-31 10:06:16 +0200 | [diff] [blame] | 140 | cflags = append(cflags, "${cc_config.CommonClangGlobalCflags}") |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 141 | if ctx.Device() { |
ThiƩbaud Weksteen | 682c9d7 | 2020-08-31 10:06:16 +0200 | [diff] [blame] | 142 | cflags = append(cflags, "${cc_config.DeviceClangGlobalCflags}") |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | // Toolchain clang flags |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 146 | cflags = append(cflags, "-target "+ccToolchain.ClangTriple()) |
ThiƩbaud Weksteen | 682c9d7 | 2020-08-31 10:06:16 +0200 | [diff] [blame] | 147 | cflags = append(cflags, strings.ReplaceAll(ccToolchain.ToolchainClangCflags(), "${config.", "${cc_config.")) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 148 | |
| 149 | // Dependency clang flags and include paths |
| 150 | cflags = append(cflags, deps.depClangFlags...) |
| 151 | for _, include := range deps.depIncludePaths { |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 152 | cflags = append(cflags, "-I"+include.String()) |
| 153 | } |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 154 | for _, include := range deps.depSystemIncludePaths { |
| 155 | cflags = append(cflags, "-isystem "+include.String()) |
| 156 | } |
| 157 | |
Stephen Crane | 12e2cb7 | 2020-08-04 12:26:10 -0700 | [diff] [blame] | 158 | esc := proptools.NinjaAndShellEscapeList |
| 159 | |
Ivan Lozano | 0a2a115 | 2020-10-16 10:49:08 -0400 | [diff] [blame] | 160 | // Filter out invalid cflags |
| 161 | for _, flag := range b.ClangProperties.Cflags { |
| 162 | if flag == "-x c++" || flag == "-xc++" { |
| 163 | ctx.PropertyErrorf("cflags", |
| 164 | "-x c++ should not be specified in cflags; setting cpp_std specifies this is a C++ header, or change the file extension to '.hpp' or '.hh'") |
| 165 | } |
| 166 | if strings.HasPrefix(flag, "-std=") { |
| 167 | ctx.PropertyErrorf("cflags", |
| 168 | "-std should not be specified in cflags; instead use c_std or cpp_std") |
| 169 | } |
| 170 | } |
| 171 | |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 172 | // Module defined clang flags and include paths |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 173 | cflags = append(cflags, esc(b.ClangProperties.Cflags)...) |
| 174 | for _, include := range b.ClangProperties.Local_include_dirs { |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 175 | cflags = append(cflags, "-I"+android.PathForModuleSrc(ctx, include).String()) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 176 | implicits = append(implicits, android.PathForModuleSrc(ctx, include)) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | bindgenFlags := defaultBindgenFlags |
Stephen Crane | 12e2cb7 | 2020-08-04 12:26:10 -0700 | [diff] [blame] | 180 | bindgenFlags = append(bindgenFlags, esc(b.Properties.Bindgen_flags)...) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 181 | |
| 182 | wrapperFile := android.OptionalPathForModuleSrc(ctx, b.Properties.Wrapper_src) |
| 183 | if !wrapperFile.Valid() { |
| 184 | ctx.PropertyErrorf("wrapper_src", "invalid path to wrapper source") |
| 185 | } |
| 186 | |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 187 | // Add C std version flag |
| 188 | stdVersion, isCpp := b.getStdVersion(ctx, wrapperFile.Path()) |
| 189 | cflags = append(cflags, "-std="+stdVersion) |
| 190 | |
| 191 | // Specify the header source language to avoid ambiguity. |
| 192 | if isCpp { |
| 193 | cflags = append(cflags, "-x c++") |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 194 | // Add any C++ only flags. |
| 195 | cflags = append(cflags, esc(b.ClangProperties.Cppflags)...) |
Ivan Lozano | 3d94752 | 2020-09-23 13:26:25 -0400 | [diff] [blame] | 196 | } else { |
| 197 | cflags = append(cflags, "-x c") |
| 198 | } |
| 199 | |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 200 | outputFile := android.PathForModuleOut(ctx, b.BaseSourceProvider.getStem(ctx)+".rs") |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 201 | |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 202 | var cmd, cmdDesc string |
| 203 | if b.Properties.Custom_bindgen != "" { |
| 204 | cmd = ctx.GetDirectDepWithTag(b.Properties.Custom_bindgen, customBindgenDepTag).(*Module).HostToolPath().String() |
| 205 | cmdDesc = b.Properties.Custom_bindgen |
| 206 | } else { |
| 207 | cmd = "$bindgenCmd" |
| 208 | cmdDesc = "bindgen" |
| 209 | } |
| 210 | |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 211 | ctx.Build(pctx, android.BuildParams{ |
| 212 | Rule: bindgen, |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 213 | Description: strings.Join([]string{cmdDesc, wrapperFile.Path().Rel()}, " "), |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 214 | Output: outputFile, |
| 215 | Input: wrapperFile.Path(), |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 216 | Implicits: implicits, |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 217 | Args: map[string]string{ |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 218 | "cmd": cmd, |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 219 | "flags": strings.Join(bindgenFlags, " "), |
| 220 | "cflags": strings.Join(cflags, " "), |
| 221 | }, |
| 222 | }) |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 223 | |
Chih-Hung Hsieh | c49649c | 2020-10-01 21:25:05 -0700 | [diff] [blame] | 224 | b.BaseSourceProvider.OutputFiles = android.Paths{outputFile} |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 225 | return outputFile |
| 226 | } |
| 227 | |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 228 | func (b *bindgenDecorator) SourceProviderProps() []interface{} { |
| 229 | return append(b.BaseSourceProvider.SourceProviderProps(), |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 230 | &b.Properties, &b.ClangProperties) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 231 | } |
| 232 | |
Ivan Lozano | 10735d9 | 2020-07-22 09:14:47 -0400 | [diff] [blame] | 233 | // rust_bindgen generates Rust FFI bindings to C libraries using bindgen given a wrapper header as the primary input. |
| 234 | // Bindgen has a number of flags to control the generated source, and additional flags can be passed to clang to ensure |
ThiƩbaud Weksteen | 295c72b | 2020-09-23 18:10:17 +0200 | [diff] [blame] | 235 | // the header and generated source is appropriately handled. It is recommended to add it as a dependency in the |
| 236 | // rlibs, dylibs or rustlibs property. It may also be added in the srcs property for external crates, using the ":" |
| 237 | // prefix. |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 238 | func RustBindgenFactory() android.Module { |
| 239 | module, _ := NewRustBindgen(android.HostAndDeviceSupported) |
| 240 | return module.Init() |
| 241 | } |
| 242 | |
Ivan Lozano | f6fe995 | 2020-07-22 16:30:20 -0400 | [diff] [blame] | 243 | func RustBindgenHostFactory() android.Module { |
| 244 | module, _ := NewRustBindgen(android.HostSupported) |
| 245 | return module.Init() |
| 246 | } |
| 247 | |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 248 | func NewRustBindgen(hod android.HostOrDeviceSupported) (*Module, *bindgenDecorator) { |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 249 | bindgen := &bindgenDecorator{ |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 250 | BaseSourceProvider: NewSourceProvider(), |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 251 | Properties: BindgenProperties{}, |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 252 | ClangProperties: cc.RustBindgenClangProperties{}, |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 253 | } |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 254 | |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 255 | module := NewSourceProviderModule(hod, bindgen, false) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 256 | |
| 257 | return module, bindgen |
| 258 | } |
| 259 | |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 260 | func (b *bindgenDecorator) SourceProviderDeps(ctx DepsContext, deps Deps) Deps { |
| 261 | deps = b.BaseSourceProvider.SourceProviderDeps(ctx, deps) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 262 | if ctx.toolchain().Bionic() { |
Ivan Lozano | bf63d00 | 2020-10-02 10:03:23 -0400 | [diff] [blame] | 263 | deps = bionicDeps(deps, false) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 264 | } |
| 265 | |
Ivan Lozano | bc9e421 | 2020-09-25 16:08:34 -0400 | [diff] [blame] | 266 | deps.SharedLibs = append(deps.SharedLibs, b.ClangProperties.Shared_libs...) |
| 267 | deps.StaticLibs = append(deps.StaticLibs, b.ClangProperties.Static_libs...) |
Ivan Lozano | 9b44383 | 2020-11-17 13:39:30 -0500 | [diff] [blame] | 268 | deps.HeaderLibs = append(deps.StaticLibs, b.ClangProperties.Header_libs...) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 269 | return deps |
| 270 | } |