2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2004-07-05 20:16:33 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2004-07-05 20:16:33 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2004-07-05 20:16:33 +04:00
|
|
|
#include "windows.h" // this must be first to define GetCurrentDirectory
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2004-07-05 20:16:33 +04:00
|
|
|
#include "cmGlobalVisualStudio8Generator.h"
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmGeneratedFileStream.h"
|
2004-07-05 20:16:33 +04:00
|
|
|
#include "cmLocalVisualStudio7Generator.h"
|
|
|
|
#include "cmMakefile.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmSourceFile.h"
|
2012-11-20 16:12:27 +04:00
|
|
|
#include "cmVisualStudioWCEPlatformParser.h"
|
2004-07-05 20:16:33 +04:00
|
|
|
#include "cmake.h"
|
|
|
|
|
2012-11-20 16:12:27 +04:00
|
|
|
static const char vs8generatorName[] = "Visual Studio 8 2005";
|
2012-11-19 22:05:55 +04:00
|
|
|
|
|
|
|
class cmGlobalVisualStudio8Generator::Factory
|
|
|
|
: public cmGlobalGeneratorFactory
|
|
|
|
{
|
|
|
|
public:
|
2015-05-24 12:31:14 +03:00
|
|
|
virtual cmGlobalGenerator*
|
|
|
|
CreateGlobalGenerator(const std::string& name, cmake* cm) const {
|
2014-02-25 02:36:27 +04:00
|
|
|
if(strncmp(name.c_str(), vs8generatorName,
|
|
|
|
sizeof(vs8generatorName) - 1) != 0)
|
2012-11-20 16:12:27 +04:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-02-25 02:36:27 +04:00
|
|
|
const char* p = name.c_str() + sizeof(vs8generatorName) - 1;
|
2012-11-20 16:12:27 +04:00
|
|
|
if(p[0] == '\0')
|
2012-11-19 22:05:55 +04:00
|
|
|
{
|
2015-05-24 12:31:14 +03:00
|
|
|
return new cmGlobalVisualStudio8Generator(cm, name, "");
|
2012-11-20 16:12:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if(p[0] != ' ')
|
|
|
|
{
|
|
|
|
return 0;
|
2012-11-19 22:05:55 +04:00
|
|
|
}
|
2012-11-20 16:12:27 +04:00
|
|
|
|
|
|
|
++p;
|
|
|
|
|
|
|
|
if(!strcmp(p, "Win64"))
|
2012-11-19 22:05:55 +04:00
|
|
|
{
|
2015-05-24 12:31:14 +03:00
|
|
|
return new cmGlobalVisualStudio8Generator(cm, name, "x64");
|
2012-11-19 22:05:55 +04:00
|
|
|
}
|
2012-11-20 16:12:27 +04:00
|
|
|
|
|
|
|
cmVisualStudioWCEPlatformParser parser(p);
|
|
|
|
parser.ParseVersion("8.0");
|
|
|
|
if (!parser.Found())
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-24 12:31:14 +03:00
|
|
|
cmGlobalVisualStudio8Generator* ret =
|
|
|
|
new cmGlobalVisualStudio8Generator(cm, name, p);
|
2012-11-20 16:12:27 +04:00
|
|
|
ret->WindowsCEVersion = parser.GetOSVersion();
|
|
|
|
return ret;
|
2012-11-19 22:05:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void GetDocumentation(cmDocumentationEntry& entry) const {
|
2015-04-07 23:33:05 +03:00
|
|
|
entry.Name = std::string(vs8generatorName) + " [arch]";
|
|
|
|
entry.Brief =
|
|
|
|
"Generates Visual Studio 2005 project files. "
|
|
|
|
"Optional [arch] can be \"Win64\"."
|
|
|
|
;
|
2012-11-19 22:05:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void GetGenerators(std::vector<std::string>& names) const {
|
2012-11-20 16:12:27 +04:00
|
|
|
names.push_back(vs8generatorName);
|
|
|
|
names.push_back(vs8generatorName + std::string(" Win64"));
|
|
|
|
cmVisualStudioWCEPlatformParser parser;
|
|
|
|
parser.ParseVersion("8.0");
|
|
|
|
const std::vector<std::string>& availablePlatforms =
|
|
|
|
parser.GetAvailablePlatforms();
|
|
|
|
for(std::vector<std::string>::const_iterator i =
|
|
|
|
availablePlatforms.begin(); i != availablePlatforms.end(); ++i)
|
|
|
|
{
|
|
|
|
names.push_back("Visual Studio 8 2005 " + *i);
|
|
|
|
}
|
|
|
|
}
|
2015-02-15 22:17:54 +03:00
|
|
|
|
|
|
|
virtual bool SupportsToolset() const { return false; }
|
2012-11-19 22:05:55 +04:00
|
|
|
};
|
|
|
|
|
2008-02-15 19:49:58 +03:00
|
|
|
//----------------------------------------------------------------------------
|
2012-11-19 22:05:55 +04:00
|
|
|
cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
|
|
|
|
{
|
|
|
|
return new Factory;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2015-05-24 12:31:14 +03:00
|
|
|
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(cmake* cm,
|
2014-07-18 00:16:10 +04:00
|
|
|
const std::string& name, const std::string& platformName)
|
2015-05-24 12:31:14 +03:00
|
|
|
: cmGlobalVisualStudio71Generator(cm, platformName)
|
2004-07-05 20:16:33 +04:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
|
2012-11-19 22:05:55 +04:00
|
|
|
this->Name = name;
|
2015-05-17 12:33:04 +03:00
|
|
|
this->ExtraFlagTable = this->GetExtraFlagTableVS8();
|
2015-05-17 12:33:09 +03:00
|
|
|
this->Version = VS8;
|
2016-04-26 15:16:19 +03:00
|
|
|
std::string vc8Express;
|
|
|
|
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
|
|
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\8.0\\Setup\\VC;"
|
|
|
|
"ProductDir", vc8Express, cmSystemTools::KeyWOW64_32);
|
2004-07-05 20:16:33 +04:00
|
|
|
}
|
|
|
|
|
2008-02-15 19:49:58 +03:00
|
|
|
//----------------------------------------------------------------------------
|
2013-11-13 23:27:51 +04:00
|
|
|
std::string cmGlobalVisualStudio8Generator::FindDevEnvCommand()
|
|
|
|
{
|
|
|
|
// First look for VCExpress.
|
|
|
|
std::string vsxcmd;
|
|
|
|
std::string vsxkey =
|
|
|
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\";
|
|
|
|
vsxkey += this->GetIDEVersion();
|
|
|
|
vsxkey += ";InstallDir";
|
|
|
|
if(cmSystemTools::ReadRegistryValue(vsxkey.c_str(), vsxcmd,
|
|
|
|
cmSystemTools::KeyWOW64_32))
|
|
|
|
{
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(vsxcmd);
|
|
|
|
vsxcmd += "/VCExpress.exe";
|
|
|
|
return vsxcmd;
|
|
|
|
}
|
|
|
|
// Now look for devenv.
|
|
|
|
return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand();
|
|
|
|
}
|
|
|
|
|
2012-11-20 14:33:34 +04:00
|
|
|
//----------------------------------------------------------------------------
|
2014-07-18 00:34:21 +04:00
|
|
|
void cmGlobalVisualStudio8Generator
|
|
|
|
::EnableLanguage(std::vector<std::string>const & lang,
|
|
|
|
cmMakefile *mf, bool optional)
|
2012-11-20 14:33:34 +04:00
|
|
|
{
|
2014-08-07 20:58:25 +04:00
|
|
|
for(std::vector<std::string>::const_iterator it = lang.begin();
|
|
|
|
it != lang.end(); ++it)
|
|
|
|
{
|
|
|
|
if(*it == "ASM_MASM")
|
|
|
|
{
|
|
|
|
this->MasmEnabled = true;
|
|
|
|
}
|
|
|
|
}
|
2014-07-18 00:34:21 +04:00
|
|
|
this->AddPlatformDefinitions(mf);
|
|
|
|
cmGlobalVisualStudio7Generator::EnableLanguage(lang, mf, optional);
|
|
|
|
}
|
2012-11-20 16:37:50 +04:00
|
|
|
|
2014-07-18 00:34:21 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
|
|
|
|
{
|
2012-11-20 16:37:50 +04:00
|
|
|
if(this->TargetsWindowsCE())
|
|
|
|
{
|
|
|
|
mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
|
|
|
|
this->WindowsCEVersion.c_str());
|
|
|
|
}
|
2012-11-20 14:33:34 +04:00
|
|
|
}
|
|
|
|
|
2014-09-05 22:53:01 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p,
|
|
|
|
cmMakefile* mf)
|
|
|
|
{
|
|
|
|
if(this->DefaultPlatformName == "Win32")
|
|
|
|
{
|
|
|
|
this->GeneratorPlatform = p;
|
|
|
|
return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform("", mf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform(p, mf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-15 19:49:58 +03:00
|
|
|
//----------------------------------------------------------------------------
|
2004-07-05 20:16:33 +04:00
|
|
|
// ouput standard header for dsw file
|
|
|
|
void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout)
|
|
|
|
{
|
|
|
|
fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n";
|
2005-11-22 21:37:42 +03:00
|
|
|
fout << "# Visual Studio 2005\n";
|
2004-07-05 20:16:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2006-05-11 19:47:03 +04:00
|
|
|
void cmGlobalVisualStudio8Generator
|
2012-11-19 19:42:24 +04:00
|
|
|
::GetDocumentation(cmDocumentationEntry& entry)
|
2004-07-05 20:16:33 +04:00
|
|
|
{
|
2012-11-19 19:42:24 +04:00
|
|
|
entry.Name = cmGlobalVisualStudio8Generator::GetActualName();
|
2012-09-19 20:08:17 +04:00
|
|
|
entry.Brief = "Generates Visual Studio 8 2005 project files.";
|
2004-07-05 20:16:33 +04:00
|
|
|
}
|
2005-12-13 22:21:28 +03:00
|
|
|
|
2006-05-06 04:54:53 +04:00
|
|
|
//----------------------------------------------------------------------------
|
2005-12-13 22:21:28 +03:00
|
|
|
void cmGlobalVisualStudio8Generator::Configure()
|
|
|
|
{
|
|
|
|
this->cmGlobalVisualStudio7Generator::Configure();
|
|
|
|
}
|
|
|
|
|
2016-04-26 15:22:27 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmGlobalVisualStudio8Generator::UseFolderProperty()
|
|
|
|
{
|
|
|
|
return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty();
|
|
|
|
}
|
|
|
|
|
2007-11-16 15:01:58 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
std::string cmGlobalVisualStudio8Generator::GetUserMacrosDirectory()
|
|
|
|
{
|
2008-01-02 23:53:28 +03:00
|
|
|
// Some VS8 sp0 versions cannot run macros.
|
|
|
|
// See http://support.microsoft.com/kb/928209
|
|
|
|
const char* vc8sp1Registry =
|
2008-01-02 23:55:18 +03:00
|
|
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\"
|
|
|
|
"InstalledProducts\\KB926601;";
|
2008-01-02 23:53:28 +03:00
|
|
|
const char* vc8exSP1Registry =
|
2008-01-02 23:55:18 +03:00
|
|
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\"
|
|
|
|
"InstalledProducts\\KB926748;";
|
2008-01-02 23:53:28 +03:00
|
|
|
std::string vc8sp1;
|
|
|
|
if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) &&
|
|
|
|
!cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1))
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2007-11-16 15:01:58 +03:00
|
|
|
std::string base;
|
|
|
|
std::string path;
|
|
|
|
|
|
|
|
// base begins with the VisualStudioProjectsLocation reg value...
|
|
|
|
if (cmSystemTools::ReadRegistryValue(
|
2007-11-20 19:10:11 +03:00
|
|
|
"HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;"
|
|
|
|
"VisualStudioProjectsLocation",
|
2007-11-16 15:01:58 +03:00
|
|
|
base))
|
|
|
|
{
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(base);
|
|
|
|
|
|
|
|
// 8.0 macros folder:
|
|
|
|
path = base + "/VSMacros80";
|
|
|
|
}
|
|
|
|
|
|
|
|
// path is (correctly) still empty if we did not read the base value from
|
|
|
|
// the Registry value
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
2008-02-15 19:49:58 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase()
|
|
|
|
{
|
|
|
|
return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros";
|
|
|
|
}
|
|
|
|
|
2005-12-13 22:21:28 +03:00
|
|
|
//----------------------------------------------------------------------------
|
2013-08-27 22:15:49 +04:00
|
|
|
bool cmGlobalVisualStudio8Generator::AddCheckTarget()
|
2005-12-13 22:21:28 +03:00
|
|
|
{
|
|
|
|
// Add a special target on which all other targets depend that
|
|
|
|
// checks the build system and optionally re-runs CMake.
|
2006-02-08 18:58:36 +03:00
|
|
|
const char* no_working_directory = 0;
|
2005-12-13 22:21:28 +03:00
|
|
|
std::vector<std::string> no_depends;
|
2009-10-19 18:47:34 +04:00
|
|
|
std::vector<cmLocalGenerator*> const& generators = this->LocalGenerators;
|
|
|
|
cmLocalVisualStudio7Generator* lg =
|
|
|
|
static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
|
|
|
|
cmMakefile* mf = lg->GetMakefile();
|
|
|
|
|
|
|
|
// Skip the target if no regeneration is to be done.
|
|
|
|
if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
|
|
|
|
{
|
2013-08-27 22:15:49 +04:00
|
|
|
return false;
|
2009-10-19 18:47:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
cmCustomCommandLines noCommandLines;
|
|
|
|
cmTarget* tgt =
|
|
|
|
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
|
|
|
|
no_working_directory, no_depends,
|
|
|
|
noCommandLines);
|
2015-08-05 01:00:53 +03:00
|
|
|
|
2015-07-28 19:57:29 +03:00
|
|
|
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
|
2015-10-18 17:53:00 +03:00
|
|
|
lg->AddGeneratorTarget(gt);
|
2009-10-19 18:47:34 +04:00
|
|
|
|
2010-09-03 21:53:22 +04:00
|
|
|
// Organize in the "predefined targets" folder:
|
|
|
|
//
|
|
|
|
if (this->UseFolderProperty())
|
|
|
|
{
|
|
|
|
tgt->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
|
|
|
|
}
|
|
|
|
|
2009-10-19 18:47:34 +04:00
|
|
|
// Create a list of all stamp files for this project.
|
|
|
|
std::vector<std::string> stamps;
|
|
|
|
std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
|
|
|
|
stampList += "generate.stamp.list";
|
|
|
|
{
|
|
|
|
std::string stampListFile =
|
2015-04-16 22:33:09 +03:00
|
|
|
generators[0]->GetMakefile()->GetCurrentBinaryDirectory();
|
2009-10-19 18:47:34 +04:00
|
|
|
stampListFile += "/";
|
|
|
|
stampListFile += stampList;
|
|
|
|
std::string stampFile;
|
|
|
|
cmGeneratedFileStream fout(stampListFile.c_str());
|
|
|
|
for(std::vector<cmLocalGenerator*>::const_iterator
|
|
|
|
gi = generators.begin(); gi != generators.end(); ++gi)
|
2005-12-13 22:21:28 +03:00
|
|
|
{
|
2015-04-16 22:33:09 +03:00
|
|
|
stampFile = (*gi)->GetMakefile()->GetCurrentBinaryDirectory();
|
2009-10-19 18:47:34 +04:00
|
|
|
stampFile += "/";
|
|
|
|
stampFile += cmake::GetCMakeFilesDirectoryPostSlash();
|
|
|
|
stampFile += "generate.stamp";
|
|
|
|
fout << stampFile << "\n";
|
|
|
|
stamps.push_back(stampFile);
|
2005-12-13 22:21:28 +03:00
|
|
|
}
|
2009-10-19 18:47:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add a custom rule to re-run CMake if any input files changed.
|
|
|
|
{
|
|
|
|
// Collect the input files used to generate all targets in this
|
|
|
|
// project.
|
|
|
|
std::vector<std::string> listFiles;
|
|
|
|
for(unsigned int j = 0; j < generators.size(); ++j)
|
|
|
|
{
|
|
|
|
cmMakefile* lmf = generators[j]->GetMakefile();
|
|
|
|
listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
|
|
|
|
lmf->GetListFiles().end());
|
|
|
|
}
|
|
|
|
// Sort the list of input files and remove duplicates.
|
|
|
|
std::sort(listFiles.begin(), listFiles.end(),
|
|
|
|
std::less<std::string>());
|
|
|
|
std::vector<std::string>::iterator new_end =
|
|
|
|
std::unique(listFiles.begin(), listFiles.end());
|
|
|
|
listFiles.erase(new_end, listFiles.end());
|
|
|
|
|
|
|
|
// Create a rule to re-run CMake.
|
|
|
|
std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
|
|
|
|
stampName += "generate.stamp";
|
|
|
|
cmCustomCommandLine commandLine;
|
2015-05-20 16:10:52 +03:00
|
|
|
commandLine.push_back(cmSystemTools::GetCMakeCommand());
|
2009-10-19 18:47:34 +04:00
|
|
|
std::string argH = "-H";
|
2015-10-07 02:17:48 +03:00
|
|
|
argH += lg->GetSourceDirectory();
|
2009-10-19 18:47:34 +04:00
|
|
|
commandLine.push_back(argH);
|
|
|
|
std::string argB = "-B";
|
2015-10-07 02:17:48 +03:00
|
|
|
argB += lg->GetBinaryDirectory();
|
2009-10-19 18:47:34 +04:00
|
|
|
commandLine.push_back(argB);
|
|
|
|
commandLine.push_back("--check-stamp-list");
|
|
|
|
commandLine.push_back(stampList.c_str());
|
|
|
|
commandLine.push_back("--vs-solution-file");
|
|
|
|
commandLine.push_back("\"$(SolutionPath)\"");
|
|
|
|
cmCustomCommandLines commandLines;
|
|
|
|
commandLines.push_back(commandLine);
|
|
|
|
|
|
|
|
// Add the rule. Note that we cannot use the CMakeLists.txt
|
|
|
|
// file as the main dependency because it would get
|
|
|
|
// overwritten by the CreateVCProjBuildRule.
|
|
|
|
// (this could be avoided with per-target source files)
|
2014-02-25 05:32:55 +04:00
|
|
|
std::string no_main_dependency = "";
|
2014-11-14 02:54:52 +03:00
|
|
|
std::vector<std::string> no_byproducts;
|
2012-04-18 22:42:43 +04:00
|
|
|
if(cmSourceFile* file =
|
|
|
|
mf->AddCustomCommandToOutput(
|
2014-11-14 02:54:52 +03:00
|
|
|
stamps, no_byproducts, listFiles,
|
2012-04-18 22:42:43 +04:00
|
|
|
no_main_dependency, commandLines, "Checking Build System",
|
|
|
|
no_working_directory, true))
|
2009-10-19 18:47:34 +04:00
|
|
|
{
|
2015-08-29 19:10:19 +03:00
|
|
|
gt->AddSource(file->GetFullPath());
|
2009-10-19 18:47:34 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
|
|
|
|
}
|
|
|
|
}
|
2013-08-27 22:15:49 +04:00
|
|
|
|
|
|
|
return true;
|
2009-10-19 18:47:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2015-09-15 21:47:35 +03:00
|
|
|
void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
|
2009-10-19 18:47:34 +04:00
|
|
|
{
|
2015-09-15 21:47:35 +03:00
|
|
|
cmGlobalVisualStudio7Generator::AddExtraIDETargets();
|
2013-08-27 22:15:49 +04:00
|
|
|
if(this->AddCheckTarget())
|
2005-12-13 22:21:28 +03:00
|
|
|
{
|
2015-10-25 14:22:51 +03:00
|
|
|
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
2005-12-13 22:21:28 +03:00
|
|
|
{
|
2015-10-25 14:22:51 +03:00
|
|
|
std::vector<cmGeneratorTarget*> tgts =
|
|
|
|
this->LocalGenerators[i]->GetGeneratorTargets();
|
|
|
|
// All targets depend on the build-system check target.
|
|
|
|
for(std::vector<cmGeneratorTarget*>::iterator ti = tgts.begin();
|
|
|
|
ti != tgts.end(); ++ti)
|
2013-08-27 22:15:49 +04:00
|
|
|
{
|
2015-10-25 14:22:51 +03:00
|
|
|
if((*ti)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
|
|
|
|
{
|
|
|
|
(*ti)->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
|
|
|
|
}
|
2013-08-27 22:15:49 +04:00
|
|
|
}
|
2005-12-13 22:21:28 +03:00
|
|
|
}
|
|
|
|
}
|
2006-02-14 23:35:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalVisualStudio8Generator
|
2015-05-20 20:55:21 +03:00
|
|
|
::WriteSolutionConfigurations(std::ostream& fout,
|
|
|
|
std::vector<std::string> const& configs)
|
2006-02-14 23:35:34 +03:00
|
|
|
{
|
|
|
|
fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
|
2015-05-20 20:55:21 +03:00
|
|
|
for(std::vector<std::string>::const_iterator i = configs.begin();
|
|
|
|
i != configs.end(); ++i)
|
2006-02-14 23:35:34 +03:00
|
|
|
{
|
2010-09-10 22:42:09 +04:00
|
|
|
fout << "\t\t" << *i << "|" << this->GetPlatformName()
|
|
|
|
<< " = " << *i << "|" << this->GetPlatformName() << "\n";
|
2006-02-14 23:35:34 +03:00
|
|
|
}
|
|
|
|
fout << "\tEndGlobalSection\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmGlobalVisualStudio8Generator
|
2012-10-11 23:57:22 +04:00
|
|
|
::WriteProjectConfigurations(
|
2015-10-08 01:21:51 +03:00
|
|
|
std::ostream& fout, const std::string& name, cmState::TargetType type,
|
2015-05-20 20:55:21 +03:00
|
|
|
std::vector<std::string> const& configs,
|
2012-10-11 23:57:22 +04:00
|
|
|
const std::set<std::string>& configsPartOfDefaultBuild,
|
2014-02-25 02:36:27 +04:00
|
|
|
std::string const& platformMapping)
|
2006-02-14 23:35:34 +03:00
|
|
|
{
|
|
|
|
std::string guid = this->GetGUID(name);
|
2015-05-20 20:55:21 +03:00
|
|
|
for(std::vector<std::string>::const_iterator i = configs.begin();
|
|
|
|
i != configs.end(); ++i)
|
2006-02-14 23:35:34 +03:00
|
|
|
{
|
2006-09-29 00:40:35 +04:00
|
|
|
fout << "\t\t{" << guid << "}." << *i
|
2012-04-16 18:07:19 +04:00
|
|
|
<< "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
|
2014-02-25 02:36:27 +04:00
|
|
|
<< (!platformMapping.empty()?
|
|
|
|
platformMapping : this->GetPlatformName())
|
2012-04-19 18:06:59 +04:00
|
|
|
<< "\n";
|
2012-10-11 23:57:22 +04:00
|
|
|
std::set<std::string>::const_iterator
|
|
|
|
ci = configsPartOfDefaultBuild.find(*i);
|
|
|
|
if(!(ci == configsPartOfDefaultBuild.end()))
|
2006-02-14 23:35:34 +03:00
|
|
|
{
|
2006-09-29 00:40:35 +04:00
|
|
|
fout << "\t\t{" << guid << "}." << *i
|
2012-04-16 18:07:19 +04:00
|
|
|
<< "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"
|
2014-02-25 02:36:27 +04:00
|
|
|
<< (!platformMapping.empty()?
|
|
|
|
platformMapping : this->GetPlatformName())
|
2012-04-19 18:06:59 +04:00
|
|
|
<< "\n";
|
2006-02-14 23:35:34 +03:00
|
|
|
}
|
2014-07-29 19:28:02 +04:00
|
|
|
if(this->NeedsDeploy(type))
|
2012-09-14 14:06:57 +04:00
|
|
|
{
|
|
|
|
fout << "\t\t{" << guid << "}." << *i
|
|
|
|
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
|
2014-02-25 02:36:27 +04:00
|
|
|
<< (!platformMapping.empty()?
|
|
|
|
platformMapping : this->GetPlatformName())
|
2012-09-14 14:06:57 +04:00
|
|
|
<< "\n";
|
|
|
|
}
|
2006-02-14 23:35:34 +03:00
|
|
|
}
|
2005-12-13 22:21:28 +03:00
|
|
|
}
|
2007-03-12 19:35:11 +03:00
|
|
|
|
2014-07-29 19:28:02 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool
|
2015-10-08 01:21:51 +03:00
|
|
|
cmGlobalVisualStudio8Generator::NeedsDeploy(cmState::TargetType type) const
|
2014-07-29 19:28:02 +04:00
|
|
|
{
|
2015-10-08 01:21:51 +03:00
|
|
|
bool needsDeploy = (type == cmState::EXECUTABLE ||
|
|
|
|
type == cmState::SHARED_LIBRARY);
|
2014-07-29 19:28:02 +04:00
|
|
|
return this->TargetsWindowsCE() && needsDeploy;
|
|
|
|
}
|
|
|
|
|
2010-12-01 19:43:30 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
|
|
|
|
{
|
|
|
|
// Skip over the cmGlobalVisualStudioGenerator implementation!
|
|
|
|
// We do not need the support that VS <= 7.1 needs.
|
|
|
|
return this->cmGlobalGenerator::ComputeTargetDepends();
|
|
|
|
}
|
|
|
|
|
2010-08-20 22:07:02 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
|
2015-10-23 19:26:44 +03:00
|
|
|
std::ostream& fout, const std::string&, const char*,
|
|
|
|
cmGeneratorTarget const* gt)
|
2010-08-20 22:07:02 +04:00
|
|
|
{
|
2015-06-06 14:08:17 +03:00
|
|
|
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
|
2015-09-22 17:14:49 +03:00
|
|
|
OrderedTargetDependSet depends(unordered, std::string());
|
2010-08-20 22:07:02 +04:00
|
|
|
for(OrderedTargetDependSet::const_iterator i = depends.begin();
|
|
|
|
i != depends.end(); ++i)
|
|
|
|
{
|
2015-10-08 01:21:51 +03:00
|
|
|
if((*i)->GetType() == cmState::INTERFACE_LIBRARY)
|
2012-11-02 18:47:40 +04:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2014-02-07 02:31:47 +04:00
|
|
|
std::string guid = this->GetGUID((*i)->GetName().c_str());
|
2010-08-20 22:07:02 +04:00
|
|
|
fout << "\t\t{" << guid << "} = {" << guid << "}\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-21 00:38:37 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
|
2015-10-23 19:26:48 +03:00
|
|
|
cmGeneratorTarget *target)
|
2009-10-21 00:38:37 +04:00
|
|
|
{
|
|
|
|
// Look for utility dependencies that magically link.
|
2014-02-10 09:21:34 +04:00
|
|
|
for(std::set<std::string>::const_iterator ui =
|
2015-10-23 02:01:46 +03:00
|
|
|
target->GetUtilities().begin();
|
|
|
|
ui != target->GetUtilities().end(); ++ui)
|
2009-10-21 00:38:37 +04:00
|
|
|
{
|
2015-10-23 19:26:48 +03:00
|
|
|
if(cmGeneratorTarget* depTarget =
|
|
|
|
target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str()))
|
2009-10-21 00:38:37 +04:00
|
|
|
{
|
2015-10-08 01:21:51 +03:00
|
|
|
if(depTarget->GetType() != cmState::INTERFACE_LIBRARY
|
2013-11-20 15:44:04 +04:00
|
|
|
&& depTarget->GetProperty("EXTERNAL_MSPROJECT"))
|
2009-10-21 00:38:37 +04:00
|
|
|
{
|
|
|
|
// This utility dependency names an external .vcproj target.
|
|
|
|
// We use LinkLibraryDependencies="true" to link to it without
|
|
|
|
// predicting the .lib file location or name.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-03-12 19:35:11 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
static cmVS7FlagTable cmVS8ExtraFlagTable[] =
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2007-12-18 01:28:23 +03:00
|
|
|
{"CallingConvention", "Gd", "cdecl", "0", 0 },
|
|
|
|
{"CallingConvention", "Gr", "fastcall", "1", 0 },
|
|
|
|
{"CallingConvention", "Gz", "stdcall", "2", 0 },
|
|
|
|
|
2007-12-18 16:53:10 +03:00
|
|
|
{"Detect64BitPortabilityProblems", "Wp64",
|
|
|
|
"Detect 64Bit Portability Problems", "true", 0 },
|
2007-12-18 01:28:23 +03:00
|
|
|
{"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 },
|
|
|
|
{"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 },
|
2007-03-12 19:35:11 +03:00
|
|
|
// Precompiled header and related options. Note that the
|
|
|
|
// UsePrecompiledHeader entries are marked as "Continue" so that the
|
|
|
|
// corresponding PrecompiledHeaderThrough entry can be found.
|
|
|
|
{"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2",
|
|
|
|
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
|
|
|
|
{"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
|
|
|
|
cmVS7FlagTable::UserValueRequired},
|
|
|
|
// There is no YX option in the VS8 IDE.
|
2007-11-16 19:01:23 +03:00
|
|
|
|
|
|
|
// Exception handling mode. If no entries match, it will be FALSE.
|
|
|
|
{"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0},
|
|
|
|
{"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0},
|
|
|
|
{"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0},
|
|
|
|
|
2010-03-09 22:59:01 +03:00
|
|
|
{"EnablePREfast", "analyze", "", "true", 0},
|
|
|
|
{"EnablePREfast", "analyze-", "", "false", 0},
|
|
|
|
|
|
|
|
// Language options
|
|
|
|
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t",
|
|
|
|
"wchar_t is a built-in type", "true", 0},
|
|
|
|
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t-",
|
|
|
|
"wchar_t is not a built-in type", "false", 0},
|
2011-02-01 21:32:43 +03:00
|
|
|
|
2007-03-12 19:35:11 +03:00
|
|
|
{0,0,0,0,0}
|
|
|
|
};
|
2009-07-29 19:28:55 +04:00
|
|
|
cmIDEFlagTable const* cmGlobalVisualStudio8Generator::GetExtraFlagTableVS8()
|
2007-03-12 19:35:11 +03:00
|
|
|
{
|
|
|
|
return cmVS8ExtraFlagTable;
|
|
|
|
}
|