2016-09-15 04:14:35 +03:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TOOLS & FUNCTIONS - the bits to make it all work
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
var InjectCompatibilityExternals = new Action<bool> ((inject) => {
|
|
|
|
// some methods don't yet exist, so we must add the compat layer to them.
|
|
|
|
// we need this as we can't modify the third party files
|
|
|
|
// all we do is insert our header before all the others
|
|
|
|
var compatHeader = "native-builds/src/WinRTCompat.h";
|
|
|
|
var compatSource = "native-builds/src/WinRTCompat.c";
|
|
|
|
var files = new Dictionary<FilePath, string> {
|
|
|
|
{ "externals/skia/third_party/externals/dng_sdk/source/dng_string.cpp", "#if qWinOS" },
|
|
|
|
{ "externals/skia/third_party/externals/dng_sdk/source/dng_utils.cpp", "#if qWinOS" },
|
|
|
|
{ "externals/skia/third_party/externals/dng_sdk/source/dng_pthread.cpp", "#if qWinOS" },
|
|
|
|
{ "externals/skia/third_party/externals/zlib/deflate.c", "#include <assert.h>" },
|
|
|
|
{ "externals/skia/third_party/externals/libjpeg-turbo/simd/jsimd_x86_64.c", "#define JPEG_INTERNALS" },
|
|
|
|
{ "externals/skia/third_party/externals/libjpeg-turbo/simd/jsimd_i386.c", "#define JPEG_INTERNALS" },
|
|
|
|
{ "externals/skia/third_party/externals/libjpeg-turbo/simd/jsimd_arm.c", "#define JPEG_INTERNALS" },
|
|
|
|
{ "externals/skia/third_party/externals/libjpeg-turbo/simd/jsimd_arm64.c", "#define JPEG_INTERNALS" },
|
|
|
|
};
|
|
|
|
foreach (var filePair in files) {
|
|
|
|
var file = filePair.Key;
|
|
|
|
|
|
|
|
if (!FileExists (file))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
var root = string.Join ("/", file.GetDirectory ().Segments.Select (x => ".."));
|
|
|
|
var include = "#include \"" + root + "/" + compatHeader + "\"";
|
|
|
|
|
|
|
|
var contents = FileReadLines (file).ToList ();
|
|
|
|
var index = contents.IndexOf (include);
|
|
|
|
if (index == -1 && inject) {
|
2017-03-17 08:00:39 +03:00
|
|
|
Information ("Injecting modifications into third party code: {0}...", file);
|
2016-09-15 04:14:35 +03:00
|
|
|
if (string.IsNullOrEmpty (filePair.Value)) {
|
|
|
|
contents.Insert (0, include);
|
|
|
|
} else {
|
|
|
|
contents.Insert (contents.IndexOf (filePair.Value), include);
|
|
|
|
}
|
|
|
|
FileWriteLines (file, contents.ToArray ());
|
|
|
|
} else if (index != -1 && !inject) {
|
2017-03-17 08:00:39 +03:00
|
|
|
Information ("Removing injected modifications from third party code: {0}...", file);
|
2016-09-15 04:14:35 +03:00
|
|
|
int idx = 0;
|
|
|
|
if (string.IsNullOrEmpty (filePair.Value)) {
|
|
|
|
idx = 0;
|
|
|
|
} else {
|
|
|
|
idx = contents.IndexOf (filePair.Value) - 1;
|
|
|
|
}
|
|
|
|
if (contents [idx] == include) {
|
|
|
|
contents.RemoveAt (idx);
|
|
|
|
}
|
|
|
|
FileWriteLines (file, contents.ToArray ());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// EXTERNALS - the native C and C++ libraries
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-03-14 05:29:13 +03:00
|
|
|
Task ("externals-init")
|
2017-04-27 22:35:54 +03:00
|
|
|
.IsDependentOn ("externals-angle-uwp")
|
|
|
|
.IsDependentOn ("externals-harfbuzz")
|
2017-03-14 05:29:13 +03:00
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-09-05 18:28:56 +03:00
|
|
|
RunProcess ("python", new ProcessSettings {
|
2017-03-17 08:00:39 +03:00
|
|
|
Arguments = SKIA_PATH.CombineWithFilePath ("tools/git-sync-deps").FullPath,
|
2017-03-14 05:29:13 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
2017-03-17 08:00:39 +03:00
|
|
|
|
|
|
|
// insert compatibility modifications for external code
|
|
|
|
InjectCompatibilityExternals (true);
|
2017-03-14 05:29:13 +03:00
|
|
|
});
|
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
// this builds the native C and C++ externals
|
|
|
|
Task ("externals-native")
|
|
|
|
.IsDependentOn ("externals-uwp")
|
|
|
|
.IsDependentOn ("externals-windows")
|
|
|
|
.IsDependentOn ("externals-osx")
|
|
|
|
.IsDependentOn ("externals-ios")
|
|
|
|
.IsDependentOn ("externals-tvos")
|
|
|
|
.IsDependentOn ("externals-android")
|
2017-01-25 01:33:42 +03:00
|
|
|
.IsDependentOn ("externals-linux")
|
2016-09-15 04:14:35 +03:00
|
|
|
.Does (() =>
|
|
|
|
{
|
|
|
|
// copy all the native files into the output
|
|
|
|
CopyDirectory ("./native-builds/lib/", "./output/native/");
|
2017-06-27 19:01:25 +03:00
|
|
|
// copy ANGLE externals
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("./output/native/uwp/arm/");
|
|
|
|
EnsureDirectoryExists ("./output/native/uwp/x86/");
|
|
|
|
EnsureDirectoryExists ("./output/native/uwp/x64/");
|
2017-06-27 19:01:25 +03:00
|
|
|
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/ARM/libEGL.dll"), "./output/native/uwp/arm/");
|
|
|
|
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/ARM/libGLESv2.dll"), "./output/native/uwp/arm/");
|
|
|
|
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/Win32/libEGL.dll"), "./output/native/uwp/x86/");
|
|
|
|
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/Win32/libGLESv2.dll"), "./output/native/uwp/x86/");
|
|
|
|
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/x64/libEGL.dll"), "./output/native/uwp/x64/");
|
|
|
|
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/x64/libGLESv2.dll"), "./output/native/uwp/x64/");
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// this builds the native C and C++ externals for Windows
|
|
|
|
Task ("externals-windows")
|
2017-03-16 15:57:43 +03:00
|
|
|
.IsDependentOn ("externals-init")
|
2016-09-15 04:14:35 +03:00
|
|
|
.WithCriteria (IsRunningOnWindows ())
|
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-04-27 22:35:54 +03:00
|
|
|
// libSkiaSharp
|
|
|
|
|
2017-03-16 15:57:43 +03:00
|
|
|
var buildArch = new Action<string, string, string> ((arch, skiaArch, dir) => {
|
|
|
|
// generate native skia build files
|
|
|
|
RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn.exe"), new ProcessSettings {
|
|
|
|
Arguments =
|
2017-03-18 16:03:10 +03:00
|
|
|
"gen out/win/" + arch + " " +
|
|
|
|
"--args=\"" +
|
|
|
|
" is_official_build=true skia_enable_tools=false" +
|
|
|
|
" target_os=\\\"win\\\" target_cpu=\\\"" + skiaArch + "\\\"" +
|
|
|
|
" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_dng_sdk=true" +
|
2017-07-11 16:01:04 +03:00
|
|
|
" skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
|
2017-05-14 22:49:49 +03:00
|
|
|
" extra_cflags=[ \\\"-DSKIA_C_DLL\\\", \\\"/MD\\\", \\\"/EHsc\\\", \\\"/Zi\\\" ]" +
|
|
|
|
" extra_ldflags=[ \\\"/DEBUG\\\" ]" +
|
2017-03-18 16:03:10 +03:00
|
|
|
"\"",
|
2017-03-16 15:57:43 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build native skia
|
|
|
|
RunProcess (DEPOT_PATH.CombineWithFilePath ("ninja.exe"), new ProcessSettings {
|
|
|
|
Arguments = "-C out/win/" + arch,
|
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
2017-03-16 15:57:43 +03:00
|
|
|
|
|
|
|
// build libSkiaSharp
|
2017-05-12 19:25:21 +03:00
|
|
|
RunMSBuildWithPlatformTarget ("native-builds/libSkiaSharp_windows/libSkiaSharp.sln", arch);
|
2017-03-16 15:57:43 +03:00
|
|
|
|
|
|
|
// copy libSkiaSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/windows/" + dir);
|
2017-03-16 15:57:43 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libSkiaSharp_windows/bin/" + arch + "/Release/libSkiaSharp.dll", "native-builds/lib/windows/" + dir);
|
|
|
|
CopyFileToDirectory ("native-builds/libSkiaSharp_windows/bin/" + arch + "/Release/libSkiaSharp.pdb", "native-builds/lib/windows/" + dir);
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
buildArch ("Win32", "x86", "x86");
|
2017-03-16 15:57:43 +03:00
|
|
|
buildArch ("x64", "x64", "x64");
|
2017-04-27 22:35:54 +03:00
|
|
|
|
|
|
|
// libHarfBuzzSharp
|
|
|
|
|
|
|
|
var buildHarfBuzzArch = new Action<string, string> ((arch, dir) => {
|
|
|
|
// build libHarfBuzzSharp
|
2017-05-12 19:25:21 +03:00
|
|
|
RunMSBuildWithPlatformTarget ("native-builds/libHarfBuzzSharp_windows/libHarfBuzzSharp.sln", arch);
|
2017-04-27 22:35:54 +03:00
|
|
|
|
|
|
|
// copy libHarfBuzzSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/windows/" + dir);
|
2017-04-27 22:35:54 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_windows/bin/" + arch + "/Release/libHarfBuzzSharp.dll", "native-builds/lib/windows/" + dir);
|
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_windows/bin/" + arch + "/Release/libHarfBuzzSharp.pdb", "native-builds/lib/windows/" + dir);
|
|
|
|
});
|
|
|
|
|
|
|
|
buildHarfBuzzArch ("Win32", "x86");
|
|
|
|
buildHarfBuzzArch ("x64", "x64");
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// this builds the native C and C++ externals for Windows UWP
|
|
|
|
Task ("externals-uwp")
|
2017-03-16 15:57:43 +03:00
|
|
|
.IsDependentOn ("externals-init")
|
2016-09-15 04:14:35 +03:00
|
|
|
.WithCriteria (IsRunningOnWindows ())
|
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-04-27 22:35:54 +03:00
|
|
|
// libSkiaSharp
|
|
|
|
|
2017-03-16 15:57:43 +03:00
|
|
|
var buildArch = new Action<string, string, string> ((arch, skiaArch, dir) => {
|
|
|
|
// generate native skia build files
|
|
|
|
RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn.exe"), new ProcessSettings {
|
|
|
|
Arguments =
|
2017-03-18 16:03:10 +03:00
|
|
|
"gen out/winrt/" + arch + " " +
|
|
|
|
"--args=\"" +
|
|
|
|
" is_official_build=true skia_enable_tools=false" +
|
|
|
|
" target_os=\\\"winrt\\\" target_cpu=\\\"" + skiaArch + "\\\"" +
|
2017-07-11 16:01:04 +03:00
|
|
|
" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true" +
|
|
|
|
" skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
|
2017-03-18 16:03:10 +03:00
|
|
|
" extra_cflags=[ " +
|
2017-05-14 22:49:49 +03:00
|
|
|
" \\\"-DSKIA_C_DLL\\\", \\\"/MD\\\", \\\"/EHsc\\\", \\\"/Zi\\\", " +
|
2017-03-18 16:03:10 +03:00
|
|
|
" \\\"-DWINAPI_FAMILY=WINAPI_FAMILY_APP\\\", \\\"-DSK_BUILD_FOR_WINRT\\\", \\\"-DSK_HAS_DWRITE_1_H\\\", \\\"-DSK_HAS_DWRITE_2_H\\\", \\\"-DNO_GETENV\\\" ]" +
|
2017-05-14 22:49:49 +03:00
|
|
|
" extra_ldflags=[ \\\"/APPCONTAINER\\\", \\\"/DEBUG\\\" ]" +
|
2017-03-18 16:03:10 +03:00
|
|
|
"\"",
|
2017-03-16 15:57:43 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
2017-03-16 15:57:43 +03:00
|
|
|
|
|
|
|
// build native skia
|
|
|
|
RunProcess (DEPOT_PATH.CombineWithFilePath ("ninja.exe"), new ProcessSettings {
|
|
|
|
Arguments = "-C out/winrt/" + arch,
|
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
2017-03-16 15:57:43 +03:00
|
|
|
// build libSkiaSharp
|
2017-05-12 19:25:21 +03:00
|
|
|
RunMSBuildWithPlatformTarget ("native-builds/libSkiaSharp_uwp/libSkiaSharp.sln", arch);
|
2016-09-15 04:14:35 +03:00
|
|
|
|
2017-03-16 15:57:43 +03:00
|
|
|
// copy libSkiaSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/uwp/" + dir);
|
2017-03-16 15:57:43 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libSkiaSharp_uwp/bin/" + arch + "/Release/libSkiaSharp.dll", "native-builds/lib/uwp/" + dir);
|
|
|
|
CopyFileToDirectory ("native-builds/libSkiaSharp_uwp/bin/" + arch + "/Release/libSkiaSharp.pdb", "native-builds/lib/uwp/" + dir);
|
|
|
|
});
|
|
|
|
|
|
|
|
buildArch ("x64", "x64", "x64");
|
|
|
|
buildArch ("Win32", "x86", "x86");
|
|
|
|
buildArch ("ARM", "arm", "ARM");
|
2017-04-27 22:35:54 +03:00
|
|
|
|
|
|
|
// libHarfBuzzSharp
|
|
|
|
|
|
|
|
var buildHarfBuzzArch = new Action<string, string> ((arch, dir) => {
|
|
|
|
// build libHarfBuzzSharp
|
2017-05-12 19:25:21 +03:00
|
|
|
RunMSBuildWithPlatformTarget ("native-builds/libHarfBuzzSharp_uwp/libHarfBuzzSharp.sln", arch);
|
2017-04-27 22:35:54 +03:00
|
|
|
|
|
|
|
// copy libHarfBuzzSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/uwp/" + dir);
|
2017-04-27 22:35:54 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_uwp/bin/" + arch + "/Release/libHarfBuzzSharp.dll", "native-builds/lib/uwp/" + dir);
|
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_uwp/bin/" + arch + "/Release/libHarfBuzzSharp.pdb", "native-builds/lib/uwp/" + dir);
|
|
|
|
});
|
|
|
|
|
|
|
|
buildHarfBuzzArch ("Win32", "x86");
|
|
|
|
buildHarfBuzzArch ("x64", "x64");
|
|
|
|
buildHarfBuzzArch ("ARM", "arm");
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// this builds the native C and C++ externals for Mac OS X
|
|
|
|
Task ("externals-osx")
|
2017-03-14 05:29:13 +03:00
|
|
|
.IsDependentOn ("externals-init")
|
2017-01-11 07:35:43 +03:00
|
|
|
.WithCriteria (IsRunningOnMac ())
|
2016-09-15 04:14:35 +03:00
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-04-28 23:03:23 +03:00
|
|
|
// SkiaSharp
|
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
var buildArch = new Action<string, string> ((arch, skiaArch) => {
|
2017-03-14 05:29:13 +03:00
|
|
|
// generate native skia build files
|
|
|
|
RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn"), new ProcessSettings {
|
|
|
|
Arguments =
|
2017-03-18 16:03:10 +03:00
|
|
|
"gen out/mac/" + arch + " " +
|
|
|
|
"--args='" +
|
|
|
|
" is_official_build=true skia_enable_tools=false" +
|
|
|
|
" target_os=\"mac\" target_cpu=\"" + skiaArch + "\"" +
|
2017-07-11 16:01:04 +03:00
|
|
|
" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true" +
|
|
|
|
" skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
|
2017-05-07 02:26:17 +03:00
|
|
|
" extra_cflags=[ \"-DSKIA_C_DLL\", \"-mmacosx-version-min=10.9\" ]" +
|
2017-03-18 16:03:10 +03:00
|
|
|
" extra_ldflags=[ \"-Wl,macosx_version_min=10.9\" ]" +
|
|
|
|
"'",
|
2017-03-14 05:29:13 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build native skia
|
|
|
|
RunProcess (DEPOT_PATH.CombineWithFilePath ("ninja"), new ProcessSettings {
|
|
|
|
Arguments = "-C out/mac/" + arch,
|
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build libSkiaSharp
|
2016-09-15 04:14:35 +03:00
|
|
|
XCodeBuild (new XCodeBuildSettings {
|
|
|
|
Project = "native-builds/libSkiaSharp_osx/libSkiaSharp.xcodeproj",
|
|
|
|
Target = "libSkiaSharp",
|
|
|
|
Sdk = "macosx",
|
|
|
|
Arch = arch,
|
|
|
|
Configuration = "Release",
|
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// copy libSkiaSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/osx/" + arch);
|
2016-09-15 04:14:35 +03:00
|
|
|
CopyDirectory ("native-builds/libSkiaSharp_osx/build/Release/", "native-builds/lib/osx/" + arch);
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// strip anything we can
|
2017-01-28 13:38:58 +03:00
|
|
|
RunProcess ("strip", new ProcessSettings {
|
|
|
|
Arguments = "-x -S libSkiaSharp.dylib",
|
|
|
|
WorkingDirectory = "native-builds/lib/osx/" + arch,
|
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// re-sign with empty
|
|
|
|
RunProcess ("codesign", new ProcessSettings {
|
|
|
|
Arguments = "--force --sign - --timestamp=none libSkiaSharp.dylib",
|
|
|
|
WorkingDirectory = "native-builds/lib/osx/" + arch,
|
|
|
|
});
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
buildArch ("i386", "x86");
|
2017-03-14 05:29:13 +03:00
|
|
|
buildArch ("x86_64", "x64");
|
2017-04-28 23:03:23 +03:00
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
// create the fat dylib
|
|
|
|
RunLipo ("native-builds/lib/osx/", "libSkiaSharp.dylib", new [] {
|
|
|
|
(FilePath) "i386/libSkiaSharp.dylib",
|
|
|
|
(FilePath) "x86_64/libSkiaSharp.dylib"
|
|
|
|
});
|
2017-04-28 23:03:23 +03:00
|
|
|
|
|
|
|
// HarfBuzzSharp
|
|
|
|
|
|
|
|
var buildHarfBuzzArch = new Action<string, string> ((arch, skiaArch) => {
|
|
|
|
// build libHarfBuzzSharp
|
|
|
|
XCodeBuild (new XCodeBuildSettings {
|
|
|
|
Project = "native-builds/libHarfBuzzSharp_osx/libHarfBuzzSharp.xcodeproj",
|
|
|
|
Target = "libHarfBuzzSharp",
|
|
|
|
Sdk = "macosx",
|
|
|
|
Arch = arch,
|
|
|
|
Configuration = "Release",
|
|
|
|
});
|
|
|
|
|
|
|
|
// copy libHarfBuzzSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/osx/" + arch);
|
2017-04-28 23:03:23 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_osx/build/Release/libHarfBuzzSharp.dylib", "native-builds/lib/osx/" + arch);
|
|
|
|
|
|
|
|
// strip anything we can
|
|
|
|
RunProcess ("strip", new ProcessSettings {
|
|
|
|
Arguments = "-x -S libHarfBuzzSharp.dylib",
|
|
|
|
WorkingDirectory = "native-builds/lib/osx/" + arch,
|
|
|
|
});
|
|
|
|
|
|
|
|
// re-sign with empty
|
|
|
|
RunProcess ("codesign", new ProcessSettings {
|
|
|
|
Arguments = "--force --sign - --timestamp=none libHarfBuzzSharp.dylib",
|
|
|
|
WorkingDirectory = "native-builds/lib/osx/" + arch,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
buildHarfBuzzArch ("i386", "x86");
|
|
|
|
buildHarfBuzzArch ("x86_64", "x64");
|
|
|
|
|
|
|
|
// create the fat dylib
|
|
|
|
RunLipo ("native-builds/lib/osx/", "libHarfBuzzSharp.dylib", new [] {
|
|
|
|
(FilePath) "i386/libHarfBuzzSharp.dylib",
|
|
|
|
(FilePath) "x86_64/libHarfBuzzSharp.dylib"
|
|
|
|
});
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// this builds the native C and C++ externals for iOS
|
|
|
|
Task ("externals-ios")
|
2017-03-14 05:29:13 +03:00
|
|
|
.IsDependentOn ("externals-init")
|
2017-01-11 07:35:43 +03:00
|
|
|
.WithCriteria (IsRunningOnMac ())
|
2016-09-15 04:14:35 +03:00
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-04-28 23:03:23 +03:00
|
|
|
// SkiaSharp
|
|
|
|
|
2017-03-14 05:29:13 +03:00
|
|
|
var buildArch = new Action<string, string, string> ((sdk, arch, skiaArch) => {
|
|
|
|
// generate native skia build files
|
|
|
|
|
|
|
|
var specifics = "";
|
|
|
|
// several instances of "error: type 'XXX' requires 8 bytes of alignment and the default allocator only guarantees 4 bytes [-Werror,-Wover-aligned]
|
|
|
|
// https://groups.google.com/forum/#!topic/skia-discuss/hU1IPFwU6bI
|
|
|
|
if (arch == "armv7" || arch == "armv7s") {
|
2017-03-18 16:03:10 +03:00
|
|
|
specifics += ", \"-Wno-over-aligned\"";
|
2017-03-14 05:29:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn"), new ProcessSettings {
|
|
|
|
Arguments =
|
2017-03-18 16:03:10 +03:00
|
|
|
"gen out/ios/" + arch + " " +
|
|
|
|
"--args='" +
|
|
|
|
" is_official_build=true skia_enable_tools=false" +
|
|
|
|
" target_os=\"ios\" target_cpu=\"" + skiaArch + "\"" +
|
2017-07-11 16:01:04 +03:00
|
|
|
" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true" +
|
|
|
|
" skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
|
2017-05-07 02:26:17 +03:00
|
|
|
" extra_cflags=[ \"-DSKIA_C_DLL\", \"-mios-version-min=8.0\" " + specifics + " ]" +
|
2017-03-18 16:03:10 +03:00
|
|
|
" extra_ldflags=[ \"-Wl,ios_version_min=8.0\" ]" +
|
|
|
|
"'",
|
2017-03-14 05:29:13 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build native skia
|
|
|
|
RunProcess (DEPOT_PATH.CombineWithFilePath ("ninja"), new ProcessSettings {
|
|
|
|
Arguments = "-C out/ios/" + arch,
|
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build libSkiaSharp
|
2016-09-15 04:14:35 +03:00
|
|
|
XCodeBuild (new XCodeBuildSettings {
|
2017-03-14 05:29:13 +03:00
|
|
|
Project = "native-builds/libSkiaSharp_ios/libSkiaSharp.xcodeproj",
|
2016-09-15 04:14:35 +03:00
|
|
|
Target = "libSkiaSharp",
|
|
|
|
Sdk = sdk,
|
|
|
|
Arch = arch,
|
|
|
|
Configuration = "Release",
|
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// copy libSkiaSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/ios/" + arch);
|
2016-09-15 04:14:35 +03:00
|
|
|
CopyDirectory ("native-builds/libSkiaSharp_ios/build/Release-" + sdk, "native-builds/lib/ios/" + arch);
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// strip anything we can
|
2017-01-28 13:38:58 +03:00
|
|
|
RunProcess ("strip", new ProcessSettings {
|
|
|
|
Arguments = "-x -S libSkiaSharp",
|
|
|
|
WorkingDirectory = "native-builds/lib/ios/" + arch + "/libSkiaSharp.framework",
|
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// re-sign with empty
|
2017-01-28 13:38:58 +03:00
|
|
|
RunProcess ("codesign", new ProcessSettings {
|
|
|
|
Arguments = "--force --sign - --timestamp=none libSkiaSharp.framework",
|
|
|
|
WorkingDirectory = "native-builds/lib/ios/" + arch,
|
|
|
|
});
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
buildArch ("iphonesimulator", "i386", "x86");
|
|
|
|
buildArch ("iphonesimulator", "x86_64", "x64");
|
|
|
|
buildArch ("iphoneos", "armv7", "arm");
|
|
|
|
buildArch ("iphoneos", "arm64", "arm64");
|
2016-09-15 04:14:35 +03:00
|
|
|
|
|
|
|
// create the fat framework
|
|
|
|
CopyDirectory ("native-builds/lib/ios/armv7/libSkiaSharp.framework/", "native-builds/lib/ios/libSkiaSharp.framework/");
|
|
|
|
DeleteFile ("native-builds/lib/ios/libSkiaSharp.framework/libSkiaSharp");
|
|
|
|
RunLipo ("native-builds/lib/ios/", "libSkiaSharp.framework/libSkiaSharp", new [] {
|
|
|
|
(FilePath) "i386/libSkiaSharp.framework/libSkiaSharp",
|
|
|
|
(FilePath) "x86_64/libSkiaSharp.framework/libSkiaSharp",
|
|
|
|
(FilePath) "armv7/libSkiaSharp.framework/libSkiaSharp",
|
|
|
|
(FilePath) "arm64/libSkiaSharp.framework/libSkiaSharp"
|
|
|
|
});
|
2017-04-28 23:03:23 +03:00
|
|
|
|
|
|
|
// HarfBuzzSharp
|
|
|
|
|
|
|
|
var buildHarfBuzzArch = new Action<string, string> ((sdk, arch) => {
|
|
|
|
// build libHarfBuzzSharp
|
|
|
|
XCodeBuild (new XCodeBuildSettings {
|
|
|
|
Project = "native-builds/libHarfBuzzSharp_ios/libHarfBuzzSharp.xcodeproj",
|
|
|
|
Target = "libHarfBuzzSharp",
|
|
|
|
Sdk = sdk,
|
|
|
|
Arch = arch,
|
|
|
|
Configuration = "Release",
|
|
|
|
});
|
|
|
|
|
|
|
|
// copy libHarfBuzzSharp_ios to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/ios/" + arch);
|
2017-04-28 23:03:23 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_ios/build/Release-" + sdk + "/libHarfBuzzSharp.a", "native-builds/lib/ios/" + arch);
|
|
|
|
|
|
|
|
// strip anything we can
|
|
|
|
RunProcess ("strip", new ProcessSettings {
|
|
|
|
Arguments = "-x -S libHarfBuzzSharp.a",
|
|
|
|
WorkingDirectory = "native-builds/lib/ios/" + arch,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
buildHarfBuzzArch ("iphonesimulator", "i386");
|
|
|
|
buildHarfBuzzArch ("iphonesimulator", "x86_64");
|
|
|
|
buildHarfBuzzArch ("iphoneos", "armv7");
|
|
|
|
buildHarfBuzzArch ("iphoneos", "arm64");
|
|
|
|
|
|
|
|
// create the fat archive
|
|
|
|
RunLipo ("native-builds/lib/ios/", "libHarfBuzzSharp.a", new [] {
|
|
|
|
(FilePath) "i386/libHarfBuzzSharp.a",
|
|
|
|
(FilePath) "x86_64/libHarfBuzzSharp.a",
|
|
|
|
(FilePath) "armv7/libHarfBuzzSharp.a",
|
|
|
|
(FilePath) "arm64/libHarfBuzzSharp.a"
|
|
|
|
});
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// this builds the native C and C++ externals for tvOS
|
|
|
|
Task ("externals-tvos")
|
2017-03-14 05:29:13 +03:00
|
|
|
.IsDependentOn ("externals-init")
|
2017-01-11 07:35:43 +03:00
|
|
|
.WithCriteria (IsRunningOnMac ())
|
2016-09-15 04:14:35 +03:00
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-04-28 23:03:23 +03:00
|
|
|
// SkiaSharp
|
|
|
|
|
2017-03-14 05:29:13 +03:00
|
|
|
var buildArch = new Action<string, string, string> ((sdk, arch, skiaArch) => {
|
|
|
|
// generate native skia build files
|
|
|
|
RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn"), new ProcessSettings {
|
|
|
|
Arguments =
|
2017-03-18 16:03:10 +03:00
|
|
|
"gen out/tvos/" + arch + " " +
|
|
|
|
"--args='" +
|
|
|
|
" is_official_build=true skia_enable_tools=false" +
|
|
|
|
" target_os=\"tvos\" target_cpu=\"" + skiaArch + "\"" +
|
2017-07-11 16:01:04 +03:00
|
|
|
" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true" +
|
2017-07-11 21:19:51 +03:00
|
|
|
" skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
|
2017-05-12 05:15:58 +03:00
|
|
|
" extra_cflags=[ \"-DSK_BUILD_FOR_TVOS\", \"-DSKIA_C_DLL\", \"-mtvos-version-min=9.0\" ]" +
|
2017-03-18 16:03:10 +03:00
|
|
|
" extra_ldflags=[ \"-Wl,tvos_version_min=9.0\" ]" +
|
|
|
|
"'",
|
2017-03-14 05:29:13 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build native skia
|
|
|
|
RunProcess (DEPOT_PATH.CombineWithFilePath ("ninja"), new ProcessSettings {
|
|
|
|
Arguments = "-C out/tvos/" + arch,
|
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build libSkiaSharp
|
2016-09-15 04:14:35 +03:00
|
|
|
XCodeBuild (new XCodeBuildSettings {
|
2017-03-14 05:29:13 +03:00
|
|
|
Project = "native-builds/libSkiaSharp_tvos/libSkiaSharp.xcodeproj",
|
2016-09-15 04:14:35 +03:00
|
|
|
Target = "libSkiaSharp",
|
|
|
|
Sdk = sdk,
|
|
|
|
Arch = arch,
|
|
|
|
Configuration = "Release",
|
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// copy libSkiaSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/tvos/" + arch);
|
2016-09-15 04:14:35 +03:00
|
|
|
CopyDirectory ("native-builds/libSkiaSharp_tvos/build/Release-" + sdk, "native-builds/lib/tvos/" + arch);
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// strip anything we can
|
2017-01-28 13:38:58 +03:00
|
|
|
RunProcess ("strip", new ProcessSettings {
|
|
|
|
Arguments = "-x -S libSkiaSharp",
|
|
|
|
WorkingDirectory = "native-builds/lib/tvos/" + arch + "/libSkiaSharp.framework",
|
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
// re-sign with empty
|
2017-01-28 13:38:58 +03:00
|
|
|
RunProcess ("codesign", new ProcessSettings {
|
|
|
|
Arguments = "--force --sign - --timestamp=none libSkiaSharp.framework",
|
|
|
|
WorkingDirectory = "native-builds/lib/tvos/" + arch,
|
|
|
|
});
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
|
|
|
buildArch ("appletvsimulator", "x86_64", "x64");
|
|
|
|
buildArch ("appletvos", "arm64", "arm64");
|
2016-09-15 04:14:35 +03:00
|
|
|
|
|
|
|
// create the fat framework
|
|
|
|
CopyDirectory ("native-builds/lib/tvos/arm64/libSkiaSharp.framework/", "native-builds/lib/tvos/libSkiaSharp.framework/");
|
|
|
|
DeleteFile ("native-builds/lib/tvos/libSkiaSharp.framework/libSkiaSharp");
|
|
|
|
RunLipo ("native-builds/lib/tvos/", "libSkiaSharp.framework/libSkiaSharp", new [] {
|
|
|
|
(FilePath) "x86_64/libSkiaSharp.framework/libSkiaSharp",
|
|
|
|
(FilePath) "arm64/libSkiaSharp.framework/libSkiaSharp"
|
|
|
|
});
|
2017-04-28 23:03:23 +03:00
|
|
|
|
|
|
|
// HarfBuzzSharp
|
|
|
|
|
|
|
|
var buildHarfBuzzArch = new Action<string, string> ((sdk, arch) => {
|
|
|
|
// build libHarfBuzzSharp
|
|
|
|
XCodeBuild (new XCodeBuildSettings {
|
|
|
|
Project = "native-builds/libHarfBuzzSharp_tvos/libHarfBuzzSharp.xcodeproj",
|
|
|
|
Target = "libHarfBuzzSharp",
|
|
|
|
Sdk = sdk,
|
|
|
|
Arch = arch,
|
|
|
|
Configuration = "Release",
|
|
|
|
});
|
|
|
|
|
|
|
|
// copy libHarfBuzzSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/tvos/" + arch);
|
2017-04-28 23:03:23 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_tvos/build/Release-" + sdk + "/libHarfBuzzSharp.a", "native-builds/lib/tvos/" + arch);
|
|
|
|
|
|
|
|
// strip anything we can
|
|
|
|
RunProcess ("strip", new ProcessSettings {
|
|
|
|
Arguments = "-x -S libHarfBuzzSharp.a",
|
|
|
|
WorkingDirectory = "native-builds/lib/tvos/" + arch,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
buildHarfBuzzArch ("appletvsimulator", "x86_64");
|
|
|
|
buildHarfBuzzArch ("appletvos", "arm64");
|
|
|
|
|
|
|
|
// create the fat framework
|
|
|
|
RunLipo ("native-builds/lib/tvos/", "libHarfBuzzSharp.a", new [] {
|
|
|
|
(FilePath) "x86_64/libHarfBuzzSharp.a",
|
|
|
|
(FilePath) "arm64/libHarfBuzzSharp.a"
|
|
|
|
});
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
// this builds the native C and C++ externals for Android
|
|
|
|
Task ("externals-android")
|
2017-03-14 05:29:13 +03:00
|
|
|
.IsDependentOn ("externals-init")
|
2017-01-11 07:35:43 +03:00
|
|
|
.WithCriteria (IsRunningOnMac ())
|
2016-09-15 04:14:35 +03:00
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-04-29 00:18:40 +03:00
|
|
|
// SkiaSharp
|
|
|
|
|
2017-03-14 05:29:13 +03:00
|
|
|
var buildArch = new Action<string, string> ((arch, skiaArch) => {
|
|
|
|
// generate native skia build files
|
|
|
|
RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn"), new ProcessSettings {
|
|
|
|
Arguments =
|
2017-03-18 16:03:10 +03:00
|
|
|
"gen out/android/" + arch + " " +
|
|
|
|
"--args='" +
|
|
|
|
" is_official_build=true skia_enable_tools=false" +
|
|
|
|
" target_os=\"android\" target_cpu=\"" + skiaArch + "\"" +
|
2017-07-11 16:01:04 +03:00
|
|
|
" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true" +
|
|
|
|
" skia_use_system_expat=false skia_use_system_freetype2=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
|
2017-05-07 02:26:17 +03:00
|
|
|
" extra_cflags=[ \"-DSKIA_C_DLL\" ]" +
|
2017-03-18 16:03:10 +03:00
|
|
|
" ndk=\"" + ANDROID_NDK_HOME + "\"" +
|
|
|
|
" ndk_api=" + (skiaArch == "x64" || skiaArch == "arm64" ? 21 : 9) +
|
|
|
|
"'",
|
2017-03-14 05:29:13 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// build native skia
|
|
|
|
RunProcess (DEPOT_PATH.CombineWithFilePath ("ninja"), new ProcessSettings {
|
|
|
|
Arguments = "-C out/android/" + arch,
|
2016-09-15 04:14:35 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
|
|
|
});
|
2017-03-14 05:29:13 +03:00
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
buildArch ("x86", "x86");
|
2017-03-14 05:29:13 +03:00
|
|
|
buildArch ("x86_64", "x64");
|
|
|
|
buildArch ("armeabi-v7a", "arm");
|
|
|
|
buildArch ("arm64-v8a", "arm64");
|
|
|
|
|
|
|
|
// build libSkiaSharp
|
2016-09-15 04:14:35 +03:00
|
|
|
var ndkbuild = MakeAbsolute (Directory (ANDROID_NDK_HOME)).CombineWithFilePath ("ndk-build").FullPath;
|
2017-01-25 01:27:13 +03:00
|
|
|
RunProcess (ndkbuild, new ProcessSettings {
|
2016-09-15 04:14:35 +03:00
|
|
|
Arguments = "",
|
|
|
|
WorkingDirectory = ROOT_PATH.Combine ("native-builds/libSkiaSharp_android").FullPath,
|
|
|
|
});
|
|
|
|
|
2017-03-14 05:29:13 +03:00
|
|
|
// copy libSkiaSharp to output
|
2016-09-15 04:14:35 +03:00
|
|
|
foreach (var folder in new [] { "x86", "x86_64", "armeabi-v7a", "arm64-v8a" }) {
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists("native-builds/lib/android/" + folder);
|
2016-09-15 04:14:35 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libSkiaSharp_android/libs/" + folder + "/libSkiaSharp.so", "native-builds/lib/android/" + folder);
|
|
|
|
}
|
2017-04-29 00:18:40 +03:00
|
|
|
|
|
|
|
// HarfBuzzSharp
|
|
|
|
|
|
|
|
// build libHarfBuzzSharp
|
|
|
|
RunProcess (ndkbuild, new ProcessSettings {
|
|
|
|
Arguments = "",
|
|
|
|
WorkingDirectory = ROOT_PATH.Combine ("native-builds/libHarfBuzzSharp_android").FullPath,
|
|
|
|
});
|
|
|
|
|
|
|
|
// copy libSkiaSharp to output
|
|
|
|
foreach (var folder in new [] { "x86", "x86_64", "armeabi-v7a", "arm64-v8a" }) {
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/android/" + folder);
|
2017-04-29 00:18:40 +03:00
|
|
|
CopyFileToDirectory ("native-builds/libHarfBuzzSharp_android/libs/" + folder + "/libHarfBuzzSharp.so", "native-builds/lib/android/" + folder);
|
|
|
|
}
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|
|
|
|
|
2017-01-25 01:33:42 +03:00
|
|
|
// this builds the native C and C++ externals for Linux
|
|
|
|
Task ("externals-linux")
|
2017-03-18 16:03:10 +03:00
|
|
|
.IsDependentOn ("externals-init")
|
2017-01-25 01:33:42 +03:00
|
|
|
.WithCriteria (IsRunningOnLinux ())
|
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-03-18 16:03:10 +03:00
|
|
|
var arches = EnvironmentVariable ("BUILD_ARCH") ?? (Environment.Is64BitOperatingSystem ? "x64" : "x86"); // x64, x86, ARM
|
|
|
|
var BUILD_ARCH = arches.Split (',').Select (a => a.Trim ()).ToArray ();
|
|
|
|
var SUPPORT_GPU = (EnvironmentVariable ("SUPPORT_GPU") ?? "1") == "1"; // 1 == true, 0 == false
|
2017-02-21 05:00:53 +03:00
|
|
|
|
2017-03-18 16:03:10 +03:00
|
|
|
var buildArch = new Action<string> ((arch) => {
|
|
|
|
// generate native skia build files
|
|
|
|
RunProcess (SKIA_PATH.CombineWithFilePath("bin/gn"), new ProcessSettings {
|
|
|
|
Arguments =
|
|
|
|
"gen out/linux/" + arch + " " +
|
|
|
|
"--args='" +
|
|
|
|
" is_official_build=true skia_enable_tools=false" +
|
|
|
|
" target_os=\"linux\" target_cpu=\"" + arch + "\"" +
|
2017-07-11 16:01:04 +03:00
|
|
|
" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true" +
|
|
|
|
" skia_use_system_expat=false skia_use_system_freetype2=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
|
2017-03-18 16:03:10 +03:00
|
|
|
" skia_enable_gpu=" + (SUPPORT_GPU ? "true" : "false") +
|
2017-05-07 02:26:17 +03:00
|
|
|
" extra_cflags=[ \"-DSKIA_C_DLL\" ]" +
|
2017-03-18 16:03:10 +03:00
|
|
|
" extra_ldflags=[ ]" +
|
|
|
|
"'",
|
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
2017-01-25 01:33:42 +03:00
|
|
|
|
2017-03-18 16:03:10 +03:00
|
|
|
// build native skia
|
|
|
|
RunProcess (DEPOT_PATH.CombineWithFilePath ("ninja"), new ProcessSettings {
|
|
|
|
Arguments = "-C out/linux/" + arch,
|
2017-01-25 01:33:42 +03:00
|
|
|
WorkingDirectory = SKIA_PATH.FullPath,
|
|
|
|
});
|
2017-03-18 16:03:10 +03:00
|
|
|
|
2017-01-25 01:33:42 +03:00
|
|
|
// build libSkiaSharp
|
2017-02-14 15:42:53 +03:00
|
|
|
// RunProcess ("make", new ProcessSettings {
|
|
|
|
// Arguments = "clean",
|
|
|
|
// WorkingDirectory = "native-builds/libSkiaSharp_linux",
|
|
|
|
// });
|
2017-01-25 01:33:42 +03:00
|
|
|
RunProcess ("make", new ProcessSettings {
|
2017-03-18 16:03:10 +03:00
|
|
|
Arguments = "ARCH=" + arch + " VERSION=" + VERSION_FILE + " SUPPORT_GPU=" + SUPPORT_GPU,
|
2017-01-25 01:33:42 +03:00
|
|
|
WorkingDirectory = "native-builds/libSkiaSharp_linux",
|
|
|
|
});
|
|
|
|
|
2017-03-18 16:03:10 +03:00
|
|
|
// copy libSkiaSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/linux/" + arch);
|
2017-06-27 19:01:25 +03:00
|
|
|
var so = "native-builds/libSkiaSharp_linux/bin/" + arch + "/libSkiaSharp.so." + VERSION_SONAME;
|
|
|
|
CopyFileToDirectory (so, "native-builds/lib/linux/" + arch);
|
|
|
|
CopyFile (so, "native-builds/lib/linux/" + arch + "/libSkiaSharp.so");
|
2017-03-18 16:03:10 +03:00
|
|
|
});
|
|
|
|
|
2017-05-02 03:09:00 +03:00
|
|
|
var buildHarfBuzzArch = new Action<string> ((arch) => {
|
|
|
|
// build libHarfBuzzSharp
|
|
|
|
// RunProcess ("make", new ProcessSettings {
|
|
|
|
// Arguments = "clean",
|
|
|
|
// WorkingDirectory = "native-builds/libHarfBuzzSharp_linux",
|
|
|
|
// });
|
|
|
|
RunProcess ("make", new ProcessSettings {
|
2017-05-02 16:21:30 +03:00
|
|
|
Arguments = "ARCH=" + arch + " VERSION=" + HARFBUZZ_VERSION_FILE,
|
2017-05-02 03:09:00 +03:00
|
|
|
WorkingDirectory = "native-builds/libHarfBuzzSharp_linux",
|
|
|
|
});
|
|
|
|
|
|
|
|
// copy libHarfBuzzSharp to output
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists ("native-builds/lib/linux/" + arch);
|
2017-06-27 19:02:42 +03:00
|
|
|
var so = "native-builds/libHarfBuzzSharp_linux/bin/" + arch + "/libHarfBuzzSharp.so." + HARFBUZZ_VERSION_SONAME;
|
|
|
|
CopyFileToDirectory (so, "native-builds/lib/linux/" + arch);
|
|
|
|
CopyFile (so, "native-builds/lib/linux/" + arch + "/libHarfBuzzSharp.so");
|
2017-05-02 03:09:00 +03:00
|
|
|
});
|
|
|
|
|
2017-03-18 16:03:10 +03:00
|
|
|
foreach (var arch in BUILD_ARCH) {
|
|
|
|
buildArch (arch);
|
2017-05-02 03:09:00 +03:00
|
|
|
buildHarfBuzzArch (arch);
|
2017-01-25 01:33:42 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// EXTERNALS DOWNLOAD - download any externals that are needed
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
Task ("externals-angle-uwp")
|
|
|
|
.WithCriteria (!FileExists (ANGLE_PATH.CombineWithFilePath ("uwp/ANGLE.WindowsStore.nuspec")))
|
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-05-07 21:59:20 +03:00
|
|
|
var angleUrl = "https://www.nuget.org/api/v2/package/ANGLE.WindowsStore/" + ANGLE_VERSION_SOURCE;
|
2016-09-15 04:14:35 +03:00
|
|
|
var angleRoot = ANGLE_PATH.Combine ("uwp");
|
2017-05-07 21:59:20 +03:00
|
|
|
var angleNupkg = angleRoot.CombineWithFilePath ("angle_" + ANGLE_VERSION_SOURCE + ".nupkg");
|
2016-09-15 04:14:35 +03:00
|
|
|
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists (angleRoot);
|
|
|
|
CleanDirectory (angleRoot);
|
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
DownloadFile (angleUrl, angleNupkg);
|
|
|
|
Unzip (angleNupkg, angleRoot);
|
|
|
|
});
|
|
|
|
|
2017-04-27 22:35:54 +03:00
|
|
|
Task ("externals-harfbuzz")
|
2017-05-07 21:59:20 +03:00
|
|
|
.WithCriteria (
|
|
|
|
!FileExists (HARFBUZZ_PATH.CombineWithFilePath ("harfbuzz/README")) ||
|
|
|
|
!FileExists (HARFBUZZ_PATH.CombineWithFilePath ("harfbuzz-" + HARFBUZZ_VERSION_SOURCE + ".tar.bz2")))
|
2017-04-27 22:35:54 +03:00
|
|
|
.Does (() =>
|
|
|
|
{
|
2017-05-07 21:59:20 +03:00
|
|
|
string url = "https://github.com/behdad/harfbuzz/releases/download/" + HARFBUZZ_VERSION_SOURCE + "/harfbuzz-" + HARFBUZZ_VERSION_SOURCE + ".tar.bz2";
|
2017-04-27 22:35:54 +03:00
|
|
|
DirectoryPath root = HARFBUZZ_PATH;
|
2017-05-07 21:59:20 +03:00
|
|
|
FilePath archive = root.CombineWithFilePath ("harfbuzz-" + HARFBUZZ_VERSION_SOURCE + ".tar.bz2");
|
2017-04-27 22:35:54 +03:00
|
|
|
|
2017-06-27 23:48:01 +03:00
|
|
|
EnsureDirectoryExists (root);
|
|
|
|
CleanDirectory (root);
|
|
|
|
|
2017-04-27 22:35:54 +03:00
|
|
|
DownloadFile (url, archive);
|
|
|
|
DecompressArchive (archive, root);
|
2017-05-07 21:59:20 +03:00
|
|
|
MoveDirectory (root.Combine ("harfbuzz-" + HARFBUZZ_VERSION_SOURCE), HARFBUZZ_PATH.Combine ("harfbuzz"));
|
2017-04-28 23:03:23 +03:00
|
|
|
|
|
|
|
if (IsRunningOnWindows ()) {
|
|
|
|
// copy the default config header file
|
|
|
|
CopyFile ("externals/harfbuzz/harfbuzz/win32/config.h.win32", "externals/harfbuzz/harfbuzz/win32/config.h");
|
|
|
|
} else {
|
|
|
|
RunProcess ("bash", new ProcessSettings {
|
|
|
|
Arguments = "configure",
|
|
|
|
WorkingDirectory = HARFBUZZ_PATH.Combine ("harfbuzz"),
|
|
|
|
});
|
|
|
|
}
|
2017-04-27 22:35:54 +03:00
|
|
|
});
|
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CLEAN - remove all the build artefacts
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-03-17 08:00:39 +03:00
|
|
|
Task ("externals-deinit").Does (() =>
|
|
|
|
{
|
|
|
|
// remove compatibility
|
|
|
|
InjectCompatibilityExternals (false);
|
|
|
|
});
|
|
|
|
|
|
|
|
Task ("clean-externals")
|
|
|
|
.IsDependentOn ("externals-deinit")
|
|
|
|
.Does (() =>
|
2016-09-15 04:14:35 +03:00
|
|
|
{
|
|
|
|
// skia
|
|
|
|
CleanDirectories ("externals/skia/out");
|
|
|
|
CleanDirectories ("externals/skia/xcodebuild");
|
|
|
|
|
2017-04-27 22:35:54 +03:00
|
|
|
// harfbuzz
|
|
|
|
CleanDirectories ("externals/harfbuzz");
|
|
|
|
|
2017-04-28 23:03:23 +03:00
|
|
|
// angle
|
|
|
|
CleanDirectories ("externals/angle");
|
|
|
|
|
2016-09-15 04:14:35 +03:00
|
|
|
// all
|
|
|
|
CleanDirectories ("native-builds/lib");
|
|
|
|
// android
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_android/obj");
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_android/libs");
|
|
|
|
// ios
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_ios/build");
|
2017-04-28 23:03:23 +03:00
|
|
|
CleanDirectories ("native-builds/libHarfBuzzSharp_ios/build");
|
2016-09-15 04:14:35 +03:00
|
|
|
// tvos
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_tvos/build");
|
2017-04-28 23:03:23 +03:00
|
|
|
CleanDirectories ("native-builds/libHarfBuzzSharp_tvos/build");
|
2016-09-15 04:14:35 +03:00
|
|
|
// osx
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_osx/build");
|
2017-04-28 23:03:23 +03:00
|
|
|
CleanDirectories ("native-builds/libHarfBuzzSharp_osx/build");
|
2016-09-15 04:14:35 +03:00
|
|
|
// windows
|
2016-09-15 05:57:22 +03:00
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_windows/bin");
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_windows/obj");
|
2017-04-27 22:35:54 +03:00
|
|
|
CleanDirectories ("native-builds/libHarfBuzzSharp_windows/bin");
|
|
|
|
CleanDirectories ("native-builds/libHarfBuzzSharp_windows/obj");
|
2016-09-15 04:14:35 +03:00
|
|
|
// uwp
|
2016-09-15 05:57:22 +03:00
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_uwp/bin");
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_uwp/obj");
|
2017-04-27 22:35:54 +03:00
|
|
|
CleanDirectories ("native-builds/libHarfBuzzSharp_uwp/bin");
|
|
|
|
CleanDirectories ("native-builds/libHarfBuzzSharp_uwp/obj");
|
2017-01-25 01:33:42 +03:00
|
|
|
// linux
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_linux/bin");
|
|
|
|
CleanDirectories ("native-builds/libSkiaSharp_linux/obj");
|
2016-09-15 04:14:35 +03:00
|
|
|
});
|