Esempio n. 1
0
        /// <summary>
        /// Parses settings for specific projects.
        /// </summary>
        private void parseSpecificProjects(XmlNode rootNode)
        {
            // We find each "Project" node for specific projects,
            // and parse them...
            XmlNodeList projectNodes = rootNode.SelectNodes("Project");

            foreach (XmlNode projectNode in projectNodes)
            {
                // The project name is in the 'Name' attribute...
                XmlAttribute nameAttribute = projectNode.Attributes["name"];
                if (nameAttribute == null)
                {
                    continue;
                }
                string projectName = nameAttribute.Value;

                // We create a config object for the project, and parse it...
                MakeItSoConfig_Project projectConfig = new MakeItSoConfig_Project(this);

                applyAllProjectsConfig(projectConfig);

                projectConfig.parseConfig(projectNode);
                m_projects.Add(projectName, projectConfig);

                applyAllProjectsConfigurationField(projectConfig);
            }
        }
        /// <summary>
        /// Updates include paths from config settings.
        /// </summary>
        private void updateIncludePaths(ProjectConfigurationInfo_CPP configuration)
        {
            MakeItSoConfig_Project projectSettings = MakeItSoConfig.Instance.getProjectConfig(configuration.ParentProjectInfo.Name);

            string projectRootFolder = configuration.ParentProjectInfo.RootFolderAbsolute;

            // We check if any include paths should be removed...
            List <string> includePaths = new List <string>(configuration.getIncludePaths());

            foreach (string includePath in includePaths)
            {
                string fullPath = Path.Combine(projectRootFolder, includePath);
                if (projectSettings.includePathShouldBeRemoved(fullPath) == true)
                {
                    configuration.removeIncludePath(includePath);
                }
            }

            // We add any new paths...
            List <string> pathsToAdd = projectSettings.getConfiguration(configuration.Name).getIncludePathsToAdd().ToList();

            foreach (string pathToAdd in pathsToAdd)
            {
                string relativePath = Utils.makeRelativePath(projectRootFolder, pathToAdd);
                configuration.addIncludePath(relativePath);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Updates preprocessor definitions from config settings.
        /// </summary>
        private void updatePreprocessorDefinitions(ProjectConfigurationInfo_CPP configuration)
        {
            MakeItSoConfig_Project projectSettings = MakeItSoConfig.Instance.getProjectConfig(configuration.ParentProjectInfo.Name);

            // By default we replace WIN32 with GCC_BUILD...
            configuration.removePreprocessorDefinition("WIN32");
            configuration.addPreprocessorDefinition("GCC_BUILD");

            // We check if any definitions should be removed...
            List <string> definitions = new List <string>(configuration.getPreprocessorDefinitions());

            foreach (string definition in definitions)
            {
                if (projectSettings.preprocessorDefinitionShouldBeRemoved(definition) == true)
                {
                    configuration.removePreprocessorDefinition(definition);
                }
            }

            // We add any new definitions...
            List <string> definitionsToAdd = projectSettings.getConfiguration(configuration.Name).getPreprocessorDefinitionsToAdd();

            foreach (string definition in definitionsToAdd)
            {
                configuration.addPreprocessorDefinition(definition);
            }
        }
Esempio n. 4
0
        private void applyAllProjectsConfigurationField(MakeItSoConfig_Project projConfig)
        {
            foreach (var configName in m_allProjects.getCongurationNames())
            {
                // If no project conguration, create it.
                projConfig.getConfiguration(configName);
            }

            applyConfigurationsField(m_allProjects, projConfig);
        }
Esempio n. 5
0
        /// <summary>
        /// Updates library paths from config settings.
        /// </summary>
        private void updateLibraryPaths(ProjectConfigurationInfo_CPP configuration)
        {
            MakeItSoConfig_Project projectSettings = MakeItSoConfig.Instance.getProjectConfig(configuration.ParentProjectInfo.Name);

            ProjectInfo projectInfo       = configuration.ParentProjectInfo;
            string      projectRootFolder = projectInfo.RootFolderAbsolute;

            // We check if any library paths should be removed...
            List <string> libraryPaths = new List <string>(configuration.getLibraryPaths());

            foreach (string libraryPath in libraryPaths)
            {
                // We remove the library (and re-add it if we need to, but
                // with the name changed)...
                configuration.removeLibraryPath(libraryPath);

                // We find the full path, and add it if we are not
                // configured to remove it...
                string fullPath = Path.Combine(projectRootFolder, libraryPath);
                if (projectSettings.libraryPathShouldBeRemoved(fullPath) == false)
                {
                    string prefix  = MakeItSoConfig.Instance.getProjectConfig(projectInfo.Name).CPPFolderPrefix;
                    string gccPath = Utils.addPrefixToFolderPath(libraryPath, prefix);
                    configuration.addLibraryPath(gccPath);
                }
            }

            // We add any new paths...
            List <ProjectPath> pathsToAdd = projectSettings.getConfiguration(configuration.Name).getLibraryPathsToAdd();

            foreach (ProjectPath pathToAdd in pathsToAdd)
            {
                string relativePath;
                if (!pathToAdd.Absolute)
                {
                    relativePath = Utils.makeRelativePath(projectRootFolder, pathToAdd.Path);
                }
                else
                {
                    relativePath = pathToAdd.Path;
                }

                configuration.addLibraryPath(relativePath);
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        private MakefileBuilder_Project_CPP(ProjectInfo_CPP project)
        {
            m_projectInfo = project;
            m_projectConfig = MakeItSoConfig.Instance.getProjectConfig(m_projectInfo.Name);
            try
            {
                // We create the file '[project-name].makefile', and set it to
                // use unix-style line endings...
                string path = String.Format("{0}/{1}.makefile", m_projectInfo.RootFolderAbsolute, m_projectInfo.Name);
                m_file = new StreamWriter(path, false);
                m_file.NewLine = "\n";

                // We create variables...
                createCompilerVariables();
                createIncludePathVariables();
                createLibraryPathVariables();
                createLibrariesVariables();
                createPreprocessorDefinitionsVariables();
                createImplicitlyLinkedObjectsVariables();
                createCompilerFlagsVariables();

                // We create an 'all configurations' root target...
                createAllConfigurationsTarget();

                // We create one target for each configuration...
                createConfigurationTargets();

                // We create a target to create the intermediate and output folders...
                createCreateFoldersTarget();

                // Creates the target that cleans intermediate files...
                createCleanTarget();
            }
            finally
            {
                if (m_file != null)
                {
                    m_file.Close();
                    m_file.Dispose();
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Updates compiler flags from the config settings.
        /// </summary>
        private void updateCompilerFlags(ProjectConfigurationInfo_CPP configuration)
        {
            MakeItSoConfig_Project projectSettings = MakeItSoConfig.Instance.getProjectConfig(configuration.ParentProjectInfo.Name);

            // We check if any definitions should be removed...
            List <string> flags = new List <string>(configuration.getCompilerFlags());

            foreach (string flag in flags)
            {
                if (projectSettings.compilerFlagShouldBeRemoved(flag) == true)
                {
                    configuration.removeCompilerFlag(flag);
                }
            }

            // We add any new definitions...
            List <string> flagsToAdd = projectSettings.getConfiguration(configuration.Name).getCompilerFlagsToAdd();

            foreach (string flag in flagsToAdd)
            {
                configuration.addCompilerFlag(flag);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Updates libraries from config settings.
        /// </summary>
        private void updateLibraries(ProjectConfigurationInfo_CPP configuration)
        {
            MakeItSoConfig_Project projectSettings = MakeItSoConfig.Instance.getProjectConfig(configuration.ParentProjectInfo.Name);

            // We check if any of the libraries in the configuration should be removed...
            HashSet <string> libraries = new HashSet <string>(configuration.getLibraryRawNames());

            foreach (string library in libraries)
            {
                if (projectSettings.libraryShouldBeRemoved(library) == true)
                {
                    configuration.removeLibraryRawName(library);
                }
            }

            // We add any that need adding...
            List <string> librariesToAdd = projectSettings.getConfiguration(configuration.Name).getLibrariesToAdd();

            foreach (string library in librariesToAdd)
            {
                string rawName = Utils.convertLinuxLibraryNameToRawName(library);
                configuration.addLibraryRawName(rawName);
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MakeItSoConfig_Configuration(MakeItSoConfig_Project projectConfig, MakeItSoConfig_Configuration parentConfig)
 {
     m_projectConfig = projectConfig;
     m_parentConfig  = parentConfig;
 }
Esempio n. 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MakeItSoConfig_Configuration(string name, MakeItSoConfig_Project projectConfig)
 {
     this.Name       = name;
     m_projectConfig = projectConfig;
 }
Esempio n. 11
0
        /// <summary>
        /// Parses settings for specific projects.
        /// </summary>
        private void parseSpecificProjects(XmlNode rootNode)
        {
            // We find each "Project" node for specific projects,
            // and parse them...
            XmlNodeList projectNodes = rootNode.SelectNodes("Project");
            foreach (XmlNode projectNode in projectNodes)
            {
                // The project name is in the 'Name' attribute...
                XmlAttribute nameAttribute = projectNode.Attributes["name"];
                if (nameAttribute == null) continue;
                string projectName = nameAttribute.Value;

                // We create a config object for the project, and parse it...
                MakeItSoConfig_Project projectConfig = new MakeItSoConfig_Project(this);
                projectConfig.parseConfig(projectNode);
                m_projects.Add(projectName, projectConfig);
            }
        }
Esempio n. 12
0
 private void applyAllProjectsConfig(MakeItSoConfig_Project projConfig)
 {
     applyField(m_allProjects, projConfig);
 }
Esempio n. 13
0
 /// <summary>
 /// Private constructor, for singleton.
 /// </summary>
 private MakeItSoConfig()
 {
     m_allProjects = new MakeItSoConfig_Project(this);
 }
Esempio n. 14
0
 /// <summary>
 /// Private constructor, for singleton.
 /// </summary>
 private MakeItSoConfig()
 {
     m_allProjects = new MakeItSoConfig_Project(this);
 }
		/// <summary>
		///	Creates the build arguments string.
		///	</summary>
        private void createCompilerArgsList(MakeItSoConfig_Project projectConfig)
        {
            String ArgsString = "";

            if (projectConfig.SolutionConfig.BuildArguments != null)
			{
				foreach (String Arg in projectConfig.SolutionConfig.BuildArguments)
				{
                    ArgsString += " -" + Arg;
                }
			}

            m_file.WriteLine(ArgsString);
        }
Esempio n. 16
0
 private void applyAllProjectsConfig(MakeItSoConfig_Project projConfig)
 {
     applyField(m_allProjects, projConfig);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public MakeItSoConfig_Configuration(MakeItSoConfig_Project projectConfig)
 {
     m_projectConfig = projectConfig;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public MakeItSoConfig_Configuration(MakeItSoConfig_Project projectConfig, MakeItSoConfig_Configuration parentConfig)
 {
     m_projectConfig = projectConfig;
     m_parentConfig = parentConfig;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public MakeItSoConfig_Configuration(MakeItSoConfig_Project projectConfig)
 {
     m_projectConfig = projectConfig;
 }