Build google skia library as dll.
https://www.chromium.org/developers/how-tos/depottools
2. Check out the Skia source code (https://skia.org/user/quick/windows)
$ git clone https://skia.googlesource.com/skia.git skia
$ cd skia
3. GYP Generators on Windows (https://skia.org/user/quick/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
- msvs: Use Visual Studio’s own (slower) build system
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:
// add '-Dskia_shared_lib=1'
//subprocess.call(['python', './gyp_skia',], env=env)
subprocess.call(['python', './gyp_skia', '-Dskia_shared_lib=1'], env=env)
[ 'skia_os == "win"',
...
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
// RuntimeLibrary 3 -> 1
#'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
'RuntimeLibrary': '1', # /MTd
...
},
...
},
...
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
// RuntimeLibrary 2 -> 0
#'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
'RuntimeLibrary': '0', # /MT
...
},
...
},
...
}
},
'conditions' : [
...
// add follow coditions
[ 'skia_shared_lib', {
'defines': [
'SKIA_DLL',
'SKIA_IMPLEMENTATION=1',
],
}],
...
],
'conditions': [
[ 'skia_os in ["mac", "linux", "freebsd", "openbsd", "solaris", "android", "win"] '
'and skia_android_framework == 0', {
//'skia_warnings_as_errors%': 1,
'skia_warnings_as_errors%': 0,
}, {
'skia_warnings_as_errors%': 0,
}],
7. Setting Enviroment Variables in Windows CMD.EXE (https://skia.org/user/tips#gypdefines)
$ cd %SKIA_CHECKOUT_DIR%
$ SET "GYP_GENERATORS=msvs"
$ python bin/sync-and-gyp
$ SET "GYP_GENERATORS="
skia_lib
#if defined(SKIA_DLL)
//#if defined(WIN32)
#if defined(SK_BUILD_FOR_WIN32) <<<<<<<<<<<<<<<<<<<
#if SKIA_IMPLEMENTATION
#define SK_API __declspec(dllexport)
#else
#define SK_API __declspec(dllimport)
#endif
#else
#define SK_API __attribute__((visibility("default")))
#endif
#else
#define SK_API
#endif