我也懒得去编译了(我也编译不来),要下载的东西太多,而skia-build项目中没有x86版本.
 所以从这里下载了别人的,编译方法.
 下载后,要改两个地方:
 1,SkRect文件中使用了max/min,删除相应的std::
 2,SkTFitsIn.h文件中的std::numeric_limits<typename sk_strip_enum<D>::type>::max要加个括号,否则编译不过,这里.
然后按这里写一个示例.
 两个文件:
 1,前面的
#include <Windows.h>#include "include/core/SkCanvas.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkPaint.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkFont.h"
#include "include/codec/SkCodec.h"
#include "include/core/SkImageEncoder.h"// Skia依赖DirectX的一些库,复制即可
#include <d3d12.h>
#pragma comment(lib, "D3D12.lib")
#pragma comment(lib, "skia.lib")
#pragma comment(lib, "user32.lib")
#include <d3dcompiler.h>
#pragma comment(lib, "d3dcompiler.lib")
#pragma comment(lib, "Opengl32.lib")
#ifdef _DEBUG
#include <dxgi1_3.h>
#pragma comment(lib, "DXGI.lib")
#endif // _DEBUG
2,画图:
#undef max
#undef min
#include <iostream>
#include "sk0.cpp"int main()
{SkBitmap bitmap;  //创建位图设备SkImageInfo imageInfo = SkImageInfo::Make(480, 320, kBGRA_8888_SkColorType, kPremul_SkAlphaType);  //设置位图信息bitmap.allocPixels(imageInfo, imageInfo.minRowBytes());  //为位图设备绑定信息和分配内存SkCanvas canvas(bitmap);  //创建画布SkPaint paint;  //创建画笔canvas.clear(SkColorSetARGB(0xFF, 0x14, 0x14, 0x14));//将画布清空并填充一种颜色,注意这里是ARGB,Alpha通道值在第一位,同时可以直接用16进制数表示,例如上面这个颜色值可以表示为0xFF141414paint.setColor(SK_ColorWHITE);//设置画笔颜色SkFont font;  //创建字体设备font.setSize(64);  //设置字体尺寸font.setTypeface(SkTypeface::MakeFromName("Microsoft YaHei", SkFontStyle::Normal()));  //设置字体SkString text("Hello, Skia!");canvas.drawSimpleText(text.c_str(), text.size(), SkTextEncoding::kUTF8, 0, 64, font, paint);  //在画布上绘制字体SkFILEWStream stream("D:\\test.png");  //创建文件输出流SkEncodeImage(&stream, bitmap, SkEncodedImageFormat::kPNG, 100);  //将位图数据按照指定格式编码并输出到文件中return 0;
}xmake.lua内容为:
add_rules("mode.release")
target("b")add_files("b.cpp")add_includedirs(".")set_targetdir('.')然后xmake编译,得到b.exe,然后运行,就成功了.