Ejemplo n.º 1
0
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Libraries.Add(IsWindows, new SystemLibrary("opengl32.lib"));
     program.NativeProgram.Libraries.Add(c => c.Platform is MacOSXPlatform, new SystemFramework("OpenGL"));
     program.NativeProgram.Libraries.Add(IsLinux, new SystemLibrary("GL"));
     program.NativeProgram.IncludeDirectories.Add(program.MainSourcePath.Combine("cpp~/libwebp"));
 }
Ejemplo n.º 2
0
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Libraries.Add(c =>
                                         ((DotsRuntimeNativeProgramConfiguration)c).CSharpConfig.EnableManagedDebugging &&
                                         ((DotsRuntimeNativeProgramConfiguration)c).CSharpConfig.WaitForManagedDebugger &&
                                         c.Platform is MacOSXPlatform, new SystemFramework("CoreFoundation"));
 }
Ejemplo n.º 3
0
 public static void RunAllAddPlatformImplementationReferences(AsmDefCSharpProgram aprogram)
 {
     foreach (var customizer in All)
     {
         customizer.AddPlatformImplementationReferences(aprogram);
     }
 }
Ejemplo n.º 4
0
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Libraries.Add(c =>
                                         ((DotsRuntimeNativeProgramConfiguration)c).CSharpConfig.EnableManagedDebugging &&
                                         ((DotsRuntimeNativeProgramConfiguration)c).CSharpConfig.WaitForManagedDebugger &&
                                         c.Platform is WindowsPlatform, new SystemLibrary("user32.lib"));
 }
Ejemplo n.º 5
0
    private static NPath GameDeployBinaryFor(AsmDefCSharpProgram game, DotsRuntimeCSharpProgramConfiguration config)
    {
        var fileName = config.ScriptingBackend == ScriptingBackend.Dotnet ?
                       game.FileName
            : new NPath(game.AsmDefDescription.Name.Replace(".", "-")).ChangeExtension(config.NativeProgramConfiguration.ExecutableFormat.Extension);

        return(GameDeployDirectoryFor(game, config).Combine(fileName));
    }
Ejemplo n.º 6
0
    private static NPath EntryPointExecutableFor(AsmDefCSharpProgram gameProgram, DotsRuntimeCSharpProgramConfiguration config)
    {
        if (gameProgram.FileName.EndsWith(".exe") || config.ScriptingBackend != ScriptingBackend.Dotnet)
        {
            return(GameDeployBinaryFor(gameProgram, config));
        }

        return(GameDeployDirectoryFor(gameProgram, config).Combine(new NPath(gameProgram.FileName).FileNameWithoutExtension + ".exe"));
    }
Ejemplo n.º 7
0
    public override void CustomizeSelf(AsmDefCSharpProgram program)
    {
        var ilSupportDll = program.MainSourcePath.Parent.Combine("Unity.Collections.LowLevel.ILSupport/Unity.Collections.LowLevel.ILSupport.dll");

        // if it doesn't exist, then perhaps the codegen is in use
        if (ilSupportDll.Exists())
        {
            program.References.Add(ilSupportDll);
        }
    }
Ejemplo n.º 8
0
 private static NPath GameDeployDirectoryFor(AsmDefCSharpProgram game, DotsRuntimeCSharpProgramConfiguration config)
 {
     if (config.FinalOutputDirectory != null)
     {
         return(new NPath("../..").Combine(config.FinalOutputDirectory));
     }
     else
     {
         return($"../../Builds/{config.Identifier}");
     }
 }
Ejemplo n.º 9
0
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     if (program.MainSourcePath.FileName == "Unity.Tiny.GLFW")
     {
         External.GLFWStaticLibrary = External.SetupGLFW();
         program.NativeProgram.Libraries.Add(new NativeProgramAsLibrary(External.GLFWStaticLibrary)
         {
             BuildMode = NativeProgramLibraryBuildMode.BagOfObjects
         });
     }
 }
Ejemplo n.º 10
0
    public void AddPlatformImplementationReferences(AsmDefCSharpProgram aprogram)
    {
        if (_implForCache == null)
        {
            _implForCache = ImplementationFor;
        }

        foreach (var src in _implForCache)
        {
            aprogram.AddPlatformImplementationFor(src, CustomizerFor);
        }
    }
Ejemplo n.º 11
0
    private static NPath GameDeployBinaryFor(AsmDefCSharpProgram game, DotsRuntimeCSharpProgramConfiguration config)
    {
        var ext = config.NativeProgramConfiguration.ExecutableFormat.Extension;

        if (!ext.StartsWith(".") && !String.IsNullOrEmpty(ext))
        {
            ext = "." + ext;
        }
        var fileName = config.ScriptingBackend == ScriptingBackend.Dotnet ?
                       game.FileName
            : new NPath(game.AsmDefDescription.Name) + ext;

        return(GameDeployDirectoryFor(game, config).Combine(fileName));
    }
