void AddWindowsPreAndPostBuildSteps(TargetInfo Target)
    {
        string VitruvioPath = string.Empty;

        // Check if Vitruvio Plugin is installed
        foreach (FileReference Plugin in UnrealBuildTool.Plugins.EnumeratePlugins(Target.ProjectFile))
        {
            if (Plugin.FullName.Contains("Vitruvio"))
            {
                VitruvioPath = Path.GetDirectoryName(Plugin.FullName);
            }
        }

        string ProjectPath = Path.GetDirectoryName(Target.ProjectFile.FullName);

        if (ProjectPath == null)
        {
            throw new InvalidOperationException("Project Path is null");
        }

        string BinaryFolder        = Path.Combine(ProjectPath, "Binaries", "Win64", "UnrealGeometryEncoder");
        string SourceIncludeFolder = Path.Combine(ProjectPath, "Source", "UnrealGeometryEncoder", "Public");

        string AllBinaryFolderFiles = Path.Combine(BinaryFolder, "*.*");

        if (File.Exists(BinaryFolder))
        {
            // We want to delete all old encoder libraries because there might be old builds with different build settings
            PreBuildSteps.Add(string.Format("echo deleting old encoder libraries \"{0}\"", AllBinaryFolderFiles));
            PreBuildSteps.Add(string.Format("del /f /q \"{0}\"", AllBinaryFolderFiles));
        }

        // If Vitruvio is installed, copy the include and library files into the ThirdParty folder of Vitruvio
        if (!string.IsNullOrEmpty(VitruvioPath))
        {
            string VitruvioEncoderLib = Path.Combine(VitruvioPath, "Source", "ThirdParty", "UnrealGeometryEncoderLib");
            string LibFolder          = Path.Combine(VitruvioEncoderLib, "lib", "Win64", "Release");

            string SrcPath  = AllBinaryFolderFiles;
            string DestPath = LibFolder;

            PostBuildSteps.Add(string.Format("echo Copying \"{0}\" to \"{1}\"", SrcPath, DestPath));
            PostBuildSteps.Add(string.Format("xcopy \"{0}\" \"{1}\" /R /Y /S", SrcPath, DestPath));

            SrcPath  = Path.Combine(SourceIncludeFolder, "*.*");
            DestPath = Path.Combine(VitruvioEncoderLib, "include");

            PostBuildSteps.Add(string.Format("echo Copying \"{0}\" to \"{1}\"", SrcPath, DestPath));
            PostBuildSteps.Add(string.Format("xcopy \"{0}\" \"{1}\" /R /Y /S", SrcPath, DestPath));
        }
    }
    public void AddPreBuildSteps(UnrealTargetPlatform TargetPlatform)
    {
        // Environment variable SWIG_DIR must be set to the Swig third party directory on the developer's workstation to run swig.
        if (string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("SWIG_DIR")))
        {
            PreBuildSteps.Add("echo Environment variable SWIG_DIR is not defined.");
            return;
        }

        PreBuildSteps.Add("echo Using SWIG_DIR env. variable: %SWIG_DIR%");

        string FacadePath      = Path.Combine("$(EngineDir)", "Source", "Developer", "Datasmith", "DatasmithFacade");
        string DatasmithUIPath = Path.Combine("$(EngineDir)", "Source", "Developer", "Datasmith", "DatasmithExporterUI");
        string ProjectPath     = Path.Combine("$(EngineDir)", "Source", "Programs", "Enterprise", "Datasmith", "DatasmithFacadeCSharp");
        string SwigCommand     = string.Format("\"{0}\" -csharp -c++ -DSWIG_FACADE -DDATASMITHFACADE_API -DDATASMITHEXPORTERUI_API -I\"{1}\" -I\"{2}\" -I\"{3}\" -o \"{4}\" -outdir \"{5}\" \"{6}\"",
                                               Path.Combine("%SWIG_DIR%", "swig"),
                                               Path.Combine(FacadePath, "Public"),
                                               Path.Combine(DatasmithUIPath, "Public"),
                                               Path.Combine(ProjectPath, "Private"),
                                               Path.Combine(ProjectPath, "Private", "DatasmithFacadeCSharp.cpp"),
                                               Path.Combine(ProjectPath, "Public"),
                                               Path.Combine(ProjectPath, "DatasmithFacadeCSharp.i"));
        string CleanupPath = Path.Combine(ProjectPath, "Public", "*.cs");

        // The 2>nul is to mute the error message if no files where found
        string CleanCommand = string.Format("del \"{0}\" 2>nul", CleanupPath);

        if (TargetPlatform == UnrealTargetPlatform.Mac)
        {
            CleanCommand = string.Format("rm -f \"{0}\"", CleanupPath);
        }

        // Files may disapear as we move or remove classes, it is important to always remove the .cs files to avoid having conflicting leftover files.
        PreBuildSteps.Add(CleanCommand);

        // Generate facade with swig
        PreBuildSteps.Add(SwigCommand);

        // Add copyright headers after generating the new files from swig.
        string PythonDir = Path.Combine("$(EngineDir)", "Binaries", "ThirdParty", "Python");

        if (TargetPlatform == UnrealTargetPlatform.Mac)
        {
            PreBuildSteps.Add(string.Format("\"{0}\" \"{1}\"", Path.Combine(PythonDir, "Mac", "bin", "python"), Path.Combine(ProjectPath, "FacadeHeaderHelper.py")));
        }
        else
        {
            PreBuildSteps.Add(string.Format("\"{0}\" \"{1}\"", Path.Combine(PythonDir, "Win64", "python.exe"), Path.Combine(ProjectPath, "FacadeHeaderHelper.py")));
        }
    }
