Esempio n. 1
0
 public PrecompileHeaderEnvironment(string InitModuleName, string InitPCHHeaderNameInCode, FileItem InitPrecompiledHeaderIncludeFilename, CPPCLRMode InitCLRMode, ModuleRules.CodeOptimization InitOptimizeCode)
 {
     ModuleName = InitModuleName;
     PCHHeaderNameInCode = InitPCHHeaderNameInCode;
     PrecompiledHeaderIncludeFilename = InitPrecompiledHeaderIncludeFilename;
     CLRMode = InitCLRMode;
     OptimizeCode = InitOptimizeCode;
 }
    /// <summary>
    /// Modify the rules for a newly created module, where the target is a different host platform.
    /// This is not required - but allows for hiding details of a particular platform.
    /// </summary>
    /// <param name="ModuleName">The name of the module</param>
    /// <param name="Rules">The module rules</param>
    /// <param name="Target">The target being build</param>
    public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target)
    {
        // set PLATFORM_XXX to 0 in modules that XXX will set to 1, so that #if checks don't trigger the error of being undefined,
        // and we don't need to set PLATFORM_XXX to 0 in Core somewhere
        if (Rules.bAllowConfidentialPlatformDefines)
        {
            Rules.PublicDefinitions.Add("PLATFORM_XXX=0");
        }

        if (ModuleName == "RHI")
        {
            // these must be mirrored down below
            Rules.AppendStringToPublicDefinition("DDPI_EXTRA_SHADERPLATFORMS", "SP_XXX=32, ");
            Rules.AppendStringToPublicDefinition("DDPI_SHADER_PLATFORM_NAME_MAP", "{ TEXT(\"XXX\"), SP_XXX },");
        }

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            bool            bIsMonolithic = true;
            UEBuildPlatform BuildPlatform = GetBuildPlatform(Target.Platform);

            if (BuildPlatform != null)
            {
                bIsMonolithic = BuildPlatform.ShouldCompileMonolithicBinary(Target.Platform);
            }

            if ((Target.bBuildEditor == false) || !bIsMonolithic)
            {
                bool bBuildShaderFormats = Target.bForceBuildShaderFormats;

                if (!Target.bBuildRequiresCookedData)
                {
                    if (ModuleName == "Engine")
                    {
                        if (Target.bBuildDeveloperTools)
                        {
                            Rules.DynamicallyLoadedModuleNames.Add("XXXTargetPlatform");
                        }
                    }
                }

                // allow standalone tools to use target platform modules, without needing Engine
                if (ModuleName == "TargetPlatform")
                {
                    if (Target.bForceBuildTargetPlatforms)
                    {
                        Rules.DynamicallyLoadedModuleNames.Add("XXXTargetPlatform");
                    }

                    if (bBuildShaderFormats)
                    {
//                      Rules.DynamicallyLoadedModuleNames.Add("XXXShaderFormat");
                    }
                }
            }
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Modify the rules for a newly created module, in a target that's being built for this platform.
    /// This is not required - but allows for hiding details of a particular platform.
    /// </summary>
    /// <param name="ModuleName">The name of the module</param>
    /// <param name="Rules">The module rules</param>
    /// <param name="Target">The target being build</param>
    public override void ModifyModuleRulesForActivePlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target)
    {
        if (Rules.bAllowConfidentialPlatformDefines)
        {
            Rules.PublicDefinitions.Add("PLATFORM_XXX=1");
        }

        if (ModuleName == "Core")
        {
//          Rules.PublicIncludePaths.Add("Runtime/Core/Public/XXX");
        }
    }
Esempio n. 4
0
        public virtual void AddExtensionLibraries(string SourceFolder, ModuleRules Rules)
        {
            foreach (string Dir in Directory.GetDirectories(SourceFolder))
            {
                AddExtensionLibraries(Dir, Rules);
            }

            foreach (string FilePath in Directory.GetFiles(SourceFolder))
            {
                Rules.RuntimeDependencies.Add(FilePath);
            }
        }
        public static string GetBlastLibrarySuffix(ModuleRules Rules)
        {
            if ((Rules.Target.Configuration == UnrealTargetConfiguration.Debug || Rules.Target.Configuration == UnrealTargetConfiguration.DebugGame))// && Rules.Target.bDebugBuildsActuallyUseDebugCRT)
            {
                return("DEBUG");
            }
            else if (Rules.Target.Configuration == UnrealTargetConfiguration.Development && Rules.Target.Platform != UnrealTargetPlatform.Linux)
            {
                return("PROFILE"); //Linux only has debug and release
            }

            return("");
        }
