public DatasmithNavisworksBaseTarget(TargetInfo Target)
		: base(Target)
	{
		Type = TargetType.Program;
		SolutionDirectory = "Programs/Datasmith";
		bBuildInSolutionByDefault = false;

		string NavisworksVersionString = GetVersion();
		
		ExeBinariesSubFolder = Path.Combine("Navisworks", NavisworksVersionString);
		LaunchModuleName = "DatasmithNavisworks" + NavisworksVersionString;

		bShouldCompileAsDLL = true;
		LinkType = TargetLinkType.Monolithic;

		bBuildDeveloperTools = false;
		bUseMallocProfiler = false;
		bBuildWithEditorOnlyData = true;
		bCompileAgainstEngine = false;
		bCompileAgainstCoreUObject = false;
		bCompileICU = false;
		bUsesSlate = false;

		// Define post-build step
		string NavisworksExporterPath = @"$(EngineDir)\Source\Programs\Enterprise\Datasmith\DatasmithNavisworksExporter";
		string SolutionPath = Path.Combine(NavisworksExporterPath, @"DatasmithNavisworksPlugin\DatasmithNavisworks.sln");
		string BuildCommand = string.Format(@"$(EngineDir)\Build\BatchFiles\MSBuild.bat /t:Build /p:Configuration=Release{1} {0}", SolutionPath, NavisworksVersionString);
		PostBuildSteps.Add(BuildCommand);
	}
    public MobuLiveLinkPluginTargetBase(TargetInfo Target, string InMobuVersionString) : base(Target)
    {
        Type = TargetType.Program;

        bShouldCompileAsDLL = true;
        LinkType            = TargetLinkType.Monolithic;
        SolutionDirectory   = "Programs/LiveLink";

        bool   bIsNotForLicensees    = false;
        string NotForLicenseesFolder = bIsNotForLicensees ? "NotForLicensees" : "";

        ExeBinariesSubFolder = Path.Combine(NotForLicenseesFolder, "MotionBuilder", InMobuVersionString);
        LaunchModuleName     = "MobuLiveLinkPlugin" + InMobuVersionString;

        // We only need minimal use of the engine for this plugin
        bBuildDeveloperTools       = false;
        bUseMallocProfiler         = false;
        bBuildWithEditorOnlyData   = true;
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = true;
        bCompileICU = false;
        bHasExports = false;

        string ResourcesFolder   = Path.GetFullPath(Path.Combine("Programs", NotForLicenseesFolder, "MobuLiveLink/Resources"));
        string BinariesDirectory = Path.GetFullPath(Path.Combine("../Binaries", "Win64", NotForLicenseesFolder, "MotionBuilder", InMobuVersionString));

        PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", ResourcesFolder, BinariesDirectory));
        PostBuildSteps.Add(string.Format("copy /a /b /y /v \"{0}\\*.*\" \"{1}\" 1>nul", ResourcesFolder, BinariesDirectory));
    }
    public MayaLiveLinkPluginTargetBase(TargetInfo Target, string InMayaVersionString) : base(Target)
    {
        Type = TargetType.Program;

        bShouldCompileAsDLL = true;
        LinkType            = TargetLinkType.Monolithic;
        SolutionDirectory   = "Programs/LiveLink";

        // We only need minimal use of the engine for this plugin
        bBuildDeveloperTools       = false;
        bUseMallocProfiler         = false;
        bBuildWithEditorOnlyData   = true;
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = true;
        bCompileICU = false;
        bHasExports = true;

        bBuildInSolutionByDefault = false;

        ExeBinariesSubFolder  = "NotForLicensees/Maya/" + InMayaVersionString;
        this.LaunchModuleName = "MayaLiveLinkPlugin" + InMayaVersionString;

        // Add a post-build step that copies the output to a file with the .mll extension
        string OutputName = LaunchModuleName;

        if (Target.Configuration != UnrealTargetConfiguration.Development)
        {
            OutputName = string.Format("{0}-{1}-{2}", OutputName, Target.Platform, Target.Configuration);
        }

        string BinaryFilePath = "$(EngineDir)\\Binaries\\Win64\\NotForLicensees\\Maya\\" + InMayaVersionString + "\\" + OutputName;
        string Command        = "copy /Y " + BinaryFilePath + ".dll " + BinaryFilePath + ".mll";

        PostBuildSteps.Add(Command);
    }
    public MayaLiveLinkPluginTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Program;

        bShouldCompileAsDLL = true;
        LinkType            = TargetLinkType.Monolithic;

        LaunchModuleName = "MayaLiveLinkPlugin";

        // We only need minimal use of the engine for this plugin
        bCompileLeanAndMeanUE      = true;
        bUseMallocProfiler         = false;
        bBuildEditor               = false;
        bBuildWithEditorOnlyData   = true;
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = true;
        bCompileICU = false;
        bHasExports = true;

        bBuildInSolutionByDefault = false;

        // Add a post-build step that copies the output to a file with the .mll extension
        string OutputName = "MayaLiveLinkPlugin";

        if (Target.Configuration != UnrealTargetConfiguration.Development)
        {
            OutputName = string.Format("{0}-{1}-{2}", OutputName, Target.Platform, Target.Configuration);
        }
        PostBuildSteps.Add(string.Format("copy /Y \"$(EngineDir)\\Binaries\\Win64\\{0}.dll\" \"$(EngineDir)\\Binaries\\Win64\\{0}.mll\" >nul: & echo Copied output to $(EngineDir)\\Binaries\\Win64\\{0}.mll", OutputName));
    }
    public MobuLiveLinkPluginTargetBase(TargetInfo Target, string InMobuVersionString) : base(Target)
    {
        Type = TargetType.Program;

        bShouldCompileAsDLL = true;
        LinkType            = TargetLinkType.Monolithic;

        Tools.DotNETCommon.Log.TraceLog("MyMessage" + this.Name);

        bool   bIsNotForLicensees    = false;
        string NotForLicenseesFolder = bIsNotForLicensees ? "NotForLicensees" : "";

        ExeBinariesSubFolder = Path.Combine(NotForLicenseesFolder, "MotionBuilder", InMobuVersionString);
        LaunchModuleName     = "MobuLiveLinkPlugin" + InMobuVersionString;

        // We only need minimal use of the engine for this plugin
        bBuildDeveloperTools       = false;
        bUseMallocProfiler         = false;
        bBuildWithEditorOnlyData   = true;
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = true;
        bCompileICU = false;
        bHasExports = false;

        string ResourcesFolder   = Path.GetFullPath(Path.Combine("Programs", NotForLicenseesFolder, "MobuLiveLink/Resources"));
        string BinariesDirectory = Path.GetFullPath(Path.Combine("../Binaries", "Win64", NotForLicenseesFolder, "MotionBuilder", InMobuVersionString));
        string Command           = "copy /a /b /y /v \"" + ResourcesFolder + "\\*.*\" \"" + BinariesDirectory + "\"";

        PostBuildSteps.Add(Command);
    }
    protected void AddPostBuildSteps()
    {
        string SrcPath = @"$(EngineDir)\Source\Programs\Enterprise\Datasmith\DatasmithFacadeCSharp\Public\*.cs";
        string DstPath = @"$(EngineDir)\Binaries\$(TargetPlatform)\DatasmithFacadeCSharp\Public\";

        // Copy the generated C# files.
        PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DstPath));
        PostBuildSteps.Add(string.Format("xcopy {0} {1} /R /S /Y", SrcPath, DstPath));
    }
    public ShaderCompileWorkerTarget(TargetInfo Target) : base(Target)
    {
        Type     = TargetType.Program;
        LinkType = TargetLinkType.Modular;

        LaunchModuleName = "ShaderCompileWorker";

        if (bUseXGEController && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64) && Configuration == UnrealTargetConfiguration.Development)
        {
            // The interception interface in XGE requires that the parent and child processes have different filenames on disk.
            // To avoid building an entire separate worker just for this, we duplicate the ShaderCompileWorker in a post build step.
            const string SrcPath  = "$(EngineDir)\\Binaries\\$(TargetPlatform)\\ShaderCompileWorker.exe";
            const string DestPath = "$(EngineDir)\\Binaries\\$(TargetPlatform)\\XGEControlWorker.exe";

            PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
            PostBuildSteps.Add(string.Format("copy /Y /B \"{0}\" /B \"{1}\" >nul:", SrcPath, DestPath));

            AdditionalBuildProducts.Add(DestPath);
        }

        // Turn off various third party features we don't need

        // Currently we force Lean and Mean mode
        bBuildDeveloperTools = false;

        // ShaderCompileWorker isn't localized, so doesn't need ICU
        bCompileICU = false;

        // Currently this app is not linking against the engine, so we'll compile out references from Core to the rest of the engine
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = false;
        bBuildWithEditorOnlyData   = true;
        bCompileCEF3 = false;

        if (Target.Configuration == UnrealTargetConfiguration.Debug)
        {
            bDebugBuildsActuallyUseDebugCRT = true;
        }

        // Never use malloc profiling in ShaderCompileWorker.
        bUseMallocProfiler = false;

        // Force all shader formats to be built and included.
        bForceBuildShaderFormats = true;

        // ShaderCompileWorker is a console application, not a Windows app (sets entry point to main(), instead of WinMain())
        bIsBuildingConsoleApplication = true;

        // Disable logging, as the workers are spawned often and logging will just slow them down
        GlobalDefinitions.Add("ALLOW_LOG_FILE=0");

        // Linking against wer.lib/wer.dll causes XGE to bail when the worker is run on a Windows 8 machine, so turn this off.
        GlobalDefinitions.Add("ALLOW_WINDOWS_ERROR_REPORT_LIB=0");

        // Disable external profiling in ShaderCompiler to improve startup time
        GlobalDefinitions.Add("UE_EXTERNAL_PROFILING_ENABLED=0");
    }
    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));
        }
    }
