internal static IL2CPPBuilder RunCompileAndLink(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action <string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool debugBuild) { IL2CPPBuilder iL2CPPBuilder = new IL2CPPBuilder(tempFolder, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, debugBuild); iL2CPPBuilder.RunCompileAndLink(); return(iL2CPPBuilder); }
internal static void CopyMetadataFiles(string tempFolder, string destinationFolder) { foreach (var file in Directory.GetFiles(Paths.Combine(IL2CPPBuilder.GetCppOutputPath(tempFolder), "Data", "Metadata")).Where(f => f.EndsWith(BinaryMetadataSuffix))) { File.Copy(file, Paths.Combine(destinationFolder, Path.GetFileName(file)), true); } }
internal static IL2CPPBuilder RunCompileAndLink(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action <string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry) { var builder = new IL2CPPBuilder(tempFolder, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(platformProvider.target))); builder.RunCompileAndLink(); return(builder); }
internal static void StripAssemblies(string managedAssemblyFolderPath, BaseUnityLinkerPlatformProvider unityLinkerPlatformProvider, IIl2CppPlatformProvider il2cppPlatformProvider, RuntimeClassRegistry rcr, ManagedStrippingLevel managedStrippingLevel) { var runInformation = new UnityLinkerRunInformation(IL2CPPBuilder.GetShortPathName(managedAssemblyFolderPath), unityLinkerPlatformProvider, il2cppPlatformProvider.target, rcr, managedStrippingLevel, il2cppPlatformProvider); RunAssemblyStripper(runInformation); }
internal static IL2CPPBuilder RunCompileAndLink(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action <string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, string il2cppBuildCacheSource) { var builder = new IL2CPPBuilder(tempFolder, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(platformProvider.namedBuildTarget)); builder.RunCompileAndLink(il2cppBuildCacheSource); return(builder); }
internal static IL2CPPBuilder RunIl2Cpp(string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action <string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool developmentBuild) { IL2CPPBuilder iL2CPPBuilder = new IL2CPPBuilder(stagingAreaData, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, developmentBuild); iL2CPPBuilder.Run(); return(iL2CPPBuilder); }
internal static void CopyEmbeddedResourceFiles(string tempFolder, string destinationFolder) { foreach (var file in Directory.GetFiles(Paths.Combine(IL2CPPBuilder.GetCppOutputPath(tempFolder), "Data", "Resources")).Where(f => f.EndsWith("-resources.dat"))) { File.Copy(file, Paths.Combine(destinationFolder, Path.GetFileName(file)), true); } }
internal static IL2CPPBuilder RunIl2Cpp(string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action <string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry) { var builder = new IL2CPPBuilder(stagingAreaData, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(platformProvider.namedBuildTarget)); builder.Run(); return(builder); }
public void RunCompileAndLink() { Il2CppNativeCodeBuilder il2CppNativeCodeBuilder = this.m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this.m_PlatformProvider.target); bool debugBuild = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup) == Il2CppCompilerConfiguration.Debug; List <string> list = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths, debugBuild).ToList <string>(); list.Add(string.Format("--map-file-parser=\"{0}\"", IL2CPPBuilder.GetMapFileParserPath())); list.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(this.GetCppOutputDirectoryInStagingArea()))); if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_4_6) { list.Add("--dotnetprofile=\"net45\""); } if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_Standard_2_0) { list.Add("--dotnetprofile=\"unityaot\""); } Action <ProcessStartInfo> setupStartInfo = new Action <ProcessStartInfo>(il2CppNativeCodeBuilder.SetupStartInfo); string fullPath = Path.GetFullPath(Path.Combine(this.m_StagingAreaData, "Managed")); this.RunIl2CppWithArguments(list, setupStartInfo, fullPath); } }
internal static void CopyConfigFiles(string tempFolder, string destinationFolder) { string source = Paths.Combine(new string[] { IL2CPPBuilder.GetCppOutputPath(tempFolder), "Data", "etc" }); FileUtil.CopyDirectoryRecursive(source, destinationFolder); }
public void RunCompileAndLink() { Il2CppNativeCodeBuilder il2CppNativeCodeBuilder = this.m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); List <string> list = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths, this.m_DebugBuild).ToList <string>(); list.Add(string.Format("--map-file-parser=\"{0}\"", IL2CPPBuilder.GetMapFileParserPath())); list.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(this.GetCppOutputDirectoryInStagingArea()))); Action <ProcessStartInfo> setupStartInfo = new Action <ProcessStartInfo>(il2CppNativeCodeBuilder.SetupStartInfo); string fullPath = Path.GetFullPath(Path.Combine(this.m_StagingAreaData, "Managed")); this.RunIl2CppWithArguments(list, setupStartInfo, fullPath); } }
internal static void CopyMetadataFiles(string tempFolder, string destinationFolder) { foreach (string current in from f in Directory.GetFiles(Paths.Combine(new string[] { IL2CPPBuilder.GetCppOutputPath(tempFolder), "Data", "Metadata" })) where f.EndsWith("-metadata.dat") select f) { File.Copy(current, Paths.Combine(new string[] { destinationFolder, Path.GetFileName(current) }), true); } }
public string GetCppOutputDirectoryInStagingArea() { return(IL2CPPBuilder.GetCppOutputPath(this.m_TempFolder)); }
public static IEnumerable <string> AddBuilderArguments(Il2CppNativeCodeBuilder builder, string outputRelativePath, IEnumerable <string> includeRelativePaths, IEnumerable <string> additionalLibs, Il2CppCompilerConfiguration compilerConfiguration) { var arguments = new List <string>(); arguments.Add("--compile-cpp"); if (builder.LinkLibIl2CppStatically) { arguments.Add("--libil2cpp-static"); } arguments.Add(FormatArgument("platform", builder.CompilerPlatform)); arguments.Add(FormatArgument("architecture", builder.CompilerArchitecture)); arguments.Add(FormatArgument("configuration", GetConfigurationName(compilerConfiguration))); arguments.Add(FormatArgument("outputpath", builder.ConvertOutputFileToFullPath(outputRelativePath))); string cacheDirectory = null; if (!string.IsNullOrEmpty(builder.CacheDirectory) && !builder.OverriddenCacheDirectory) { cacheDirectory = IL2CPPBuilder.GetShortPathName(CacheDirectoryPathFor(builder.CacheDirectory)); arguments.Add(FormatArgument("cachedirectory", cacheDirectory)); } if (!string.IsNullOrEmpty(builder.CompilerFlags)) { arguments.Add(FormatArgument("compiler-flags", builder.CompilerFlags)); } if (!string.IsNullOrEmpty(builder.LinkerFlags)) { if (cacheDirectory == null) { throw new ArgumentException("If you pass linkerflags, a cachedirectory also needs to be passed."); } NPath templinkerflagsTxt = $"{cacheDirectory}/linkerflags/linkerflags.txt"; templinkerflagsTxt.WriteAllText(builder.LinkerFlags); arguments.Add(FormatArgument("linker-flags-file", templinkerflagsTxt.ToString())); } if (!string.IsNullOrEmpty(builder.PluginPath)) { arguments.Add(FormatArgument("plugin", builder.PluginPath)); } foreach (var includePath in builder.ConvertIncludesToFullPaths(includeRelativePaths)) { arguments.Add(FormatArgument("additional-include-directories", includePath)); } foreach (var library in additionalLibs) { arguments.Add(FormatArgument("additional-libraries", library)); } if (!string.IsNullOrEmpty(builder.BaselibLibraryDirectory)) { arguments.Add(FormatArgument("baselib-directory", builder.BaselibLibraryDirectory)); } arguments.Add("--avoid-dynamic-library-copy"); arguments.AddRange(builder.AdditionalIl2CPPArguments); return(arguments); }
private static string GetFullPath(string path) { return(IL2CPPBuilder.GetShortPathName(Path.GetFullPath(path))); }
internal static void CopyEmbeddedResourceFiles(string tempFolder, string destinationFolder) { string[] components = new string[] { IL2CPPBuilder.GetCppOutputPath(tempFolder), "Data", "Resources" }; if (< > f__am$cache0 == null) {
internal static IL2CPPBuilder RunIl2Cpp(string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action<string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry) { IL2CPPBuilder iL2CPPBuilder = new IL2CPPBuilder(stagingAreaData, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry); iL2CPPBuilder.Run(); return iL2CPPBuilder; }
internal static IL2CPPBuilder RunIl2Cpp(string stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action<string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool developmentBuild) { IL2CPPBuilder il2CppBuilder = new IL2CPPBuilder(stagingAreaData, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, developmentBuild); il2CppBuilder.Run(); return il2CppBuilder; }
private void ConvertPlayerDlltoCpp(ICollection <string> userAssemblies, string outputDirectory, string workingDirectory) { if (userAssemblies.Count != 0) { List <string> list = new List <string>(); list.Add("--convert-to-cpp"); if (this.m_PlatformProvider.emitNullChecks) { list.Add("--emit-null-checks"); } if (this.m_PlatformProvider.enableStackTraces) { list.Add("--enable-stacktrace"); } if (this.m_PlatformProvider.enableArrayBoundsCheck) { list.Add("--enable-array-bounds-check"); } if (this.m_PlatformProvider.enableDivideByZeroCheck) { list.Add("--enable-divide-by-zero-check"); } if (this.m_PlatformProvider.developmentMode) { list.Add("--development-mode"); } BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this.m_PlatformProvider.target); if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_4_6) { list.Add("--dotnetprofile=\"net45\""); } Il2CppNativeCodeBuilder il2CppNativeCodeBuilder = this.m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); list.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths, this.m_DebugBuild)); } list.Add(string.Format("--map-file-parser=\"{0}\"", IL2CPPBuilder.GetMapFileParserPath())); string text = PlayerSettings.GetAdditionalIl2CppArgs(); if (!string.IsNullOrEmpty(text)) { list.Add(text); } text = Environment.GetEnvironmentVariable("IL2CPP_ADDITIONAL_ARGS"); if (!string.IsNullOrEmpty(text)) { list.Add(text); } List <string> source = new List <string>(userAssemblies); list.AddRange(from arg in source select "--assembly=\"" + Path.GetFullPath(arg) + "\""); list.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(outputDirectory))); string info = "Converting managed assemblies to C++"; if (il2CppNativeCodeBuilder != null) { info = "Building native binary with IL2CPP..."; } if (EditorUtility.DisplayCancelableProgressBar("Building Player", info, 0.3f)) { throw new OperationCanceledException(); } Action <ProcessStartInfo> setupStartInfo = null; if (il2CppNativeCodeBuilder != null) { setupStartInfo = new Action <ProcessStartInfo>(il2CppNativeCodeBuilder.SetupStartInfo); } this.RunIl2CppWithArguments(list, setupStartInfo, workingDirectory); } }
private void ConvertPlayerDlltoCpp(ICollection <string> userAssemblies, string outputDirectory, string workingDirectory) { if (userAssemblies.Count != 0) { string[] array = (from s in Directory.GetFiles("Assets", "il2cpp_extra_types.txt", SearchOption.AllDirectories) select Path.Combine(Directory.GetCurrentDirectory(), s)).ToArray <string>(); List <string> list = new List <string>(); list.Add("--convert-to-cpp"); if (this.m_PlatformProvider.emitNullChecks) { list.Add("--emit-null-checks"); } if (this.m_PlatformProvider.enableStackTraces) { list.Add("--enable-stacktrace"); } if (this.m_PlatformProvider.enableArrayBoundsCheck) { list.Add("--enable-array-bounds-check"); } if (this.m_PlatformProvider.enableDivideByZeroCheck) { list.Add("--enable-divide-by-zero-check"); } if (this.m_PlatformProvider.loadSymbols) { list.Add("--enable-symbol-loading"); } if (this.m_PlatformProvider.developmentMode) { list.Add("--development-mode"); } Il2CppNativeCodeBuilder il2CppNativeCodeBuilder = this.m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); list.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths, this.m_DebugBuild)); } list.Add(string.Format("--map-file-parser=\"{0}\"", IL2CPPBuilder.GetMapFileParserPath())); if (array.Length > 0) { string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string arg2 = array2[i]; list.Add(string.Format("--extra-types.file=\"{0}\"", arg2)); } } string text = Path.Combine(this.m_PlatformProvider.il2CppFolder, "il2cpp_default_extra_types.txt"); if (File.Exists(text)) { list.Add(string.Format("--extra-types.file=\"{0}\"", text)); } string text2 = PlayerSettings.GetAdditionalIl2CppArgs(); if (!string.IsNullOrEmpty(text2)) { list.Add(text2); } text2 = Environment.GetEnvironmentVariable("IL2CPP_ADDITIONAL_ARGS"); if (!string.IsNullOrEmpty(text2)) { list.Add(text2); } List <string> source = new List <string>(userAssemblies); list.AddRange(from arg in source select "--assembly=\"" + Path.GetFullPath(arg) + "\""); list.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(outputDirectory))); if (EditorUtility.DisplayCancelableProgressBar("Building Player", "Converting managed assemblies to C++", 0.3f)) { throw new OperationCanceledException(); } Action <ProcessStartInfo> setupStartInfo = null; if (il2CppNativeCodeBuilder != null) { setupStartInfo = new Action <ProcessStartInfo>(il2CppNativeCodeBuilder.SetupStartInfo); } this.RunIl2CppWithArguments(list, setupStartInfo, workingDirectory); } }
/// <summary> /// Change the relative path to the output file to an absolute path that can be passed to the C++ compiler. /// By default this method returns its input relative to the current directory. /// </summary> /// <param name="outputFileRelativePath">The relative output file path to convert</param> /// <returns>The full output file path</returns> public virtual string ConvertOutputFileToFullPath(string outputFileRelativePath) { return(Path.Combine(IL2CPPBuilder.GetShortPathName(Directory.GetCurrentDirectory()), outputFileRelativePath)); }
internal static void CopyConfigFiles(string tempFolder, string destinationFolder) { string[] components = new string[] { IL2CPPBuilder.GetCppOutputPath(tempFolder), "Data", "etc" }; FileUtil.CopyDirectoryRecursive(Paths.Combine(components), destinationFolder); }
/// <summary> /// Change the relative include paths into absolute paths that can be passed to the C++ compiler. /// By default this method returns its input with each path relative to the current directory. /// </summary> /// <param name="relativeIncludePaths">The list of relative paths to convert</param> /// <returns>A list of full paths</returns> public virtual IEnumerable <string> ConvertIncludesToFullPaths(IEnumerable <string> relativeIncludePaths) { var workingDirectory = IL2CPPBuilder.GetShortPathName(Directory.GetCurrentDirectory()); return(relativeIncludePaths.Select(path => Path.Combine(workingDirectory, path))); }
internal static void CopyMetadataFiles(string tempFolder, string destinationFolder) { foreach (string str in ((IEnumerable <string>)Directory.GetFiles(Paths.Combine(IL2CPPBuilder.GetCppOutputPath(tempFolder), "Data", "Metadata"))).Where <string>((Func <string, bool>)(f => f.EndsWith("-metadata.dat")))) { File.Copy(str, Paths.Combine(destinationFolder, Path.GetFileName(str)), 1 != 0); } }