GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1785743003 NOTRY=true DOCS_PREVIEW= https://skia.org/?cl=1785743003 NOTREECHECKS=true NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1785743003
5.2 KiB
Windows
Prerequisites
Make sure the following have been installed:
-
Git
- Either use the mysygit installed by depot_tools
- Or install git-for-windows yourself.
-
Python 2.7.x (if you're not planning to use cygwin)
- available for free download at python.org
- make sure the installer changes your %PATH% environment variable to include the directory with the "python.exe" binary
-
Cygwin (optional, but useful if you want to use git)
- Download from https://www.cygwin.com/setup-x86.exe or https://www.cygwin.com/setup-x86_64.exe
- Use any mirror you like; http://lug.mtu.edu works well
- Cygwin installs a minimum of options. Add these packages if they
aren't already selected:
- Devel git
- Devel subversion
- Editors vim
- to fix arrows in insert, copy
/usr/share/vim/vim73/vimrc_example.vim
to~/.vimrc
- to fix arrows in insert, copy
- Net ca-certificates
- Python python
- Utils patch
- Utils util-linux
- Set the windows envionment variable CYGWIN to nodosfilewarning
Check out the source code
Follow the instructions here for downloading the Skia source.
Gyp Generators on Windows
We use the open-source Gyp tool to generate Visual Studio projects (and analogous build scripts on other platforms) from our multi-platform "gyp" files.
Three Gyp generators are used on Windows:
-
ninja
- Run ninja yourself, without VisualStudio project files, -
msvs-ninja
- Develop from a fully-integrated Visual Studio. Gyp generates Visual-Studio-compatible project files that still ultimately build using ninja. This is the preferred and better maintained way of using Visual Studio. -
msvs
- Use Visual Studio's own (slower) build system. This is not as well maintained as msvs-ninja. The msvs and ninja output can clobber each other so building from both the command line and Visual Studio can produce bad states that can be fixed by deleting the out directory and rerunning gyp_skia.
To choose which ones to use, set the GYP_GENERATORS
environment
variable to a comma-delimited list of generators before running
sync-and-gyp. The default value for GYP_GENERATORS
is
ninja,msvs-ninja
. For example to enable the ninja
and msvs
generators:
Setting Enviroment Variables in Windows CMD.EXE
cd %SKIA_CHECKOUT_DIR%
SET "GYP_GENERATORS=ninja,msvs"
python bin/sync-and-gyp
SET "GYP_GENERATORS="
Build and run tests from the command line
ninja -C out/Debug dm
out\Debug\dm
See this page for running Skia tests on all desktop
Build and run tests in the Visual Studio IDE
-
Generate the Visual Studio project files by running
sync-and-gyp
as described above -
Open a File Explorer window pointing at the
%SKIA_CHECKOUT_DIR%\out\gyp
directory -
Double-click on dm.sln to start Visual Studio and load the project
-
When Visual Studio starts, you may see an error dialog stating that "One or more projects in the solution were not loaded correctly"... but there's probably nothing to worry about.
-
In the "Solution Explorer" window, right-click on the "dm" project and select "Set as StartUp Project".
-
In the "Debug" menu, click on "Start Debugging" (or just press F5). If you get a dialog saying that the project is out of date, click on "Yes" to rebuild it.
-
Once the build is complete, you should see console output from the tests in the "Output" window at lower right.
Build and run SampleApp in Visual Studio
-
Generate the Visual Studio project files by running
sync-and-gyp
as described above -
Open a File Explorer window pointing at the
%SKIA_INSTALLDIR%\trunk\out\gyp
directory -
Double-click on SampleApp.sln
-
When Visual Studio starts, you may see an error dialog stating that "One or more project s in the solution were not loaded correctly"... but there's probably nothing to worry about.
-
In the "Debug" menu, click on "Start Debugging" (or just press F5). If you get a dialog saying that the project is out of date, click on "Yes" to rebuild it.
-
Once the build is complete, you should see a window with various example graphics. To move through the sample app, use the following keypresses:
- right- and left-arrow key: cycle through different test pages
- 'D' key: cycle through rendering methods for each test page
- other keys are defined in SampleApp.cpp’s SampleWindow::onHandleKey() and SampleWindow::onHandleChar() methods