aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-10-24 16:49:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-26 14:37:43 +0000
commit82364bae1690d0f4421afa0116441d99ce35b92a (patch)
tree34c8cba80c3778d2f029900246cd1fdedc35abbc
parent3cfdf6c8b1f0c6ebe59ddd0d2750976c2dd1921d (diff)
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>
-rwxr-xr-xbin/droid7
-rw-r--r--gn/BUILD.gn31
-rw-r--r--gn/BUILDCONFIG.gn2
-rw-r--r--gn/ar.py18
4 files changed, 50 insertions, 8 deletions
diff --git a/bin/droid b/bin/droid
index b1644c6049..c633181766 100755
--- a/bin/droid
+++ b/bin/droid
@@ -16,6 +16,7 @@ args=$@
set -e
set -x
-adb push $path /data/local/tmp/
-adb push resources /data/local/tmp/
-adb shell "cd /data/local/tmp; ./$name $args"
+adb push $path //data/local/tmp/
+adb push resources //data/local/tmp/
+adb shell "chmod +x //data/local/tmp/$name"
+adb shell "cd //data/local/tmp; ./$name $args"
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index bd5ce7fe2c..8451b9f078 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -12,6 +12,11 @@ declare_args() {
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 @@ declare_args() {
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 @@ toolchain("msvc") {
}
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 @@ toolchain("gcc_like") {
}
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 @@ toolchain("gcc_like") {
}
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}}"
}
}
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index d997ec513c..12df69d3a2 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -59,6 +59,8 @@ if (is_android) {
ndk_host = "linux-x86_64"
} else if (host_os == "mac") {
ndk_host = "darwin-x86_64"
+ } else if (host_os == "win") {
+ ndk_host = "windows-x86_64"
}
if (target_cpu == "arm64") {
diff --git a/gn/ar.py b/gn/ar.py
new file mode 100644
index 0000000000..dc3ae8d948
--- /dev/null
+++ b/gn/ar.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+#
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import subprocess
+import sys
+
+# Equivalent to: rm -f $2 && $1 rcs $2 @$3
+
+ar, output, rspfile = sys.argv[1:]
+
+if os.path.exists(output):
+ os.remove(output)
+sys.exit(subprocess.call([ar, "rcs", output, "@" + rspfile]))