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>
This commit is contained in:
Mike Klein 2016-10-24 16:49:15 -04:00 committed by Skia Commit-Bot
parent 3cfdf6c8b1
commit 82364bae16
4 changed files with 50 additions and 8 deletions

View File

@ -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"

View File

@ -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}}"
}
}

View File

@ -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") {

18
gn/ar.py Normal file
View File

@ -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]))