Ejemplo n.º 1
0
        public static IEnumerable <string> AddBuilderArguments(Il2CppNativeCodeBuilder builder, string outputRelativePath, IEnumerable <string> includeRelativePaths)
        {
            List <string> list = new List <string>();

            list.Add("--compile-cpp");
            list.Add("--libil2cpp-static");
            list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("platform", builder.CompilerPlatform));
            list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("architecture", builder.CompilerArchitecture));
            list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("configuration", "Release"));
            list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("outputpath", builder.ConvertOutputFileToFullPath(outputRelativePath)));
            if (!string.IsNullOrEmpty(builder.CacheDirectory))
            {
                list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("cachedirectory", Il2CppNativeCodeBuilderUtils.CacheDirectoryPathFor(builder.CacheDirectory)));
            }
            if (!string.IsNullOrEmpty(builder.CompilerFlags))
            {
                list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("compiler-flags", builder.CompilerFlags));
            }
            if (!string.IsNullOrEmpty(builder.LinkerFlags))
            {
                list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("linker-flags", builder.LinkerFlags));
            }
            if (!string.IsNullOrEmpty(builder.PluginPath))
            {
                list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("plugin", builder.PluginPath));
            }
            foreach (string current in builder.ConvertIncludesToFullPaths(includeRelativePaths))
            {
                list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("additional-include-directories", current));
            }
            list.AddRange(builder.AdditionalIl2CPPArguments);
            return(list);
        }
        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));

            // In IL2CPP, Master config is called "ReleasePlus"
            string configurationName = compilerConfiguration != Il2CppCompilerConfiguration.Master ? compilerConfiguration.ToString() : "ReleasePlus";

            arguments.Add(FormatArgument("configuration", configurationName));

            arguments.Add(FormatArgument("outputpath", builder.ConvertOutputFileToFullPath(outputRelativePath)));

            if (!string.IsNullOrEmpty(builder.CacheDirectory) && !builder.OverriddenCacheDirectory)
            {
                arguments.Add(FormatArgument("cachedirectory", CacheDirectoryPathFor(builder.CacheDirectory)));
            }

            if (!string.IsNullOrEmpty(builder.CompilerFlags))
            {
                arguments.Add(FormatArgument("compiler-flags", builder.CompilerFlags));
            }

            if (!string.IsNullOrEmpty(builder.LinkerFlags))
            {
                arguments.Add(FormatArgument("linker-flags", builder.LinkerFlags));
            }

            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);
        }
Ejemplo n.º 3
0
        public static IEnumerable <string> AddBuilderArguments(Il2CppNativeCodeBuilder builder, string outputRelativePath, IEnumerable <string> includeRelativePaths, bool debugBuild)
        {
            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));

            if (debugBuild)
            {
                arguments.Add(FormatArgument("configuration", "Debug"));
            }
            else
            {
                arguments.Add(FormatArgument("configuration", "Release"));
            }

            arguments.Add(FormatArgument("outputpath", builder.ConvertOutputFileToFullPath(outputRelativePath)));

            if (!string.IsNullOrEmpty(builder.CacheDirectory))
            {
                arguments.Add(FormatArgument("cachedirectory", CacheDirectoryPathFor(builder.CacheDirectory)));
            }

            if (!string.IsNullOrEmpty(builder.CompilerFlags))
            {
                arguments.Add(FormatArgument("compiler-flags", builder.CompilerFlags));
            }

            if (!string.IsNullOrEmpty(builder.LinkerFlags))
            {
                arguments.Add(FormatArgument("linker-flags", builder.LinkerFlags));
            }

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

            arguments.AddRange(builder.AdditionalIl2CPPArguments);

            return(arguments);
        }
Ejemplo n.º 4
0
        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);
        }