private void GenerateMocFileStepsForConfiguration(ProjConfiguration conf)
        {
            // Build a set of custom build steps from the source-target pairs.
            List <MocSourceAndTargetFile> mocTargets;

            if (!MocTargetsPerConfiguration.TryGetValue(conf, out mocTargets))
            {
                return;
            }

            // Copy the defines and add -D in front of them.
            Strings confDefines = new Strings(conf.Defines.Select(define => define.Replace(" ", "")));

            foreach (var additionalDefine in AdditionalDefines)
            {
                if ((conf.Target.GetPlatform() & additionalDefine.Platform) != 0 && (conf.Target.GetFragment <DevEnv>() & additionalDefine.DevEnv) != 0)
                {
                    confDefines.AddRange(additionalDefine.Defines);
                }
            }
            confDefines.InsertPrefix("-D");
            string combinedDefines = confDefines.JoinStrings(" ");

            // Combine all the different includes into a single string pool.
            Strings confIncludes = new Strings(conf.IncludePaths);

            confIncludes.AddRange(conf.DependenciesIncludePaths);
            confIncludes.AddRange(conf.IncludePrivatePaths);
            // Quote the include strings, if need be.
            List <string> includeValues = confIncludes.Values;

            foreach (string path in includeValues)
            {
                if (path.Contains(' '))
                {
                    confIncludes.UpdateValue(path, "\"" + path + "\"");
                }
            }

            Strings precompiledHeader = new Strings();

            // Build the string we need to pass to moc for all calls.
            if (conf.PrecompHeader != null)
            {
                // If we have a precompiled header, we need the new cpp file to include this also.
                // Technically we don't need to do this if the file is in ExcludeMocFromCompileRegex
                precompiledHeader.Add(conf.PrecompHeader);
            }

            // Apply these settings to all Moc targets.
            foreach (var target in mocTargets)
            {
                target.CombinedDefines = combinedDefines;
                target.IncludePaths.AddRange(confIncludes);
                if (!target.IsCPPFile)
                {
                    target.ForceIncludes.AddRange(precompiledHeader);
                }
            }
        }
Example #2
0
 public override void ConfigureAll(Sharpmake.Project.Configuration conf, Sharpmake.Target target)
 {
     base.ConfigureAll(conf, target);
     conf.AddPrivateDependency <MyLib>(target);
     conf.AddPrivateDependency <MyDll>(target);
     conf.AddPrivateDependency <Export.ExternLib>(target);
     conf.AddPrivateDependency <Export.ExternDll>(target);
     conf.AddPrivateDependency <ExternBinaries>(target);
 }
Example #3
0
        public CustomBuildFileHLSL(ProjConfig conf, string targetName, ShaderProfile shaderProfile, string entryPoint, string outputDir, string sourceFile)
        {
            KeyInput = sourceFile;
            string resourceName = Path.GetFileNameWithoutExtension(sourceFile);

            Output              = string.Format(@"{0}\{1}.h", outputDir, resourceName);
            Description         = "Shader (" + shaderProfile.ToString() + ") : " + sourceFile;
            Executable          = "";                         // Setting 'fxc' exe in ExeArgs instead, avoid build system adding a uneeded dependency to 'fxc'
            ExecutableArguments = string.Format("fxc /Zi /nologo /O2 /E\"{0}\" /T {1} /Fh\"{2}\" /Vn\"gpShader_{3}\" \"{4}\"", entryPoint, shaderProfile.ToString(), Output, resourceName, sourceFile);
        }
Example #4
0
            public override string GetCommand(BuildType buildType, Sharpmake.Project.Configuration conf, string fastbuildArguments)
            {
                Project project = conf.Project;
                string  fastBuildShortProjectName = Bff.GetShortProjectName(project, conf);

                string makePath = FastBuildSettings.FastBuildMakeCommand;

                if (!Path.IsPathRooted(FastBuildSettings.FastBuildMakeCommand))
                {
                    makePath = conf.Project.RootPath + Path.DirectorySeparatorChar + FastBuildSettings.FastBuildMakeCommand;
                }
                makePath = Util.SimplifyPath(makePath);

                string fastBuildExecutable = Util.PathGetRelative(conf.ProjectPath, makePath, true);

                string rebuildCmd = buildType == BuildType.Rebuild ? " -clean" : "";

                // $(ProjectDir) has a trailing slash
                return($@"""$(ProjectDir){fastBuildExecutable}""{rebuildCmd} {fastBuildShortProjectName} {fastbuildArguments}");
            }
Example #5
0
    public void ConfigureAll(Sharpmake.Project.Configuration conf, Sharpmake.Target target)
    {
        //Name of the project file
        conf.ProjectFileName = "[project.Name]_[target.Platform]_[target.DevEnv]";

        //Intermediate path
        conf.IntermediatePath = @"[conf.ProjectPath]\temp\[target.Optimization]";

        //Name of the binary generated
        conf.TargetFileName = "[project.Name]" + Puma.SharpmakeUtils.GetOptimizationSuffix(target.Optimization);

        conf.Defines.Add("_CRT_SECURE_NO_WARNINGS");
        conf.Options.Add(Sharpmake.Options.Vc.Compiler.Exceptions.Enable);
        conf.Options.Add(Sharpmake.Options.Vc.General.WindowsTargetPlatformVersion.Latest);
        conf.Options.Add(Sharpmake.Options.Vc.Compiler.CppLanguageStandard.CPP17);

        string[] warningsToIgnore = { "4100" };
        Sharpmake.Options.Vc.Compiler.DisableSpecificWarnings disableSpecificWarnings = new Sharpmake.Options.Vc.Compiler.DisableSpecificWarnings(warningsToIgnore);
        conf.Options.Add(disableSpecificWarnings);

        conf.VcxprojUserFile = new Sharpmake.Project.Configuration.VcxprojUserFileSettings();
        conf.VcxprojUserFile.LocalDebuggerWorkingDirectory = Puma.SharpmakeUtils.GetOutputPath();
    }
Example #6
0
 private bool FileIsPrecompiledHeader(string file, ProjConfiguration conf)
 {
     return((conf.PrecompHeader != null && file.EndsWith(conf.PrecompHeader, StringComparison.InvariantCultureIgnoreCase)) ||
            (conf.PrecompSource != null && file.EndsWith(conf.PrecompSource, StringComparison.InvariantCultureIgnoreCase)));
 }
Example #7
0
 public abstract string GetCommand(BuildType buildType, Sharpmake.Project.Configuration conf, string fastbuildArguments);