示例#1
0
        private void IntegrateIntoConfiguration(VCConfiguration configuration)
        {
            string absPropFilePath      = GetPropsFilePath(configuration);
            string relativePropFilePath = ConanPathHelper.GetRelativePath(configuration.project.ProjectDirectory, absPropFilePath);

            IVCCollection tools = (IVCCollection)configuration.Tools;

            if (tools != null)
            {
                VCLinkerTool ltool = (VCLinkerTool)tools.Item("VCLinkerTool");
                if (ltool != null)
                {
                    string deps = ltool.AdditionalDependencies;
                    ltool.AdditionalDependencies = deps.Replace("$(NOINHERIT)", "");
                }
            }

            foreach (VCPropertySheet sheet in configuration.PropertySheets)
            {
                if (ConanPathHelper.NormalizePath(sheet.PropertySheetFile) == ConanPathHelper.NormalizePath(absPropFilePath))
                {
                    return;
                }
            }
            configuration.AddPropertySheet(relativePropFilePath);
            configuration.CollectIntelliSenseInfo();
        }
示例#2
0
        protected internal override async Task MenuItemCallback()
        {
            var project            = _vcProjectService.GetActiveProject();
            var projectDirectory   = project.ProjectDirectory;
            var conanfileDirectory = await ConanPathHelper.GetNearestConanfilePath(projectDirectory);

            var propFilePath         = Path.Combine(conanfileDirectory, @"conan\conanbuildinfo_multi.props");
            var relativePropFilePath = ConanPathHelper.GetRelativePath(projectDirectory, propFilePath);
            await _vcProjectService.AddPropsImport(project.ProjectFile, relativePropFilePath);
        }
示例#3
0
        private string GetPropsFilePath(VCConfiguration configuration)
        {
            string installPath = _vcProjectService.GetInstallationDirectory(_settingsService, configuration);
            string propFileName;

            if (_settingsService.GetConanGenerator() == ConanGeneratorType.visual_studio)
            {
                propFileName = @"conanbuildinfo.props";
            }
            else
            {
                propFileName = @"conanbuildinfo_multi.props";
            }
            string propFilePath = Path.Combine(installPath, propFileName);

            return(ConanPathHelper.GetRelativePath(configuration.project.ProjectDirectory, propFilePath));
        }
示例#4
0
        private void IntegrateIntoConfiguration(IVCConfiguration configuration)
        {
            string absPropFilePath      = GetPropsFilePath(configuration);
            string relativePropFilePath = ConanPathHelper.GetRelativePath(configuration.ProjectDirectory, absPropFilePath);

            configuration.AdditionalDependencies = configuration.AdditionalDependencies.Replace("$(NOINHERIT)", "");

            foreach (IVCPropertySheet sheet in configuration.PropertySheets)
            {
                if (ConanPathHelper.NormalizePath(sheet.PropertySheetFile) == ConanPathHelper.NormalizePath(absPropFilePath))
                {
                    string msg = $"[Conan.VisualStudio] Property sheet '{absPropFilePath}' already added to project {configuration.ProjectName}";
                    Logger.Log(msg);
                    return;
                }
            }
            configuration.AddPropertySheet(relativePropFilePath);
            Logger.Log($"[Conan.VisualStudio] Property sheet '{absPropFilePath}' added to project {configuration.ProjectName}");
            configuration.CollectIntelliSenseInfo();
        }
示例#5
0
 public void GetRelativePathTests(string basePath, string location, string expectedRelativePath) =>
 Assert.AreEqual(expectedRelativePath, ConanPathHelper.GetRelativePath(basePath, location));