コード例 #1
0
        /// <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);
            MakeItSoConfig_Project      projectConfig = MakeItSoConfig.Instance.getProjectConfig(m_projectInfo.Name);

            string folderPrefix = "";

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

            case ProjectInfo.ProjectTypeEnum.CSHARP_EXECUTABLE:
                folderPrefix = 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("");
        }
コード例 #2
0
        /// <summary>
        /// We define which compilers we will use.
        /// </summary>
        private void createCompilerVariables()
        {
            // We create an collection of compiler flags for each configuration...
            m_file.WriteLine("# Compiler flags...");

            MakeItSoConfig_Project projectConfig = MakeItSoConfig.Instance.getProjectConfig(m_projectInfo.Name);

            m_file.Write("CPP_COMPILER = " + projectConfig.CPPCompiler);
            createCompilerArgsList(projectConfig);

            m_file.WriteLine("C_COMPILER = " + projectConfig.CCompiler);
            m_file.WriteLine("");
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <summary>
        /// Finds the configurations, e.g. debug, release etc.
        /// </summary>
        private void parseProject_Configurations()
        {
            MakeItSoConfig_Project projectSettings = MakeItSoConfig.Instance.getProjectConfig(m_projectInfo.Name);

            // We loop through the collection of configurations for the project...
            IVCCollection configurations    = Utils.call(() => (m_vcProject.Configurations as IVCCollection));
            int           numConfigurations = Utils.call(() => (configurations.Count));

            for (int i = 1; i <= numConfigurations; ++i)
            {
                // We parse this configuration, and add the parsed data to the collection
                // for this project...
                VCConfiguration vcConfiguration = Utils.call(() => (configurations.Item(i) as VCConfiguration));

                if (projectSettings.configurationShouldBeRemoved(vcConfiguration.Name) == false)
                {
                    parseConfiguration(vcConfiguration);
                }
            }
        }
コード例 #5
0
        private void parseFileCudaCompile(XmlNode item, MakeItSoConfig_Project projConfig)
        {
            var inc = item.Attributes["Include"];

            if (inc == null)
            {
                return;
            }

            ProjectInfo_CUDA.CudaCompileInfo info = new ProjectInfo_CUDA.CudaCompileInfo();

            info.File = inc.Value;
            info.File = info.File.Replace("\\", "/");

            var child = item.FirstChild;

            while (child != null)
            {
                var cond          = child.Attributes["Condition"].Value;
                var configuration = parseCondition(cond);

                if (!projConfig.configurationShouldBeRemoved(configuration))
                {
                    configuration = parseConfiguration(configuration);
                    var opt = info.getOption(configuration);
                    parseCudaCompileOptions(opt, configuration, child, projConfig);

                    // TODO
                    if (child.Name == "AdditionalOptions")
                    {
                        opt.AdditionalOptions = child.InnerText;
                        opt.AdditionalOptions = opt.AdditionalOptions.Replace("%(AdditionalOptions)", "");
                    }
                }

                child = child.NextSibling;
            }

            m_Project.addCompileInfo(info);
        }
コード例 #6
0
        private void parseCommonCudaCompile(XmlNode item, MakeItSoConfig_Project projConfig)
        {
            var parent = item.ParentNode;

            var cond          = parent.Attributes["Condition"].Value;
            var configuration = parseCondition(cond);

            if (m_Project.CompileInfos.Count == 0)
            {
                if (!projConfig.configurationShouldBeRemoved(configuration))
                {
                    configuration = parseConfiguration(configuration);
                    var opt  = m_Project.AllCompileInfo.getOption(configuration);
                    var node = item.FirstChild;
                    parseCudaCompileOptions(opt, configuration, node, projConfig);
                }
            }
            else
            {
                foreach (var info in m_Project.CompileInfos)
                {
                    var child = item.FirstChild;

                    while (child != null)
                    {
                        if (!projConfig.configurationShouldBeRemoved(configuration))
                        {
                            configuration = parseConfiguration(configuration);
                            var opt = info.getOption(configuration);
                            parseCudaCompileOptions(opt, configuration, child, projConfig);
                        }

                        child = child.NextSibling;
                    }
                }
            }
        }
コード例 #7
0
 private void parseCudaCompileOptions(ProjectInfo_CUDA.CudaCompileOption opt, string configuration, XmlNode item, MakeItSoConfig_Project projConfig)
 {
     if (item.Name == "GenerateRelocatableDeviceCode")
     {
         opt.GenerateRelocatableDeviceCode = checkIsTrue(item.InnerText);
     }
     else if (item.Name == "TargetMachinePlatform")
     {
         opt.TargetMachinePlatform = Int32.Parse(item.InnerText);
     }
     else if (item.Name == "CodeGeneration")
     {
         opt.CodeGeneration = item.InnerText;
     }
     else if (item.Name == "NvccCompilation")
     {
         opt.NvccCompilation = item.InnerText;
     }
     else if (item.Name == "FastMath")
     {
         opt.FastMath = checkIsTrue(item.InnerText);
     }
     else if (item.Name == "CudaRuntime")
     {
         opt.CudaRuntime = item.InnerText;
     }
     else if (item.Name == "GPUDebugInfo")
     {
         opt.GPUDebugInfo = checkIsTrue(item.InnerText);
     }
     else if (item.Name == "HostDebugInfo")
     {
         opt.GenerateHostDebugInfo = checkIsTrue(item.InnerText);
     }
 }
コード例 #8
0
        /// <summary>
        /// Creates the COMPILER variable, which specifies which compiler to use.
        /// </summary>
        private void createCompilerVariable()
        {
            MakeItSoConfig_Project projectConfig = MakeItSoConfig.Instance.getProjectConfig(m_projectInfo.Name);

            m_file.WriteLine("CSHARP_COMPILER = " + projectConfig.CSharpCompiler);
        }