Ejemplo n.º 12
0
    static void SetupTestForConfig(string name, AsmDefCSharpProgram testProgram, DotsRuntimeCSharpProgramConfiguration config)
    {
        var builtTest           = testProgram.SetupSpecificConfiguration(config);
        var postILProcessedTest = ILPostProcessorTool.SetupInvocation(builtTest, config, testProgram.Defines.For(config).ToArray());
        var postTypeRegGenTest  = TypeRegistrationTool.SetupInvocation(postILProcessedTest, config);

        NPath deployDirectory = GameDeployDirectoryFor(testProgram, config);
        var   deployed        = postTypeRegGenTest.DeployTo(deployDirectory);

        testProgram.ProjectFile.OutputPath.Add(c => c == config, deployDirectory);
        testProgram.ProjectFile.BuildCommand.Add(c => c == config, new BeeBuildCommand(deployed.Path.ToString(), false, false).ToExecuteArgs());

        Backend.Current.AddAliasDependency($"{name.ToLower()}-{ config.Identifier}", deployed.Path);
        Backend.Current.AddAliasDependency("tests", deployed.Path);
    }
Ejemplo n.º 13
0
    public override void CustomizeSelf(AsmDefCSharpProgram program)
    {
        program.NativeProgram.Libraries.Add(c => c.Platform is AndroidPlatform, new List <string>
        {
            "android", "log", "OpenSLES"
        }.ConvertAll(s => new SystemLibrary(s)));

        program.NativeProgram.Libraries.Add(c => c.Platform is LinuxPlatform, new List <string>
        {
            "dl", "rt"
        }.ConvertAll(s => new SystemLibrary(s)));

        program.NativeProgram.Libraries.Add(c => c.Platform is IosPlatform, new List <string>
        {
            "AudioToolbox", "AVFoundation"
        }.ConvertAll(s => new SystemFramework(s)));

        program.NativeProgram.CompilerSettingsForIos().Add(c => c.WithLanguage(Language.ObjectiveCpp));
    }
    public override void CustomizeSelf(AsmDefCSharpProgram program)
    {
        if (program.MainSourcePath.FileName == "Unity.Tiny.GLFW")
        {
            External.GLFWStaticLibrary = External.SetupGLFW();
            program.NativeProgram.CompilerSettingsForMac().Add(c => c.WithObjcArc(false));
            program.NativeProgram.Libraries.Add(c => c.Platform is MacOSXPlatform, new List <string>
            {
                "Cocoa", "QuartzCore", "OpenGL", "Metal"
            }
                                                .ConvertAll(s => new SystemFramework(s)));

            program.NativeProgram.CompilerSettingsForIos().Add(c => c.WithObjcArc(false));

            program.NativeProgram.Libraries.Add(new NativeProgramAsLibrary(External.GLFWStaticLibrary)
            {
                BuildMode = NativeProgramLibraryBuildMode.BagOfObjects
            });
        }
    }
Ejemplo n.º 15
0
    public static AsmDefCSharpProgram GetOrMakeDotsRuntimeCSharpProgramFor(
        AsmDefDescription asmDefDescription)
    {
        return(_cache.GetOrMake(asmDefDescription, () =>
        {
            if (BuildStack.Contains(asmDefDescription))
            {
                Console.WriteLine($"Fatal Error: recursive asmdef or build program dependency detected!");
                foreach (var bs in BuildStack)
                {
                    Console.WriteLine($"   {bs.Name}");
                }
                Console.WriteLine($"-> {asmDefDescription.Name}");
                throw new InvalidProgramException("Recursive asmdef dependencies");
            }

            BuildStack.Add(asmDefDescription);
            var prog = new AsmDefCSharpProgram(asmDefDescription);
            BuildStack.RemoveAt(BuildStack.Count - 1);
            return prog;
        }));
    }
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Libraries.Add(IsWindows, new SystemLibrary("opengl32.lib"));
     program.NativeProgram.Libraries.Add(c => c.Platform is MacOSXPlatform, new SystemFramework("OpenGL"));
     program.NativeProgram.Libraries.Add(IsLinux, new SystemLibrary("GL"));
 }
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     Il2Cpp.AddLibIl2CppAsLibraryFor(program.NativeProgram);
 }
