CMake/Source/cmVisualStudio10TargetGenerator.h

183 lines
6.6 KiB
C
Raw Normal View History

Simplify CMake per-source license notices Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
2016-09-27 19:01:08 +00:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmVisualStudioTargetGenerator_h
#define cmVisualStudioTargetGenerator_h
#include <cmConfigure.h>
2016-11-25 21:54:58 +00:00
#include <iosfwd>
#include <map>
#include <set>
#include <string>
#include <vector>
2016-11-25 21:54:58 +00:00
class cmComputeLinkInformation;
class cmCustomCommand;
class cmGeneratedFileStream;
2016-11-25 21:54:58 +00:00
class cmGeneratorTarget;
class cmGlobalVisualStudio10Generator;
class cmLocalVisualStudio7Generator;
2016-11-25 21:54:58 +00:00
class cmMakefile;
class cmSourceFile;
class cmSourceGroup;
class cmVisualStudioGeneratorOptions;
class cmVisualStudio10TargetGenerator
{
public:
2015-10-22 16:27:57 +00:00
cmVisualStudio10TargetGenerator(cmGeneratorTarget* target,
cmGlobalVisualStudio10Generator* gg);
~cmVisualStudio10TargetGenerator();
void Generate();
// used by cmVisualStudioGeneratorOptions
void WritePlatformConfigTag(const char* tag, const std::string& config,
int indentLevel, const char* attribute = 0,
const char* end = 0, std::ostream* strm = 0);
private:
struct ToolSource
{
2014-03-12 22:50:42 +00:00
cmSourceFile const* SourceFile;
bool RelativePath;
};
struct ToolSources : public std::vector<ToolSource>
{
};
struct TargetsFileAndConfigs
{
std::string File;
std::vector<std::string> Configs;
};
std::string ConvertPath(std::string const& path, bool forceRelative);
void ConvertToWindowsSlash(std::string& s);
void WriteString(const char* line, int indentLevel);
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteMSToolConfigurationValues(std::string const& config);
void WriteMSToolConfigurationValuesManaged(std::string const& config);
void WriteHeaderSource(cmSourceFile const* sf);
void WriteExtraSource(cmSourceFile const* sf);
void WriteNsightTegraConfigurationValues(std::string const& config);
void WriteSource(std::string const& tool, cmSourceFile const* sf,
2014-03-12 22:50:42 +00:00
const char* end = 0);
void WriteSources(std::string const& tool,
std::vector<cmSourceFile const*> const&);
void WriteAllSources();
void WriteDotNetReferences();
void WriteDotNetReference(std::string const& ref, std::string const& hint);
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
void WriteWinRTPackageCertificateKeyFile();
void WriteXamlFilesGroup();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
void VerifyNecessaryFiles();
void WriteMissingFiles();
void WriteMissingFilesWP80();
void WriteMissingFilesWP81();
void WriteMissingFilesWS80();
void WriteMissingFilesWS81();
void WriteMissingFilesWS10_0();
void WritePlatformExtensions();
void WriteSinglePlatformExtension(std::string const& extension,
std::string const& version);
void WriteSDKReferences();
void WriteSingleSDKReference(std::string const& extension,
std::string const& version);
void WriteCommonMissingFiles(const std::string& manifestFile);
void WriteTargetSpecificReferences();
void WriteTargetsFileReferences();
bool ComputeClOptions();
bool ComputeClOptions(std::string const& configName);
void WriteClOptions(std::string const& config,
std::vector<std::string> const& includes);
bool ComputeRcOptions();
bool ComputeRcOptions(std::string const& config);
void WriteRCOptions(std::string const& config,
std::vector<std::string> const& includes);
bool ComputeMasmOptions();
bool ComputeMasmOptions(std::string const& config);
void WriteMasmOptions(std::string const& config,
std::vector<std::string> const& includes);
bool ComputeLinkOptions();
bool ComputeLinkOptions(std::string const& config);
bool ComputeLibOptions();
bool ComputeLibOptions(std::string const& config);
void WriteLinkOptions(std::string const& config);
void WriteMidlOptions(std::string const& config,
std::vector<std::string> const& includes);
void WriteAntBuildOptions(std::string const& config);
void OutputLinkIncremental(std::string const& configName);
2014-03-12 22:50:42 +00:00
void WriteCustomRule(cmSourceFile const* source,
cmCustomCommand const& command);
void WriteCustomCommands();
2014-03-12 22:50:42 +00:00
void WriteCustomCommand(cmSourceFile const* sf);
void WriteGroups();
void WriteProjectReferences();
void WriteApplicationTypeSettings();
2014-03-12 22:50:42 +00:00
bool OutputSourceSpecificFlags(cmSourceFile const* source);
void AddLibraries(cmComputeLinkInformation& cli,
std::vector<std::string>& libVec,
std::vector<std::string>& vsTargetVec);
void AddTargetsFileAndConfigPair(std::string const& targetsFile,
std::string const& config);
2009-06-28 13:46:25 +00:00
void WriteLibOptions(std::string const& config);
void WriteManifestOptions(std::string const& config);
2009-07-10 13:12:39 +00:00
void WriteEvents(std::string const& configName);
void WriteEvent(const char* name,
std::vector<cmCustomCommand> const& commands,
2009-07-10 13:12:39 +00:00
std::string const& configName);
void WriteGroupSources(const char* name, ToolSources const& sources,
std::vector<cmSourceGroup>&);
void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed,
const std::vector<cmSourceGroup>& allGroups);
bool IsResxHeader(const std::string& headerFile);
bool IsXamlHeader(const std::string& headerFile);
bool IsXamlSource(const std::string& headerFile);
bool ForceOld(const std::string& source) const;
private:
typedef cmVisualStudioGeneratorOptions Options;
typedef std::map<std::string, Options*> OptionsMap;
OptionsMap ClOptions;
OptionsMap RcOptions;
OptionsMap MasmOptions;
OptionsMap LinkOptions;
std::string PathToProjectFile;
std::string ProjectFileExtension;
enum VsProjectType
{
vcxproj,
csproj
} ProjectType;
bool InSourceBuild;
std::vector<std::string> Configurations;
std::vector<TargetsFileAndConfigs> TargetsFileAndConfigsVec;
cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;
std::string Platform;
std::string GUID;
std::string Name;
bool MSTools;
bool Managed;
bool NsightTegra;
int NsightTegraVersion[4];
bool TargetCompileAsWinRT;
cmGlobalVisualStudio10Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
cmLocalVisualStudio7Generator* LocalGenerator;
2014-03-12 22:50:42 +00:00
std::set<cmSourceFile const*> SourcesVisited;
bool IsMissingFiles;
std::vector<std::string> AddedFiles;
std::string DefaultArtifactDir;
typedef std::map<std::string, ToolSources> ToolSourceMap;
ToolSourceMap Tools;
};
#endif