Esempio n. 6
0
        public void Should_return_true_if_module_id_is_unique()
        {
            var id = Guid.NewGuid();

            var repositoryMock = new Mock<IModuleRepository>();
            repositoryMock.Setup(x => x.GetById(id)).Returns((Module)null);

            var sut = new ModuleRules(repositoryMock.Object);

            var actual = sut.IsModuleIdUnique(id);

            Assert.AreEqual(true, actual);
        }
        public static void SetupModuleBlastSupport(ModuleRules Rules, string[] BlastLibs)
        {
            string LibConfiguration = GetBlastLibrarySuffix(Rules);

            Rules.PublicDefinitions.Add(string.Format("BLAST_LIB_CONFIG_STRING=\"{0}\"", LibConfiguration));

            //Go up two from Source/Blast
            DirectoryReference ModuleRootFolder = (new DirectoryReference(Rules.ModuleDirectory)).ParentDirectory.ParentDirectory;
            DirectoryReference EngineDirectory  = new DirectoryReference(Path.GetFullPath(Rules.Target.RelativeEnginePath));
            string             BLASTLibDir      = Path.Combine("$(EngineDir)", ModuleRootFolder.MakeRelativeTo(EngineDirectory), "Libraries", Rules.Target.Platform.ToString());

            Rules.PublicLibraryPaths.Add(Path.Combine(ModuleRootFolder.ToString(), "Libraries", Rules.Target.Platform.ToString()));

            string DLLSuffix = "";
            string DLLPrefix = "";
            string LibSuffix = "";

            // Libraries and DLLs for windows platform
            if (Rules.Target.Platform == UnrealTargetPlatform.Win64)
            {
                DLLSuffix = "_x64.dll";
                LibSuffix = "_x64.lib";
            }
            else if (Rules.Target.Platform == UnrealTargetPlatform.Win32)
            {
                DLLSuffix = "_x86.dll";
                LibSuffix = "_x86.lib";
            }
            else if (Rules.Target.Platform == UnrealTargetPlatform.Linux)
            {
                DLLPrefix = "lib";
                DLLSuffix = ".so";
            }

            Rules.PublicDefinitions.Add(string.Format("BLAST_LIB_DLL_SUFFIX=\"{0}\"", DLLSuffix));
            Rules.PublicDefinitions.Add(string.Format("BLAST_LIB_DLL_PREFIX=\"{0}\"", DLLPrefix));

            foreach (string Lib in BlastLibs)
            {
                Rules.PublicAdditionalLibraries.Add(String.Format("{0}{1}{2}", Lib, LibConfiguration, LibSuffix));
                var DllName = String.Format("{0}{1}{2}{3}", DLLPrefix, Lib, LibConfiguration, DLLSuffix);
                Rules.PublicDelayLoadDLLs.Add(DllName);
                Rules.RuntimeDependencies.Add(Path.Combine(BLASTLibDir, DllName));
            }

            //It's useful to periodically turn this on since the order of appending files in unity build is random.
            //The use of types without the right header can creep in and cause random build failures

            //Rules.bFasterWithoutUnity = true;
        }
Esempio n. 8
0
        public void Should_return_true_if_module_exists()
        {
            var id = Guid.NewGuid();
            var siteId = Guid.NewGuid();

            var repositoryMock = new Mock<IModuleRepository>();
            repositoryMock.Setup(x => x.GetById(siteId, id)).Returns(new Module());

            var sut = new ModuleRules(repositoryMock.Object);

            var actual = sut.DoesModuleExist(siteId, id);

            Assert.AreEqual(true, actual);
        }
Esempio n. 9
0
 public GUtils(ModuleRules Module, string ModuleName)
 {
     this.Module     = Module;
     this.ModuleName = ModuleName;
 }
