Build for Android from Windows, work in progress.
Pretty vanilla stuff here, mostly just making the gcc-like toolchain Windows friendly.
I was having trouble getting rm -r {{output}} && $ar rcs {{output}} @$rspfile to work without deleting my ar.exe, so I chickened out the usual way by adding gn/ar.py.
I've also updated bin/droid to work with Git Bash on Windows.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3751
Change-Id: I04c34ccc91e6a291c11ac4e7a7a0ffe41d879fe6
Reviewed-on: https://skia-review.googlesource.com/3751
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index bd5ce7f..8451b9f 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -12,6 +12,11 @@
ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar"
cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang"
cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++"
+ if (host_os == "win") {
+ ar = ar + ".exe"
+ cc = cc + ".exe"
+ cxx = cxx + ".exe"
+ }
}
windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
@@ -24,6 +29,14 @@
cc_wrapper = ""
}
+if (host_os == "win") {
+ python = "python.bat"
+ stamp = "cmd.exe /c echo >"
+} else {
+ python = "python"
+ stamp = "touch"
+}
+
if (!is_win) {
is_clang = exec_script("is_clang.py",
[
@@ -465,13 +478,13 @@
}
tool("stamp") {
- command = "cmd.exe /c echo > {{output}}"
+ command = "$stamp {{output}}"
description = "stamp {{output}}"
}
tool("copy") {
cp_py = rebase_path("cp.py")
- command = "python.bat $cp_py {{source}} {{output}}"
+ command = "$python $cp_py {{source}} {{output}}"
description = "copy {{source}} {{output}}"
}
}
@@ -531,7 +544,15 @@
}
tool("alink") {
- command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}"
+ if (host_os == "win") {
+ rspfile = "{{output}}.rsp"
+ rspfile_content = "{{inputs}}"
+ ar_py = rebase_path("ar.py")
+ command = "$python $ar_py $ar {{output}} $rspfile"
+ } else {
+ # We'd use ar.py all the time, but Mac ar doesn't support @rspfile syntax. :(
+ command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}"
+ }
outputs = [
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
]
@@ -566,13 +587,13 @@
}
tool("stamp") {
- command = "touch {{output}}"
+ command = "$stamp {{output}}"
description = "stamp {{output}}"
}
tool("copy") {
cp_py = rebase_path("cp.py")
- command = "python $cp_py {{source}} {{output}}"
+ command = "$python $cp_py {{source}} {{output}}"
description = "copy {{source}} {{output}}"
}
}