OLD | NEW |
1 # Copyright 2015 Google Inc. | 1 # Copyright 2015 Google Inc. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This GYP file stores the dependencies necessary to build Skia on the Android | 6 # This GYP file stores the dependencies necessary to build Skia on the Android |
7 # platform. The OS doesn't provide many stable libraries as part of the | 7 # platform. The OS doesn't provide many stable libraries as part of the |
8 # distribution so we have to build a few of them ourselves. | 8 # distribution so we have to build a few of them ourselves. |
9 # | 9 # |
10 { | 10 { |
11 'variables': { | 11 'variables': { |
12 'conditions': [ | 12 'conditions': [ |
13 [ 'skia_arch_type == "arm" and arm_version != 7', { | 13 [ 'skia_arch_type == "arm" and arm_version != 7', { |
14 'android_arch%': "armeabi", | 14 'android_arch%': "armeabi", |
15 'android_variant%': "arm", | |
16 }], | 15 }], |
17 [ 'skia_arch_type == "arm" and arm_version == 7', { | 16 [ 'skia_arch_type == "arm" and arm_version == 7', { |
18 'android_arch%': "armeabi-v7a", | 17 'android_arch%': "armeabi-v7a", |
19 'android_variant%': "arm", | |
20 }], | 18 }], |
21 [ 'skia_arch_type == "arm64"', { | 19 [ 'skia_arch_type == "arm64"', { |
22 'android_arch%': "arm64-v8a", | 20 'android_arch%': "arm64-v8a", |
23 'android_variant%': "arm64", | |
24 }], | 21 }], |
25 [ 'skia_arch_type == "x86"', { | 22 [ 'skia_arch_type == "x86"', { |
26 'android_arch%': "x86", | 23 'android_arch%': "x86", |
27 'android_variant%': "x86", | |
28 }], | 24 }], |
29 [ 'skia_arch_type == "x86_64"', { | 25 [ 'skia_arch_type == "x86_64"', { |
30 'android_arch%': "x86_64", | 26 'android_arch%': "x86_64", |
31 'android_variant%': "x86_64", | |
32 }], | 27 }], |
33 [ 'skia_arch_type == "mips" and skia_arch_width == 32', { | 28 [ 'skia_arch_type == "mips" and skia_arch_width == 32', { |
34 'android_arch%': "mips", | 29 'android_arch%': "mips", |
35 'android_variant%': "mips", | |
36 }], | 30 }], |
37 [ 'skia_arch_type == "mips" and skia_arch_width == 64', { | 31 [ 'skia_arch_type == "mips" and skia_arch_width == 64', { |
38 'android_arch%': "mips64", | 32 'android_arch%': "mips64", |
39 'android_variant%': "mips64", | |
40 }], | 33 }], |
41 ], | 34 ], |
42 }, | 35 }, |
43 'targets': [ | 36 'targets': [ |
44 { | 37 { |
45 'target_name': 'CopySampleAppDeps', | 38 'target_name': 'CopySampleAppDeps', |
46 'type': 'none', | 39 'type': 'none', |
47 'dependencies': [ | 40 'dependencies': [ |
48 'skia_lib.gyp:skia_lib', | 41 'skia_lib.gyp:skia_lib', |
49 'SampleApp.gyp:SampleApp', | 42 'SampleApp.gyp:SampleApp', |
50 ], | 43 ], |
51 'copies': [ | 44 'copies': [ |
52 # Copy all shared libraries into the Android app's libs folder. Note | 45 # Copy all shared libraries into the Android app's libs folder. Note |
53 # that this copy requires us to build SkiaAndroidApp after those | 46 # that this copy requires us to build SkiaAndroidApp after those |
54 # libraries, so that they exist by the time it occurs. If there are no | 47 # libraries, so that they exist by the time it occurs. If there are no |
55 # libraries to copy, this will cause an error in Make, but the app will | 48 # libraries to copy, this will cause an error in Make, but the app will |
56 # still build. | 49 # still build. |
57 { | 50 { |
58 'destination': '<(android_base)/apps/sample_app/src/main/libs/<(androi
d_arch)', | 51 'destination': '<(PRODUCT_DIR)/android/SampleApp/libs/<(android_arch)'
, |
59 'conditions': [ | 52 'conditions': [ |
60 [ 'skia_shared_lib', { | 53 [ 'skia_shared_lib', { |
61 'files': [ | 54 'files': [ |
62 '<(SHARED_LIB_DIR)/libSampleApp.so', | 55 '<(SHARED_LIB_DIR)/libSampleApp.so', |
63 '<(SHARED_LIB_DIR)/libskia_android.so', | 56 '<(SHARED_LIB_DIR)/libskia_android.so', |
64 ]}, { | 57 ]}, { |
65 'files': [ | 58 'files': [ |
66 '<(SHARED_LIB_DIR)/libSampleApp.so', | 59 '<(SHARED_LIB_DIR)/libSampleApp.so', |
67 ]} | 60 ]} |
68 ], | 61 ], |
69 ], | 62 ], |
70 }, | 63 }, |
71 ], | 64 ], |
72 }, | 65 }, |
73 { | 66 { |
74 'target_name': 'SampleApp_APK', | 67 'target_name': 'SampleApp_APK', |
75 'type': 'none', | 68 'type': 'none', |
76 'dependencies': [ | 69 'dependencies': [ |
77 'CopySampleAppDeps', | 70 'CopySampleAppDeps', |
78 ], | 71 ], |
| 72 'variables': { |
| 73 'ANDROID_SDK_ROOT': '<!(echo $ANDROID_SDK_ROOT)', |
| 74 # the ninja generator treats PRODUCT_DIR as a relative path to the |
| 75 # gyp directory but android ant build wants a path relative to the |
| 76 # build.xml file so we do that adjustment here. |
| 77 'ANDROID_OUT': '../../<(PRODUCT_DIR)/android/SampleApp' |
| 78 }, |
79 'actions': [ | 79 'actions': [ |
80 { | 80 { |
81 'action_name': 'SampleApp_apk', | 81 'action_name': 'SampleApp_apk', |
82 'inputs': [ | 82 'inputs': [ |
83 '<(android_base)/apps/sample_app/src/main/AndroidManifest.xml', | 83 '<(android_base)/app/AndroidManifest.xml', |
84 '<(android_base)/apps/sample_app/src/main/jni/com_skia_SkiaSampleRen
derer.h', | 84 '<(android_base)/app/build.xml', |
85 '<(android_base)/apps/sample_app/src/main/jni/com_skia_SkiaSampleRen
derer.cpp', | 85 '<(android_base)/app/project.properties', |
86 '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleAc
tivity.java', | 86 '<(android_base)/app/jni/com_skia_SkiaSampleRenderer.h', |
87 '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleRe
nderer.java', | 87 '<(android_base)/app/jni/com_skia_SkiaSampleRenderer.cpp', |
88 '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleVi
ew.java', | 88 '<(android_base)/app/src/com/skia/SkiaSampleActivity.java', |
| 89 '<(android_base)/app/src/com/skia/SkiaSampleRenderer.java', |
| 90 '<(android_base)/app/src/com/skia/SkiaSampleView.java', |
89 ], | 91 ], |
90 'outputs': [ | 92 'outputs': [ |
91 '<(android_base)/apps/sample_app/build', | 93 '<(PRODUCT_DIR)/../android/SampleApp/bin/SampleApp.apk', |
92 ], | 94 ], |
93 'action': [ | 95 'action': [ |
94 '<(android_base)/apps/gradlew', | 96 'ant', |
95 ':sample_app:assemble<(android_variant)Debug', | 97 '-quiet', |
96 '-p<(android_base)/apps/sample_app', | 98 '-f', |
97 '-PsuppressNativeBuild', | 99 '<(android_base)/app/build.xml', |
| 100 '-Dout.dir=<(ANDROID_OUT)/bin', |
| 101 '-Dgen.absolute.dir=<(ANDROID_OUT)/gen', |
| 102 '-Dnative.libs.absolute.dir=<(ANDROID_OUT)/libs', |
| 103 '-Dout.final.file=<(ANDROID_OUT)/bin/SampleApp.apk', |
| 104 '-Dsdk.dir=<(ANDROID_SDK_ROOT)', |
| 105 'debug', |
98 ], | 106 ], |
99 }, | 107 }, |
100 ], | 108 ], |
101 }, | 109 }, |
102 { | 110 { |
103 'target_name': 'CopyVisualBenchDeps', | 111 'target_name': 'CopyVisualBenchDeps', |
104 'type': 'none', | 112 'type': 'none', |
105 'dependencies': [ | 113 'dependencies': [ |
106 'skia_lib.gyp:skia_lib', | 114 'skia_lib.gyp:skia_lib', |
107 'visualbench.gyp:visualbench', | 115 'visualbench.gyp:visualbench', |
108 ], | 116 ], |
109 | 117 |
110 'copies': [ | 118 'copies': [ |
111 # Copy all shared libraries into the Android app's libs folder. Note | 119 # Copy all shared libraries into the Android app's libs folder. Note |
112 # that this copy requires us to build SkiaAndroidApp after those | 120 # that this copy requires us to build SkiaAndroidApp after those |
113 # libraries, so that they exist by the time it occurs. If there are no | 121 # libraries, so that they exist by the time it occurs. If there are no |
114 # libraries to copy, this will cause an error in Make, but the app will | 122 # libraries to copy, this will cause an error in Make, but the app will |
115 # still build. | 123 # still build. |
116 { | 124 { |
117 'destination': '<(android_base)/apps/visualbench/src/main/libs/<(andro
id_arch)', | 125 'destination': '<(PRODUCT_DIR)/android/VisualBench/libs/<(android_arch
)', |
118 'conditions': [ | 126 'conditions': [ |
119 [ 'skia_shared_lib', { | 127 [ 'skia_shared_lib', { |
120 'files': [ | 128 'files': [ |
121 '<(SHARED_LIB_DIR)/libskia_android.so', | 129 '<(SHARED_LIB_DIR)/libskia_android.so', |
122 '<(SHARED_LIB_DIR)/libvisualbench.so', | 130 '<(SHARED_LIB_DIR)/libvisualbench.so', |
123 ]}, { | 131 ]}, { |
124 'files': [ | 132 'files': [ |
125 '<(SHARED_LIB_DIR)/libvisualbench.so', | 133 '<(SHARED_LIB_DIR)/libvisualbench.so', |
126 ]} | 134 ]} |
127 ], | 135 ], |
128 ], | 136 ], |
129 }, | 137 }, |
130 ], | 138 ], |
131 }, | 139 }, |
132 { | 140 { |
133 'target_name': 'VisualBench_APK', | 141 'target_name': 'VisualBench_APK', |
134 'type': 'none', | 142 'type': 'none', |
135 'dependencies': [ | 143 'dependencies': [ |
136 'CopyVisualBenchDeps', | 144 'CopyVisualBenchDeps', |
137 ], | 145 ], |
| 146 'variables': { |
| 147 'ANDROID_SDK_ROOT': '<!(echo $ANDROID_SDK_ROOT)', |
| 148 # the ninja generator treats PRODUCT_DIR as a relative path to the |
| 149 # gyp directory but android ant build wants a path relative to the |
| 150 # build.xml file so we do that adjustment here. |
| 151 'ANDROID_OUT': '../../<(PRODUCT_DIR)/android/VisualBench/' |
| 152 }, |
138 'actions': [ | 153 'actions': [ |
139 { | 154 { |
140 'action_name': 'SkiaVisualBench_apk', | 155 'action_name': 'SkiaVisualBench_apk', |
141 'inputs': [ | 156 'inputs': [ |
142 '<(android_base)/apps/visualbench/src/main/AndroidManifest.xml', | 157 '<(android_base)/visualbench/AndroidManifest.xml', |
143 '<(android_base)/apps/visualbench/src/main/java/com/skia/VisualBench
Activity.java', | 158 '<(android_base)/visualbench/build.xml', |
| 159 '<(android_base)/visualbench/project.properties', |
| 160 '<(android_base)/visualbench/src/com/skia/VisualBenchActivity.java', |
144 ], | 161 ], |
145 'outputs': [ | 162 'outputs': [ |
146 '<(android_base)/apps/visualbench/build', | 163 '<(PRODUCT_DIR)/../android/VisualBench/bin/VisualBench.apk', |
147 ], | 164 ], |
148 'action': [ | 165 'action': [ |
149 '<(android_base)/apps/gradlew', | 166 'ant', |
150 ':visualbench:assemble<(android_variant)Debug', | 167 '-quiet', |
151 '-p<(android_base)/apps/visualbench', | 168 '-f', |
152 '-PsuppressNativeBuild', | 169 '<(android_base)/visualbench/build.xml', |
| 170 '-Dout.dir=<(ANDROID_OUT)/bin', |
| 171 '-Dgen.absolute.dir=<(ANDROID_OUT)/gen', |
| 172 '-Dnative.libs.absolute.dir=<(ANDROID_OUT)/libs', |
| 173 '-Dout.final.file=<(ANDROID_OUT)/bin/VisualBench.apk', |
| 174 '-Dsdk.dir=<(ANDROID_SDK_ROOT)', |
| 175 'debug', |
153 ], | 176 ], |
154 }, | 177 }, |
155 ], | 178 ], |
156 }, | 179 }, |
157 ], | 180 ], |
158 } | 181 } |
OLD | NEW |