Added dng/raw support back for Windows builds

This commit is contained in:
Matthew Leibowitz 2017-03-17 07:00:39 +02:00
Родитель 7d53ba4820
Коммит f420c1b15b
3 изменённых файлов: 20 добавлений и 116 удалений

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

@ -50,7 +50,6 @@ DirectoryPath DOCS_PATH = MakeAbsolute(ROOT_PATH.Combine("docs/en"));
#load "cake/UtilsManaged.cake"
#load "cake/UtilsMSBuild.cake"
#load "cake/UtilsNative.cake"
#load "cake/TransformToUWP.cake"
#load "cake/BuildExternals.cake"
////////////////////////////////////////////////////////////////////////////////////////////////////

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

@ -3,22 +3,6 @@
// TOOLS & FUNCTIONS - the bits to make it all work
////////////////////////////////////////////////////////////////////////////////////////////////////
// find a better place for this / or fix the path issue
var VisualStudioPathFixup = new Action (() => {
var props = SKIA_PATH.CombineWithFilePath ("out/gyp/libjpeg-turbo.props").FullPath;
var xdoc = XDocument.Load (props);
var temp = xdoc.Root
.Elements (MSBuildNS + "ItemDefinitionGroup")
.Elements (MSBuildNS + "assemble")
.Elements (MSBuildNS + "CommandLineTemplate")
.Single ();
var newInclude = SKIA_PATH.Combine ("third_party/externals/libjpeg-turbo/win/").FullPath;
if (!temp.Value.Contains (newInclude)) {
temp.Value += " \"-I" + newInclude + "\"";
xdoc.Save (props);
}
});
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
@ -47,6 +31,7 @@ var InjectCompatibilityExternals = new Action<bool> ((inject) => {
var contents = FileReadLines (file).ToList ();
var index = contents.IndexOf (include);
if (index == -1 && inject) {
Information ("Injecting modifications into third party code: {0}...", file);
if (string.IsNullOrEmpty (filePair.Value)) {
contents.Insert (0, include);
} else {
@ -54,6 +39,7 @@ var InjectCompatibilityExternals = new Action<bool> ((inject) => {
}
FileWriteLines (file, contents.ToArray ());
} else if (index != -1 && !inject) {
Information ("Removing injected modifications from third party code: {0}...", file);
int idx = 0;
if (string.IsNullOrEmpty (filePair.Value)) {
idx = 0;
@ -99,9 +85,12 @@ Task ("externals-init")
.Does (() =>
{
RunProcess ("python", new ProcessSettings {
Arguments = SKIA_PATH.CombineWithFilePath("tools/git-sync-deps").FullPath,
Arguments = SKIA_PATH.CombineWithFilePath ("tools/git-sync-deps").FullPath,
WorkingDirectory = SKIA_PATH.FullPath,
});
// insert compatibility modifications for external code
InjectCompatibilityExternals (true);
});
// this builds the native C and C++ externals
@ -174,8 +163,8 @@ Task ("externals-windows")
@"--args=""" +
@" is_official_build=true skia_enable_tools=false" +
@" target_os=\""win\"" target_cpu=\""" + skiaArch + @"\""" +
@" skia_use_icu=false skia_use_sfntly=false" +
@" extra_cflags=[ \""-DSKIA_C_DLL\"", \""/MD\"" ]" +
@" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_dng_sdk=true" +
@" extra_cflags=[ \""-DSKIA_C_DLL\"", \""/MD\"", \""/EHsc\"" ]" +
@" extra_ldflags=[ ]" +
@"""",
WorkingDirectory = SKIA_PATH.FullPath,
@ -219,10 +208,10 @@ Task ("externals-uwp")
@"--args=""" +
@" is_official_build=true skia_enable_tools=false" +
@" target_os=\""winrt\"" target_cpu=\""" + skiaArch + @"\""" +
@" skia_use_icu=false skia_use_sfntly=false" +
@" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_dng_sdk=true" +
@" extra_cflags=[ " +
@" \""-DSKIA_C_DLL\"", \""/MD\"", " +
@" \""-DWINAPI_FAMILY=WINAPI_FAMILY_APP\"", \""-DSK_BUILD_FOR_WINRT\"", \""-DSK_HAS_DWRITE_1_H\"", \""-DSK_HAS_DWRITE_2_H\"" ]" +
@" \""-DSKIA_C_DLL\"", \""/MD\"", \""/EHsc\"", " +
@" \""-DWINAPI_FAMILY=WINAPI_FAMILY_APP\"", \""-DSK_BUILD_FOR_WINRT\"", \""-DSK_HAS_DWRITE_1_H\"", \""-DSK_HAS_DWRITE_2_H\"", \""-DNO_GETENV\"" ]" +
@" extra_ldflags=[ \""/APPCONTAINER\"" ]" +
@"""",
WorkingDirectory = SKIA_PATH.FullPath,
@ -604,7 +593,15 @@ Task ("externals-angle-uwp")
// CLEAN - remove all the build artefacts
////////////////////////////////////////////////////////////////////////////////////////////////////
Task ("clean-externals").Does (() =>
Task ("externals-deinit").Does (() =>
{
// remove compatibility
InjectCompatibilityExternals (false);
});
Task ("clean-externals")
.IsDependentOn ("externals-deinit")
.Does (() =>
{
// skia
CleanDirectories ("externals/skia/out");
@ -631,7 +628,4 @@ Task ("clean-externals").Does (() =>
// linux
CleanDirectories ("native-builds/libSkiaSharp_linux/bin");
CleanDirectories ("native-builds/libSkiaSharp_linux/obj");
// remove compatibility
InjectCompatibilityExternals (false);
});

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

@ -1,89 +0,0 @@
var TransformToUWP = new Action<FilePath, string> ((projectFilePath, platform) => {
var projectFile = MakeAbsolute (projectFilePath).FullPath;
var xdoc = XDocument.Load (projectFile);
var configType = xdoc.Root
.Elements (MSBuildNS + "PropertyGroup")
.Elements (MSBuildNS + "ConfigurationType")
.Select (e => e.Value)
.FirstOrDefault ();
if (configType != "StaticLibrary") {
// skip over "Utility" projects as they aren't actually
// library projects, but intermediate build steps.
return;
} else {
// special case for ARM, gyp does not yet have ARM,
// so it defaults to Win32
// update and reload
if (platform.ToUpper () == "ARM") {
ReplaceTextInFiles (projectFile, "Win32", "ARM");
xdoc = XDocument.Load (projectFile);
}
}
var rootNamespace = xdoc.Root
.Elements (MSBuildNS + "PropertyGroup")
.Elements (MSBuildNS + "RootNamespace")
.Select (e => e.Value)
.FirstOrDefault ();
var globals = xdoc.Root
.Elements (MSBuildNS + "PropertyGroup")
.Where (e => e.Attribute ("Label") != null && e.Attribute ("Label").Value == "Globals")
.Single ();
globals.Elements (MSBuildNS + "WindowsTargetPlatformVersion").Remove ();
SetXValue (globals, "Keyword", "StaticLibrary");
SetXValue (globals, "AppContainerApplication", "true");
SetXValue (globals, "ApplicationType", "Windows Store");
SetXValue (globals, "WindowsTargetPlatformVersion", "10.0.10586.0");
SetXValue (globals, "WindowsTargetPlatformMinVersion", "10.0.10240.0");
SetXValue (globals, "ApplicationTypeRevision", "10.0");
SetXValue (globals, "DefaultLanguage", "en-US");
var properties = xdoc.Root
.Elements (MSBuildNS + "PropertyGroup")
.Elements (MSBuildNS + "LinkIncremental")
.First ()
.Parent;
SetXValue (properties, "GenerateManifest","false");
SetXValue (properties, "IgnoreImportLibrary","false");
SetXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "CompileAsWinRT", "false");
SetXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "DebugInformationFormat", "ProgramDatabase");
AddXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "PreprocessorDefinitions", ";SK_BUILD_FOR_WINRT;WINAPI_FAMILY=WINAPI_FAMILY_APP;");
// if (platform.ToUpper () == "ARM") {
// AddXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "PreprocessorDefinitions", ";__ARM_NEON;__ARM_NEON__;");
// }
AddXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "DisableSpecificWarnings", ";4146;4703;");
SetXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "Link" }, "SubSystem", "Console");
SetXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "Link" }, "IgnoreAllDefaultLibraries", "false");
SetXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "Link" }, "GenerateWindowsMetadata", "false");
xdoc.Root
.Elements (MSBuildNS + "ItemDefinitionGroup")
.Elements (MSBuildNS + "Link")
.Elements (MSBuildNS + "AdditionalDependencies")
.Remove ();
if (rootNamespace == "pdf") {
// remove sfntly as this is not supported for winrt
RemoveXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "PreprocessorDefinitions", "SK_PDF_USE_SFNTLY");
} else if (rootNamespace == "ports") {
RemoveFileReference (xdoc.Root, "SkFontHost_win.cpp");
AddXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "PreprocessorDefinitions", ";SK_HAS_DWRITE_1_H;SK_HAS_DWRITE_2_H;");
} else if (rootNamespace == "skgpu" ) {
// GL is not available to WinRT
RemoveFileReference (xdoc.Root, "GrGLCreateNativeInterface_none.cpp");
AddFileReference (xdoc.Root, @"..\..\src\gpu\gl\GrGLCreateNativeInterface_none.cpp");
RemoveFileReference (xdoc.Root, "GrGLCreateNativeInterface_win.cpp");
RemoveFileReference (xdoc.Root, "SkCreatePlatformGLContext_win.cpp");
} else if (rootNamespace == "utils" ) {
// GL is not available to WinRT
RemoveFileReference (xdoc.Root, "SkWGL.h");
RemoveFileReference (xdoc.Root, "SkWGL_win.cpp");
AddXValues (xdoc.Root, new [] { "ItemDefinitionGroup", "ClCompile" }, "PreprocessorDefinitions", ";SK_HAS_DWRITE_1_H;SK_HAS_DWRITE_2_H;");
}
xdoc.Save (projectFile);
});