ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            var encapsulating = sender.GetEncapsulatingReferencedModule();

            var solution = Bam.Core.Graph.Instance.MetaData as VSSolutionBuilder.VSSolution;
            var project  = solution.EnsureProjectExists(encapsulating);
            var config   = project.GetConfiguration(encapsulating);

            var group = (sender is WinResource) ?
                        VSSolutionBuilder.VSSettingsGroup.ESettingsGroup.Resource :
                        VSSolutionBuilder.VSSettingsGroup.ESettingsGroup.Compiler;

            var settingsGroup = config.GetSettingsGroup(
                group,
                include: source.GeneratedPaths[C.SourceFile.Key],
                uniqueToProject: true);
            var intDir = sender.CreateTokenizedString("@trimstart(@relativeto($(0),$(packagebuilddir)/$(moduleoutputdir)),../)", objectFilePath);

            intDir.Parse();
            settingsGroup.AddSetting("ObjectFileName", "$(IntDir)" + intDir.ToString());
            if (!sender.PerformCompilation)
            {
                settingsGroup.AddSetting("ExcludedFromBuild", true);
            }
            sender.MetaData = settingsGroup;

            // any non-C module projects should be order-only dependencies
            foreach (var dependent in sender.Dependents)
            {
                if (null == dependent.MetaData)
                {
                    continue;
                }
                if (dependent is C.CModule)
                {
                    continue;
                }
                var dependentProject = dependent.MetaData as VSSolutionBuilder.VSProject;
                if (null != dependentProject)
                {
                    config.RequiresProject(dependentProject);
                }
            }
        }
示例#2
0
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            var encapsulating = sender.GetEncapsulatingReferencedModule();

            var workspace = Bam.Core.Graph.Instance.MetaData as XcodeBuilder.WorkspaceMeta;
            var target    = workspace.EnsureTargetExists(encapsulating);

            XcodeBuilder.FileReference.EFileType fileType;
            if (sender is C.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeC;
            }
            else if (sender is C.Cxx.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeCxx;
            }
            else if (sender is C.ObjC.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeObjC;
            }
            else if (sender is C.ObjCxx.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeObjCxx;
            }
            else
            {
                throw new Bam.Core.Exception("Unknown object file type, {0}", sender.GetType().ToString());
            }

            sender.MetaData = target.EnsureSourceBuildFileExists(source.GeneratedPaths[C.SourceFile.Key], fileType);

            // this is for stand-alone object files
            if (encapsulating == sender || encapsulating == (sender as Bam.Core.IChildModule).Parent)
            {
                target.Type = XcodeBuilder.Target.EProductType.ObjFile;
                var configuration = target.GetConfiguration(sender);
                configuration.SetProductName(Bam.Core.TokenizedString.CreateVerbatim("${TARGET_NAME}"));
                (sender.Settings as XcodeProjectProcessor.IConvertToProject).Convert(sender, configuration);
            }
        }
示例#3
0
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            var encapsulating = sender.GetEncapsulatingReferencedModule();

            var workspace = Bam.Core.Graph.Instance.MetaData as XcodeBuilder.WorkspaceMeta;
            var target = workspace.EnsureTargetExists(encapsulating);

            XcodeBuilder.FileReference.EFileType fileType;
            if (sender is C.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeC;
            }
            else if (sender is C.Cxx.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeCxx;
            }
            else if (sender is C.ObjC.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeObjC;
            }
            else if (sender is C.ObjCxx.ObjectFile)
            {
                fileType = XcodeBuilder.FileReference.EFileType.SourceCodeObjCxx;
            }
            else
            {
                throw new Bam.Core.Exception("Unknown object file type, {0}", sender.GetType().ToString());
            }

            sender.MetaData = target.EnsureSourceBuildFileExists(source.GeneratedPaths[C.SourceFile.Key], fileType);

            // this is for stand-alone object files
            if (encapsulating == sender || encapsulating == (sender as Bam.Core.IChildModule).Parent)
            {
                target.Type = XcodeBuilder.Target.EProductType.ObjFile;
                var configuration = target.GetConfiguration(sender);
                configuration.SetProductName(Bam.Core.TokenizedString.CreateVerbatim("${TARGET_NAME}"));
                (sender.Settings as XcodeProjectProcessor.IConvertToProject).Convert(sender, configuration);
            }
        }
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            var encapsulating = sender.GetEncapsulatingReferencedModule();

            var solution = Bam.Core.Graph.Instance.MetaData as VSSolutionBuilder.VSSolution;
            var project = solution.EnsureProjectExists(encapsulating);
            var config = project.GetConfiguration(encapsulating);

            var group = (sender is WinResource) ?
                VSSolutionBuilder.VSSettingsGroup.ESettingsGroup.Resource :
                VSSolutionBuilder.VSSettingsGroup.ESettingsGroup.Compiler;

            var settingsGroup = config.GetSettingsGroup(
                group,
                include: source.GeneratedPaths[C.SourceFile.Key],
                uniqueToProject: true);
            settingsGroup.AddSetting("ObjectFileName", "$(IntDir)" + sender.CreateTokenizedString("@trimstart(@relativeto($(0),$(packagebuilddir)/$(moduleoutputdir)),../)", objectFilePath).Parse());
            sender.MetaData = settingsGroup;
        }
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            var encapsulating = sender.GetEncapsulatingReferencedModule();

            var solution = Bam.Core.Graph.Instance.MetaData as VSSolutionBuilder.VSSolution;
            var project  = solution.EnsureProjectExists(encapsulating);
            var config   = project.GetConfiguration(encapsulating);

            var group = (sender is WinResource) ?
                        VSSolutionBuilder.VSSettingsGroup.ESettingsGroup.Resource :
                        VSSolutionBuilder.VSSettingsGroup.ESettingsGroup.Compiler;

            var settingsGroup = config.GetSettingsGroup(
                group,
                include: source.GeneratedPaths[C.SourceFile.Key],
                uniqueToProject: true);

            settingsGroup.AddSetting("ObjectFileName", "$(IntDir)" + sender.CreateTokenizedString("@trimstart(@relativeto($(0),$(packagebuilddir)/$(moduleoutputdir)),../)", objectFilePath).Parse());
            sender.MetaData = settingsGroup;
        }