Lines Matching +full:cross +full:- +full:ios +full:- +full:build
1 ---
2 title: 'How to build Skia'
3 linkTitle: 'How to build Skia'
6 ---
14 - [`is_official_build` and Third-party Dependencies](#third-party)
15 - [Supported and Preferred Compilers](#compilers)
16 - [Quickstart](#quick)
17 - [Android](#android)
18 - [ChromeOS](#cros)
19 - [Mac](#macos)
20 - [iOS](#ios)
21 - [Windows](#windows)
22 - [Windows ARM64](#win-arm64)
23 - [CMake](#cmake)
25 ## <span id="third-party">`is_official_build` and Third-party Dependencies</span>
30 This mode configures Skia in a way that's suitable to ship: an optimized build
31 with no debug symbols, dynamically linked against its third-party dependencies
34 In contrast, the developer-oriented default is an unoptimized build with full
35 debug symbols and all third-party dependencies built from source and embedded
38 Skia offers several features that make use of third-party libraries, like
39 libpng, libwebp, or libjpeg-turbo to decode images, or ICU and sftnly to subset
40 fonts. All these third-party dependencies are optional and can be controlled by
43 If `skia_use_foo` is enabled, enabling `skia_use_system_foo` will build and link
56 prioritization; there is nothing fundamentally wrong with non-Clang compilers.
59 Skia makes use of C++17 language features (compiles with `-std=c++17` flag) and
62 produce non-obvious compilation errors. You can configure your build to use
64 `--args='cc="clang-6.0" cxx="clang++6.0"'` GN build arguments, as illustrated in
70 Run `gn gen` to generate your build files. As arguments to `gn gen`, pass a name
71 for your build directory, and optionally `--args=` to configure the build type.
73 To build Skia as a static library in a build directory named `out/Static`:
76 bin/gn gen out/Static --args='is_official_build=true'
79 To build Skia as a shared library (DLL) in a build directory named `out/Shared`:
82 bin/gn gen out/Shared --args='is_official_build=true is_component_build=true'
88 python2 tools/git-sync-deps
91 For a list of available build arguments, take a look at `gn/skia.gni`, or run:
94 bin/gn args out/Debug --list
97 GN allows multiple build folders to coexist; each build can be configured
102 bin/gn gen out/Release --args='is_debug=false'
103 bin/gn gen out/Clang --args='cc="clang" cxx="clang++"'
104 bin/gn gen out/Cached --args='cc_wrapper="ccache"'
105 bin/gn gen out/RTTI --args='extra_cflags_cc=["-frtti"]'
108 Once you have generated your build files, run Ninja to compile and link Skia:
111 ninja -C out/Static
124 python tools/git-sync-deps
125 ninja -C out/Static
130 To build Skia for Android you need an
137 python2 infra/bots/assets/android_ndk_linux/download.py -t /tmp/ndk
138 python2 infra/bots/assets/android_ndk_darwin/download.py -t /tmp/ndk
139 python2 infra/bots/assets/android_ndk_windows/download.py -t C:/ndk
142 When generating your GN build files, pass the path to your `ndk` and your
146 bin/gn gen out/arm --args='ndk="/tmp/ndk" target_cpu="arm"'
147 bin/gn gen out/arm64 --args='ndk="/tmp/ndk" target_cpu="arm64"'
148 bin/gn gen out/x64 --args='ndk="/tmp/ndk" target_cpu="x64"'
149 bin/gn gen out/x86 --args='ndk="/tmp/ndk" target_cpu="x86"'
159 ninja -C out/arm64
162 adb shell "cd /data/local/tmp; ./dm --src gm --config gl"
167 To cross-compile Skia for arm ChromeOS devices the following is needed:
169 - Clang 4 or newer
170 - An armhf sysroot
171 - The (E)GL lib files on the arm chromebook to link against.
179 python2 infra/bots/assets/clang_linux/download.py -t /opt/clang
180 python2 infra/bots/assets/armhf_sysroot/download.py -t /opt/armhf_sysroot
181 python2 infra/bots/assets/chromebook_arm_gles/download.py -t /opt/chromebook_arm_gles
182 python2 infra/bots/assets/chromebook_x86_64_gles/download.py -t /opt/chromebook_x86_64_gles
201 "--target=armv7a-linux-gnueabihf",
202 "--sysroot=/opt/armhf_sysroot/",
203 "-march=armv7-a",
204 "-mfpu=neon",
205 "-mthumb",
208 "--target=armv7a-linux-gnueabihf",
209 "--sysroot=/opt/armhf_sysroot",
210 "-I/opt/chromebook_arm_gles/include",
211 "-I/opt/armhf_sysroot/include/",
212 "-I/opt/armhf_sysroot/include/c++/4.8.4/",
213 "-I/opt/armhf_sysroot/include/c++/4.8.4/arm-linux-gnueabihf/",
214 "-DMESA_EGL_NO_X11_HEADERS",
215 "-funwind-tables",
218 "--sysroot=/opt/armhf_sysroot",
219 "-B/opt/armhf_sysroot/bin",
220 "-B/opt/armhf_sysroot/gcc-cross",
221 "-L/opt/armhf_sysroot/gcc-cross",
222 "-L/opt/armhf_sysroot/lib",
223 "-L/opt/chromebook_arm_gles/lib",
224 "--target=armv7a-linux-gnueabihf",
236 "-I/opt/clang/include/c++/v1/",
237 "-I/opt/chromebook_x86_64_gles/include",
238 "-DMESA_EGL_NO_X11_HEADERS",
239 "-DEGL_NO_IMAGE_EXTERNAL",
242 "-stdlib=libc++",
243 "-fuse-ld=lld",
244 "-L/opt/chromebook_x86_64_gles/lib",
261 sudo mount -i -o remount,exec /home/chronos
266 Mac users may want to pass `--ide=xcode` to `bin/gn gen` to generate an Xcode
269 ## <span id="ios">iOS</span>
271 Run GN to generate your build files. Set `target_os="ios"` to build for iOS.
272 This defaults to `target_cpu="arm64"`. Choosing `x64` targets the iOS simulator.
275 bin/gn gen out/ios64 --args='target_os="ios"'
276 bin/gn gen out/ios32 --args='target_os="ios" target_cpu="arm"'
277 bin/gn gen out/iossim --args='target_os="ios" target_cpu="x64"'
280 This will also package (and for devices, sign) iOS test binaries. This defaults
290 A list of identities can be found by typing `security find-identity` on the
298 For signed packages `ios-deploy` makes installing and running them on a device
302 ios-deploy -b out/Debug/dm.app -d --args "--match foo"
305 Alternatively you can generate an Xcode project by passing `--ide=xcode` to
307 `Project Settings...` and verify that `Build System:` is set to
308 `Legacy Build System`.
317 where `<major>.<minor>` is the iOS version on the device, e.g., 12.0 or 11.4.
321 Skia can build on Windows with Visual Studio 2017 or 2019. If GN is unable to
326 [Build Tools for Visual Studio 2017 or 2019](https://www.visualstudio.com/downloads/#build-tools-fo…
331 python2 infra/bots/assets/win_toolchain/download.py -t C:/toolchain
341 This toolchain is the only way we support 32-bit builds, by also setting
344 The Skia build assumes that the PATHEXT environment variable contains ".EXE".
346 ### **Highly Recommended**: Build with clang-cl
351 Setting the `cc` and `cxx` gn args is _not_ sufficient to build with clang-cl.
366 If you use Visual Studio, you may want to pass `--ide=vs` to `bin/gn gen` to
368 specific configuration, and will only build/run that configuration.
373 `--ide=vs` when running `bin/gn gen` for each one. Then:
385 ## <span id="win-arm64">Windows ARM64</span>
388 [Windows 10 on ARM](https://docs.microsoft.com/en-us/windows/arm/). This
399 bin/gn gen out/win-arm64 --args='target_cpu="arm64" skia_use_angle=true'
402 This will produce a build of Skia that can use the software or ANGLE backends,
403 in DM. Viewer only works when launched with `--backend angle`, because the
408 We have added a GN-to-CMake translator mainly for use with IDEs that like CMake
412 bin/gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py