Skip to content

Commit

Permalink
Working on getting a patch out for a few reasons:
Browse files Browse the repository at this point in the history
 - dotnet publish improvements #659
 - statically link vcredist #136
 - clang O3 optimization bug #647
  • Loading branch information
mattleibow committed Oct 29, 2018
1 parent ae150f3 commit 28c6755
Show file tree
Hide file tree
Showing 7 changed files with 414 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<!-- get the preferred paths -->
<PropertyGroup>
<PreferredWindowsNativeHarfBuzzSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\win7-$(PreferredNativeHarfBuzzSharp)\native\libHarfBuzzSharp.dll</PreferredWindowsNativeHarfBuzzSharpPath>
<PreferredWindowsNativeHarfBuzzSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\win-$(PreferredNativeHarfBuzzSharp)\native\libHarfBuzzSharp.dll</PreferredWindowsNativeHarfBuzzSharpPath>
<PreferredOSXNativeHarfBuzzSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\osx\native\libHarfBuzzSharp.dylib</PreferredOSXNativeHarfBuzzSharpPath>
<PreferredLinuxNativeHarfBuzzSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\linux-$(PreferredNativeHarfBuzzSharp)\native\libHarfBuzzSharp.so</PreferredLinuxNativeHarfBuzzSharpPath>
</PropertyGroup>
Expand All @@ -47,13 +47,13 @@
<!-- a special case for Any CPU -->
<ItemGroup Condition=" '$(ShouldIncludeNativeHarfBuzzSharp)' != 'False' and ( '$(PlatformTarget)' != 'x64' and '$(PlatformTarget)' != 'x86' ) ">
<!-- Windows -->
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\libHarfBuzzSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\libHarfBuzzSharp.dll')">
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libHarfBuzzSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libHarfBuzzSharp.dll')">
<Link>x86\libHarfBuzzSharp.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\libHarfBuzzSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\libHarfBuzzSharp.dll')">
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libHarfBuzzSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libHarfBuzzSharp.dll')">
<Link>x64\libHarfBuzzSharp.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
10 changes: 5 additions & 5 deletions binding/SkiaSharp.Desktop/nuget/build/net45/SkiaSharp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<!-- get the preferred paths -->
<PropertyGroup>
<PreferredWindowsNativeSkiaSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\win7-$(PreferredNativeSkiaSharp)\native\libSkiaSharp.dll</PreferredWindowsNativeSkiaSharpPath>
<PreferredWindowsNativeSkiaSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\win-$(PreferredNativeSkiaSharp)\native\libSkiaSharp.dll</PreferredWindowsNativeSkiaSharpPath>
<PreferredOSXNativeSkiaSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\osx\native\libSkiaSharp.dylib</PreferredOSXNativeSkiaSharpPath>
<PreferredLinuxNativeSkiaSharpPath>$(MSBuildThisFileDirectory)..\..\runtimes\linux-$(PreferredNativeSkiaSharp)\native\libSkiaSharp.so</PreferredLinuxNativeSkiaSharpPath>
</PropertyGroup>
Expand All @@ -47,13 +47,13 @@
<!-- a special case for Any CPU -->
<ItemGroup Condition=" '$(ShouldIncludeNativeSkiaSharp)' != 'False' and ( '$(PlatformTarget)' != 'x64' and '$(PlatformTarget)' != 'x86' ) ">
<!-- Windows -->
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\libSkiaSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\libSkiaSharp.dll')">
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libSkiaSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libSkiaSharp.dll')">
<Link>x86\libSkiaSharp.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\libSkiaSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\libSkiaSharp.dll')">
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libSkiaSharp.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libSkiaSharp.dll')">
<Link>x64\libSkiaSharp.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
56 changes: 26 additions & 30 deletions cake/BuildExternals.cake
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,14 @@ Task ("externals-init")
});

// 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-watchos")
.IsDependentOn ("externals-android")
.IsDependentOn ("externals-linux")
.IsDependentOn ("externals-tizen")
.Does (() =>
{
});
Task ("externals-native");
Task ("externals-native-skip");

