| OLD | NEW |
| 1 # Copyright 2016 Google Inc. | 1 # Copyright 2016 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 declare_args() { | 6 declare_args() { |
| 7 ar = "ar" |
| 7 cc = "cc" | 8 cc = "cc" |
| 8 cxx = "c++" | 9 cxx = "c++" |
| 9 | 10 |
| 10 if (is_android) { | 11 if (is_android) { |
| 12 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar" |
| 11 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" | 13 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" |
| 12 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" | 14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" |
| 13 } | 15 } |
| 14 | 16 |
| 15 extra_cflags = "" | 17 extra_cflags = "" |
| 16 extra_cflags_c = "" | 18 extra_cflags_c = "" |
| 17 extra_cflags_cc = "" | 19 extra_cflags_cc = "" |
| 18 } | 20 } |
| 19 | 21 |
| 20 config("no_rtti") { | 22 config("no_rtti") { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 ] | 43 ] |
| 42 cflags_cc = [ | 44 cflags_cc = [ |
| 43 "-std=c++11", | 45 "-std=c++11", |
| 44 "-fno-exceptions", | 46 "-fno-exceptions", |
| 45 "-fno-threadsafe-statics", | 47 "-fno-threadsafe-statics", |
| 46 "-fvisibility-inlines-hidden", | 48 "-fvisibility-inlines-hidden", |
| 47 | 49 |
| 48 "-Wnon-virtual-dtor", | 50 "-Wnon-virtual-dtor", |
| 49 ] | 51 ] |
| 50 if (current_cpu == "arm") { | 52 if (current_cpu == "arm") { |
| 51 cflags += [ "-mfpu=neon" ] | 53 cflags += [ |
| 54 "-march=armv7-a", |
| 55 "-mfpu=neon", |
| 56 "-mthumb", |
| 57 ] |
| 58 } else if (current_cpu == "mipsel") { |
| 59 cflags += [ |
| 60 "-march=mips32r2", |
| 61 "-mdspr2", |
| 62 ] |
| 52 } | 63 } |
| 53 | 64 |
| 54 if (is_android) { | 65 if (is_android) { |
| 55 asmflags = [ "--target=$ndk_target" ] | 66 asmflags = [ |
| 67 "--target=$ndk_target", |
| 68 "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin", |
| 69 ] |
| 56 cflags += [ | 70 cflags += [ |
| 57 "--sysroot=$ndk/platforms/$ndk_platform", | 71 "--sysroot=$ndk/platforms/$ndk_platform", |
| 58 "--target=$ndk_target", | 72 "--target=$ndk_target", |
| 73 "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin", |
| 59 ] | 74 ] |
| 60 cflags_cc += [ | 75 cflags_cc += [ |
| 61 "-isystem$ndk/sources/android/support/include", | 76 "-isystem$ndk/sources/android/support/include", |
| 62 "-isystem$ndk/sources/cxx-stl/llvm-libc++/libcxx/include", | 77 "-isystem$ndk/sources/cxx-stl/llvm-libc++/libcxx/include", |
| 63 ] | 78 ] |
| 64 ldflags = [ | 79 ldflags = [ |
| 65 "--sysroot=$ndk/platforms/$ndk_platform", | 80 "--sysroot=$ndk/platforms/$ndk_platform", |
| 66 "--target=$ndk_target", | 81 "--target=$ndk_target", |
| 67 "-B$ndk/toolchains/$ndk_target-4.9/prebuilt/$ndk_host/$ndk_target/bin", | 82 "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin", |
| 68 "-pie", | 83 "-pie", |
| 69 ] | 84 ] |
| 70 lib_dirs = [ | 85 lib_dirs = [ |
| 71 "$ndk/sources/cxx-stl/llvm-libc++/libs/$ndk_stdlib", | 86 "$ndk/sources/cxx-stl/llvm-libc++/libs/$ndk_stdlib", |
| 72 "$ndk/toolchains/$ndk_target-4.9/prebuilt/$ndk_host/lib/gcc/$ndk_target/4.
9.x", | 87 "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/lib/gcc/$ndk_target/4.
9.x", |
| 73 ] | 88 ] |
| 74 libs = [ | 89 libs = [ |
| 75 # Order matters here! Keep these three in exactly this order. | 90 # Order matters here! Keep these three in exactly this order. |
| 76 "c++_static", | 91 "c++_static", |
| 77 "c++abi", | 92 "c++abi", |
| 78 "android_support", | 93 "android_support", |
| 79 ] | 94 ] |
| 95 if (target_cpu == "arm") { |
| 96 libs += [ "unwind" ] |
| 97 } |
| 80 } | 98 } |
| 81 | 99 |
| 82 if (is_linux) { | 100 if (is_linux) { |
| 83 libs = [ "pthread" ] | 101 libs = [ "pthread" ] |
| 84 } | 102 } |
| 85 } | 103 } |
| 86 | 104 |
| 87 config("release") { | 105 config("release") { |
| 88 cflags = [ "-Os" ] | 106 cflags = [ "-Os" ] |
| 89 defines = [ "NDEBUG" ] | 107 defines = [ "NDEBUG" ] |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 depfile = "{{output}}.d" | 147 depfile = "{{output}}.d" |
| 130 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -
c {{source}} -o {{output}}" | 148 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -
c {{source}} -o {{output}}" |
| 131 depsformat = "gcc" | 149 depsformat = "gcc" |
| 132 outputs = [ | 150 outputs = [ |
| 133 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 151 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 134 ] | 152 ] |
| 135 description = "$cc ... -o {{output}}" | 153 description = "$cc ... -o {{output}}" |
| 136 } | 154 } |
| 137 | 155 |
| 138 tool("alink") { | 156 tool("alink") { |
| 139 command = "rm -f {{output}} && ar rcs {{output}} {{inputs}}" | 157 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}" |
| 140 outputs = [ | 158 outputs = [ |
| 141 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", | 159 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
| 142 ] | 160 ] |
| 143 default_output_extension = ".a" | 161 default_output_extension = ".a" |
| 144 output_prefix = "lib" | 162 output_prefix = "lib" |
| 145 description = "ar {{output}} ..." | 163 description = "$ar {{output}} ..." |
| 146 } | 164 } |
| 147 | 165 |
| 148 tool("solink") { | 166 tool("solink") { |
| 149 soname = "{{target_output_name}}{{output_extension}}" | 167 soname = "{{target_output_name}}{{output_extension}}" |
| 150 | 168 |
| 151 rpath = "-Wl,-soname,$soname" | 169 rpath = "-Wl,-soname,$soname" |
| 152 if (is_mac) { | 170 if (is_mac) { |
| 153 rpath = "-Wl,-install_name,@rpath/$soname" | 171 rpath = "-Wl,-install_name,@rpath/$soname" |
| 154 } | 172 } |
| 155 | 173 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 173 } | 191 } |
| 174 | 192 |
| 175 tool("stamp") { | 193 tool("stamp") { |
| 176 command = "touch {{output}}" | 194 command = "touch {{output}}" |
| 177 } | 195 } |
| 178 | 196 |
| 179 tool("copy") { | 197 tool("copy") { |
| 180 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" | 198 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" |
| 181 } | 199 } |
| 182 } | 200 } |
| OLD | NEW |