diff options
author | Colin Cross <ccross@android.com> | 2016-12-13 12:50:57 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-12-13 15:03:42 -0800 |
commit | 5950f3827c37b073377c84fa407982bc2f47856c (patch) | |
tree | 31d58333fb5d4cafab7028710347074985330b61 /cc/cc.go | |
parent | ab3b7323c4ca7880217d7bb3d422b27c8f716d87 (diff) | |
download | build_soong-5950f3827c37b073377c84fa407982bc2f47856c.tar.gz build_soong-5950f3827c37b073377c84fa407982bc2f47856c.tar.bz2 build_soong-5950f3827c37b073377c84fa407982bc2f47856c.zip |
Support explicit header-only libraries
To date we have been using static libraries with no source files as
header-only libraries. Switch to using header_libs to make the user's
expectations clear, in case we need to differentiate the semantics of
static libraries and header-only libraries when we enable transitive
static library dependencies.
Test: mma -j external/llvm
Change-Id: I3ce16df11076b637bd192880e86ec9027738b9e7
Diffstat (limited to 'cc/cc.go')
-rw-r--r-- | cc/cc.go | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -54,8 +54,9 @@ func init() { type Deps struct { SharedLibs, LateSharedLibs []string StaticLibs, LateStaticLibs, WholeStaticLibs []string + HeaderLibs []string - ReexportSharedLibHeaders, ReexportStaticLibHeaders []string + ReexportSharedLibHeaders, ReexportStaticLibHeaders, ReexportHeaderLibHeaders []string ObjFiles []string @@ -221,6 +222,7 @@ var ( staticExportDepTag = dependencyTag{name: "static", library: true, reexportFlags: true} lateStaticDepTag = dependencyTag{name: "late static", library: true} wholeStaticDepTag = dependencyTag{name: "whole static", library: true, reexportFlags: true} + headerDepTag = dependencyTag{name: "header", library: true, reexportFlags: true} genSourceDepTag = dependencyTag{name: "gen source"} genHeaderDepTag = dependencyTag{name: "gen header"} genHeaderExportDepTag = dependencyTag{name: "gen header", reexportFlags: true} @@ -556,6 +558,7 @@ func (c *Module) deps(ctx BaseModuleContext) Deps { deps.LateStaticLibs = lastUniqueElements(deps.LateStaticLibs) deps.SharedLibs = lastUniqueElements(deps.SharedLibs) deps.LateSharedLibs = lastUniqueElements(deps.LateSharedLibs) + deps.HeaderLibs = lastUniqueElements(deps.HeaderLibs) for _, lib := range deps.ReexportSharedLibHeaders { if !inList(lib, deps.SharedLibs) { @@ -569,6 +572,12 @@ func (c *Module) deps(ctx BaseModuleContext) Deps { } } + for _, lib := range deps.ReexportHeaderLibHeaders { + if !inList(lib, deps.HeaderLibs) { + ctx.PropertyErrorf("export_header_lib_headers", "Header library not in header_libs: '%s'", lib) + } + } + for _, gen := range deps.ReexportGeneratedHeaders { if !inList(gen, deps.GeneratedHeaders) { ctx.PropertyErrorf("export_generated_headers", "Generated header module not in generated_headers: '%s'", gen) @@ -644,6 +653,8 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) { deps.LateSharedLibs, variantLateNdkLibs = rewriteNdkLibs(deps.LateSharedLibs) } + actx.AddVariationDependencies(nil, headerDepTag, deps.HeaderLibs...) + actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, wholeStaticDepTag, deps.WholeStaticLibs...) @@ -910,6 +921,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps { ctx.AddMissingDependencies(missingDeps) } depPaths.WholeStaticLibObjs = depPaths.WholeStaticLibObjs.Append(staticLib.objs()) + case headerDepTag: + // Nothing case objDepTag: depPaths.Objs.objFiles = append(depPaths.Objs.objFiles, linkFile.Path()) case crtBeginDepTag: |