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