/// <summary>
        /// Enumerates list of libraries that should be linked with project build file.
        /// </summary>
        /// <param name="platform">One of the target platforms.</param>
        /// <param name="configuration">One of the target configurations.</param>
        public virtual IEnumerable <DependencyFile> EnumerateLinkedLibraries(TargetPlatform platform, TargetConfiguration configuration)
        {
            foreach (var libraryFile in Directory.EnumerateFiles(GetLocation()))
            {
                if (!MatchesPlatformConfiguration(libraryFile, platform, configuration))
                {
                    continue;
                }
                var libraryFileExtension = (Path.GetExtension(libraryFile) ?? "").ToLowerInvariant();
                if (TargetInfo.IsMicrosoftPlatform(platform))
                {
                    switch (libraryFileExtension)
                    {
                    case ".lib":
                        yield return(new DependencyFile(libraryFile, DependencyFileType.StaticLibrary));

                        break;
                    }
                }
                else if (TargetInfo.IsApplePlatform(platform))
                {
                    // TODO: '.framework' bundles on Apple platforms.
                    switch (libraryFileExtension)
                    {
                    case ".a":
                        yield return(new DependencyFile(libraryFile, DependencyFileType.StaticLibrary));

                        break;

                    case ".dylib":
                        yield return(new DependencyFile(libraryFile, DependencyFileType.DynamicLibrary));

                        break;
                    }
                }
                else if (TargetInfo.IsPosixPlatform(platform))
                {
                    switch (libraryFileExtension)
                    {
                    case ".a":
                        yield return(new DependencyFile(libraryFile, DependencyFileType.StaticLibrary));

                        break;

                    case ".so":
                        yield return(new DependencyFile(libraryFile, DependencyFileType.DynamicLibrary));

                        break;
                    }
                }
                else
                {
                    throw new NotSupportedException("Unknown target platform for depenedency linked libraries.");
                }
            }
        }
 /// <summary>
 /// Returns path to the import library (only actual for Windows DLLs), or null if no import library needs to be generated.
 /// </summary>
 /// <param name="platform">One of the target platforms.</param>
 /// <param name="configuration">One of the target configurations.</param>
 public virtual string GetImportLibraryOutputPath(TargetPlatform platform, TargetConfiguration configuration)
 {
     Debug.Assert(platform != TargetPlatform.Unknown);
     if (TargetInfo.IsMicrosoftPlatform(platform) && GetBuildType(platform, configuration) == ProjectBuildType.DynamicLibrary)
     {
         var importLibraryOutputDirectory = Path.Combine(BuildSystem.GetSdkLocation(), "lib", GetName());
         return(configuration != TargetConfiguration.Release
             ? importLibraryOutputDirectory + "." + configuration + ".lib"
             : importLibraryOutputDirectory + ".lib");
     }
     return(null);
 }
        /// <summary>
        /// Enumerates list of files that should be copied to project build output directory.
        /// </summary>
        /// <param name="platform">One of the target platforms.</param>
        /// <param name="configuration">One of the target configurations.</param>
        public virtual IEnumerable <DependencyFile> EnumerateCopyFiles(TargetPlatform platform, TargetConfiguration configuration)
        {
            foreach (var copyFilePath in Directory.EnumerateFiles(GetLocation()))
            {
                if (!MatchesPlatformConfiguration(copyFilePath, platform, configuration))
                {
                    continue;
                }

                var copyFileExtension = (Path.GetExtension(copyFilePath) ?? "").ToLowerInvariant();
                if (TargetInfo.IsMicrosoftPlatform(platform))
                {
                    switch (copyFileExtension)
                    {
                    case ".dll":
                        yield return(new DependencyFile(copyFilePath, DependencyFileType.DynamicLibrary));

                        break;
                    }
                }
                else if (TargetInfo.IsApplePlatform(platform))
                {
                    switch (copyFileExtension)
                    {
                    case ".dylib":
                        yield return(new DependencyFile(copyFilePath, DependencyFileType.DynamicLibrary));

                        break;
                    }
                }
                else if (TargetInfo.IsPosixPlatform(platform))
                {
                    switch (copyFileExtension)
                    {
                    case ".so":
                        yield return(new DependencyFile(copyFilePath, DependencyFileType.DynamicLibrary));

                        break;
                    }
                }
                else
                {
                    throw new NotSupportedException("Unknown target platform for depenedency copy files.");
                }
            }
        }
 /// <summary>
 /// Enumerates list of additional preprocessor definitions added to this project.
 /// </summary>
 /// <param name="platform">One of the target platforms.</param>
 /// <param name="configuration">One of the target configurations.</param>
 public virtual IEnumerable <ProjectMacro> EnumerateMacros(TargetPlatform platform, TargetConfiguration configuration)
 {
     if (TargetInfo.IsMicrosoftPlatform(platform))
     {
         if (TargetConfigurationInfo.Get(configuration).IsDebug)
         {
             yield return(new ProjectMacro("_DEBUG", "1"));
         }
         else
         {
             yield return(new ProjectMacro("NDEBUG", "1"));
         }
         if (GetBuildType(platform, configuration) == ProjectBuildType.DynamicLibrary)
         {
             yield return(new ProjectMacro("_WINDLL"));
         }
     }
     // Something else here..
 }
        /// <inheritdoc />
        public sealed override IEnumerable <DependencyFile> EnumerateLinkedLibraries(TargetPlatform platform, TargetConfiguration configuration)
        {
            if (TargetInfo.IsMicrosoftPlatform(platform))
            {
                yield return(new DependencyFile(GetProject().ImportLibraryOutputPath[platform, configuration], DependencyFileType.StaticLibrary));
            }
            else
            {
                switch (GetProject().BuildType[platform, configuration])
                {
                case ProjectBuildType.StaticLibrary:
                    yield return(new DependencyFile(GetProject().OutputPath[platform, configuration], DependencyFileType.StaticLibrary));

                    break;

                case ProjectBuildType.DynamicLibrary:
                    yield return(new DependencyFile(GetProject().OutputPath[platform, configuration], DependencyFileType.DynamicLibrary));

                    break;
                }
            }
        }
        /// <summary>
        /// Enumerates list of files with source code, which would be added to generated project data.
        /// </summary>
        /// <param name="platform">One of the target platforms.</param>
        /// <param name="configuration">One of the target configurations.</param>
        public virtual IEnumerable <ProjectFile> EnumerateSourceFiles(TargetPlatform platform, TargetConfiguration configuration)
        {
            // Adding collected project files.
            var projectSourceDirectory = Path.Combine(GetLocation(), "Source");

            if (Directory.Exists(projectSourceDirectory))
            {
                foreach (var sourceFile in Directory.EnumerateFiles(projectSourceDirectory, "*.*", SearchOption.AllDirectories))
                {
                    var sourceFileExtension = (Path.GetExtension(sourceFile) ?? "").ToLowerInvariant();
                    switch (sourceFileExtension)
                    {
                    case ".h":
                    case ".hh":
                    case ".hpp":
                    case ".hxx":
                        yield return(new ProjectFile(sourceFile, GetProgrammingLanguage() == ProjectLanguge.Cpp ? ProjectSourceFileType.HeaderFile : ProjectSourceFileType.SupportFile));

                        break;

                    case ".c":
                    case ".cc":
                    case ".cpp":
                    case ".cxx":
                        yield return(new ProjectFile(sourceFile, GetProgrammingLanguage() == ProjectLanguge.Cpp ? ProjectSourceFileType.SourceCode : ProjectSourceFileType.SupportFile));

                        break;

                    case ".s":
                    case ".asm":
                        yield return(new ProjectFile(sourceFile, GetProgrammingLanguage() == ProjectLanguge.Cpp ? ProjectSourceFileType.SourceCodeAssembler : ProjectSourceFileType.SupportFile));

                        break;

                    case ".m":
                    case ".mm":
                        yield return(new ProjectFile(sourceFile, GetProgrammingLanguage() == ProjectLanguge.Cpp ? ProjectSourceFileType.SourceCodeObjective : ProjectSourceFileType.SupportFile));

                        break;

                    case ".inl":
                        yield return(new ProjectFile(sourceFile, GetProgrammingLanguage() == ProjectLanguge.Cpp ? ProjectSourceFileType.InlineImplementation : ProjectSourceFileType.SupportFile));

                        break;

                    case ".rc":
                        if (TargetInfo.IsMicrosoftPlatform(platform))
                        {
                            yield return(new ProjectFile(sourceFile, GetProgrammingLanguage() == ProjectLanguge.Cpp ? ProjectSourceFileType.ResourceScript : ProjectSourceFileType.SupportFile));
                        }
                        break;

                    case ".cs":
                        var projectFileSecondExtension = Path.GetExtension(Path.GetFileNameWithoutExtension(sourceFile) ?? "").ToLowerInvariant();
                        if (!string.IsNullOrEmpty(projectFileSecondExtension))
                        {
                            switch (projectFileSecondExtension)
                            {
                            case ".gdproj":
                            case ".gddep":
                            case ".gdsln":
                                yield return(new ProjectFile(sourceFile, ProjectSourceFileType.SupportFile));

                                break;
                            }
                        }
                        break;
                    }
                }
                // Adding project file as support file.
                yield return(new ProjectFile(GetSource(), ProjectSourceFileType.SupportFile));
            }
        }
        /// <summary>
        /// Returns directory of the compilation result.
        /// </summary>
        /// <param name="platform">One of the target platforms.</param>
        /// <param name="configuration">One of the target configurations.</param>
        public virtual string GetOutputFileName(TargetPlatform platform, TargetConfiguration configuration)
        {
            Debug.Assert(platform != TargetPlatform.Unknown);
            string outputExtension = null, outputPrefix = null;

            if (TargetInfo.IsMicrosoftPlatform(platform))
            {
                switch (GetBuildType(platform, configuration))
                {
                case ProjectBuildType.Application:
                    outputPrefix    = "";
                    outputExtension = ".exe";
                    break;

                case ProjectBuildType.DynamicLibrary:
                    outputPrefix    = "";
                    outputExtension = ".dll";
                    break;

                case ProjectBuildType.StaticLibrary:
                    outputPrefix    = "";
                    outputExtension = ".lib";
                    break;
                }
            }
            else if (TargetInfo.IsApplePlatform(platform))
            {
                switch (GetBuildType(platform, configuration))
                {
                case ProjectBuildType.Application:
                    outputPrefix    = "";
                    outputExtension = ".app";
                    break;

                case ProjectBuildType.DynamicLibrary:
                    outputPrefix    = "";
                    outputExtension = ".dylib";
                    break;

                case ProjectBuildType.StaticLibrary:
                    outputPrefix    = "lib";
                    outputExtension = ".a";
                    break;
                }
            }
            else if (TargetInfo.IsPosixPlatform(platform))
            {
                switch (GetBuildType(platform, configuration))
                {
                case ProjectBuildType.Application:
                    outputPrefix    = "";
                    outputExtension = "";
                    break;

                case ProjectBuildType.DynamicLibrary:
                    outputPrefix    = "lib";
                    outputExtension = ".so";
                    break;

                case ProjectBuildType.StaticLibrary:
                    outputPrefix    = "lib";
                    outputExtension = ".a";
                    break;
                }
            }
            else
            {
                throw new NotSupportedException("Unknown target platform for project output path.");
            }
            return(outputPrefix + GetName() + outputExtension);
        }