// this builds the native C and C++ externals for Windows
Task ("externals-windows")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("windows"))
.IsDependeeOf (ShouldBuildExternal ("windows") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("windows"))
.WithCriteria (IsRunningOnWindows ())
.Does (() =>
{
Expand All @@ -98,8 +88,8 @@ Task ("externals-windows")
$"target_os='win' target_cpu='{skiaArch}' " +
$"skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_dng_sdk=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 " +
$"extra_cflags=[ '-DSKIA_C_DLL', '/MD', '/EHsc', '/Zi' ] " +
$"extra_ldflags=[ '/DEBUG' ]");
$"extra_cflags=[ '-DSKIA_C_DLL', '/MD', '/EHsc', '/Z7' ] " +
$"extra_ldflags=[ '/DEBUG:FULL' ]");

// copy libSkiaSharp to output
var outDir = $"output/native/windows/{dir}";
Expand Down Expand Up @@ -131,7 +121,8 @@ Task ("externals-windows")
// this builds the native C and C++ externals for Windows UWP
Task ("externals-uwp")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("uwp"))
.IsDependeeOf (ShouldBuildExternal ("uwp") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("uwp"))
.WithCriteria (IsRunningOnWindows ())
.Does (() =>
{
Expand All @@ -145,9 +136,9 @@ Task ("externals-uwp")
$"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 " +
$"extra_cflags=[ " +
$" '-DSKIA_C_DLL', '/MD', '/EHsc', '/Zi', " +
$" '-DSKIA_C_DLL', '/MD', '/EHsc', '/Z7', " +
$" '-DWINAPI_FAMILY=WINAPI_FAMILY_APP', '-DSK_BUILD_FOR_WINRT', '-DSK_HAS_DWRITE_1_H', '-DSK_HAS_DWRITE_2_H', '-DNO_GETENV' ] " +
$"extra_ldflags=[ '/APPCONTAINER', '/DEBUG', 'WindowsApp.lib' ]");
$"extra_ldflags=[ '/DEBUG:FULL', '/APPCONTAINER', 'WindowsApp.lib' ]");

// copy libSkiaSharp to output
var outDir = $"output/native/uwp/{dir}";
Expand Down Expand Up @@ -190,9 +181,12 @@ Task ("externals-uwp")
});

// this builds the native C and C++ externals for Mac OS X
Task ("externals-macos")
.IsDependentOn ("externals-osx");
Task ("externals-osx")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("osx"))
.IsDependeeOf (ShouldBuildExternal ("osx") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("osx"))
.WithCriteria (IsRunningOnMac ())
.Does (() =>
{
Expand Down Expand Up @@ -224,12 +218,10 @@ Task ("externals-osx")
StripSign ($"output/native/osx/{arch}/libSkiaSharp.dylib");
});

buildArch ("i386", "x86");
buildArch ("x86_64", "x64");

// create the fat dylib
RunLipo ("output/native/osx/", "libSkiaSharp.dylib", new [] {
(FilePath) "i386/libSkiaSharp.dylib",
(FilePath) "x86_64/libSkiaSharp.dylib"
});

Expand All @@ -252,20 +244,19 @@ Task ("externals-osx")
StripSign ($"output/native/osx/{arch}/libHarfBuzzSharp.dylib");
});

buildHarfBuzzArch ("i386", "x86");
buildHarfBuzzArch ("x86_64", "x64");

// create the fat dylib
RunLipo ("output/native/osx/", "libHarfBuzzSharp.dylib", new [] {
(FilePath) "i386/libHarfBuzzSharp.dylib",
(FilePath) "x86_64/libHarfBuzzSharp.dylib"
});
});

