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); }
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))); }
/// <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)); }
/// <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))); }