Ejemplo n.º 1
0
        /// <summary>
        /// Gets the configuration type.
        /// </summary>
        private ProjectInfo.ProjectTypeEnum parseConfiguration_Type(VCConfiguration vcConfiguration)
        {
            ProjectInfo.ProjectTypeEnum result = ProjectInfo.ProjectTypeEnum.INVALID;

            // We get the Visual Studio confiuration type...
            ConfigurationTypes configurationType = Utils.call(() => (vcConfiguration.ConfigurationType));

            // And convert it to our enum type...
            switch (configurationType)
            {
            case ConfigurationTypes.typeApplication:
                result = ProjectInfo.ProjectTypeEnum.CPP_EXECUTABLE;
                break;

            case ConfigurationTypes.typeStaticLibrary:
                result = ProjectInfo.ProjectTypeEnum.CPP_STATIC_LIBRARY;
                break;

            case ConfigurationTypes.typeDynamicLibrary:
                result = ProjectInfo.ProjectTypeEnum.CPP_DLL;
                break;
            }

            return(result);
        }
        /// <summary>
        /// Creates a target for one custom build rule.
        /// </summary>
        private void createCustomBuildRuleTarget(ProjectConfigurationInfo_CPP configuration, CustomBuildRuleInfo_CPP ruleInfo)
        {
            // The rule might be built by one of the other projects in this solution.
            // If so, we need to change the folder name to the adjusted output folder
            // name we generate. (This means that we need to know if the project that
            // generates it is a C++ or C# project.)
            string executablePath = Path.Combine(configuration.ParentProjectInfo.RootFolderAbsolute, ruleInfo.RelativePathToExecutable);

            ProjectInfo.ProjectTypeEnum projectType = m_projectInfo.ParentSolution.isOutputObject(executablePath);

            string folderPrefix = "";

            switch (projectType)
            {
            case ProjectInfo.ProjectTypeEnum.CPP_EXECUTABLE:
                folderPrefix = m_projectConfig.CPPFolderPrefix;
                break;

            case ProjectInfo.ProjectTypeEnum.CSHARP_EXECUTABLE:
                folderPrefix = m_projectConfig.CSharpFolderPrefix;
                break;
            }

            // We add the target to the makefile...
            m_file.WriteLine("# Custom build rule for " + ruleInfo.RelativePathToFile);
            string targetName = getCustomRuleTargetName(configuration, ruleInfo);

            m_file.WriteLine(".PHONY: " + targetName);
            m_file.WriteLine(targetName + ":");
            m_file.WriteLine("\t" + ruleInfo.getCommandLine(folderPrefix));

            m_file.WriteLine("");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks if the (absolute path to) the executable passed in is an
 /// output object for any of the projects in the solution.
 /// Returns the type of executable if it is, or INVALID if it is not.
 /// </summary>
 public ProjectInfo.ProjectTypeEnum isOutputObject(string absoluteExecutablePath)
 {
     foreach (ProjectInfo projectInfo in m_projectInfos.Values)
     {
         ProjectInfo.ProjectTypeEnum result = projectInfo.isOutputObject(absoluteExecutablePath);
         if (result != ProjectInfo.ProjectTypeEnum.INVALID)
         {
             return(result);
         }
     }
     return(ProjectInfo.ProjectTypeEnum.INVALID);
 }