Ejemplo n.º 18
0
    public override void CustomizeSelf(AsmDefCSharpProgram program)
    {
        // We need to make sure that these two files are identical, but we can't read the stevedore
        // one until the build actually starts.  And we can't just use the stevedore one for our
        // build, because Unity also needs to build the code and it doesn't see the files that
        // we download as part of this build.
        // Also they're not identical because we have to hack in the library name.
#if false
        var ourBgfxCs  = program.MainSourcePath.Combine("Bgfx.cs").MakeAbsolute();
        var realBgfxCs = BgfxBuild.Instance.BgfxRoot.Combine("bgfx/bindings/cs/bgfx.cs").MakeAbsolute();

        if (ourBgfxCs.ReadAllText() != realBgfxCs.ReadAllText())
        {
            throw new InvalidProgramException($"Bgfx.cs file mismatch!  The Bgfx.cs that's checked in must match the stevedore version, because both Unity and DOTS Runtime need access to it.  Please copy {realBgfxCs} to {ourBgfxCs}.");
        }
#endif

        program.NativeProgram.CompilerSettings().Add(c => c.WithCppLanguageVersion(CppLanguageVersion.Cpp14));
        program.NativeProgram.CompilerSettingsForMac().Add(c => c.WithObjcArc(false));
        program.NativeProgram.Libraries.Add(new NativeProgramAsLibrary(BgfxBuild.Instance.BxLib)
        {
            BuildMode = NativeProgramLibraryBuildMode.BagOfObjects
        });
        program.NativeProgram.Libraries.Add(new NativeProgramAsLibrary(BgfxBuild.Instance.BimgLib)
        {
            BuildMode = NativeProgramLibraryBuildMode.BagOfObjects
        });
        program.NativeProgram.Libraries.Add(new NativeProgramAsLibrary(BgfxBuild.Instance.BgfxLib)
        {
            BuildMode = NativeProgramLibraryBuildMode.BagOfObjects
        });

        // lib_unity_blah_bgfx.bc bx.bc
        program.NativeProgram.Libraries.Add(IsWindows, new List <string>
        {
            "gdi32",
            "user32",
            "kernel32",
            "psapi",
            "dxguid"
        }
                                            .ConvertAll(s => new SystemLibrary(s + ".lib"))
                                            );
        program.NativeProgram.Libraries.Add(IsLinux, new SystemLibrary("dl"), new SystemLibrary("pthread"), new SystemLibrary("X11"));
        program.NativeProgram.Libraries.Add(c => c.Platform is MacOSXPlatform, new List <string>
        {
            "Cocoa", "QuartzCore", "OpenGL", "Metal"
        }
                                            .ConvertAll(s => new SystemFramework(s)));
        program.NativeProgram.Libraries.Add(c => c.Platform is LinuxPlatform, new List <string>
        {
            "GL", "X11", "udev", "Xrandr", "dl"
        }
                                            .ConvertAll(s => new SystemFramework(s)));


        program.NativeProgram.Libraries.Add(c => c.Platform is WebGLPlatform, new List <string>
        {
            "GL", "EGL"
        }.ConvertAll(s => new SystemLibrary(s)));

        program.NativeProgram.Libraries.Add(c => c.Platform is AndroidPlatform, new List <string>
        {
            "android", "log", "GLESv3", "EGL"
        }.ConvertAll(s => new SystemLibrary(s)));
        program.NativeProgram.Libraries.Add(c => c.Platform is IosPlatform, new List <string>
        {
            "Foundation", "UIKit", "QuartzCore", "OpenGLES", "Metal"
        }
                                            .ConvertAll(s => new SystemFramework(s)));
    }
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     NiceIO.NPath path = program.MainSourcePath.Combine("external/libwebp.js");
     program.NativeProgram.Libraries.Add(c => ((DotsRuntimeNativeProgramConfiguration)c).CSharpConfig.PlatformBuildConfig is WebBuildConfig, new PostJsLibrary(path));
 }
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Libraries.Add(c => c.Platform is WebGLPlatform && !Il2Cpp.ManagedDebuggingIsEnabled(c), Il2Cpp.LibIL2Cpp);
     program.NativeProgram.Libraries.Add(c => c.Platform is WebGLPlatform && Il2Cpp.ManagedDebuggingIsEnabled(c), Il2Cpp.BigLibIL2Cpp);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Called to customize the program when the program does not matche the asmdef for which
 /// this is a customizer for.
 /// </summary>
 public virtual void CustomizeOther(AsmDefCSharpProgram aprogram)
 {
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Called to customize the program when the program matches the asmdef for which
 /// this is a customizer for.
 /// </summary>
 /// <param name="aprogram">The program</param>
 public virtual void CustomizeSelf(AsmDefCSharpProgram aprogram)
 {
 }
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Defines.Add(c => c.Platform == Platform.Windows, "LZ4_DLL_EXPORT");
 }
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Libraries.Add(new SystemLibrary("log"));
     program.NativeProgram.Libraries.Add(new SystemLibrary("android"));
 }
Ejemplo n.º 25
0
 public override void CustomizeSelf(AsmDefCSharpProgram program)
 {
     program.NativeProgram.Defines.Add(c => ((DotsRuntimeNativeProgramConfiguration)c).CSharpConfig.PlatformBuildConfig is WebBuildConfig webBuildConfig && webBuildConfig.SingleFile, "SINGLE_FILE=1");
     program.NativeProgram.Libraries.Add(c => c.Platform is AndroidPlatform, new SystemLibrary("log"));
     program.NativeProgram.Libraries.Add(c => c.Platform is AndroidPlatform, new SystemLibrary("android"));
 }