Lines Matching +full:build +full:- +full:mac +full:- +full:intel
1 ---
2 title: 'How to build Skia'
3 linkTitle: 'How to build Skia'
6 ---
14 ## `is_official_build` and Third-party Dependencies
19 This mode configures Skia in a way that's suitable to ship: an optimized build
20 with no debug symbols, dynamically linked against its third-party dependencies
23 In contrast, the developer-oriented default is an unoptimized build with full
24 debug symbols and all third-party dependencies built from source and embedded
27 Skia offers several features that make use of third-party libraries, like
28 libpng, libwebp, or libjpeg-turbo to decode images, or ICU and sftnly to subset
29 fonts. All these third-party dependencies are optional and can be controlled by
32 If `skia_use_foo` is enabled, enabling `skia_use_system_foo` will build and link
45 prioritization; there is nothing fundamentally wrong with non-Clang compilers.
48 Skia makes use of C++17 language features (compiles with `-std=c++17` flag) and
51 produce non-obvious compilation errors. You can configure your build to use
53 `--args='cc="clang" cxx="clang++"'` GN build arguments, as illustrated in
62 Run `gn gen` to generate your build files. As arguments to `gn gen`, pass a name
63 for your build directory, and optionally `--args=` to configure the build type.
65 To build Skia as a static library in a build directory named `out/Static`:
68 bin/gn gen out/Static --args='is_official_build=true'
71 To build Skia as a shared library (DLL) in a build directory named `out/Shared`:
74 bin/gn gen out/Shared --args='is_official_build=true is_component_build=true'
80 python3 tools/git-sync-deps
83 For a list of available build arguments, take a look at `gn/skia.gni`, or run:
86 bin/gn args out/Debug --list
89 GN allows multiple build folders to coexist; each build can be configured
94 bin/gn gen out/Release --args='is_debug=false'
95 bin/gn gen out/Clang --args='cc="clang" cxx="clang++"'
96 bin/gn gen out/Cached --args='cc_wrapper="ccache"'
97 bin/gn gen out/RTTI --args='extra_cflags_cc=["-frtti"]'
100 Once you have generated your build files, run Ninja to compile and link Skia:
103 ninja -C out/Static
116 python tools/git-sync-deps
117 ninja -C out/Static
122 To build Skia for Android you need an
129 ./bin/fetch-sk
131 ./bin/sk asset download android_ndk_darwin /tmp/ndk # on Mac
135 When generating your GN build files, pass the path to your `ndk` and your
139 bin/gn gen out/arm --args='ndk="/tmp/ndk" target_cpu="arm"'
140 bin/gn gen out/arm64 --args='ndk="/tmp/ndk" target_cpu="arm64"'
141 bin/gn gen out/x64 --args='ndk="/tmp/ndk" target_cpu="x64"'
142 bin/gn gen out/x86 --args='ndk="/tmp/ndk" target_cpu="x86"'
152 ninja -C out/arm64
155 adb shell "cd /data/local/tmp; ./dm --src gm --config gl"
160 To cross-compile Skia for arm ChromeOS devices the following is needed:
162 - Clang 4 or newer
163 - An armhf sysroot
164 - The (E)GL lib files on the arm chromebook to link against.
194 "--target=armv7a-linux-gnueabihf",
195 "--sysroot=/opt/armhf_sysroot/",
196 "-march=armv7-a",
197 "-mfpu=neon",
198 "-mthumb",
201 "--target=armv7a-linux-gnueabihf",
202 "--sysroot=/opt/armhf_sysroot",
203 "-I/opt/chromebook_arm_gles/include",
204 "-I/opt/armhf_sysroot/include/",
205 "-I/opt/armhf_sysroot/include/c++/4.8.4/",
206 "-I/opt/armhf_sysroot/include/c++/4.8.4/arm-linux-gnueabihf/",
207 "-DMESA_EGL_NO_X11_HEADERS",
208 "-funwind-tables",
211 "--sysroot=/opt/armhf_sysroot",
212 "-B/opt/armhf_sysroot/bin",
213 "-B/opt/armhf_sysroot/gcc-cross",
214 "-L/opt/armhf_sysroot/gcc-cross",
215 "-L/opt/armhf_sysroot/lib",
216 "-L/opt/chromebook_arm_gles/lib",
217 "--target=armv7a-linux-gnueabihf",
229 "-I/opt/clang/include/c++/v1/",
230 "-I/opt/chromebook_x86_64_gles/include",
231 "-DMESA_EGL_NO_X11_HEADERS",
232 "-DEGL_NO_IMAGE_EXTERNAL",
235 "-stdlib=libc++",
236 "-fuse-ld=lld",
237 "-L/opt/chromebook_x86_64_gles/lib",
254 sudo mount -i -o remount,exec /home/chronos
257 ## Mac section
259 Mac users may want to pass `--ide=xcode` to `bin/gn gen` to generate an Xcode
262 Mac GN builds assume an Intel CPU by default. If you are building for Apple
266 bin/gn gen out/AppleSilicon --args='target_cpu="arm64"'
269 Googlers should see [go/skia-corp-xcode](http://go/skia-corp-xcode) for
275 and it is known to interact poorly with our build system. We recommend
282 Run GN to generate your build files. Set `target_os="ios"` to build for iOS.
284 `ios_use_simulator=true` and set `target_cpu` to your Mac's architecture. argument
285 On an Intel Mac, setting `target_cpu="x64"` alone will also target the iOS
289 bin/gn gen out/ios64 --args='target_os="ios"'
290 bin/gn gen out/ios32 --args='target_os="ios" target_cpu="arm"'
291 bin/gn gen out/iossim-apple --args='target_os="ios" target_cpu="arm64" ios_use_simulator=true'
292 bin/gn gen out/iossim-intel --args='target_os="ios" target_cpu="x64"'
295 By default this will also package (and for non-simulator devices, sign) iOS test binaries.
299 When signing, the build defaults to a Google signing identity and provisioning profile.
309 A list of identities can be found by typing `security find-identity` on the
320 For signed packages `ios-deploy` makes installing and running them on a device
324 ios-deploy -b out/Debug/dm.app -d --args "--match foo"
327 If you wish to deploy through Xcode you can generate a project by passing `--ide=xcode` to
329 `Project Settings...` and verify that `Build System:` is set to
330 `Legacy Build System`.
343 Skia can build on Windows with Visual Studio 2017 or 2019. If GN is unable to
348 [Build Tools for Visual Studio 2017 or 2019](https://www.visualstudio.com/downloads/#build-tools-fo…
363 This toolchain is the only way we support 32-bit builds, by also setting
366 The Skia build assumes that the PATHEXT environment variable contains ".EXE".
368 ### **Highly Recommended**: Build with clang-cl
373 Setting the `cc` and `cxx` gn args is _not_ sufficient to build with clang-cl.
395 If you use Visual Studio, you may want to pass `--ide=vs` to `bin/gn gen` to
397 specific configuration, and will only build/run that configuration.
402 `--ide=vs` when running `bin/gn gen` for each one. Then:
417 [Windows 10 on ARM](https://docs.microsoft.com/en-us/windows/arm/). This
428 bin/gn gen out/win-arm64 --args='target_cpu="arm64" skia_use_angle=true'
431 This will produce a build of Skia that can use the software or ANGLE backends,
432 in DM. Viewer only works when launched with `--backend angle`, because the
437 We have added a GN-to-CMake translator mainly for use with IDEs that like CMake
441 bin/gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py