public override void GenerateProjectConfigurationGeneral(IVcxprojGenerationContext context, IFileGenerator generator) { var devEnv = context.DevelopmentEnvironment; var resolver = generator.Resolver; string remoteProjectPath = @"$(RemoteRootDir)"; Options.Vc.RemoteBuild.ProjectDirectory projectDirectoryOption = Options.GetObject <Options.Vc.RemoteBuild.ProjectDirectory>(context.Configuration); if (projectDirectoryOption != null) { remoteProjectPath += Util.WindowsSeparator + projectDirectoryOption.Value; remoteProjectPath = remoteProjectPath.TrimEnd(Util.WindowsSeparator); } string remoteBinPath = remoteProjectPath + Util.WindowsSeparator + resolver.Resolve("[options.OutputDirectory]").TrimEnd(Util.WindowsSeparator); if (context.Configuration.StartWorkingDirectory.Length > 0) { remoteBinPath = context.Configuration.StartWorkingDirectory; } string remoteCommand = remoteProjectPath + Util.WindowsSeparator + resolver.Resolve("[options.OutputFile]"); using (generator.Declare("LinuxRemoteRootDir", @"~/" + devEnv.ToString())) // Should this be configurable? using (generator.Declare("LinuxRemoteProjectDir", remoteProjectPath.Replace(Util.WindowsSeparator, Util.UnixSeparator))) using (generator.Declare("LinuxRemoteDebuggerWorkingDirectory", remoteBinPath.Replace(Util.WindowsSeparator, Util.UnixSeparator))) using (generator.Declare("LinuxRemoteDebuggerCommand", remoteCommand.Replace(Util.WindowsSeparator, Util.UnixSeparator))) { generator.Write(_projectConfigurationsGeneral); } }
protected override IEnumerable <string> GetIncludePathsImpl(IGenerationContext context) { var includePaths1 = new OrderableStrings(); var includePaths2 = new OrderableStrings(); includePaths2.AddRange(context.Configuration.IncludePrivatePaths); includePaths2.AddRange(context.Configuration.IncludePaths); includePaths2.AddRange(context.Configuration.DependenciesIncludePaths); Options.Vc.RemoteBuild.RelativeDirectory relativeDirectoryOption = Options.GetObject <Options.Vc.RemoteBuild.RelativeDirectory>(context.Configuration); if (relativeDirectoryOption != null) { string basePath = relativeDirectoryOption.Value.TrimEnd(Util.WindowsSeparator); Options.Vc.RemoteBuild.ProjectDirectory projectDirectoryOption = Options.GetObject <Options.Vc.RemoteBuild.ProjectDirectory>(context.Configuration); if (projectDirectoryOption != null) { basePath += Util.WindowsSeparator + projectDirectoryOption.Value.TrimEnd(Util.WindowsSeparator); } for (int i = 0; i < includePaths2.Count; ++i) { string includePath = includePaths2[i]; foreach (var variable in Options.GetObjects <Options.Vc.RemoteBuild.Variable>(context.Configuration)) { includePath = includePath.Replace(@"$(" + variable.Key + @")", variable.Value); } string remotePath = Util.PathGetRelative(basePath, includePath.TrimEnd(Util.WindowsSeparator)); if (remotePath != includePath) { includePaths1.Add(remotePath); } } } includePaths1.AddRange(includePaths2); return(includePaths1); }
public override void SelectPlatformAdditionalDependenciesOptions(IGenerationContext context) { context.Options["AdditionalLibraryDirectories"] = FileGeneratorUtilities.RemoveLineTag; context.Options["AdditionalDependencies"] = FileGeneratorUtilities.RemoveLineTag; context.Options["LibraryDependencies"] = FileGeneratorUtilities.RemoveLineTag; context.CommandLineOptions["AdditionalDependencies"] = FileGeneratorUtilities.RemoveLineTag; context.CommandLineOptions["AdditionalLibraryDirectories"] = FileGeneratorUtilities.RemoveLineTag; context.CommandLineOptions["LibraryDependencies"] = FileGeneratorUtilities.RemoveLineTag; var dependencies = new List <Project.Configuration>(); dependencies.AddRange(context.Configuration.ResolvedPublicDependencies); // Sort by the number of dependencies to get a good starting point dependencies.Sort((Project.Configuration d0, Project.Configuration d1) => { return(d1.ProjectGuidDependencies.Count.CompareTo(d0.ProjectGuidDependencies.Count)); }); var libPaths = new OrderableStrings(); var libFiles = new OrderableStrings(); foreach (var dependency in dependencies) { string outputFileName = dependency.TargetFileName; string outputPrefix = GetOutputFileNamePrefix(context, dependency.Output); if (!string.IsNullOrEmpty(outputPrefix)) { outputFileName = outputPrefix + outputFileName; } string outputExtension = GetDefaultOutputExtension(dependency.Output); if (!string.IsNullOrEmpty(outputExtension)) { outputFileName = outputFileName + "." + outputExtension; } string libPath = dependency.IntermediatePath + Util.WindowsSeparator + outputFileName; foreach (var variable in Options.GetObjects <Options.Vc.RemoteBuild.Variable>(context.Configuration)) { libPath = libPath.Replace(@"$(" + variable.Key + @")", variable.Value); } string remotePath = Util.PathGetRelative(dependency.ProjectPath.TrimEnd(Util.WindowsSeparator), libPath.TrimEnd(Util.WindowsSeparator)); Options.Vc.RemoteBuild.ProjectDirectory projectDirectoryOption = Options.GetObject <Options.Vc.RemoteBuild.ProjectDirectory>(dependency); if (projectDirectoryOption != null) { remotePath = projectDirectoryOption.Value.TrimEnd(Util.WindowsSeparator) + Util.WindowsSeparator + remotePath; // Unlike the include paths, this needs the RemoteRootDir variable and unix separators remotePath = @"$(RemoteRootDir)" + Util.UnixSeparator + remotePath.Replace(Util.WindowsSeparator, Util.UnixSeparator); libPaths.Add(remotePath); } } foreach (var file in context.Configuration.LibraryFiles) { if (file.Contains(Util.WindowsSeparator.ToString())) { string libPath = file; Options.Vc.RemoteBuild.RelativeDirectory relativeDirectoryOption = Options.GetObject <Options.Vc.RemoteBuild.RelativeDirectory>(context.Configuration); if (relativeDirectoryOption != null) { string basePath = relativeDirectoryOption.Value.TrimEnd(Util.WindowsSeparator); foreach (var variable in Options.GetObjects <Options.Vc.RemoteBuild.Variable>(context.Configuration)) { libPath = libPath.Replace(@"$(" + variable.Key + @")", variable.Value); } string remotePath = Util.PathGetRelative(basePath, libPath.TrimEnd(Util.WindowsSeparator)); remotePath = @"$(RemoteRootDir)" + Util.UnixSeparator + remotePath.Replace(Util.WindowsSeparator, Util.UnixSeparator); libPaths.Add(remotePath); } } else { libFiles.Add(file); } } context.Options["AdditionalDependencies"] = string.Join(";", libPaths); context.Options["LibraryDependencies"] = string.Join(";", libFiles); }