Esempio n. 10
0
        public override void AddPrtCoreLibrary(string LibraryPath, string LibraryName, ModuleRules Rules)
        {
            base.AddPrtCoreLibrary(LibraryPath, LibraryName, Rules);

            if (Path.GetExtension(LibraryPath) == ".lib")
            {
                if (Debug)
                {
                    Console.WriteLine("Adding Public Additional Library " + LibraryName);
                }

                Rules.PublicAdditionalLibraries.Add(LibraryPath);
            }
        }
Esempio n. 11
0
        public virtual void AddPrtCoreLibrary(string LibraryPath, string LibraryName, ModuleRules Rules)
        {
            if (Path.GetExtension(LibraryName) == DynamicLibExtension)
            {
                if (Debug)
                {
                    Console.WriteLine("Adding Runtime Library " + LibraryName);
                }

                Rules.RuntimeDependencies.Add(LibraryPath);
                Rules.PublicDelayLoadDLLs.Add(LibraryName);
            }
        }
Esempio n. 12
0
 public STBuildModuleCPPCLR(
     STBuildTarget InTarget,
     string InName,
     STBuildModuleType InType,
     string InModuleDirectory,
     string InOutputDirectory,
     bool? InIsRedistributableOverride,
     IntelliSenseGatherer InIntelliSenseGatherer,
     IEnumerable<FileItem> InSourceFiles,
     IEnumerable<string> InPublicIncludePaths,
     IEnumerable<string> InPublicSystemIncludePaths,
     IEnumerable<string> InDefinitions,
     IEnumerable<string> InPrivateAssemblyReferences,
     IEnumerable<string> InPublicIncludePathModuleNames,
     IEnumerable<string> InPublicDependencyModuleNames,
     IEnumerable<string> InPublicDelayLoadDLLs,
     IEnumerable<string> InPublicAdditionalLibraries,
     IEnumerable<string> InPublicFrameworks,
     IEnumerable<string> InPublicWeakFrameworks,
     IEnumerable<STBuildFramework> InPublicAdditionalFrameworks,
     IEnumerable<string> InPublicAdditionalShadowFiles,
     IEnumerable<STBuildBundleResource> InPublicAdditionalBundleResources,
     IEnumerable<string> InPrivateIncludePaths,
     IEnumerable<string> InPrivateIncludePathModuleNames,
     IEnumerable<string> InPrivateDependencyModuleNames,
     IEnumerable<string> InCircularlyReferencedDependentModules,
     IEnumerable<string> InDynamicallyLoadedModuleNames,
     IEnumerable<string> InPlatformSpecificDynamicallyLoadedModuleNames,
     ModuleRules.CodeOptimization InOptimizeCode,
     bool InAllowSharedPCH,
     string InSharedPCHHeaderFile,
     bool InUseRTTI,
     bool InEnableBufferSecurityChecks,
     bool InFasterWithoutUnity,
     int InMinFilesUsingPrecompiledHeaderOverride,
     bool InEnableExceptions,
     bool bInBuildSourceFiles
     )
     : base(InTarget, InName, InType, InModuleDirectory, InOutputDirectory, InIsRedistributableOverride, InIntelliSenseGatherer,
     InSourceFiles, InPublicIncludePaths, InPublicSystemIncludePaths, InDefinitions,
     InPublicIncludePathModuleNames, InPublicDependencyModuleNames, InPublicDelayLoadDLLs, InPublicAdditionalLibraries, InPublicFrameworks, InPublicWeakFrameworks, InPublicAdditionalFrameworks, InPublicAdditionalShadowFiles, InPublicAdditionalBundleResources,
     InPrivateIncludePaths, InPrivateIncludePathModuleNames, InPrivateDependencyModuleNames,
     InCircularlyReferencedDependentModules, InDynamicallyLoadedModuleNames, InPlatformSpecificDynamicallyLoadedModuleNames, InOptimizeCode,
     InAllowSharedPCH, InSharedPCHHeaderFile, InUseRTTI, InEnableBufferSecurityChecks, InFasterWithoutUnity, InMinFilesUsingPrecompiledHeaderOverride,
     InEnableExceptions, bInBuildSourceFiles)
 {
     PrivateAssemblyReferences = HashSetFromOptionalEnumerableStringParameter(InPrivateAssemblyReferences);
 }
