Ejemplo n.º 1
0
    static void Main()
    {
        List <BuildCommand> commands = HostPlatform.IsOSX ? MacCommands() : WindowsCommands();

        commands.AddRange(GetAndroidBuildCommands());

        NativeProgram plugin = new NativeProgram("traceeventprofiler")
        {
            Sources = { "src" }
        };

        plugin.CompilerSettingsForIosOrTvos().Add(s => s.WithEmbedBitcode(true));
        plugin.DynamicLinkerSettingsForWindows().Add(s => s.WithDefinitionFile("src/ProfilerPlugin.def"));

        plugin.OutputName.Set(c => DllNameForPlatform(c.ToolChain.Platform));

        foreach (var command in commands)
        {
            var toolchain = command.ToolChain;

            var config       = new NativeProgramConfiguration(CodeGen.Release, toolchain, false);
            var tempDir      = $"artifacts_preprocess/{toolchain.LegacyPlatformIdentifier}";
            var builtProgram = plugin.SetupSpecificConfiguration(config, toolchain.DynamicLibraryFormat).DeployTo(tempDir).Path;
            if (command.PostProcess != null)
            {
                builtProgram = command.PostProcess(builtProgram, toolchain, command.PluginSubFolder);
            }
            Backend.Current.AddAliasDependency(command.Alias, builtProgram);
        }
    }
Ejemplo n.º 2
0
    static void Main()
    {
        // For Windows plugins
        List <BuildCommand> desktop = new List <BuildCommand>();

        desktop.Add(BuildCommand.Create(new WindowsToolchain(WindowsSdk.Locatorx86.UserDefaultOrLatest), "windows", "x86"));
        desktop.Add(BuildCommand.Create(new WindowsToolchain(WindowsSdk.Locatorx64.UserDefaultOrLatest), "windows", "x86_64"));
        desktop.Add(BuildCommand.Create(new LinuxGccToolchain(WSLGccSdk.Locatorx64.UserDefaultOrLatest), "linux", "x86_64"));

        // For Android plugins
        List <BuildCommand> android = new List <BuildCommand>();

        android.Add(BuildCommand.Create(new AndroidNdkToolchain(AndroidNdk.LocatorArmv7.UserDefaultOrLatest), "android", "Android/armeabi-v7a"));
        android.Add(BuildCommand.Create(new AndroidNdkToolchain(AndroidNdk.LocatorArm64.UserDefaultOrLatest), "android", "Android/arm64-v8a"));
        android.Add(BuildCommand.Create(new AndroidNdkToolchain(AndroidNdk.Locatorx86.UserDefaultOrLatest), "android", "Android/x86"));


        NativeProgram androidStudioPlugin = new NativeProgram("libProfilerPluginGAS");

        androidStudioPlugin.Sources.Add("src/ProfilerPlugin.cpp");
        androidStudioPlugin.Sources.Add("src/AndroidSystrace.cpp");
        androidStudioPlugin.Sources.Add("src/AndroidSystraceProfiler.cpp");
        androidStudioPlugin.PrebuiltLibraries.Add(new SystemLibrary("log"));
        ProcessProgram(androidStudioPlugin, "../com.unity.nativeprofilers.androidsystrace/Plugins", android);

        NativeProgram streamlineAnalyzerPlugin = new NativeProgram("libProfilerPluginASA");

        streamlineAnalyzerPlugin.Sources.Add("src/ProfilerPlugin.cpp");
        streamlineAnalyzerPlugin.Sources.Add("src/StreamlineAnalyzerProfiler.cpp");
        streamlineAnalyzerPlugin.Sources.Add("src/Arm");
        streamlineAnalyzerPlugin.PrebuiltLibraries.Add(new SystemLibrary("log"));
        ProcessProgram(streamlineAnalyzerPlugin, "../com.unity.nativeprofilers.streamlineanalyzer/Plugins", android);

        NativeProgram vtuneAmplifierPlugin = new NativeProgram("ProfilerPluginIVT");

        vtuneAmplifierPlugin.Sources.Add("src/ProfilerPlugin.cpp");
        vtuneAmplifierPlugin.Sources.Add("src/VTuneAmplifierProfiler.cpp");
        vtuneAmplifierPlugin.DynamicLinkerSettingsForWindows().Add(s => s.WithDefinitionFile("src/ProfilerPlugin.def"));
        vtuneAmplifierPlugin.PrebuiltLibraries.Add((program) => { return((program.Platform is WindowsPlatform) && (program.ToolChain.Architecture == Architecture.x86)); }, new StaticLibrary("src/Intel/libittnotify32.lib"));
        vtuneAmplifierPlugin.PrebuiltLibraries.Add((program) => { return((program.Platform is WindowsPlatform) && (program.ToolChain.Architecture == Architecture.x64)); }, new StaticLibrary("src/Intel/libittnotify64.lib"));
        vtuneAmplifierPlugin.PrebuiltLibraries.Add((program) => { return(program.Platform is LinuxPlatform); }, new StaticLibrary("src/Intel/libittnotify64.a"));
        vtuneAmplifierPlugin.PrebuiltLibraries.Add((program) => { return(program.Platform is LinuxPlatform); }, new SystemLibrary("dl"));
        ProcessProgram(vtuneAmplifierPlugin, "../com.unity.nativeprofilers.vtune/Plugins", desktop);
    }