Skip to content

Building SkiaSharp

Matthew Leibowitz edited this page Mar 11, 2019 · 37 revisions

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.

Windows Dependencies:

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

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