示例#9
0
    protected void AddCopyPostBuildStep(TargetInfo Target)
    {
        // Add a post-build step that copies the output to a file with the .dle extension
        string OutputName = "$(TargetName)";

        if (Target.Configuration != UnrealTargetConfiguration.Development)
        {
            OutputName = string.Format("{0}-{1}-{2}", OutputName, Target.Platform, Target.Configuration);
        }

        string SrcOutputFileName = string.Format(@"$(EngineDir)\Binaries\Win64\{0}\{1}.dll", ExeBinariesSubFolder, OutputName);
        string DstOutputFileName = string.Format(@"$(EngineDir)\Binaries\Win64\{0}\{1}.dle", ExeBinariesSubFolder, OutputName);

        PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", SrcOutputFileName, DstOutputFileName));
        PostBuildSteps.Add(string.Format("copy /Y \"{0}\" \"{1}\" 1>nul", SrcOutputFileName, DstOutputFileName));
    }
    private void AddVersionUpdatePostSteps(TargetInfo Target)
    {
        ReadOnlyBuildVersion BuildVersion = Target.Version;
        string VersionString              = string.Format("{0}.{1}.{2}.{3}", BuildVersion.MajorVersion, BuildVersion.MinorVersion, BuildVersion.PatchVersion, BuildVersion.Changelist);
        string CustomAssemblyInfoPath     = Path.Combine(GetPropertiesPath(), "GeneratedAssemblyInfo.cs");
        string CustomAssemblyTemplatePath = Path.Combine(GetPropertiesPath(), "GeneratedAssemblyInfo.cs.Template");
        string Disclaimer = "// Warning. This is an AUTO-GENERATED file used for automatic version management. Please add your changes to GeneratedAssemblyInfo.cs.template.";

        PostBuildSteps.Add(string.Format(@"echo Generating custom AssemblyInfo.cs with assembly version: {0}", VersionString));
        PostBuildSteps.Add(string.Format(@"echo ""copy /Y {0} {1}""", CustomAssemblyTemplatePath, CustomAssemblyInfoPath));
        PostBuildSteps.Add(string.Format(@"copy /Y ""{0}"" ""{1}""", CustomAssemblyTemplatePath, CustomAssemblyInfoPath));
        // Add a disclaimer on the auto-generated file.
        PostBuildSteps.Add(string.Format(@"powershell -Command ""(Get-Content -Path ""{0}"") -replace '<AutoGenerationDisclaimer>', '{1}' | Out-File -encoding UTF8 {0}""; exit", CustomAssemblyInfoPath, Disclaimer));
        // Update the assembly version of the plugin.
        PostBuildSteps.Add(string.Format(@"powershell -Command ""(Get-Content -Path ""{0}"") -replace '<AssemblyVersion>', '{1}' | Out-File -encoding UTF8 {0}""; exit", CustomAssemblyInfoPath, VersionString));
        PostBuildSteps.Add(string.Format(@"powershell -Command ""(Get-Content -Path ""{0}"") -replace '<AssemblyFileVersion>', '{1}' | Out-File -encoding UTF8 {0}""; exit", CustomAssemblyInfoPath, VersionString));
    }
    public ShaderCompileWorkerTarget(TargetInfo Target) : base(Target)
    {
        Type     = TargetType.Program;
        LinkType = TargetLinkType.Modular;

        LaunchModuleName = "ShaderCompileWorker";

        if (bUseXGEController && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64))
        {
            // The interception interface in XGE requires that the parent and child processes have different filenames on disk.
            // To avoid building an entire separate worker just for this, we duplicate the ShaderCompileWorker in a post build step.
            const string SrcPath  = "$(EngineDir)\\Binaries\\$(TargetPlatform)\\ShaderCompileWorker.exe";
            const string DestPath = "$(EngineDir)\\Binaries\\$(TargetPlatform)\\XGEControlWorker.exe";

            PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
            PostBuildSteps.Add(string.Format("copy /Y /B \"{0}\" /B \"{1}\"", SrcPath, DestPath));
        }
    }
    public DatasmithRhinoBaseTarget(TargetInfo Target)
        : base(Target)
    {
        Type = TargetType.Program;
        SolutionDirectory         = "Programs/Datasmith";
        bBuildInSolutionByDefault = false;

        string RhinoVersionString = GetVersion();
        string ProjectName        = "DatasmithRhino" + RhinoVersionString;

        ExeBinariesSubFolder = Path.Combine("Rhino", RhinoVersionString);
        LaunchModuleName     = ProjectName;

        bShouldCompileAsDLL = true;
        LinkType            = TargetLinkType.Monolithic;

        bBuildDeveloperTools       = false;
        bUseMallocProfiler         = false;
        bBuildWithEditorOnlyData   = true;
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = true;
        bCompileICU = false;
        bUsesSlate  = false;

        bHasExports            = true;
        bForceEnableExceptions = true;

        AddVersionUpdatePostSteps(Target);

        // Define post-build step
        // Since the Datasmith Rhino Exporter is a C# project, build in batch the release configuration of the Visual Studio C# project file.
        string ProjectFile            = Path.Combine(RhinoExporterPath, ProjectName, ProjectName + ".csproj");
        string CustomAssemblyInfoPath = Path.Combine(GetPropertiesPath(), "GeneratedAssemblyInfo.cs");
        string BuildCommand           = string.Format(@"$(EngineDir)\Build\BatchFiles\MSBuild.bat /t:Build /p:Configuration={1} /p:AssemblyInfo=""{2}"" {0}", ProjectFile, Target.Configuration, CustomAssemblyInfoPath);
        string ErrorMsg = string.Format("Cannot build {0}: Environment variable {1} is not defined.", ProjectName, RhinoEnvVarName);

        // If the environment variable RHINO<version>_PATH is set we use it to find the Rhino SDK location, otherwise we look if the SDK is in the ThirdParty folder, if not we look for it in an eventual Rhino installation
        PostBuildSteps.Add("setlocal enableextensions");
        PostBuildSteps.Add(string.Format(@"if not defined {0} (if exist ""{1}"" (set ""{0}={1}"") else if exist ""{2}"" (set ""{0}={2}"") else ((echo {3}) & (exit /b 1)))", RhinoEnvVarName, GetRhinoThirdPartyFolder(), GetRhinoInstallFolder(), ErrorMsg));

        PostBuildSteps.Add(string.Format(@"echo {0}", BuildCommand));
        PostBuildSteps.Add(BuildCommand);
    }
    protected void AddPostBuildSteps(UnrealTargetPlatform TargetPlatform)
    {
        string SrcPath      = Path.Combine("$(EngineDir)", "Source", "Programs", "Enterprise", "Datasmith", "DatasmithFacadeCSharp", "Public");
        string SrcPathFiles = Path.Combine(SrcPath, "*.cs");
        string DstPath      = Path.Combine("$(EngineDir)", "Binaries", "$(TargetPlatform)", "DatasmithFacadeCSharp", "Public");

        // Copy the generated C# files.
        PostBuildSteps.Add(string.Format("echo \"Replace {1} with {0}\"", SrcPathFiles, DstPath));
        if (TargetPlatform == UnrealTargetPlatform.Win64)
        {
            PostBuildSteps.Add(string.Format("del /S /Q \"{0}\"", Path.Combine(DstPath, "*.cs")));
            PostBuildSteps.Add(string.Format("xcopy \"{0}\" \"{1}\" /R /S /Y", SrcPathFiles, DstPath + Path.DirectorySeparatorChar));
        }
        else if (TargetPlatform == UnrealTargetPlatform.Mac)
        {
            PostBuildSteps.Add(string.Format("mkdir -p \"{0}\"", DstPath));
            PostBuildSteps.Add(string.Format("rm -f \"{0}\"*.cs", DstPath + Path.DirectorySeparatorChar));
            PostBuildSteps.Add(string.Format("cp -R \"{0}\"*.cs \"{1}\"", SrcPath + Path.DirectorySeparatorChar, DstPath));
        }
    }