Esempio n. 13
0
        public STBuildModuleCPP(
            STBuildTarget InTarget,
            string InName,
            STBuildModuleType InType,
            string InModuleDirectory,
            string InOutputDirectory,
            bool? InIsRedistributableOverride,
            IntelliSenseGatherer InIntelliSenseGatherer,
            IEnumerable<FileItem> InSourceFiles,
            IEnumerable<string> InPublicIncludePaths,
            IEnumerable<string> InPublicSystemIncludePaths,
            IEnumerable<string> InDefinitions,
            IEnumerable<string> InPublicIncludePathModuleNames,
            IEnumerable<string> InPublicDependencyModuleNames,
            IEnumerable<string> InPublicDelayLoadDLLs,
            IEnumerable<string> InPublicAdditionalLibraries,
            IEnumerable<string> InPublicFrameworks,
            IEnumerable<string> InPublicWeakFrameworks,
            IEnumerable<STBuildFramework> InPublicAdditionalFrameworks,
            IEnumerable<string> InPublicAdditionalShadowFiles,
            IEnumerable<STBuildBundleResource> InPublicAdditionalBundleResources,
            IEnumerable<string> InPrivateIncludePaths,
            IEnumerable<string> InPrivateIncludePathModuleNames,
            IEnumerable<string> InPrivateDependencyModuleNames,
            IEnumerable<string> InCircularlyReferencedDependentModules,
            IEnumerable<string> InDynamicallyLoadedModuleNames,
            IEnumerable<string> InPlatformSpecificDynamicallyLoadedModuleNames,
            ModuleRules.CodeOptimization InOptimizeCode,
            bool InAllowSharedPCH,
            string InSharedPCHHeaderFile,
            bool InUseRTTI,
            bool InEnableBufferSecurityChecks,
            bool InFasterWithoutUnity,
            int InMinFilesUsingPrecompiledHeaderOverride,
            bool InEnableExceptions,
            bool bInBuildSourceFiles
            )
            : base(InTarget,
                    InName,
                    InType,
                    InModuleDirectory,
                    InOutputDirectory,
                    InIsRedistributableOverride,
                    InDefinitions,
                    InPublicIncludePaths,
                    InPublicSystemIncludePaths,
                    null,
                    InPublicAdditionalLibraries,
                    InPublicFrameworks,
                    InPublicWeakFrameworks,
                    InPublicAdditionalFrameworks,
                    InPublicAdditionalShadowFiles,
                    InPublicAdditionalBundleResources,
                    InPublicIncludePathModuleNames,
                    InPublicDependencyModuleNames,
                    InPublicDelayLoadDLLs,
                    InPrivateIncludePaths,
                    InPrivateIncludePathModuleNames,
                    InPrivateDependencyModuleNames,
                    InCircularlyReferencedDependentModules,
                    InDynamicallyLoadedModuleNames,
                    InPlatformSpecificDynamicallyLoadedModuleNames)
        {
            IntelliSenseGatherer = InIntelliSenseGatherer;

            CategorizeSourceFiles(InSourceFiles, SourceFilesFound);
            if (bInBuildSourceFiles)
            {
                CategorizeSourceFiles(InSourceFiles, SourceFilesToBuild);
            }

            Definitions = HashSetFromOptionalEnumerableStringParameter(InDefinitions);
            foreach (var Def in Definitions)
            {
                Log.TraceVerbose("Compile Env {0}: {1}", Name, Def);
            }
            OptimizeCode                           = InOptimizeCode;
            bAllowSharedPCH                        = InAllowSharedPCH;
            SharedPCHHeaderFile                    = InSharedPCHHeaderFile;
            bUseRTTI                               = InUseRTTI;
            bEnableBufferSecurityChecks            = InEnableBufferSecurityChecks;
            bFasterWithoutUnity                    = InFasterWithoutUnity;
            MinFilesUsingPrecompiledHeaderOverride = InMinFilesUsingPrecompiledHeaderOverride;
            bEnableExceptions                      = InEnableExceptions;
        }
