Merge "Specify the API level via the triple instead of __ANDROID_API__."
This commit is contained in:
@@ -17,6 +17,7 @@ package cc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
@@ -308,27 +309,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
flags.SystemIncludeFlags = append(flags.SystemIncludeFlags,
|
flags.SystemIncludeFlags = append(flags.SystemIncludeFlags,
|
||||||
"-isystem "+getCurrentIncludePath(ctx).String(),
|
"-isystem "+getCurrentIncludePath(ctx).String(),
|
||||||
"-isystem "+getCurrentIncludePath(ctx).Join(ctx, config.NDKTriple(tc)).String())
|
"-isystem "+getCurrentIncludePath(ctx).Join(ctx, config.NDKTriple(tc)).String())
|
||||||
|
|
||||||
// TODO: Migrate to API suffixed triple?
|
|
||||||
// Traditionally this has come from android/api-level.h, but with the
|
|
||||||
// libc headers unified it must be set by the build system since we
|
|
||||||
// don't have per-API level copies of that header now.
|
|
||||||
version := ctx.sdkVersion()
|
|
||||||
if version == "current" {
|
|
||||||
version = "__ANDROID_API_FUTURE__"
|
|
||||||
}
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
|
||||||
"-D__ANDROID_API__="+version)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.useVndk() {
|
if ctx.useVndk() {
|
||||||
// sdkVersion() returns VNDK version for vendor modules.
|
flags.GlobalFlags = append(flags.GlobalFlags, "-D__ANDROID_VNDK__")
|
||||||
version := ctx.sdkVersion()
|
|
||||||
if version == "current" {
|
|
||||||
version = "__ANDROID_API_FUTURE__"
|
|
||||||
}
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
|
||||||
"-D__ANDROID_API__="+version, "-D__ANDROID_VNDK__")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.inRecovery() {
|
if ctx.inRecovery() {
|
||||||
@@ -364,6 +348,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)
|
flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)
|
||||||
|
|
||||||
target := "-target " + tc.ClangTriple()
|
target := "-target " + tc.ClangTriple()
|
||||||
|
if ctx.Os().Class == android.Device {
|
||||||
|
version := ctx.sdkVersion()
|
||||||
|
if version == "" || version == "current" {
|
||||||
|
target += strconv.Itoa(android.FutureApiLevel)
|
||||||
|
} else {
|
||||||
|
target += version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gccPrefix := "-B" + config.ToolPath(tc)
|
gccPrefix := "-B" + config.ToolPath(tc)
|
||||||
|
|
||||||
flags.CFlags = append(flags.CFlags, target, gccPrefix)
|
flags.CFlags = append(flags.CFlags, target, gccPrefix)
|
||||||
|
@@ -266,9 +266,9 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
clangPrefix := secondPrefix + "CLANG_" + typePrefix
|
clangPrefix := secondPrefix + "CLANG_" + typePrefix
|
||||||
clangExtras := "-target " + toolchain.ClangTriple()
|
clangExtras := "-B" + config.ToolPath(toolchain)
|
||||||
clangExtras += " -B" + config.ToolPath(toolchain)
|
|
||||||
|
|
||||||
|
ctx.Strict(clangPrefix+"TRIPLE", toolchain.ClangTriple())
|
||||||
ctx.Strict(clangPrefix+"GLOBAL_CFLAGS", strings.Join([]string{
|
ctx.Strict(clangPrefix+"GLOBAL_CFLAGS", strings.Join([]string{
|
||||||
toolchain.ClangCflags(),
|
toolchain.ClangCflags(),
|
||||||
"${config.CommonClangGlobalCflags}",
|
"${config.CommonClangGlobalCflags}",
|
||||||
|
Reference in New Issue
Block a user