Preparation for building on linux

This commit is contained in:
Matthew Leibowitz 2017-01-11 06:35:43 +02:00
Родитель d744b3f6b2
Коммит 3b9a7f9fde
4 изменённых файлов: 33 добавлений и 13 удалений

Просмотреть файл

@ -109,7 +109,7 @@ Task ("libs")
CopyFileToDirectory ("./source/SkiaSharp.Svg/SkiaSharp.Svg/bin/Release/SkiaSharp.Svg.dll", "./output/portable/");
}
if (IsRunningOnUnix ()) {
if (IsRunningOnMac ()) {
// build
RunNuGetRestore ("binding/SkiaSharp.Mac.sln");
DotNetBuild ("binding/SkiaSharp.Mac.sln", c => {
@ -145,6 +145,9 @@ Task ("libs")
// copy SVG
CopyFileToDirectory ("./source/SkiaSharp.Svg/SkiaSharp.Svg/bin/Release/SkiaSharp.Svg.dll", "./output/portable/");
}
if (IsRunningOnLinux ()) {
}
});
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -171,7 +174,7 @@ Task ("tests")
RunTests("./tests/SkiaSharp.Desktop.Tests/bin/x64/Release/SkiaSharp.Desktop.Tests.dll");
}
// Mac OSX (Any CPU)
if (IsRunningOnUnix ()) {
if (IsRunningOnMac () || IsRunningOnLinux ()) {
DotNetBuild ("./tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.sln", c => {
c.Configuration = "Release";
});
@ -195,7 +198,11 @@ Task ("samples")
Zip ("./samples", "./output/samples.zip");
}
if (IsRunningOnUnix ()) {
if (IsRunningOnLinux ()) {
}
if (IsRunningOnMac ()) {
RunNuGetRestore ("./samples/MacSample/MacSample.sln");
DotNetBuild ("./samples/MacSample/MacSample.sln", c => {
c.Configuration = "Release";
@ -317,7 +324,7 @@ Task ("update-docs")
});
}
// add mac-specific references
if (IsRunningOnUnix ()) {
if (IsRunningOnMac ()) {
refs = refs.Union (new DirectoryPath [] {
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5",
"/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild-frameworks/MonoAndroid/v1.0",
@ -346,7 +353,7 @@ Task ("update-docs")
}).ToArray ();
}
// add mac-specific assemblies
if (IsRunningOnUnix ()) {
if (IsRunningOnMac ()) {
assemblies = assemblies.Union (new FilePath [] {
"./output/android/SkiaSharp.Views.Android.dll",
"./output/ios/SkiaSharp.Views.iOS.dll",
@ -420,11 +427,14 @@ Task ("nuget")
PackageNuGet ("./nuget/SkiaSharp.Views.Windows.nuspec", "./output/");
PackageNuGet ("./nuget/SkiaSharp.Views.Forms.Windows.nuspec", "./output/");
}
if (IsRunningOnUnix ()) {
if (IsRunningOnMac ()) {
PackageNuGet ("./nuget/SkiaSharp.Mac.nuspec", "./output/");
PackageNuGet ("./nuget/SkiaSharp.Views.Mac.nuspec", "./output/");
PackageNuGet ("./nuget/SkiaSharp.Views.Forms.Mac.nuspec", "./output/");
}
if (IsRunningOnLinux ()) {
}
}
// SVG is a PCL
PackageNuGet ("./nuget/SkiaSharp.Svg.nuspec", "./output/");

Просмотреть файл

@ -130,12 +130,14 @@ Task ("externals-native")
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/x64/libEGL.dll"), "./output/uwp/x64/");
CopyFileToDirectory (ANGLE_PATH.CombineWithFilePath ("uwp/bin/UAP/x64/libGLESv2.dll"), "./output/uwp/x64/");
}
if (IsRunningOnUnix ()) {
if (IsRunningOnMac ()) {
if (!DirectoryExists ("./output/osx")) CreateDirectory ("./output/osx");
if (!DirectoryExists ("./output/mac")) CreateDirectory ("./output/mac");
CopyFileToDirectory ("./native-builds/lib/osx/libSkiaSharp.dylib", "./output/osx/");
CopyFileToDirectory ("./native-builds/lib/osx/libSkiaSharp.dylib", "./output/mac/");
}
if (IsRunningOnLinux ()) {
}
});
// this builds the native C and C++ externals for Windows
@ -215,7 +217,7 @@ Task ("externals-uwp")
// this builds the native C and C++ externals for Mac OS X
Task ("externals-osx")
.WithCriteria (IsRunningOnUnix ())
.WithCriteria (IsRunningOnMac ())
.WithCriteria (
!FileExists ("native-builds/lib/osx/libSkiaSharp.dylib"))
.Does (() =>
@ -252,7 +254,7 @@ Task ("externals-osx")
// this builds the native C and C++ externals for iOS
Task ("externals-ios")
.WithCriteria (IsRunningOnUnix ())
.WithCriteria (IsRunningOnMac ())
.WithCriteria (
!FileExists ("native-builds/lib/ios/libSkiaSharp.framework/libSkiaSharp"))
.Does (() =>
@ -296,7 +298,7 @@ Task ("externals-ios")
// this builds the native C and C++ externals for tvOS
Task ("externals-tvos")
.WithCriteria (IsRunningOnUnix ())
.WithCriteria (IsRunningOnMac ())
.WithCriteria (
!FileExists ("native-builds/lib/tvos/libSkiaSharp.framework/libSkiaSharp"))
.Does (() =>
@ -335,7 +337,7 @@ Task ("externals-tvos")
// this builds the native C and C++ externals for Android
Task ("externals-android")
.WithCriteria (IsRunningOnUnix ())
.WithCriteria (IsRunningOnMac ())
.WithCriteria (
!FileExists ("native-builds/lib/android/x86/libSkiaSharp.so") ||
!FileExists ("native-builds/lib/android/x86_64/libSkiaSharp.so") ||

Просмотреть файл

@ -81,3 +81,11 @@ var ClearSkiaSharpNuGetCache = new Action (() => {
CleanDirectory (installedNuGet);
}
});
var IsRunningOnMac = new Func<bool> (() => {
return System.Environment.OSVersion.Platform == PlatformID.MacOSX;
});
var IsRunningOnLinux = new Func<bool> (() => {
return IsRunningOnUnix () && !IsRunningOnMac ();
});

Просмотреть файл

@ -19,7 +19,7 @@ var RunGyp = new Action<string, string> ((defines, generators) =>
var RunInstallNameTool = new Action<DirectoryPath, string, string, FilePath> ((directory, oldName, newName, library) =>
{
if (!IsRunningOnUnix ()) {
if (!IsRunningOnMac ()) {
throw new InvalidOperationException ("install_name_tool is only available on Unix.");
}
@ -31,7 +31,7 @@ var RunInstallNameTool = new Action<DirectoryPath, string, string, FilePath> ((d
var RunLipo = new Action<DirectoryPath, FilePath, FilePath[]> ((directory, output, inputs) =>
{
if (!IsRunningOnUnix ()) {
if (!IsRunningOnMac ()) {
throw new InvalidOperationException ("lipo is only available on Unix.");
}