// this builds the native C and C++ externals for iOS
Task ("externals-ios")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("ios"))
.IsDependeeOf (ShouldBuildExternal ("ios") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("ios"))
.WithCriteria (IsRunningOnMac ())
.Does (() =>
{
Expand Down Expand Up @@ -362,7 +353,8 @@ Task ("externals-ios")
// this builds the native C and C++ externals for tvOS
Task ("externals-tvos")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("tvos"))
.IsDependeeOf (ShouldBuildExternal ("tvos") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("tvos"))
.WithCriteria (IsRunningOnMac ())
.Does (() =>
{
Expand Down Expand Up @@ -437,7 +429,8 @@ Task ("externals-tvos")
// this builds the native C and C++ externals for watchOS
Task ("externals-watchos")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("watchos"))
.IsDependeeOf (ShouldBuildExternal ("watchos") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("watchos"))
.WithCriteria (IsRunningOnMac ())
.Does (() =>
{
Expand Down Expand Up @@ -520,7 +513,8 @@ Task ("externals-watchos")
// this builds the native C and C++ externals for Android
Task ("externals-android")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("android"))
.IsDependeeOf (ShouldBuildExternal ("android") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("android"))
.WithCriteria (IsRunningOnMac () || IsRunningOnWindows ())
.Does (() =>
{
Expand Down Expand Up @@ -568,7 +562,8 @@ Task ("externals-android")
// this builds the native C and C++ externals for Linux
Task ("externals-linux")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("linux"))
.IsDependeeOf (ShouldBuildExternal ("linux") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("linux"))
.WithCriteria (IsRunningOnLinux ())
.Does (() =>
{
Expand Down Expand Up @@ -624,7 +619,8 @@ Task ("externals-linux")

Task ("externals-tizen")
.IsDependentOn ("externals-init")
.WithCriteria (!SKIP_EXTERNALS.Contains ("tizen"))
.IsDependeeOf (ShouldBuildExternal ("tizen") ? "externals-native" : "externals-native-skip")
.WithCriteria (ShouldBuildExternal ("tizen"))
.Does (() =>
{
var bat = IsRunningOnWindows () ? ".bat" : "";
Expand Down
23 changes: 23 additions & 0 deletions cake/Utils.cake
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,26 @@ string GetVersion (string lib, string type = "nuget")
return "";
}
}

bool ShouldBuildExternal (string platform)
{
platform = platform?.ToLower() ?? "";

if (SKIP_EXTERNALS.Contains ("all"))
return false;

switch (platform) {
case "mac":
case "macos":
platform = "osx";
break;
case "win":
platform = "windows";
break;
}

if (SKIP_EXTERNALS.Contains (platform))
return false;

return true;
}
15 changes: 7 additions & 8 deletions cake/UtilsManaged.cake
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ var RunTests = new Action<FilePath, string[], bool> ((testAssembly, skip, is32)
{
var dir = testAssembly.GetDirectory ();
var settings = new XUnit2Settings {
NUnitReport = true,
ReportName = "TestResult",
XmlReport = true,
UseX86 = is32,
Parallelism = ParallelismOption.Assemblies,
OutputDirectory = dir,
Expand All @@ -106,13 +106,11 @@ var RunTests = new Action<FilePath, string[], bool> ((testAssembly, skip, is32)
var RunNetCoreTests = new Action<FilePath, string[]> ((testAssembly, skip) =>
{
var dir = testAssembly.GetDirectory ();
string skipString = string.Empty;
if (skip != null) {
foreach (var s in skip) {
skipString += $" -notrait \"Category={skip}\"";
}
}
DotNetCoreTool(testAssembly, "xunit", $"-verbose -parallel none -nunit \"TestResult.xml\" {skipString}", new DotNetCoreToolSettings {
DotNetCoreTest(testAssembly.GetFilename().ToString(), new DotNetCoreTestSettings {
Configuration = "Release",
NoRestore = true,
TestAdapterPath = ".",
Logger = "xunit",
WorkingDirectory = dir,
});
});
Expand All @@ -138,6 +136,7 @@ var CreateSamplesZip = new Action<DirectoryPath, DirectoryPath> ((samplesDirPath
".gtk",
".ios",
".mac",
".macos",
".netstandard",
".osx",
".portable",
Expand Down
2 changes: 1 addition & 1 deletion externals/skia
Submodule skia updated 1 files
+3 −3 gn/BUILD.gn
Loading

0 comments on commit 28c6755

Please sign in to comment.