示例#14
0
    protected void AddCopyPostBuildStep(TargetInfo Target, string DLLName)
    {
        // Since SketchUp expects an exporter DLL name based on the exported file extension,
        // add a post-build step that copies the output to such properly named DLL.

        string OutputName = "$(TargetName)";

        if (Target.Configuration != UnrealTargetConfiguration.Development)
        {
            OutputName = string.Format("{0}-{1}-{2}", OutputName, Target.Platform, Target.Configuration);
        }

        string SrcOutputFileName = string.Format(@"$(EngineDir)\Binaries\Win64\{0}\{1}.dll", ExeBinariesSubFolder, OutputName);
        string DstOutputFileName = string.Format(@"$(EngineDir)\Binaries\Win64\{0}\{1}.dll", ExeBinariesSubFolder, DLLName);

        PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", SrcOutputFileName, DstOutputFileName));

        // Note the * at the end allows to skip the prompt asking if the destination is a file or directory when it doesn't exist yet
        PostBuildSteps.Add(string.Format("xcopy /Y /R \"{0}\" \"{1}*\" 1>nul", SrcOutputFileName, DstOutputFileName));
    }
    public void AddWindowsPostBuildSteps()
    {
        // Copy the documentation
        string SrcPath  = @"$(EngineDir)\Source\Programs\Enterprise\Datasmith\DatasmithSDK\Documentation\*.*";
        string DestPath = @"$(EngineDir)\Binaries\$(TargetPlatform)\DatasmithSDK\Documentation\";

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

        // Copy the header files
        SrcPath  = @"$(EngineDir)\Source\Developer\Datasmith\DatasmithCore\Public\*.h";
        DestPath = @"$(EngineDir)\Binaries\$(TargetPlatform)\DatasmithSDK\Public\";

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

        SrcPath  = @"$(EngineDir)\Source\Developer\Datasmith\DatasmithExporter\Public\*.h";
        DestPath = @"$(EngineDir)\Binaries\$(TargetPlatform)\DatasmithSDK\Public\";

        PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
        PostBuildSteps.Add(string.Format("xcopy {0} {1} /R /Y /S", SrcPath, DestPath));
    }
    public MobuLiveLinkPluginTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Program;

        bShouldCompileAsDLL  = true;
        LinkType             = TargetLinkType.Monolithic;
        ExeBinariesSubFolder = "MotionBuilder";
        LaunchModuleName     = "MobuLiveLinkPlugin";

        // We only need minimal use of the engine for this plugin
        bCompileLeanAndMeanUE      = true;
        bUseMallocProfiler         = false;
        bBuildEditor               = false;
        bBuildWithEditorOnlyData   = true;
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = true;
        bCompileICU = false;
        bHasExports = false;

        string ResourcesFolder = Path.GetFullPath(Path.Combine(ModuleDirectory, "../Resources"));

        PostBuildSteps.Add("copy /a /b /y /v \"" + ResourcesFolder + "\\*.*\" \"" + BinariesDirectory + "\"");
    }
    public TextureShareSDKTarget(TargetInfo Target)
        : base(Target)
    {
        Type     = TargetType.Program;
        LinkType = TargetLinkType.Monolithic;

        // This is a library, we want it to produce a dy-lib
        bShouldCompileAsDLL = true;

        ExeBinariesSubFolder = @"TextureShare";

        SolutionDirectory = "Programs/TextureShare";
        LaunchModuleName  = "TextureShareSDK";

        // Lean and mean
        bBuildDeveloperTools = false;
        // Nor editor-only data
        bBuildWithEditorOnlyData = false;

        // Currently this module is not linking against the engine, so we'll compile out references from Core to the rest of the engine
        bCompileAgainstEngine      = true;
        bCompileAgainstCoreUObject = false;

        // Logs and asserts are still useful to report results
        bUseLoggingInShipping = true;
        bUseChecksInShipping  = true;

        // Disable memory profiling in the build
        bUseMallocProfiler = false;

        // Whether to include ICU unicode/i18n support in Core
        bCompileICU = false;

        bUsesSlate = false;

        // Whether the final executable should export symbols.
        bHasExports = false;

        // Setting this is necessary since we are creating the binaries outside of Restricted.
        bLegalToDistributeBinary = true;

        bBuildInSolutionByDefault = false;

        // This .cs file must be inside the source folder of this Program. We later use this to find other key directories.
        string TargetFilePath     = GetCallerFilePath();
        string TextureShareSDKDir = Directory.GetParent(TargetFilePath).ToString();

        // We need to avoid failing to load DLL due to looking for EngineDir() in non-existent folders.
        // By having it build in the same directory as the engine, it will assume the engine is in the same directory
        // as the program, and because this folder always exists, it will not fail the check inside EngineDir().
        // Because this is a Program, we assume that this target file resides under a "Programs" folder.
        string ProgramsDir = InnermostParentDirectoryPathWithName("Programs", TargetFilePath);

        // We assume this Program resides under a Source folder.
        string SourceDir = InnermostParentDirectoryPathWithName("Source", ProgramsDir);

        // The program is assumed to reside inside the "Engine" folder.
        string EngineDir = InnermostParentDirectoryPathWithName("Engine", SourceDir);

        // The default Binaries path is assumed to be a sibling of "Source" folder.
        string DefaultBinDir = Path.GetFullPath(Path.Combine(SourceDir, "..", "Binaries", Platform.ToString()));

        // We assume that the engine exe resides in Engine/Binaries/[Platform]
        string EngineBinariesDir = Path.Combine(EngineDir, "Binaries", Platform.ToString(), "TextureShareSDK");

        {
            // Now we calculate the relative path between the default output directory and the engine binaries,
            // in order to force the output of this program to be in the same folder as th engine.
            ExeBinariesSubFolder = (new DirectoryReference(EngineBinariesDir)).MakeRelativeTo(new DirectoryReference(DefaultBinDir));

            string TextureSharePluginDir = EngineDir + "/Plugins/Runtime/TextureShare/Source/TextureShareCore";
            string PostBuildBinDir       = Path.Combine(DefaultBinDir, "TextureShareSDK");

            // Copy Headers
            string HeadesSrcPath1      = Path.Combine(TextureShareSDKDir, "Public");
            string HeadesSrcPath2      = Path.Combine(TextureSharePluginDir, "Public", "Containers");
            string PostBuildHeadersDir = Path.Combine(PostBuildBinDir, "Public");

            PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", HeadesSrcPath1, PostBuildHeadersDir));
            PostBuildSteps.Add(string.Format("xcopy /y /i /v \"{0}\\*.h\" \"{1}\" 1>nul", HeadesSrcPath1, PostBuildHeadersDir));

            PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", HeadesSrcPath2, PostBuildHeadersDir));
            PostBuildSteps.Add(string.Format("xcopy /y /i /v \"{0}\\*.h\" \"{1}\" 1>nul", HeadesSrcPath2, PostBuildHeadersDir));

            // Copy documentation

            /*
             * string DocPath = Path.Combine(TextureShareSDKDir, "Documentation");
             * string PostBuildDocDir = Path.Combine(PostBuildBinDir, "Documentation");
             * PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", DocPath, PostBuildDocDir));
             * PostBuildSteps.Add(string.Format("xcopy /R /S /y /i /v \"{0}\\*.*\" \"{1}\"  1>nul", DocPath, PostBuildDocDir));
             */
        }
    }
