mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-26 08:29:54 -06:00
Introduce an index from source file to source group in `cmLocalGenerator` to make lookups significantly more efficient during the source group generation, which could be particularly slow when dealing with thousands of source files. Falls back to the recursive lookup when the source file is not present on the index, which is more likely to happen when dealing with regex-based sources. Fixes: #27359
108 lines
3.5 KiB
C++
108 lines
3.5 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file LICENSE.rst or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
#include <iosfwd>
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "cmExternalMakefileProjectGenerator.h"
|
|
#include "cmSourceGroup.h"
|
|
|
|
class cmLocalGenerator;
|
|
class cmMakefile;
|
|
class cmXMLWriter;
|
|
|
|
/** \class cmExtraEclipseCDT4Generator
|
|
* \brief Write Eclipse project files for Makefile based projects
|
|
*/
|
|
class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
|
|
{
|
|
public:
|
|
enum LinkType
|
|
{
|
|
VirtualFolder,
|
|
LinkToFolder,
|
|
LinkToFile
|
|
};
|
|
|
|
cmExtraEclipseCDT4Generator();
|
|
|
|
static cmExternalMakefileProjectGeneratorFactory* GetFactory();
|
|
|
|
void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
|
|
bool optional) override;
|
|
|
|
void Generate() override;
|
|
|
|
private:
|
|
// create .project file in the source tree
|
|
void CreateSourceProjectFile();
|
|
|
|
// create .settings/org.eclipse.core.resources.prefs
|
|
void CreateSettingsResourcePrefsFile();
|
|
|
|
// create .project file
|
|
void CreateProjectFile();
|
|
|
|
// create .cproject file
|
|
void CreateCProjectFile() const;
|
|
|
|
// If built with cygwin cmake, convert posix to windows path.
|
|
static std::string GetEclipsePath(std::string const& path);
|
|
|
|
// Extract basename.
|
|
static std::string GetPathBasename(std::string const& path);
|
|
|
|
// Generate the project name as: <name>-<type>@<path>
|
|
static std::string GenerateProjectName(std::string const& name,
|
|
std::string const& type,
|
|
std::string const& path);
|
|
|
|
// Helper functions
|
|
static void AppendStorageScanners(cmXMLWriter& xml,
|
|
cmMakefile const& makefile);
|
|
static void AppendTarget(cmXMLWriter& xml, std::string const& target,
|
|
std::string const& make,
|
|
std::string const& makeArguments,
|
|
std::string const& path, char const* prefix = "",
|
|
char const* makeTarget = nullptr);
|
|
static void AppendScannerProfile(
|
|
cmXMLWriter& xml, std::string const& profileID, bool openActionEnabled,
|
|
std::string const& openActionFilePath, bool pParserEnabled,
|
|
std::string const& scannerInfoProviderID,
|
|
std::string const& runActionArguments, std::string const& runActionCommand,
|
|
bool runActionUseDefault, bool sipParserEnabled);
|
|
|
|
static void AppendLinkedResource(cmXMLWriter& xml, std::string const& name,
|
|
std::string const& path, LinkType linkType);
|
|
|
|
static void AppendIncludeDirectories(
|
|
cmXMLWriter& xml, std::vector<std::string> const& includeDirs,
|
|
std::set<std::string>& emittedDirs);
|
|
|
|
static void AddEnvVar(std::ostream& out, char const* envVar,
|
|
cmLocalGenerator& lg);
|
|
|
|
void WriteGroups(SourceGroupVector const& sourceGroups,
|
|
std::string& linkName, cmXMLWriter& xml);
|
|
void CreateLinksToSubprojects(cmXMLWriter& xml, std::string const& baseDir);
|
|
void CreateLinksForTargets(cmXMLWriter& xml);
|
|
|
|
std::vector<std::string> SrcLinkedResources;
|
|
std::set<std::string> Natures;
|
|
std::string HomeDirectory;
|
|
std::string HomeOutputDirectory;
|
|
bool IsOutOfSourceBuild;
|
|
bool GenerateSourceProject;
|
|
bool GenerateLinkedResources;
|
|
bool SupportsVirtualFolders;
|
|
bool SupportsGmakeErrorParser;
|
|
bool SupportsMachO64Parser;
|
|
bool CEnabled;
|
|
bool CXXEnabled;
|
|
};
|