1# Copyright 2016 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import("../build_overrides/skia.gni") 7 8is_skia_standalone = true 9 10# It's best to keep the names and defaults of is_foo flags consistent with Chrome. 11 12declare_args() { 13 is_official_build = false 14 is_component_build = false 15 ndk = "" 16 17 # Android 5.0, Lollipop 18 ndk_api = 21 19 20 ar = "ar" 21 cc = "cc" 22 cxx = "c++" 23 24 win_sdk = "C:/Program Files (x86)/Windows Kits/10" 25 win_sdk_version = "" 26 27 win_vc = "" 28 win_toolchain_version = "" 29 30 clang_win = "" 31 clang_win_version = "" 32 33 ios_min_target = "" 34} 35declare_args() { 36 is_debug = !is_official_build 37} 38 39assert(!(is_debug && is_official_build)) 40 41if (target_cpu == "wasm") { 42 target_os = "wasm" 43} 44 45import("platform.gni") 46 47# This is just to make the Dawn build files happy. Skia itself uses target_os = "linux" 48# for ChromeOS, so this variable will not affect Skia proper. 49is_chromeos = false 50 51# This is to make the ANGLE build files happy. Skia always uses is_mac and/or is_ios. 52is_apple = is_mac || is_ios 53 54if (target_cpu == "") { 55 target_cpu = host_cpu 56 if (is_android || is_ios) { 57 target_cpu = "arm64" 58 } 59} 60if (target_cpu == "x86_64") { 61 target_cpu = "x64" 62} 63if (current_cpu == "") { 64 current_cpu = target_cpu 65} 66 67is_clang = is_android || is_ios || is_mac || is_fuchsia || 68 (cc == "clang" && cxx == "clang++") || clang_win != "" 69if (!is_clang && !is_win) { 70 is_clang = exec_script("${skia_root_dir}/gn/is_clang.py", 71 [ 72 cc, 73 cxx, 74 ], 75 "value") 76} 77 78if (is_android) { 79 ndk_host = "" 80 ndk_target = "" 81 ndk_gdbserver = "" 82 83 if (host_os == "linux") { 84 ndk_host = "linux-x86_64" 85 } else if (host_os == "mac") { 86 ndk_host = "darwin-x86_64" 87 } else if (host_os == "win") { 88 ndk_host = "windows-x86_64" 89 } 90 91 if (target_cpu == "arm64") { 92 ndk_target = "aarch64-linux-android" 93 ndk_gdbserver = "prebuilt/android-arm64/gdbserver/gdbserver" 94 } else if (target_cpu == "arm") { 95 ndk_target = "armv7a-linux-androideabi" 96 ndk_gdbserver = "prebuilt/android-arm/gdbserver/gdbserver" 97 } else if (target_cpu == "x64") { 98 ndk_target = "x86_64-linux-android" 99 ndk_gdbserver = "prebuilt/android-x86_64/gdbserver/gdbserver" 100 } else if (target_cpu == "x86") { 101 ndk_target = "i686-linux-android" 102 ndk_gdbserver = "prebuilt/android-x86/gdbserver/gdbserver" 103 } 104} 105 106if (target_os == "win") { 107 # By default we look for 2017 (Enterprise, Pro, and Community), then 2015. If MSVC is installed in a 108 # non-default location, you can set win_vc to inform us where it is. 109 110 if (win_vc == "") { 111 win_vc = exec_script("${skia_root_dir}/gn/find_msvc.py", [], "trim string") 112 } 113 assert(win_vc != "") # Could not find VC installation. Set win_vc to your VC 114 # directory. 115} 116 117if (target_os == "win") { 118 if (win_toolchain_version == "") { 119 win_toolchain_version = 120 exec_script("${skia_root_dir}/gn/highest_version_dir.py", 121 [ 122 "$win_vc/Tools/MSVC", 123 "[0-9]{2}\.[0-9]{2}\.[0-9]{5}", 124 ], 125 "trim string") 126 } 127 if (win_sdk_version == "") { 128 win_sdk_version = exec_script("${skia_root_dir}/gn/highest_version_dir.py", 129 [ 130 "$win_sdk/Include", 131 "[0-9]{2}\.[0-9]\.[0-9]{5}\.[0-9]", 132 ], 133 "trim string") 134 } 135 if (clang_win != "" && clang_win_version == "") { 136 clang_win_version = 137 exec_script("${skia_root_dir}/gn/highest_version_dir.py", 138 [ 139 "$clang_win/lib/clang", 140 "[0-9]+\.[0-9]+\.[0-9]+", 141 ], 142 "trim string") 143 } 144} 145 146set_defaults("source_set") { 147 configs = [] 148} 149 150set_defaults("static_library") { 151 configs = [] 152} 153 154set_defaults("shared_library") { 155 configs = [] 156} 157 158set_defaults("executable") { 159 configs = [] 160} 161 162if (is_win) { 163 # Windows tool chain 164 set_default_toolchain("${skia_root_dir}/gn/toolchain:msvc") 165 default_toolchain_name = "msvc" 166 host_toolchain = "msvc" 167} else { 168 # GCC-like toolchains, including Clang. 169 set_default_toolchain("${skia_root_dir}/gn/toolchain:gcc_like") 170 default_toolchain_name = "gcc_like" 171 host_toolchain = "gcc_like_host" 172} 173