Merge branch '1.1' into 1.2
# Conflicts: # Source/Platforms/DotNet/Newtonsoft.Json.dll # Source/Platforms/DotNet/Newtonsoft.Json.pdb # Source/Platforms/UWP/Binaries/Newtonsoft.Json.dll # Source/Platforms/XboxOne/Binaries/Newtonsoft.Json.dll
This commit is contained in:
@@ -250,66 +250,66 @@ namespace Flax.Build.Bindings
|
||||
var path = GetCachePath(moduleInfo.Module, moduleOptions);
|
||||
if (!File.Exists(path))
|
||||
return false;
|
||||
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var reader = new BinaryReader(stream, Encoding.UTF8))
|
||||
try
|
||||
{
|
||||
// Version
|
||||
var version = reader.ReadInt32();
|
||||
if (version != CacheVersion)
|
||||
return false;
|
||||
if (File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location).Ticks != reader.ReadInt64())
|
||||
return false;
|
||||
|
||||
// Build options
|
||||
if (reader.ReadString() != moduleOptions.IntermediateFolder ||
|
||||
reader.ReadInt32() != (int)moduleOptions.Platform.Target ||
|
||||
reader.ReadInt32() != (int)moduleOptions.Architecture ||
|
||||
reader.ReadInt32() != (int)moduleOptions.Configuration)
|
||||
return false;
|
||||
var publicDefinitions = Read(reader, Utilities.GetEmptyArray<string>());
|
||||
if (publicDefinitions.Length != moduleOptions.PublicDefinitions.Count || publicDefinitions.Any(x => !moduleOptions.PublicDefinitions.Contains(x)))
|
||||
return false;
|
||||
var privateDefinitions = Read(reader, Utilities.GetEmptyArray<string>());
|
||||
if (privateDefinitions.Length != moduleOptions.PrivateDefinitions.Count || privateDefinitions.Any(x => !moduleOptions.PrivateDefinitions.Contains(x)))
|
||||
return false;
|
||||
var preprocessorDefinitions = Read(reader, Utilities.GetEmptyArray<string>());
|
||||
if (preprocessorDefinitions.Length != moduleOptions.CompileEnv.PreprocessorDefinitions.Count || preprocessorDefinitions.Any(x => !moduleOptions.CompileEnv.PreprocessorDefinitions.Contains(x)))
|
||||
return false;
|
||||
|
||||
// Header files
|
||||
var headerFilesCount = reader.ReadInt32();
|
||||
if (headerFilesCount != headerFiles.Count)
|
||||
return false;
|
||||
for (int i = 0; i < headerFilesCount; i++)
|
||||
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var reader = new BinaryReader(stream, Encoding.UTF8))
|
||||
{
|
||||
var headerFile = headerFiles[i];
|
||||
if (headerFile != reader.ReadString())
|
||||
// Version
|
||||
var version = reader.ReadInt32();
|
||||
if (version != CacheVersion)
|
||||
return false;
|
||||
if (File.GetLastWriteTime(headerFile).Ticks > reader.ReadInt64())
|
||||
if (File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location).Ticks != reader.ReadInt64())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Info
|
||||
var newModuleInfo = new ModuleInfo
|
||||
{
|
||||
Module = moduleInfo.Module,
|
||||
Name = moduleInfo.Name,
|
||||
Namespace = moduleInfo.Namespace,
|
||||
IsFromCache = true,
|
||||
};
|
||||
try
|
||||
{
|
||||
// Build options
|
||||
if (reader.ReadString() != moduleOptions.IntermediateFolder ||
|
||||
reader.ReadInt32() != (int)moduleOptions.Platform.Target ||
|
||||
reader.ReadInt32() != (int)moduleOptions.Architecture ||
|
||||
reader.ReadInt32() != (int)moduleOptions.Configuration)
|
||||
return false;
|
||||
var publicDefinitions = Read(reader, Utilities.GetEmptyArray<string>());
|
||||
if (publicDefinitions.Length != moduleOptions.PublicDefinitions.Count || publicDefinitions.Any(x => !moduleOptions.PublicDefinitions.Contains(x)))
|
||||
return false;
|
||||
var privateDefinitions = Read(reader, Utilities.GetEmptyArray<string>());
|
||||
if (privateDefinitions.Length != moduleOptions.PrivateDefinitions.Count || privateDefinitions.Any(x => !moduleOptions.PrivateDefinitions.Contains(x)))
|
||||
return false;
|
||||
var preprocessorDefinitions = Read(reader, Utilities.GetEmptyArray<string>());
|
||||
if (preprocessorDefinitions.Length != moduleOptions.CompileEnv.PreprocessorDefinitions.Count || preprocessorDefinitions.Any(x => !moduleOptions.CompileEnv.PreprocessorDefinitions.Contains(x)))
|
||||
return false;
|
||||
|
||||
// Header files
|
||||
var headerFilesCount = reader.ReadInt32();
|
||||
if (headerFilesCount != headerFiles.Count)
|
||||
return false;
|
||||
for (int i = 0; i < headerFilesCount; i++)
|
||||
{
|
||||
var headerFile = headerFiles[i];
|
||||
if (headerFile != reader.ReadString())
|
||||
return false;
|
||||
if (File.GetLastWriteTime(headerFile).Ticks > reader.ReadInt64())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Info
|
||||
var newModuleInfo = new ModuleInfo
|
||||
{
|
||||
Module = moduleInfo.Module,
|
||||
Name = moduleInfo.Name,
|
||||
Namespace = moduleInfo.Namespace,
|
||||
IsFromCache = true,
|
||||
};
|
||||
newModuleInfo.Read(reader);
|
||||
|
||||
// Skip parsing and use data loaded from cache
|
||||
moduleInfo = newModuleInfo;
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Skip loading cache
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Skip loading cache
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1129,6 +1129,7 @@ namespace Flax.Build.Bindings
|
||||
var paramsCount = eventInfo.Type.GenericArgs?.Count ?? 0;
|
||||
|
||||
// C# event invoking wrapper (calls C# event from C++ delegate)
|
||||
CppIncludeFiles.Add("Engine/Scripting/ManagedCLR/MClass.h");
|
||||
CppIncludeFiles.Add("Engine/Scripting/ManagedCLR/MEvent.h");
|
||||
contents.Append(" ");
|
||||
if (eventInfo.IsStatic)
|
||||
@@ -1251,7 +1252,13 @@ namespace Flax.Build.Bindings
|
||||
if (fieldInfo.Getter != null)
|
||||
GenerateCppWrapperFunction(buildData, contents, classInfo, fieldInfo.Getter, "{0}");
|
||||
if (fieldInfo.Setter != null)
|
||||
GenerateCppWrapperFunction(buildData, contents, classInfo, fieldInfo.Setter, "{0} = {1}");
|
||||
{
|
||||
var callFormat = "{0} = {1}";
|
||||
var type = fieldInfo.Setter.Parameters[0].Type;
|
||||
if (type.IsArray)
|
||||
callFormat = $"auto __tmp = {{1}}; for (int32 i = 0; i < {type.ArraySize}; i++) {{0}}[i] = __tmp[i]";
|
||||
GenerateCppWrapperFunction(buildData, contents, classInfo, fieldInfo.Setter, callFormat);
|
||||
}
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
@@ -623,9 +623,6 @@ namespace Flax.Build.Bindings
|
||||
|
||||
if (!fieldInfo.IsReadOnly)
|
||||
{
|
||||
if (fieldInfo.Type.IsArray)
|
||||
throw new NotImplementedException("Use ReadOnly on field. TODO: add support for setter for fixed-array fields.");
|
||||
|
||||
fieldInfo.Setter = new FunctionInfo
|
||||
{
|
||||
Name = "Set" + fieldInfo.Name,
|
||||
|
||||
@@ -67,10 +67,10 @@ namespace Flax.Build.Platforms
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("PLATFORM_UWP");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("WINAPI_FAMILY=WINAPI_FAMILY_PC_APP");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("_WINRT_DLL");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("_WINDLL");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("__WRL_NO_DEFAULT_LIB__");
|
||||
|
||||
options.LinkEnv.InputLibraries.Add("WindowsApp.lib");
|
||||
options.LinkEnv.InputLibraries.Add("dloadhelper.lib");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,6 +680,8 @@ namespace Flax.Build.Platforms
|
||||
args.Add("/WINMD");
|
||||
args.Add(string.Format("/WINMDFILE:\"{0}\"", Path.ChangeExtension(outputFilePath, "winmd")));
|
||||
args.Add("/APPCONTAINER");
|
||||
if (linkEnvironment.Output == LinkerOutput.SharedLibrary)
|
||||
args.Add("/DYNAMICBASE");
|
||||
}
|
||||
|
||||
if (linkEnvironment.LinkTimeCodeGeneration)
|
||||
@@ -937,7 +939,7 @@ namespace Flax.Build.Platforms
|
||||
xmlTextWriter.WriteStartElement("Properties");
|
||||
|
||||
// TODO: better logo handling
|
||||
var logoSrcPath = Path.Combine(Environment.CurrentDirectory, "Source", "Logo.png");
|
||||
var logoSrcPath = Path.Combine(Globals.EngineRoot, "Source", "Logo.png");
|
||||
var logoDstPath = Path.Combine(options.IntermediateFolder, "Logo.png");
|
||||
if (!File.Exists(logoDstPath))
|
||||
Utilities.FileCopy(logoSrcPath, logoDstPath);
|
||||
|
||||
Reference in New Issue
Block a user