Compiling Skia from source code under Windows

Source: Internet
Author: User
Tags skia

Draw in the PPAPI, can be combined with third-party graphics library. For example, Cairo, Skia.

Google Chrome, Chromium, and Android all use Skia as the drawing engine. I'll try it, too. Skia, first pass the compile off.

Foruok original. For reprint please follow Foruok's subscription number "program Horizon" contact Foruok.

CEF-compiled Skia cannot be used alone

Chromium use Skia. under Windows, compiling CEF from source code illustrates how to compile CEF, which will be chromium by the compiler. There are skia in it, but the skia_library.lib it compiles cannot be used alone and added to the VSProject. Report n multiple link error.

Just good to build it yourself.

Compiling Skia separately

Guide to compiling Windows: https://skia.org/user/quick/windows. First of all, you have Python system. We've compiled CEF, we've got it.

Download Skia here: Https://skia.org/user/download.

Need to use Git. Depot_tools is very full. There's everything.

We have previously compiled CEF and have voluntarily downloaded depot_tools. In E:\sources\CEF\2526\depot_tools, set to path:

set path=E:\sources\CEF\2526\depot_tools;%path%

Then use git to download Skia:

git clone https://skia.googlesource.com/skia.git

Then execute the following command:

cd %SKIA_CHECKOUT_DIR%SET "GYP_GENERATORS=ninja,msvs"  //告诉GYP。产生ninja构建文件和msvs构建文件python bin/sync-and-gyp             SET "GYP_GENERATORS="

After the above command is complete, the ninja-based build file is here: E:\sources\skia\out\Release (Debug) \build.ninja. The solution based on VS2013 is here: E:\sources\skia\out\skia.sln.

I choose to compile the release version number.

The "most" target is compiled by default. Most.ninja here: E:\sources\skia\out\Release\obj\gyp, which specifies the compilation skia_lib and the DM, SampleApp, HelloWorld and other modules.

Compile commands such as the following:

cd out\Releaseninja

Compiled into the effects module, something went wrong. Said:

Ninja:build Stopped:subcommand failed.

Add a number of references and then:

ninja -v > skia_build.log

Research Skia_build.log, find error messages such as the following:

[6/1807] ninja-t msvc-e environment.x86– "E:\software\VS2013_64_update4\VC\bin\amd64_x86\cl.exe"/nologo/ SHOWINCLUDES/FC @obj \tools\imgslice.imgslice.obj.rsp/c .... \tools\imgslice.cpp/foobj\tools\imgslice.imgslice.obj/ Fdimgslice.pdb
Failed:ninja-t msvc-e environment.x86– "E:\software\VS2013_64_update4\VC\bin\amd64_x86\cl.exe"/nologo/ SHOWINCLUDES/FC @obj \src\effects\effects. Skdisplacementmapeffect.obj.rsp/c. \src\effects\skdisplacementmapeffect.cpp/foobj\src\effects\effects. Skdisplacementmapeffect.obj/fdeffects.pdb
E:\sources\skia\src\effects\skdisplacementmapeffect.cpp:error C2220: Warning is treated as error-no "object" file generated
E:\sources\skia\src\effects\skdisplacementmapeffect.cpp:warning C4819: This file includes characters that cannot be represented in the current code page (936). Please save the file in Unicode format to prevent data loss

Error C2220 is due to all warnings as errors, compile-time with the/WX tag. and warning C4819. MSDN says "C4819" occurs when an ANSI source file is compiled on a system that has a code page that cannot represent all characters in a file.

Remember before compiling CEF (refer to windows to compile CEF from source code) said to set the system locale to English, and then try again.

(⊙o⊙) ..., really.

After compiling, lib files and exe files are all under the E:\sources\skia\out\Release folder. There are so some Skia libraries, see:

Try executing the HelloWorld.exe (under the E:\sources\skia\out\Release folder). Effects such as:

Well, yes, I can move on.

Next time I will combine Ppapi and Skia to try.

Other articles:

    • CEF Windows Development Environment Setup
    • CEF load Ppapi plug-in
    • VS2013 compiling the simplest Ppapi plugin
    • Understanding the design of PPAPI
    • Ppapi plugin-to-browser interaction process
    • Under Windows, compile CEF from source code
    • Media_stream_video Demo sample for compiling Ppapi
    • PPAPI plug-in drawing and input event handling
    • Create a local form in the PPAPI plug-in
    • PPAPI plug-in communication with the browser

Compiling Skia from source code under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.