Skip to content

Building SkiaSharp

Matthew Leibowitz edited this page Nov 17, 2019 · 37 revisions

Table of Contents

Preparation

Building a complete SkiaSharp is actually pretty simple, you just need to install a few dependencies.

To get started with any type of development, you will have to fork and then clone SkiaSharp. If you are not going to be making changes, you can clone the main repository:

> git clone https://github.com/mono/SkiaSharp

Once the source is on your machine, you can get started with building. There are a few ways in which to get started, depending on what you are going to do.

Managed-Only Building

In many cases, you just want to fix a bug in the managed code. If this is the case, you can just download the native bits from CI, and then work from there.

Dependencies

Windows Dependencies:

  • Windows 10 Fall Creators Update (build 16299 / version 1709)
  • Visual Studio 2017+
    • .NET desktop development
    • Universal Windows Platform development
      • Windows 10 SDK (10.0.16299)
      • Windows 10 SDK (10.0.10240)
    • Mobile development with .NET
      • Android SDK platform for API level 19 (KitKat / version 4.4)
    • .NET Core cross-platform development
    • Individual components
      • .NET Framework 4.7 SDK
      • .NET Framework 4.7 targeting pack

Preparation

Before downloading the bits from CI, you need to determine what is the build ID for the latest of the branch you are building. The location of the CI is on Azure DevOps: https://dev.azure.com/xamarin/public/_build?definitionId=4

Typically, you would be working on the master branch, so you can filter by that branch and successful builds. Once you have a build ID, you can run the bootstrapper to download and extract the files:

> .\bootstrapper.ps1 -t externals-download --azureBuildId=<build-id>

Making Changes

Once that is complete, you should be able to now start working on some code. You can open the source/SkiaSharpSource.sln solution (or one of the platform variants) and start making changes. If you are going to be working with unit tests, or don't need to work on all the platform projects, you can open the tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.sln solution.

The SkiaSharpSource.sln solution is primarily for working with platform-specific bits, and then you can compile to make sure everything is working. The SkiaSharp.Desktop.Tests.sln solution is for testing that changes to the API are still working as expected.

Building

Once you are finished making changes, you can run the tests target and make sure that the tests will pass on CI. There is also the samples and nuget targets. By adding the --skipExternals=all argument, you can let the bootstrapper know that it should not build any native bits, but rather use the bits that were downloaded.

> .\bootstrapper.ps1 -t everything --skipExternals=all

Native Building

Dependencies

In addition to a few extra dependencies, the Managed-Only build dependencies are still required.

Windows Dependencies:

  • Managed-Only build dependencies
  • Python 2.7
    • Make sure the path to python is in the PATH environment variable, or the full path to python is in the PYTHON_EXE environment variable.
  • Visual Studio 2017+
    • Desktop development with C++
      • Windows 10 SDK (10.0.16299)
      • Windows 10 SDK (10.0.10240)
      • Windows 8.1 SDK and UCRT SDK
      • VC++ 2015.3 v14.00 (v140) toolset for desktop
    • Individual components
      • Visual C++ compilers and libraries for ARM
      • Visual C++ compilers and libraries for ARM64
      • Visual C++ runtime for UWP
      • Android NDK r15+ or manually
        • Make sure the path to the root is in the ANDROID_NDK_ROOT or ANDROID_NDK_HOME environment variables.
  • Tizen Studio 2.4+ (either the IDE or the CLI)
    • Using CLI: Install the MOBILE-4.0 and MOBILE-4.0-NativeAppDevelopment packages
    • Using IDE: Install the 4.0 Mobile | Native app. development (IDE)
    • Make sure the root is in the TIZEN_STUDIO_HOME environment variable, or at ~/tizen-studio.
    • Tizen Studio requires Java 8/9/10 to be installed and available in the PATH environment variable.

Generating Documentation

.\bootstrapper.ps1 -t docs-download-output --azureBuildId=<build-id>
.\bootstrapper.ps1 -t update-docs