Add DeviceUsesClang to change clang default
This is equivalent to USE_CLANG_PLATFORM_BUILD in the current build system. Change-Id: Ifaca0f2639871dac834ef603cfade695191cff11
This commit is contained in:
parent
60c3dfb19a
commit
dd0e2c338f
10
cc/cc.go
10
cc/cc.go
|
@ -495,10 +495,16 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
|
||||||
// TODO: debug
|
// TODO: debug
|
||||||
flags.CFlags = append(flags.CFlags, c.Properties.Release.Cflags...)
|
flags.CFlags = append(flags.CFlags, c.Properties.Release.Cflags...)
|
||||||
|
|
||||||
if ctx.Host() && !ctx.ContainsProperty("clang") {
|
if !ctx.ContainsProperty("clang") {
|
||||||
|
if ctx.Host() {
|
||||||
flags.Clang = true
|
flags.Clang = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Device() && ctx.AConfig().DeviceUsesClang() {
|
||||||
|
flags.Clang = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if flags.Clang {
|
if flags.Clang {
|
||||||
flags.CFlags = clangFilterUnknownCflags(flags.CFlags)
|
flags.CFlags = clangFilterUnknownCflags(flags.CFlags)
|
||||||
flags.CFlags = append(flags.CFlags, c.Properties.Clang_cflags...)
|
flags.CFlags = append(flags.CFlags, c.Properties.Clang_cflags...)
|
||||||
|
@ -1128,7 +1134,7 @@ func (c *CCLibrary) flags(ctx common.AndroidModuleContext, flags CCFlags) CCFlag
|
||||||
libName := ctx.ModuleName()
|
libName := ctx.ModuleName()
|
||||||
// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
|
// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
|
||||||
sharedFlag := "-Wl,-shared"
|
sharedFlag := "-Wl,-shared"
|
||||||
if c.Properties.Clang || ctx.Host() {
|
if flags.Clang || ctx.Host() {
|
||||||
sharedFlag = "-shared"
|
sharedFlag = "-shared"
|
||||||
}
|
}
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
|
|
|
@ -214,6 +214,13 @@ func (c *config) DeviceName() string {
|
||||||
return *c.ProductVariables.DeviceName
|
return *c.ProductVariables.DeviceName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *config) DeviceUsesClang() bool {
|
||||||
|
if c.ProductVariables.DeviceUsesClang != nil {
|
||||||
|
return *c.ProductVariables.DeviceUsesClang
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// DeviceOut returns the path to out directory for device targets
|
// DeviceOut returns the path to out directory for device targets
|
||||||
func (c *config) DeviceOut() string {
|
func (c *config) DeviceOut() string {
|
||||||
return filepath.Join(c.BuildDir(), "target/product", c.DeviceName())
|
return filepath.Join(c.BuildDir(), "target/product", c.DeviceName())
|
||||||
|
|
|
@ -63,6 +63,7 @@ type productVariables struct {
|
||||||
DeviceArchVariant *string `json:",omitempty"`
|
DeviceArchVariant *string `json:",omitempty"`
|
||||||
DeviceCpuVariant *string `json:",omitempty"`
|
DeviceCpuVariant *string `json:",omitempty"`
|
||||||
DeviceAbi *[]string `json:",omitempty"`
|
DeviceAbi *[]string `json:",omitempty"`
|
||||||
|
DeviceUsesClang *bool `json:",omitempty"`
|
||||||
|
|
||||||
DeviceSecondaryArch *string `json:",omitempty"`
|
DeviceSecondaryArch *string `json:",omitempty"`
|
||||||
DeviceSecondaryArchVariant *string `json:",omitempty"`
|
DeviceSecondaryArchVariant *string `json:",omitempty"`
|
||||||
|
@ -95,6 +96,7 @@ func (v *productVariables) SetDefaultConfig() {
|
||||||
DeviceArch: stringPtr("arm64"),
|
DeviceArch: stringPtr("arm64"),
|
||||||
DeviceCpuVariant: stringPtr("denver64"),
|
DeviceCpuVariant: stringPtr("denver64"),
|
||||||
DeviceAbi: &[]string{"arm64-v8a"},
|
DeviceAbi: &[]string{"arm64-v8a"},
|
||||||
|
DeviceUsesClang: boolPtr(true),
|
||||||
DeviceSecondaryArch: stringPtr("arm"),
|
DeviceSecondaryArch: stringPtr("arm"),
|
||||||
DeviceSecondaryArchVariant: stringPtr("armv7-a-neon"),
|
DeviceSecondaryArchVariant: stringPtr("armv7-a-neon"),
|
||||||
DeviceSecondaryCpuVariant: stringPtr("denver"),
|
DeviceSecondaryCpuVariant: stringPtr("denver"),
|
||||||
|
|
Loading…
Reference in New Issue