public override void Register(BuildRulesConfig Config) { BuildType = BuildOutputTypes.Executable; IgnoreAllWarnings = true; DependencyModules.Add("FW_Core"); IncludePaths.Add("Source/ELFIO"); }
// All include paths being added are resolved against projectBasePath public void AddIncludePath(string path) { if (String.IsNullOrEmpty(_projectBasePath)) { return; } else if (path.Equals(".") || path.Equals("\\\".\\\"")) { IncludePaths.Add(path); return; } bool isAbsolutePath; try { isAbsolutePath = System.IO.Path.IsPathRooted(path); } catch (System.ArgumentException) { // seems like an invalid path, ignore return; } if (isAbsolutePath) // absolute path { IncludePaths.Add(path); } else { // Relative path - converting to absolute String pathForCombine = path.Replace("\"", String.Empty).TrimStart('\\', '/'); IncludePaths.Add(Path.GetFullPath(Path.Combine(_projectBasePath, pathForCombine))); // Workaround for Path.Combine bugs } }
public void AddIncludePath(string path) { if (path.StartsWith(@"\")) { IncludePaths.Add(Directory.GetCurrentDirectory() + path); } else { IncludePaths.Add(path); } }
private async void AddIncludePath(object param) { var fbd = new OpenFolderDialog(); fbd.InitialDirectory = Model.CurrentDirectory; var result = await fbd.ShowAsync(); if (result != string.Empty) { var newInclude = Model.CurrentDirectory.MakeRelativePath(result); if (newInclude == string.Empty) { newInclude = "\\"; } IncludePaths.Add(newInclude); } UpdateCompileString(); }
private async void AddIncludePath() { var fbd = new OpenFolderDialog(); fbd.InitialDirectory = Model.CurrentDirectory; var result = await fbd.ShowAsync(); if (!string.IsNullOrEmpty(result)) { var newInclude = Model.CurrentDirectory.MakeRelativePath(result); if (newInclude == string.Empty) { // TODO Platform specific? newInclude = "\\"; } IncludePaths.Add(newInclude); } UpdateCompileString(); }
/// <summary> /// コンパイルオプションのチェック。 /// </summary> /// <param name="args"></param> private void CheckCompileOptions(string[] args) { // オプションの読み取り Func <string, string> getPath = (s) => { string result = s; if (!(s.EndsWith("/") || s.EndsWith("\\"))) { result = s + "/"; } return(result); }; int offset = 1; for (int i = 0; i < args.Length; i += offset) { string arg = args[i]; switch (arg) { // 出力ファイル case "-o": case "-O": if ((i + 1) < args.Length) { OutputFile = args[i + 1]; } offset = 2; break; // コンフィグファイル case "-c": case "-C": if ((i + 1) < args.Length) { ConfigFilePath = args[i + 1]; } offset = 2; break; // ヘッダファイルのディレクトリパス case "-i": case "-I": if ((i + 1) < args.Length) { string arg2 = args[i + 1]; string[] includes = arg2.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string inc in includes) { IncludePaths.Add(getPath(inc)); } } offset = 2; break; // マクロ定義 case "-d": case "-D": if ((i + 1) < args.Length) { string arg2 = args[i + 1]; string[] macros = arg2.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string macro in macros) { Macros.Add(macro); } } offset = 2; break; // 開発対象 case "-t": case "-T": if ((i + 1) < args.Length) { string arg2 = args[i + 1].ToLower(); switch (arg2) { case "win32": case "win_32": case "windows32": case "windows_32": case "winx86": case "win_x86": case "windowsx86": case "windows_x86": case "x86win": case "x86_win": case "x86windows": case "x86_windows": Target = DevelopmentTarget.WindowsX86; break; case "win64": case "win_64": case "windows64": case "windows_64": case "winx64": case "win_x64": case "windowsx64": case "windows_x64": case "x64win": case "x64_win": case "x64windows": case "x64_windows": Target = DevelopmentTarget.WindowsX64; break; case "linux32": case "linux_32": case "linuxx86": case "linux_x86": case "x86linux": case "x86_linux": Target = DevelopmentTarget.LinuxX86; break; case "linux64": case "linux_64": case "linuxx64": case "linux_x64": case "x64linux": case "x64_linux": Target = DevelopmentTarget.LinuxX64; break; case "linuxarm": case "linux_arm": case "armlinux": case "arm_linux": Target = DevelopmentTarget.LinuxARM; break; case "linuxarm64": case "linux_arm64": case "arm64linux": case "arm64_linux": Target = DevelopmentTarget.LinuxARM64; break; case "mac": case "macos": case "mac64": case "macos64": case "mac_64": case "macos_64": case "macx64": case "macosx64": case "mac_x64": case "macos_x64": case "x64mac": case "x64macos": case "x64_mac": case "x64_macos": Target = DevelopmentTarget.macOSX64; break; default: break; } } offset = 2; break; // 開発環境 case "-e": case "-E": if ((i + 1) < args.Length) { string arg2 = args[i + 1].ToLower(); switch (arg2) { case "vs": case "visualstudio": case "visual_studio": case "vc": case "vc++": case "visualc": case "visualc++": case "visual_c": case "visual_c++": Environment = DevelopmentEnvironment.VisualStudio; break; case "gcc": case "g++": Environment = DevelopmentEnvironment.GCC; break; case "clang": case "llvm": case "mingw": Environment = DevelopmentEnvironment.Clang; break; default: break; } } offset = 2; break; // ソースのルートフォルダ case "-r": case "-R": if ((i + 1) < args.Length) { string arg2 = args[i + 1]; SourceRootPath = getPath(arg2); } offset = 2; break; // ヘルプ case "--help": break; // バージョン case "--virsion": break; // 入力ファイル default: // 未知のオプションでないかチェック if (arg[0] != '-') { // 入力ファイルの追加 SourceFiles.Add(arg); } offset = 1; break; } } }
public void Initialize(Entity root) { ProjectEntity project = ProjectEntity.Decorate(root); TemplateEntity template = TemplateEntity.Decorate(root); Target[] availableTargets = sdkRepository.GetAllTargets().ToArray(); ICodeModel codeModel = root.Value <ICodeModel>(); SetProjectName(); SetProjectNamespace(); SetProjectType(); SetProjectTargets(); SetProjectEntities(); SetProjectIncludes(); void SetProjectName() { ProjectName = null; if (fileSystem.FileExists(System.IO.Path.Combine(root.Path, Constants.ProjectFileName))) { ProjectName = root.Name; } } void SetProjectNamespace() { ProjectNamespace = CodeEntity.Decorate(project).Namespace; } void SetProjectType() { ProjectType = project.Type; } void SetProjectTargets() { TargetsResult targetsResult = targetParser.Targets(project, false); ProjectTargets = targetsResult.ValidTargets .Select(t => new ProjectTarget(t, availableTargets.Any(at => t.Name == at.Name && at.LongVersion == t.LongVersion))); Exceptions = targetsResult.Errors; } void SetProjectEntities() { IEnumerable <CodeEntity> entities = template.EntityHierarchy.Select(e => { CodeEntity codeEntity = CodeEntity.Decorate(e); return(codeEntity); } ); ProjectCodeEntities = entities.Select(e => { TemplateEntity te = TemplateEntity.Decorate(e); return(e, te.RelatedEntites.Where(en => !en.Type.Contains("project"))); }) .Where(e => !e.Item1.Type.Contains("project")).ToDictionary(p => p.Item1, p => p.Item2); } void SetProjectIncludes() { IEnumerable <SdkInformation> relevantSdks = ProjectTargets.Select(t => availableTargets.FirstOrDefault(at => t.Target.Name == at.Name && at.LongVersion == t.Target.LongVersion)) .Where(t => t != null) .Select(sdkRepository.GetSdk) .Where(sdk => sdk != null) .Distinct(); IncludePaths = relevantSdks.SelectMany(sdk => sdk.IncludePaths) .Concat(relevantSdks.SelectMany(sdk => sdk.CompilerInformation.IncludePaths)) .Distinct() .ToDictionary(x => x, x => true); foreach (KeyValuePair <string, VirtualDirectory> codeModelIncludeDirectory in codeModel.IncludeDirectories) { if (!IncludePaths.ContainsKey(codeModelIncludeDirectory.Key)) { IncludePaths.Add(codeModelIncludeDirectory.Key, codeModelIncludeDirectory.Value != null); } } } }