public void RunCompileAndLink() { var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); var arguments = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration).ToList(); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add($"--map-file-parser={CommandLineFormatter.PrepareFileName(GetMapFileParserPath())}"); arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(GetShortPathName(Path.GetFullPath(GetCppOutputDirectoryInStagingArea())))}"); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup)))); arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); Action <ProcessStartInfo> setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; var managedDir = Path.GetFullPath(Path.Combine(m_StagingAreaData, "Managed")); RunIl2CppWithArguments(arguments, setupStartInfo, managedDir); } }
internal static string GetExePath(string executableFileName) { var platform = Application.platform; var deployDirectory = $"{IL2CPPUtils.GetIl2CppFolder()}/build/deploy"; var il2cppPath = $"{deployDirectory}/{executableFileName}{(platform == RuntimePlatform.WindowsEditor ? ".exe" : "")}"; if (!File.Exists(il2cppPath)) { il2cppPath = $"{deployDirectory}/{ExpectedTargetFrameworkDirectoryNameWhenUsingCustomBuild(platform)}/{BinaryDirectoryForPlatform(platform)}/{executableFileName}{(platform == RuntimePlatform.WindowsEditor ? ".exe" : "")}"; } return(il2cppPath); }
private string GetIl2CppReapiCacheClientExe() { if (Application.platform == RuntimePlatform.OSXEditor) { return($"{IL2CPPUtils.GetReapiCacheClientFolder()}/tundra-mac-x64/tundra2"); } if (Application.platform == RuntimePlatform.LinuxEditor) { return($"{IL2CPPUtils.GetReapiCacheClientFolder()}/tundra-linux-x64/tundra2"); } return($"{IL2CPPUtils.GetReapiCacheClientFolder()}/tundra-win-x64/tundra2.exe"); }
public void RunCompileAndLink(string il2cppBuildCacheSource) { if (string.Equals(Path.GetFullPath(il2cppBuildCacheSource), Path.GetFullPath(m_PlatformProvider.il2cppBuildCacheDirectory), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("IIl2CppPlatformProvider.il2cppBuildCacheDirectory cannot be the same as il2cppBuildCacheDirectory. You probably forgot to override il2cppBuildCacheDirectory on your IIl2CppPlatformProvider."); } var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); var buildCacheDirectory = m_PlatformProvider.il2cppBuildCacheDirectory; Directory.CreateDirectory(buildCacheDirectory); var buildCacheNativeOutputFile = Path.Combine(GetNativeOutputRelativeDirectory(buildCacheDirectory), m_PlatformProvider.nativeLibraryFileName); var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); var arguments = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, buildCacheNativeOutputFile, m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration).ToList(); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } foreach (var buildingArgument in IL2CPPUtils.GetBuildingIL2CPPArguments(m_PlatformProvider, buildTargetGroup)) { if (!arguments.Contains(buildingArgument)) { arguments.Add(buildingArgument); } } arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(GetCppOutputDirectory(il2cppBuildCacheSource))}"); arguments.Add($"--dotnetprofile=\"{IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup), m_PlatformProvider.target)}\""); arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); Action <ProcessStartInfo> setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; RunIl2CppWithArguments(arguments, setupStartInfo); } }
private string GetIl2CppCoreExe() { return(IL2CPPUtils.GetIl2CppFolder() + "/build/il2cppcore/il2cppcore.dll"); }
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); }
private void ConvertPlayerDlltoCpp(string inputDirectory, string outputDirectory, string workingDirectory, bool platformSupportsManagedDebugging) { var arguments = new List <string>(); arguments.Add("--convert-to-cpp"); if (m_PlatformProvider.emitNullChecks) { arguments.Add("--emit-null-checks"); } if (m_PlatformProvider.enableStackTraces) { arguments.Add("--enable-stacktrace"); } if (m_PlatformProvider.enableArrayBoundsCheck) { arguments.Add("--enable-array-bounds-check"); } if (m_PlatformProvider.enableDivideByZeroCheck) { arguments.Add("--enable-divide-by-zero-check"); } if (m_BuildForMonoRuntime) { arguments.Add("--mono-runtime"); } var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup)))); if (IL2CPPUtils.EnableIL2CPPDebugger(m_PlatformProvider, buildTargetGroup) && platformSupportsManagedDebugging) { arguments.Add("--enable-debugger"); } var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); arguments.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration)); } arguments.Add(string.Format("--map-file-parser=\"{0}\"", GetMapFileParserPath())); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add("--directory=\"" + Path.GetFullPath(inputDirectory) + "\""); arguments.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(outputDirectory))); string progressMessage = "Converting managed assemblies to C++"; if (il2CppNativeCodeBuilder != null) { progressMessage = "Building native binary with IL2CPP..."; } if (EditorUtility.DisplayCancelableProgressBar("Building Player", progressMessage, 0.3f)) { throw new OperationCanceledException(); } Action <ProcessStartInfo> setupStartInfo = null; if (il2CppNativeCodeBuilder != null) { setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; } if (PlayerBuildInterface.ExtraTypesProvider != null) { var extraTypes = new HashSet <string>(); foreach (var extraType in PlayerBuildInterface.ExtraTypesProvider()) { extraTypes.Add(extraType); } var tempFile = Path.GetFullPath(Path.Combine(m_TempFolder, "extra-types.txt")); File.WriteAllLines(tempFile, extraTypes.ToArray()); arguments.Add(string.Format("--extra-types-file=\"{0}\"", tempFile)); } RunIl2CppWithArguments(arguments, setupStartInfo, workingDirectory); }
private string GetIl2CppExe() { return(IL2CPPUtils.GetIl2CppFolder() + "/build/il2cpp.exe"); }
private void ConvertPlayerDlltoCpp(Il2CppBuildPipelineData data, string outputDirectory, string workingDirectory, bool platformSupportsManagedDebugging) { ProcessBuildPipelineOnBeforeConvertRun(m_PlatformProvider.buildReport, data); var arguments = new List <string>(); arguments.Add("--convert-to-cpp"); if (m_PlatformProvider.emitNullChecks) { arguments.Add("--emit-null-checks"); } if (m_PlatformProvider.enableStackTraces) { arguments.Add("--enable-stacktrace"); } if (m_PlatformProvider.enableArrayBoundsCheck) { arguments.Add("--enable-array-bounds-check"); } if (m_PlatformProvider.enableDivideByZeroCheck) { arguments.Add("--enable-divide-by-zero-check"); } if (m_PlatformProvider.development && m_PlatformProvider.enableDeepProfilingSupport) { arguments.Add("--enable-deep-profiler"); } if (m_BuildForMonoRuntime) { arguments.Add("--mono-runtime"); } var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(apiCompatibilityLevel))); var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); arguments.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration)); } arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); arguments.AddRange(IL2CPPUtils.GetBuildingIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); arguments.Add($"--map-file-parser={CommandLineFormatter.PrepareFileName(GetMapFileParserPath())}"); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add($"--directory={CommandLineFormatter.PrepareFileName(Path.GetFullPath(data.inputDirectory))}"); arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(Path.GetFullPath(outputDirectory))}"); // NOTE: any arguments added here that affect how generated code is built need // to also be added to PlatformDependent\Win\Extensions\Managed\VisualStudioProjectHelpers.cs // as that file generated project files that invoke back into IL2CPP in order to build // generated code string progressMessage = "Converting managed assemblies to C++"; if (il2CppNativeCodeBuilder != null) { progressMessage = "Building native binary with IL2CPP..."; } if (EditorUtility.DisplayCancelableProgressBar("Building Player", progressMessage, 0.3f)) { throw new OperationCanceledException(); } Action <ProcessStartInfo> setupStartInfo = null; if (il2CppNativeCodeBuilder != null) { setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; } if (PlayerBuildInterface.ExtraTypesProvider != null) { var extraTypes = new HashSet <string>(); foreach (var extraType in PlayerBuildInterface.ExtraTypesProvider()) { extraTypes.Add(extraType); } var tempFile = Path.GetFullPath(Path.Combine(m_TempFolder, "extra-types.txt")); File.WriteAllLines(tempFile, extraTypes.ToArray()); arguments.Add($"--extra-types-file={CommandLineFormatter.PrepareFileName(tempFile)}"); } RunIl2CppWithArguments(arguments, setupStartInfo, workingDirectory); }
private static string GetProfileArgumentValueForLinker(BuildTargetGroup buildTargetGroup) { return(IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup))); }
private string GetIl2CppCoreExe() { return(IL2CPPUtils.GetIl2CppFolder() + "/build/deploy/netcoreapp3.0/il2cpp" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : "")); }
internal static void CopySymmapFile(string tempFolder, string destinationFolder) { IL2CPPUtils.CopySymmapFile(tempFolder, destinationFolder, string.Empty); }
private string GetIl2CppCoreExe() { return(IL2CPPUtils.GetIl2CppFolder() + "/build/deploy/netcoreapp2.1/publish/il2cppcore.dll"); }
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 static string GetIl2CppExe() { return(IL2CPPUtils.GetExePath("il2cpp")); }
private void ConvertPlayerDlltoCpp(Il2CppBuildPipelineData data) { var arguments = new List <string>(); arguments.Add("--convert-to-cpp"); if (m_PlatformProvider.emitNullChecks) { arguments.Add("--emit-null-checks"); } if (m_PlatformProvider.enableStackTraces) { arguments.Add("--enable-stacktrace"); } if (m_PlatformProvider.enableArrayBoundsCheck) { arguments.Add("--enable-array-bounds-check"); } if (m_PlatformProvider.enableDivideByZeroCheck) { arguments.Add("--enable-divide-by-zero-check"); } if (m_PlatformProvider.development && m_PlatformProvider.enableDeepProfilingSupport) { arguments.Add("--enable-deep-profiler"); } if (m_BuildForMonoRuntime) { arguments.Add("--mono-runtime"); } var apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(m_PlatformProvider.namedBuildTarget); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(apiCompatibilityLevel, m_PlatformProvider.target))); var il2cppCodeGeneration = PlayerSettings.GetIl2CppCodeGeneration(m_PlatformProvider.namedBuildTarget); if (il2cppCodeGeneration == Il2CppCodeGeneration.OptimizeSize) { arguments.Add("--generics-option=EnableFullSharing"); } var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { var buildCacheNativeOutputFile = Path.Combine(GetNativeOutputRelativeDirectory(m_PlatformProvider.il2cppBuildCacheDirectory), m_PlatformProvider.nativeLibraryFileName); var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(m_PlatformProvider.namedBuildTarget); Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); arguments.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, buildCacheNativeOutputFile, m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration)); } else { arguments.Add($"--cachedirectory={CommandLineFormatter.PrepareFileName(GetShortPathName(Path.GetFullPath(m_PlatformProvider.il2cppBuildCacheDirectory)))}"); } // Additional files can take any form, depending on platform, so pass anything in the additional files directory foreach (var additionalCppFile in Directory.GetFiles(GetAdditionalCppFilesDirectory(m_PlatformProvider.il2cppBuildCacheDirectory))) { arguments.Add($"--additional-cpp={CommandLineFormatter.PrepareFileName(GetShortPathName(Path.GetFullPath(additionalCppFile)))}"); } arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider)); foreach (var buildingArgument in IL2CPPUtils.GetBuildingIL2CPPArguments(m_PlatformProvider)) { if (!arguments.Contains(buildingArgument)) { arguments.Add(buildingArgument); } } if (CrashReportingSettings.enabled) { arguments.Add($"--emit-source-mapping"); } var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add($"--directory={CommandLineFormatter.PrepareFileName(GetShortPathName(Path.GetFullPath(data.inputDirectory)))}"); arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(GetCppOutputDirectory(m_PlatformProvider.il2cppBuildCacheDirectory))}"); // NOTE: any arguments added here that affect how generated code is built need // to also be added to PlatformDependent\Win\Extensions\Managed\VisualStudioProjectHelpers.cs // as that file generated project files that invoke back into IL2CPP in order to build // generated code string progressMessage = "Converting managed assemblies to C++"; if (il2CppNativeCodeBuilder != null) { progressMessage = "Building native binary with IL2CPP..."; } if (EditorUtility.DisplayCancelableProgressBar("Building Player", progressMessage, 0.3f)) { throw new OperationCanceledException(); } Action <ProcessStartInfo> setupStartInfo = null; if (il2CppNativeCodeBuilder != null) { setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; } if (PlayerBuildInterface.ExtraTypesProvider != null) { var extraTypes = new HashSet <string>(); foreach (var extraType in PlayerBuildInterface.ExtraTypesProvider()) { extraTypes.Add(extraType); } var tempFile = Path.GetFullPath(Path.Combine(m_TempFolder, "extra-types.txt")); File.WriteAllLines(tempFile, extraTypes.ToArray()); arguments.Add($"--extra-types-file={CommandLineFormatter.PrepareFileName(tempFile)}"); } RunIl2CppWithArguments(arguments, setupStartInfo); }
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); }