示例#18
0
 public void PostBuildCopy(string SrcPath, string DestPath)
 {
     PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
     PostBuildSteps.Add(string.Format("xcopy {0} {1} /R /Y /S", SrcPath, DestPath));
 }
示例#19
0
    public DatasmithRevitBaseTarget(TargetInfo Target)
        : base(Target)
    {
        Type = TargetType.Program;
        SolutionDirectory         = "Programs/Datasmith";
        bBuildInSolutionByDefault = false;

        string RevitVersionString    = GetVersion();
        string ProjectName           = "DatasmithRevit" + RevitVersionString;
        string DynamoNodeProjectName = "DatasmithDynamoNode";

        ExeBinariesSubFolder = Path.Combine("Revit", RevitVersionString);
        LaunchModuleName     = ProjectName;

        bShouldCompileAsDLL = true;
        LinkType            = TargetLinkType.Monolithic;

        bBuildDeveloperTools       = false;
        bUseMallocProfiler         = false;
        bBuildWithEditorOnlyData   = true;
        bCompileAgainstEngine      = false;
        bCompileAgainstCoreUObject = true;
        bCompileICU = false;
        bUsesSlate  = false;

        bHasExports            = true;
        bForceEnableExceptions = true;

        // Define post-build step

        string RevitSDKLocation = "";
        string RevitSDKEnvVar   = "Revit_" + RevitVersionString + "_API";

        // Try with custom setup
        string Location = System.Environment.GetEnvironmentVariable(RevitSDKEnvVar);

        if (Location != null && Location != "")
        {
            RevitSDKLocation = Location;
        }

        if (!Directory.Exists(RevitSDKLocation))
        {
            // Try with build machine setup
            string SDKRootEnvVar = System.Environment.GetEnvironmentVariable("UE_SDKS_ROOT");
            if (SDKRootEnvVar != null && SDKRootEnvVar != "")
            {
                RevitSDKLocation = Path.Combine(SDKRootEnvVar, "HostWin64", "Win64", "Revit", RevitVersionString);
            }
        }

        string RevitExporterPath      = @"$(EngineDir)\Source\Programs\Enterprise\Datasmith\DatasmithRevitExporter";
        string ProjectFile            = Path.Combine(RevitExporterPath, ProjectName, ProjectName + ".csproj");
        string DynamoNodeProjectFile  = Path.Combine(RevitExporterPath, ProjectName, DynamoNodeProjectName + ".csproj");
        string BuildCommand           = string.Format(@"$(EngineDir)\Build\BatchFiles\MSBuild.bat /t:Build /p:Configuration=Release /p:{1}=%{1}% {0}", ProjectFile, RevitSDKEnvVar);
        string BuildCommandDynamoNode = string.Format(@"$(EngineDir)\Build\BatchFiles\MSBuild.bat /t:Build /p:Configuration=Release /p:{1}=%{1}% {0}", DynamoNodeProjectFile, RevitSDKEnvVar);
        string ErrorMsg = string.Format("Cannot build {0}: Environment variable {1} is not defined.", ProjectName, RevitSDKEnvVar);

        // Since the Datasmith Revit Exporter is a C# project, build in batch the release configuration of the Visual Studio C# project file.
        // Outside of Epic Games, environment variable <RevitSDKEnvVar> (Revit_<year>_API) must be set to the Revit API directory on the developer's workstation.
        PostBuildSteps.Add("setlocal enableextensions");
        PostBuildSteps.Add(string.Format(@"if not defined {0} (if exist {1} (set {0}={1}) else ((echo {2}) & (exit /b 1)))", RevitSDKEnvVar, RevitSDKLocation, ErrorMsg));
        PostBuildSteps.Add(string.Format(@"echo {0}", BuildCommandDynamoNode));
        PostBuildSteps.Add(BuildCommandDynamoNode);
        PostBuildSteps.Add(string.Format(@"echo {0}", BuildCommand));
        PostBuildSteps.Add(BuildCommand);
    }