diff options
author | Colin Cross <ccross@android.com> | 2017-04-04 12:59:48 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-04-04 15:39:04 -0700 |
commit | 3edeee113ac2f0be96348d7f5580414ae6642616 (patch) | |
tree | a502b1e42b7c205202ac915dcfbc2691a1357021 | |
parent | ac01ff5447518986f778be5b5c5a7bb0bf354e9c (diff) | |
download | build_soong-3edeee113ac2f0be96348d7f5580414ae6642616.tar.gz build_soong-3edeee113ac2f0be96348d7f5580414ae6642616.tar.bz2 build_soong-3edeee113ac2f0be96348d7f5580414ae6642616.zip |
Add ctx.Windows()
Replace ctx.Os() == android.Windows with ctx.Windows()
Test: builds
Change-Id: I7c24c39bcf54a51ad152b21c0021e40a0c07f189
-rw-r--r-- | android/module.go | 5 | ||||
-rw-r--r-- | cc/binary.go | 4 | ||||
-rw-r--r-- | cc/library.go | 2 | ||||
-rw-r--r-- | cc/linker.go | 2 | ||||
-rw-r--r-- | cc/stl.go | 2 |
5 files changed, 10 insertions, 5 deletions
diff --git a/android/module.go b/android/module.go index 4fba1cf7..3c09b3ea 100644 --- a/android/module.go +++ b/android/module.go @@ -57,6 +57,7 @@ type androidBaseContext interface { Host() bool Device() bool Darwin() bool + Windows() bool Debug() bool PrimaryArch() bool Proprietary() bool @@ -611,6 +612,10 @@ func (a *androidBaseContextImpl) Darwin() bool { return a.target.Os == Darwin } +func (a *androidBaseContextImpl) Windows() bool { + return a.target.Os == Windows +} + func (a *androidBaseContextImpl) Debug() bool { return a.debug } diff --git a/cc/binary.go b/cc/binary.go index 637f6c7a..25783113 100644 --- a/cc/binary.go +++ b/cc/binary.go @@ -204,7 +204,7 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags if ctx.Host() && !binary.static() { if !ctx.AConfig().IsEnvTrue("DISABLE_HOST_PIE") { flags.LdFlags = append(flags.LdFlags, "-pie") - if ctx.Os() == android.Windows { + if ctx.Windows() { flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup") } } @@ -213,7 +213,7 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags // MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because // all code is position independent, and then those warnings get promoted to // errors. - if ctx.Os() != android.Windows { + if !ctx.Windows() { flags.CFlags = append(flags.CFlags, "-fpie") } diff --git a/cc/library.go b/cc/library.go index 953c37a1..1871696c 100644 --- a/cc/library.go +++ b/cc/library.go @@ -228,7 +228,7 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla // MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because // all code is position independent, and then those warnings get promoted to // errors. - if ctx.Os() != android.Windows { + if !ctx.Windows() { flags.CFlags = append(flags.CFlags, "-fPIC") } diff --git a/cc/linker.go b/cc/linker.go index 07d9aa80..4d21d99b 100644 --- a/cc/linker.go +++ b/cc/linker.go @@ -156,7 +156,7 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps { } } - if ctx.Os() == android.Windows { + if ctx.Windows() { deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread") } @@ -60,7 +60,7 @@ func (stl *stl) begin(ctx BaseModuleContext) { ctx.ModuleErrorf("stl: %q is not a supported STL with sdk_version set", s) return "" } - } else if ctx.Os() == android.Windows { + } else if ctx.Windows() { switch s { case "libc++", "libc++_static", "libstdc++", "": // libc++ is not supported on mingw |