Esempio n. 14
0
 /*
  *  譬如
  *  约定目录为:
  *      ThirdParty
  *          XXX_LIB
  *              include
  *              win32
  *              win64
  *                  debug
  *.dll
  *.lib
  *                  release
  *              linux
  *
  */
 public ThirdUtils(ModuleRules InTarget, ReadOnlyTargetRules InTargetRules)
 {
     Module = InTarget;
     Target = InTargetRules;
 }
Esempio n. 15
0
        protected virtual STBuildModule InstantiateModule(
            ModuleRules RulesObject,
            string ModuleName,
            STBuildModuleType ModuleType,
            string ModuleDirectory,
            string ApplicationOutputPath,
            IntelliSenseGatherer IntelliSenseGatherer,
            List<FileItem> ModuleSourceFiles,
            bool bBuildSourceFiles)
        {
            switch (RulesObject.Type)
            {
                case ModuleRules.ModuleType.CPlusPlus:
                    return new STBuildModuleCPP(
                            InTarget: this,
                            InName: ModuleName,
                            InType: ModuleType,
                            InModuleDirectory: ModuleDirectory,
                            InOutputDirectory: ApplicationOutputPath,
                            InIsRedistributableOverride: RulesObject.IsRedistributableOverride,
                            InIntelliSenseGatherer: IntelliSenseGatherer,
                            InSourceFiles: ModuleSourceFiles,
                            InPublicSystemIncludePaths: RulesObject.PublicSystemIncludePaths,
                            InPublicIncludePaths: RulesObject.PublicIncludePaths,
                            InDefinitions: RulesObject.Definitions,
                            InPublicIncludePathModuleNames: RulesObject.PublicIncludePathModuleNames,
                            InPublicDependencyModuleNames: RulesObject.PublicDependencyModuleNames,
                            InPublicDelayLoadDLLs: RulesObject.PublicDelayLoadDLLs,
                            InPublicAdditionalLibraries: RulesObject.PublicAdditionalLibraries,
                            InPublicFrameworks: RulesObject.PublicFrameworks,
                            InPublicWeakFrameworks: RulesObject.PublicWeakFrameworks,
                            InPublicAdditionalFrameworks: RulesObject.PublicAdditionalFrameworks,
                            InPublicAdditionalShadowFiles: RulesObject.PublicAdditionalShadowFiles,
                            InPublicAdditionalBundleResources: RulesObject.AdditionalBundleResources,
                            InPrivateIncludePaths: RulesObject.PrivateIncludePaths,
                            InPrivateIncludePathModuleNames: RulesObject.PrivateIncludePathModuleNames,
                            InPrivateDependencyModuleNames: RulesObject.PrivateDependencyModuleNames,
                            InCircularlyReferencedDependentModules: RulesObject.CircularlyReferencedDependentModules,
                            InDynamicallyLoadedModuleNames: RulesObject.DynamicallyLoadedModuleNames,
                            InPlatformSpecificDynamicallyLoadedModuleNames: RulesObject.PlatformSpecificDynamicallyLoadedModuleNames,
                            InOptimizeCode: RulesObject.OptimizeCode,
                            InAllowSharedPCH: (RulesObject.PCHUsage == ModuleRules.PCHUsageMode.NoSharedPCHs) ? false : true,
                            InSharedPCHHeaderFile: RulesObject.SharedPCHHeaderFile,
                            InUseRTTI: RulesObject.bUseRTTI,
                            InEnableBufferSecurityChecks: RulesObject.bEnableBufferSecurityChecks,
                            InFasterWithoutUnity: RulesObject.bFasterWithoutUnity,
                            InMinFilesUsingPrecompiledHeaderOverride: RulesObject.MinFilesUsingPrecompiledHeaderOverride,
                            InEnableExceptions: RulesObject.bEnableExceptions,
                            bInBuildSourceFiles: bBuildSourceFiles
                        );

                case ModuleRules.ModuleType.CPlusPlusCLR:
                    return new STBuildModuleCPPCLR(
                            InTarget: this,
                            InName: ModuleName,
                            InType: ModuleType,
                            InModuleDirectory: ModuleDirectory,
                            InOutputDirectory: ApplicationOutputPath,
                            InIsRedistributableOverride: RulesObject.IsRedistributableOverride,
                            InIntelliSenseGatherer: IntelliSenseGatherer,
                            InSourceFiles: ModuleSourceFiles,
                            InDefinitions: RulesObject.Definitions,
                            InPublicSystemIncludePaths: RulesObject.PublicSystemIncludePaths,
                            InPublicIncludePaths: RulesObject.PublicIncludePaths,
                            InPublicIncludePathModuleNames: RulesObject.PublicIncludePathModuleNames,
                            InPublicDependencyModuleNames: RulesObject.PublicDependencyModuleNames,
                            InPublicDelayLoadDLLs: RulesObject.PublicDelayLoadDLLs,
                            InPublicAdditionalLibraries: RulesObject.PublicAdditionalLibraries,
                            InPublicFrameworks: RulesObject.PublicFrameworks,
                            InPublicWeakFrameworks: RulesObject.PublicWeakFrameworks,
                            InPublicAdditionalFrameworks: RulesObject.PublicAdditionalFrameworks,
                            InPublicAdditionalShadowFiles: RulesObject.PublicAdditionalShadowFiles,
                            InPublicAdditionalBundleResources: RulesObject.AdditionalBundleResources,
                            InPrivateIncludePaths: RulesObject.PrivateIncludePaths,
                            InPrivateIncludePathModuleNames: RulesObject.PrivateIncludePathModuleNames,
                            InPrivateDependencyModuleNames: RulesObject.PrivateDependencyModuleNames,
                            InPrivateAssemblyReferences: RulesObject.PrivateAssemblyReferences,
                            InCircularlyReferencedDependentModules: RulesObject.CircularlyReferencedDependentModules,
                            InDynamicallyLoadedModuleNames: RulesObject.DynamicallyLoadedModuleNames,
                            InPlatformSpecificDynamicallyLoadedModuleNames: RulesObject.PlatformSpecificDynamicallyLoadedModuleNames,
                            InOptimizeCode: RulesObject.OptimizeCode,
                            InAllowSharedPCH: (RulesObject.PCHUsage == ModuleRules.PCHUsageMode.NoSharedPCHs) ? false : true,
                            InSharedPCHHeaderFile: RulesObject.SharedPCHHeaderFile,
                            InUseRTTI: RulesObject.bUseRTTI,
                            InEnableBufferSecurityChecks: RulesObject.bEnableBufferSecurityChecks,
                            InFasterWithoutUnity: RulesObject.bFasterWithoutUnity,
                            InMinFilesUsingPrecompiledHeaderOverride: RulesObject.MinFilesUsingPrecompiledHeaderOverride,
                            InEnableExceptions: RulesObject.bEnableExceptions,
                            bInBuildSourceFiles: bBuildSourceFiles
                        );

                case ModuleRules.ModuleType.External:
                    return new STBuildExternalModule(
                            InTarget: this,
                            InName: ModuleName,
                            InType: ModuleType,
                            InModuleDirectory: ModuleDirectory,
                            InOutputDirectory: ApplicationOutputPath,
                            InIsRedistributableOverride: RulesObject.IsRedistributableOverride,
                            InPublicDefinitions: RulesObject.Definitions,
                            InPublicSystemIncludePaths: RulesObject.PublicSystemIncludePaths,
                            InPublicIncludePaths: RulesObject.PublicIncludePaths,
                            InPublicLibraryPaths: RulesObject.PublicLibraryPaths,
                            InPublicAdditionalLibraries: RulesObject.PublicAdditionalLibraries,
                            InPublicFrameworks: RulesObject.PublicFrameworks,
                            InPublicWeakFrameworks: RulesObject.PublicWeakFrameworks,
                            InPublicAdditionalFrameworks: RulesObject.PublicAdditionalFrameworks,
                            InPublicAdditionalShadowFiles: RulesObject.PublicAdditionalShadowFiles,
                            InPublicAdditionalBundleResources: RulesObject.AdditionalBundleResources,
                            InPublicDependencyModuleNames: RulesObject.PublicDependencyModuleNames,
                            InPublicDelayLoadDLLs: RulesObject.PublicDelayLoadDLLs
                        );

                default:
                    return null;
            }
        }