Beispiel #3
0
    public UnrealMatch3Target(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Game;
        ExtraModuleNames.AddRange(new string[] { "Match3" });

        if (Target.Platform == UnrealTargetPlatform.IOS && !bUsePrecompiled)
        {
            bCompileAPEX          = false;
            bCompileNvCloth       = false;
            bCompileICU           = true;
            bCompileSimplygon     = false;
            bCompileLeanAndMeanUE = true;
            bCompileRecast        = true;
            bCompileFreeType      = true;
            bCompileForSize       = true;
        }

        PreBuildSteps.Add("echo =========!!!");
    }
    public void AddPreBuildSteps()
    {
        // Environment variable SWIG_DIR must be set to the Swig third party directory on the developer's workstation to run swig.
        if (string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("SWIG_DIR")))
        {
            PreBuildSteps.Add("echo Environment variable SWIG_DIR is not defined.");
            return;
        }

        PreBuildSteps.Add("echo Using SWIG_DIR env. variable: %SWIG_DIR%");

        string FacadePath  = @"$(EngineDir)\Source\Developer\Datasmith\DatasmithFacade";
        string ProjectPath = @"$(EngineDir)\Source\Programs\Enterprise\Datasmith\DatasmithFacadeCSharp";
        string SwigCommand = string.Format(@"%SWIG_DIR%\swig -csharp -c++ -DSWIG_FACADE -DDATASMITHFACADE_API -I{0}\Public -I{1}\Private -o {1}\Private\DatasmithFacadeCSharp.cpp -outdir {1}\Public {1}\DatasmithFacadeCSharp.i", FacadePath, ProjectPath);

        // Clean Destination folder
        PreBuildSteps.Add(string.Format(@"del {0}\Public\*.cs", ProjectPath));

        // Generate facade with swig
        PreBuildSteps.Add(SwigCommand);
    }
    public RuntimeBlueprintsEditorTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Editor;
        DefaultBuildSettings = BuildSettingsVersion.V2;

        // For some reason, the LongUnion update does not happen after the first build since the change. You will have to cancel and build again to have the TypeAmount value updated.
        // This seems to be a bug with UHT, although unsure.
        int    TypeAmount  = 29;
        string UnionScript = "\"$(ProjectDir)\\Source\\UpdateLongUnion.ps1\"";
        string FilePath    = "\"$(ProjectDir)\\Source\\RuntimeBlueprints\\LongUnion.h\"";
        string UnionPath   = "\"$(EngineDir)\\Source\\Runtime\\Core\\Public\\Containers\\Union.h\"";

        PreBuildSteps.Add("powershell -executionpolicy bypass -file " + UnionScript +
                          " " + FilePath +
                          " " + UnionPath +
                          " " + TypeAmount.ToString());

        //bUseUBTMakefiles = false;

        ExtraModuleNames.AddRange(new string[] { "RuntimeBpExample", "RuntimeBlueprints" });
    }