Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved. |
| 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 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 15 | package config |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 16 | |
| 17 | import ( |
| 18 | "strings" |
| 19 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 20 | "android/soong/android" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 21 | ) |
| 22 | |
| 23 | var ( |
| 24 | windowsCflags = []string{ |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 25 | "-DUSE_MINGW", |
| 26 | "-DWIN32_LEAN_AND_MEAN", |
| 27 | "-Wno-unused-parameter", |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 28 | |
| 29 | // Workaround differences in inttypes.h between host and target. |
| 30 | //See bug 12708004. |
| 31 | "-D__STDC_FORMAT_MACROS", |
| 32 | "-D__STDC_CONSTANT_MACROS", |
| 33 | |
| 34 | // Use C99-compliant printf functions (%zd). |
| 35 | "-D__USE_MINGW_ANSI_STDIO=1", |
Dan Willemsen | 01fdd3d | 2016-03-30 00:01:12 -0700 | [diff] [blame] | 36 | // Admit to using >= Vista. Both are needed because of <_mingw.h>. |
| 37 | "-D_WIN32_WINNT=0x0600", |
| 38 | "-DWINVER=0x0600", |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 39 | // Get 64-bit off_t and related functions. |
| 40 | "-D_FILE_OFFSET_BITS=64", |
| 41 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 42 | "--sysroot ${WindowsGccRoot}/${WindowsGccTriple}", |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 43 | } |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 44 | windowsClangCflags = append(ClangFilterUnknownCflags(windowsCflags), []string{}...) |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 45 | |
| 46 | windowsIncludeFlags = []string{ |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 47 | "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include", |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 48 | } |
| 49 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 50 | windowsClangCppflags = []string{ |
| 51 | "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3", |
| 52 | "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/backward", |
| 53 | } |
| 54 | |
| 55 | windowsX86ClangCppflags = []string{ |
| 56 | "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/${WindowsGccTriple}/32", |
| 57 | } |
| 58 | |
| 59 | windowsX8664ClangCppflags = []string{ |
| 60 | "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/${WindowsGccTriple}", |
| 61 | } |
| 62 | |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 63 | windowsLdflags = []string{ |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 64 | "--enable-stdcall-fixup", |
Pirama Arumuga Nainar | 191f646 | 2018-08-30 12:37:56 -0700 | [diff] [blame^] | 65 | "-Wl,--dynamicbase", |
| 66 | "-Wl,--nxcompat", |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 67 | } |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 68 | windowsClangLdflags = append(ClangFilterUnknownCflags(windowsLdflags), []string{}...) |
| 69 | windowsClangLldflags = ClangFilterUnknownLldflags(windowsClangLdflags) |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 70 | |
| 71 | windowsX86Cflags = []string{ |
| 72 | "-m32", |
| 73 | } |
| 74 | |
| 75 | windowsX8664Cflags = []string{ |
| 76 | "-m64", |
| 77 | } |
| 78 | |
| 79 | windowsX86Ldflags = []string{ |
| 80 | "-m32", |
Dan Willemsen | 7752bca | 2017-03-14 13:36:23 -0700 | [diff] [blame] | 81 | "-Wl,--large-address-aware", |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 82 | "-L${WindowsGccRoot}/${WindowsGccTriple}/lib32", |
Pirama Arumuga Nainar | abf1b31 | 2018-06-25 16:42:23 -0700 | [diff] [blame] | 83 | "-static-libgcc", |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 84 | } |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 85 | windowsX86ClangLdflags = append(ClangFilterUnknownCflags(windowsX86Ldflags), []string{ |
Pirama Arumuga Nainar | 8a852e7 | 2018-06-19 20:07:54 -0700 | [diff] [blame] | 86 | "-B${WindowsGccRoot}/${WindowsGccTriple}/bin", |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 87 | "-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32", |
| 88 | "-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32", |
| 89 | "-B${WindowsGccRoot}/${WindowsGccTriple}/lib32", |
Pirama Arumuga Nainar | 8a852e7 | 2018-06-19 20:07:54 -0700 | [diff] [blame] | 90 | "-pthread", |
| 91 | // Bug: http://b/109759970 - WAR until issue with ld.bfd's |
| 92 | // inability to handle Clang-generated section names is fixed. |
| 93 | "-Wl,--allow-multiple-definition", |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 94 | }...) |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 95 | windowsX86ClangLldflags = ClangFilterUnknownLldflags(windowsX86ClangLdflags) |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 96 | |
| 97 | windowsX8664Ldflags = []string{ |
| 98 | "-m64", |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 99 | "-L${WindowsGccRoot}/${WindowsGccTriple}/lib64", |
Pirama Arumuga Nainar | abf1b31 | 2018-06-25 16:42:23 -0700 | [diff] [blame] | 100 | "-static-libgcc", |
Pirama Arumuga Nainar | 191f646 | 2018-08-30 12:37:56 -0700 | [diff] [blame^] | 101 | "-Wl,--high-entropy-va", |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 102 | } |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 103 | windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{ |
Pirama Arumuga Nainar | 8a852e7 | 2018-06-19 20:07:54 -0700 | [diff] [blame] | 104 | "-B${WindowsGccRoot}/${WindowsGccTriple}/bin", |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 105 | "-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3", |
| 106 | "-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3", |
| 107 | "-B${WindowsGccRoot}/${WindowsGccTriple}/lib64", |
Pirama Arumuga Nainar | 8a852e7 | 2018-06-19 20:07:54 -0700 | [diff] [blame] | 108 | "-pthread", |
| 109 | // Bug: http://b/109759970 - WAR until issue with ld.bfd's |
| 110 | // inability to handle Clang-generated section names is fixed. |
| 111 | "-Wl,--allow-multiple-definition", |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 112 | }...) |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 113 | windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags) |
Dan Willemsen | 2b1f094 | 2016-07-20 12:47:47 -0700 | [diff] [blame] | 114 | |
| 115 | windowsAvailableLibraries = addPrefix([]string{ |
| 116 | "gdi32", |
| 117 | "imagehlp", |
Dan Willemsen | b18cf7a | 2017-09-09 01:42:00 -0700 | [diff] [blame] | 118 | "iphlpapi", |
| 119 | "netapi32", |
Dan Willemsen | 2b1f094 | 2016-07-20 12:47:47 -0700 | [diff] [blame] | 120 | "ole32", |
Dan Willemsen | b18cf7a | 2017-09-09 01:42:00 -0700 | [diff] [blame] | 121 | "powrprof", |
Dan Willemsen | 2b1f094 | 2016-07-20 12:47:47 -0700 | [diff] [blame] | 122 | "psapi", |
Kenny Root | b912349 | 2016-09-20 14:49:33 -0700 | [diff] [blame] | 123 | "pthread", |
Dan Willemsen | 2b1f094 | 2016-07-20 12:47:47 -0700 | [diff] [blame] | 124 | "userenv", |
| 125 | "uuid", |
Colin Cross | 124fd9a | 2016-11-21 17:31:08 -0800 | [diff] [blame] | 126 | "version", |
Dan Willemsen | 2b1f094 | 2016-07-20 12:47:47 -0700 | [diff] [blame] | 127 | "ws2_32", |
| 128 | }, "-l") |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 129 | ) |
| 130 | |
Dan Willemsen | 34fc3b1 | 2015-12-07 12:30:44 -0800 | [diff] [blame] | 131 | const ( |
| 132 | windowsGccVersion = "4.8" |
| 133 | ) |
| 134 | |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 135 | func init() { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 136 | pctx.StaticVariable("WindowsGccVersion", windowsGccVersion) |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 137 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 138 | pctx.SourcePathVariable("WindowsGccRoot", |
| 139 | "prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-w64-mingw32-${WindowsGccVersion}") |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 140 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 141 | pctx.StaticVariable("WindowsGccTriple", "x86_64-w64-mingw32") |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 142 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 143 | pctx.StaticVariable("WindowsCflags", strings.Join(windowsCflags, " ")) |
| 144 | pctx.StaticVariable("WindowsLdflags", strings.Join(windowsLdflags, " ")) |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 145 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 146 | pctx.StaticVariable("WindowsClangCflags", strings.Join(windowsClangCflags, " ")) |
| 147 | pctx.StaticVariable("WindowsClangLdflags", strings.Join(windowsClangLdflags, " ")) |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 148 | pctx.StaticVariable("WindowsClangLldflags", strings.Join(windowsClangLldflags, " ")) |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 149 | pctx.StaticVariable("WindowsClangCppflags", strings.Join(windowsClangCppflags, " ")) |
| 150 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 151 | pctx.StaticVariable("WindowsX86Cflags", strings.Join(windowsX86Cflags, " ")) |
| 152 | pctx.StaticVariable("WindowsX8664Cflags", strings.Join(windowsX8664Cflags, " ")) |
| 153 | pctx.StaticVariable("WindowsX86Ldflags", strings.Join(windowsX86Ldflags, " ")) |
| 154 | pctx.StaticVariable("WindowsX8664Ldflags", strings.Join(windowsX8664Ldflags, " ")) |
Dan Willemsen | d352edf | 2016-05-18 16:06:10 -0700 | [diff] [blame] | 155 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 156 | pctx.StaticVariable("WindowsX86ClangCflags", |
| 157 | strings.Join(ClangFilterUnknownCflags(windowsX86Cflags), " ")) |
| 158 | pctx.StaticVariable("WindowsX8664ClangCflags", |
| 159 | strings.Join(ClangFilterUnknownCflags(windowsX8664Cflags), " ")) |
| 160 | pctx.StaticVariable("WindowsX86ClangLdflags", strings.Join(windowsX86ClangLdflags, " ")) |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 161 | pctx.StaticVariable("WindowsX86ClangLldflags", strings.Join(windowsX86ClangLldflags, " ")) |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 162 | pctx.StaticVariable("WindowsX8664ClangLdflags", strings.Join(windowsX8664ClangLdflags, " ")) |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 163 | pctx.StaticVariable("WindowsX8664ClangLldflags", strings.Join(windowsX8664ClangLldflags, " ")) |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 164 | pctx.StaticVariable("WindowsX86ClangCppflags", strings.Join(windowsX86ClangCppflags, " ")) |
| 165 | pctx.StaticVariable("WindowsX8664ClangCppflags", strings.Join(windowsX8664ClangCppflags, " ")) |
| 166 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 167 | pctx.StaticVariable("WindowsIncludeFlags", strings.Join(windowsIncludeFlags, " ")) |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | type toolchainWindows struct { |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 171 | cFlags, ldFlags string |
| 172 | } |
| 173 | |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 174 | type toolchainWindowsX86 struct { |
| 175 | toolchain32Bit |
| 176 | toolchainWindows |
| 177 | } |
| 178 | |
| 179 | type toolchainWindowsX8664 struct { |
| 180 | toolchain64Bit |
| 181 | toolchainWindows |
| 182 | } |
| 183 | |
| 184 | func (t *toolchainWindowsX86) Name() string { |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 185 | return "x86" |
| 186 | } |
| 187 | |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 188 | func (t *toolchainWindowsX8664) Name() string { |
| 189 | return "x86_64" |
| 190 | } |
| 191 | |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 192 | func (t *toolchainWindows) GccRoot() string { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 193 | return "${config.WindowsGccRoot}" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | func (t *toolchainWindows) GccTriple() string { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 197 | return "${config.WindowsGccTriple}" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | func (t *toolchainWindows) GccVersion() string { |
Dan Willemsen | 34fc3b1 | 2015-12-07 12:30:44 -0800 | [diff] [blame] | 201 | return windowsGccVersion |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 202 | } |
| 203 | |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 204 | func (t *toolchainWindowsX86) Cflags() string { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 205 | return "${config.WindowsCflags} ${config.WindowsX86Cflags}" |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | func (t *toolchainWindowsX8664) Cflags() string { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 209 | return "${config.WindowsCflags} ${config.WindowsX8664Cflags}" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | func (t *toolchainWindows) Cppflags() string { |
| 213 | return "" |
| 214 | } |
| 215 | |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 216 | func (t *toolchainWindowsX86) Ldflags() string { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 217 | return "${config.WindowsLdflags} ${config.WindowsX86Ldflags}" |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | func (t *toolchainWindowsX8664) Ldflags() string { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 221 | return "${config.WindowsLdflags} ${config.WindowsX8664Ldflags}" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | func (t *toolchainWindows) IncludeFlags() string { |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 225 | return "${config.WindowsIncludeFlags}" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 226 | } |
| 227 | |
Dan Willemsen | 4f1c3d4 | 2017-09-09 01:15:26 -0700 | [diff] [blame] | 228 | func (t *toolchainWindowsX86) WindresFlags() string { |
| 229 | return "-F pe-i386" |
| 230 | } |
| 231 | |
| 232 | func (t *toolchainWindowsX8664) WindresFlags() string { |
| 233 | return "-F pe-x86-64" |
| 234 | } |
| 235 | |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 236 | func (t *toolchainWindows) ClangSupported() bool { |
Pirama Arumuga Nainar | 8a852e7 | 2018-06-19 20:07:54 -0700 | [diff] [blame] | 237 | return true |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 238 | } |
| 239 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 240 | func (t *toolchainWindowsX86) ClangTriple() string { |
| 241 | return "i686-windows-gnu" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 242 | } |
| 243 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 244 | func (t *toolchainWindowsX8664) ClangTriple() string { |
| 245 | return "x86_64-pc-windows-gnu" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 246 | } |
| 247 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 248 | func (t *toolchainWindowsX86) ClangCflags() string { |
| 249 | return "${config.WindowsClangCflags} ${config.WindowsX86ClangCflags}" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 250 | } |
| 251 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 252 | func (t *toolchainWindowsX8664) ClangCflags() string { |
| 253 | return "${config.WindowsClangCflags} ${config.WindowsX8664ClangCflags}" |
| 254 | } |
| 255 | |
| 256 | func (t *toolchainWindowsX86) ClangCppflags() string { |
| 257 | return "${config.WindowsClangCppflags} ${config.WindowsX86ClangCppflags}" |
| 258 | } |
| 259 | |
| 260 | func (t *toolchainWindowsX8664) ClangCppflags() string { |
| 261 | return "${config.WindowsClangCppflags} ${config.WindowsX8664ClangCppflags}" |
| 262 | } |
| 263 | |
| 264 | func (t *toolchainWindowsX86) ClangLdflags() string { |
| 265 | return "${config.WindowsClangLdflags} ${config.WindowsX86ClangLdflags}" |
| 266 | } |
| 267 | |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 268 | func (t *toolchainWindowsX86) ClangLldflags() string { |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 269 | return "${config.WindowsClangLldflags} ${config.WindowsX86ClangLldflags}" |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 270 | } |
| 271 | |
Dan Willemsen | 01f388c | 2017-11-30 13:31:26 -0800 | [diff] [blame] | 272 | func (t *toolchainWindowsX8664) ClangLdflags() string { |
| 273 | return "${config.WindowsClangLdflags} ${config.WindowsX8664ClangLdflags}" |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 274 | } |
| 275 | |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 276 | func (t *toolchainWindowsX8664) ClangLldflags() string { |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 277 | return "${config.WindowsClangLldflags} ${config.WindowsX8664ClangLldflags}" |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 278 | } |
| 279 | |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 280 | func (t *toolchainWindows) ShlibSuffix() string { |
| 281 | return ".dll" |
| 282 | } |
| 283 | |
| 284 | func (t *toolchainWindows) ExecutableSuffix() string { |
| 285 | return ".exe" |
| 286 | } |
| 287 | |
Dan Willemsen | 2b1f094 | 2016-07-20 12:47:47 -0700 | [diff] [blame] | 288 | func (t *toolchainWindows) AvailableLibraries() []string { |
| 289 | return windowsAvailableLibraries |
| 290 | } |
| 291 | |
Dan Willemsen | 2e47b34 | 2016-11-17 01:02:25 -0800 | [diff] [blame] | 292 | func (t *toolchainWindows) Bionic() bool { |
| 293 | return false |
| 294 | } |
| 295 | |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 296 | var toolchainWindowsX86Singleton Toolchain = &toolchainWindowsX86{} |
| 297 | var toolchainWindowsX8664Singleton Toolchain = &toolchainWindowsX8664{} |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 298 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 299 | func windowsX86ToolchainFactory(arch android.Arch) Toolchain { |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 300 | return toolchainWindowsX86Singleton |
| 301 | } |
| 302 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 303 | func windowsX8664ToolchainFactory(arch android.Arch) Toolchain { |
Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 304 | return toolchainWindowsX8664Singleton |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | func init() { |
Colin Cross | a1ad8d1 | 2016-06-01 17:09:44 -0700 | [diff] [blame] | 308 | registerToolchainFactory(android.Windows, android.X86, windowsX86ToolchainFactory) |
| 309 | registerToolchainFactory(android.Windows, android.X86_64, windowsX8664ToolchainFactory) |
Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 310 | } |