ENH: rename DSWMakefile and DSPMakefile to DSWWriter and DSPWriter
This commit is contained in:
parent
b31fcf1cac
commit
38a164d254
|
@ -1,655 +0,0 @@
|
||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: Insight Segmentation & Registration Toolkit
|
|
||||||
Module: $RCSfile$
|
|
||||||
Language: C++
|
|
||||||
Date: $Date$
|
|
||||||
Version: $Revision$
|
|
||||||
|
|
||||||
Copyright (c) 2001 Insight Consortium
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
* The name of the Insight Consortium, nor the names of any consortium members,
|
|
||||||
nor of any contributors, may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
* Modified source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
#include "cmDSPMakefile.h"
|
|
||||||
#include "cmStandardIncludes.h"
|
|
||||||
#include "cmSystemTools.h"
|
|
||||||
#include "cmRegularExpression.h"
|
|
||||||
#include "cmCacheManager.h"
|
|
||||||
|
|
||||||
cmDSPMakefile::~cmDSPMakefile()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cmDSPMakefile::cmDSPMakefile(cmMakefile*mf)
|
|
||||||
{
|
|
||||||
m_Makefile = mf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmDSPMakefile::OutputDSPFile()
|
|
||||||
{
|
|
||||||
// If not an in source build, then create the output directory
|
|
||||||
if(strcmp(m_Makefile->GetStartOutputDirectory(),
|
|
||||||
m_Makefile->GetHomeDirectory()) != 0)
|
|
||||||
{
|
|
||||||
if(!cmSystemTools::MakeDirectory(m_Makefile->GetStartOutputDirectory()))
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Error creating directory ",
|
|
||||||
m_Makefile->GetStartOutputDirectory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup /I and /LIBPATH options for the resulting DSP file
|
|
||||||
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
|
|
||||||
std::vector<std::string>::iterator i;
|
|
||||||
for(i = includes.begin(); i != includes.end(); ++i)
|
|
||||||
{
|
|
||||||
m_IncludeOptions += "/I \"";
|
|
||||||
// watch for network paths, MSVC can't seem to load //
|
|
||||||
if (strlen(i->c_str()) > 2 && i->c_str()[0] == '/' &&
|
|
||||||
i->c_str()[1] == '/')
|
|
||||||
{
|
|
||||||
m_IncludeOptions += "\\\\";
|
|
||||||
m_IncludeOptions += (i->c_str() + 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_IncludeOptions += *i;
|
|
||||||
}
|
|
||||||
m_IncludeOptions += "\" ";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the DSP or set of DSP's for libraries and executables
|
|
||||||
m_LibraryBuildType = STATIC_LIBRARY;
|
|
||||||
if(cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"))
|
|
||||||
{
|
|
||||||
m_LibraryBuildType = DLL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clear project names
|
|
||||||
m_CreatedProjectNames.clear();
|
|
||||||
|
|
||||||
// build any targets
|
|
||||||
cmTargets &tgts = m_Makefile->GetTargets();
|
|
||||||
for(cmTargets::iterator l = tgts.begin();
|
|
||||||
l != tgts.end(); l++)
|
|
||||||
{
|
|
||||||
switch(l->second.GetType())
|
|
||||||
{
|
|
||||||
case cmTarget::LIBRARY:
|
|
||||||
this->SetBuildType(m_LibraryBuildType, l->first.c_str());
|
|
||||||
break;
|
|
||||||
case cmTarget::EXECUTABLE:
|
|
||||||
this->SetBuildType(EXECUTABLE,l->first.c_str());
|
|
||||||
break;
|
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
this->SetBuildType(WIN32_EXECUTABLE,l->first.c_str());
|
|
||||||
break;
|
|
||||||
case cmTarget::UTILITY:
|
|
||||||
this->SetBuildType(UTILITY, l->first.c_str());
|
|
||||||
break;
|
|
||||||
case cmTarget::INSTALL:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cmSystemTools::Error("Bad target type", l->first.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (l->second.GetType() != cmTarget::INSTALL)
|
|
||||||
{
|
|
||||||
this->CreateSingleDSP(l->first.c_str(),l->second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
|
|
||||||
{
|
|
||||||
std::string fname;
|
|
||||||
fname = m_Makefile->GetStartOutputDirectory();
|
|
||||||
fname += "/";
|
|
||||||
fname += lname;
|
|
||||||
fname += ".dsp";
|
|
||||||
std::string pname = lname;
|
|
||||||
m_CreatedProjectNames.push_back(pname);
|
|
||||||
std::ofstream fout(fname.c_str());
|
|
||||||
if(!fout)
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Error Writing ", fname.c_str());
|
|
||||||
}
|
|
||||||
this->WriteDSPFile(fout,lname,target);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
|
|
||||||
{
|
|
||||||
std::string dspname = *(m_CreatedProjectNames.end()-1);
|
|
||||||
dspname += ".dsp";
|
|
||||||
std::string makefileIn = "\"";
|
|
||||||
makefileIn += m_Makefile->GetStartDirectory();
|
|
||||||
makefileIn += "/";
|
|
||||||
makefileIn += "CMakeLists.txt\"";
|
|
||||||
std::string dsprule = "${CMAKE_COMMAND} ";
|
|
||||||
dsprule += makefileIn;
|
|
||||||
dsprule += " -DSP -H\"";
|
|
||||||
dsprule += m_Makefile->GetHomeDirectory();
|
|
||||||
dsprule += "\" -S\"";
|
|
||||||
dsprule += m_Makefile->GetStartDirectory();
|
|
||||||
dsprule += "\" -O\"";
|
|
||||||
dsprule += m_Makefile->GetStartOutputDirectory();
|
|
||||||
dsprule += "\" -B\"";
|
|
||||||
dsprule += m_Makefile->GetHomeOutputDirectory();
|
|
||||||
dsprule += "\"";
|
|
||||||
m_Makefile->ExpandVariablesInString(dsprule);
|
|
||||||
|
|
||||||
std::vector<std::string> outputs;
|
|
||||||
outputs.push_back(dspname);
|
|
||||||
cmCustomCommand cc(makefileIn.c_str(), dsprule.c_str(),
|
|
||||||
m_Makefile->GetListFiles(),
|
|
||||||
outputs);
|
|
||||||
sourceGroup.AddCustomCommand(cc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
|
||||||
const char *libName,
|
|
||||||
cmTarget &target)
|
|
||||||
{
|
|
||||||
// Write the DSP file's header.
|
|
||||||
this->WriteDSPHeader(fout, libName, target);
|
|
||||||
|
|
||||||
// We may be modifying the source groups temporarily, so make a copy.
|
|
||||||
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
|
|
||||||
|
|
||||||
// get the classes from the source lists then add them to the groups
|
|
||||||
std::vector<cmSourceFile> classes = target.GetSourceFiles();
|
|
||||||
for(std::vector<cmSourceFile>::iterator i = classes.begin();
|
|
||||||
i != classes.end(); i++)
|
|
||||||
{
|
|
||||||
if(!i->IsAHeaderFileOnly())
|
|
||||||
{
|
|
||||||
// Add the file to the list of sources.
|
|
||||||
std::string source = i->GetFullPath();
|
|
||||||
cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(),
|
|
||||||
sourceGroups);
|
|
||||||
sourceGroup.AddSource(source.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add any custom rules to the source groups
|
|
||||||
for (std::vector<cmCustomCommand>::const_iterator cr =
|
|
||||||
target.GetCustomCommands().begin();
|
|
||||||
cr != target.GetCustomCommands().end(); ++cr)
|
|
||||||
{
|
|
||||||
cmSourceGroup& sourceGroup =
|
|
||||||
m_Makefile->FindSourceGroup(cr->GetSourceName().c_str(),
|
|
||||||
sourceGroups);
|
|
||||||
cmCustomCommand cc(*cr);
|
|
||||||
cc.ExpandVariables(*m_Makefile);
|
|
||||||
sourceGroup.AddCustomCommand(cc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the group in which the CMakeLists.txt source belongs, and add
|
|
||||||
// the rule to generate this DSP file.
|
|
||||||
for(std::vector<cmSourceGroup>::reverse_iterator sg = sourceGroups.rbegin();
|
|
||||||
sg != sourceGroups.rend(); ++sg)
|
|
||||||
{
|
|
||||||
if(sg->Matches("CMakeLists.txt"))
|
|
||||||
{
|
|
||||||
this->AddDSPBuildRule(*sg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop through every source group.
|
|
||||||
for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin();
|
|
||||||
sg != sourceGroups.end(); ++sg)
|
|
||||||
{
|
|
||||||
const cmSourceGroup::BuildRules& buildRules = sg->GetBuildRules();
|
|
||||||
// If the group is empty, don't write it at all.
|
|
||||||
if(buildRules.empty())
|
|
||||||
{ continue; }
|
|
||||||
|
|
||||||
// If the group has a name, write the header.
|
|
||||||
std::string name = sg->GetName();
|
|
||||||
if(name != "")
|
|
||||||
{
|
|
||||||
this->WriteDSPBeginGroup(fout, name.c_str(), "");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop through each build rule in the source group.
|
|
||||||
for(cmSourceGroup::BuildRules::const_iterator cc =
|
|
||||||
buildRules.begin(); cc != buildRules.end(); ++ cc)
|
|
||||||
{
|
|
||||||
std::string source = cc->first;
|
|
||||||
const cmSourceGroup::Commands& commands = cc->second;
|
|
||||||
|
|
||||||
fout << "# Begin Source File\n\n";\
|
|
||||||
|
|
||||||
// Tell MS-Dev what the source is. If the compiler knows how to
|
|
||||||
// build it, then it will.
|
|
||||||
fout << "SOURCE=" << source.c_str() << "\n\n";
|
|
||||||
if (!commands.empty())
|
|
||||||
{
|
|
||||||
// Loop through every custom command generating code from the
|
|
||||||
// current source.
|
|
||||||
// build up the depends and outputs and commands
|
|
||||||
cmSourceGroup::CommandFiles totalCommand;
|
|
||||||
std::string totalCommandStr;
|
|
||||||
for(cmSourceGroup::Commands::const_iterator c = commands.begin();
|
|
||||||
c != commands.end(); ++c)
|
|
||||||
{
|
|
||||||
totalCommandStr += "\n\t";
|
|
||||||
totalCommandStr += c->first;
|
|
||||||
totalCommand.Merge(c->second);
|
|
||||||
}
|
|
||||||
// Create a dummy file with the name of the source if it does
|
|
||||||
// not exist
|
|
||||||
if(totalCommand.m_Outputs.empty())
|
|
||||||
{
|
|
||||||
std::string dummyFile = m_Makefile->GetStartOutputDirectory();
|
|
||||||
dummyFile += "/";
|
|
||||||
dummyFile += source;
|
|
||||||
if(!cmSystemTools::FileExists(dummyFile.c_str()))
|
|
||||||
{
|
|
||||||
std::ofstream fout(dummyFile.c_str());
|
|
||||||
fout << "Dummy file created by cmake as unused source for utility command.\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->WriteCustomRule(fout, source.c_str(), totalCommandStr.c_str(),
|
|
||||||
totalCommand.m_Depends,
|
|
||||||
totalCommand.m_Outputs);
|
|
||||||
}
|
|
||||||
fout << "# End Source File\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the group has a name, write the footer.
|
|
||||||
if(name != "")
|
|
||||||
{
|
|
||||||
this->WriteDSPEndGroup(fout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the DSP file's footer.
|
|
||||||
this->WriteDSPFooter(fout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteCustomRule(std::ostream& fout,
|
|
||||||
const char* source,
|
|
||||||
const char* command,
|
|
||||||
const std::set<std::string>& depends,
|
|
||||||
const std::set<std::string>& outputs)
|
|
||||||
{
|
|
||||||
std::vector<std::string>::iterator i;
|
|
||||||
for(i = m_Configurations.begin(); i != m_Configurations.end(); ++i)
|
|
||||||
{
|
|
||||||
if (i == m_Configurations.begin())
|
|
||||||
{
|
|
||||||
fout << "!IF \"$(CFG)\" == " << i->c_str() << std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fout << "!ELSEIF \"$(CFG)\" == " << i->c_str() << std::endl;
|
|
||||||
}
|
|
||||||
fout << "# Begin Custom Build\n\n";
|
|
||||||
|
|
||||||
// Write out the dependencies (this seems to be the only way to
|
|
||||||
// get VC6 to actually take these dependencies into account.
|
|
||||||
fout << "USERDEP__HACK= ";
|
|
||||||
for(std::set<std::string>::const_iterator d = depends.begin();
|
|
||||||
d != depends.end(); ++d)
|
|
||||||
{
|
|
||||||
fout << " \"" << d->c_str() << "\"";
|
|
||||||
}
|
|
||||||
fout << "\n";
|
|
||||||
|
|
||||||
fout << "# Begin Custom Build\n\n";
|
|
||||||
if(outputs.size() == 0)
|
|
||||||
{
|
|
||||||
fout << source << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"";
|
|
||||||
fout << command << "\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write a rule for every output generated by this command.
|
|
||||||
for(std::set<std::string>::const_iterator output = outputs.begin();
|
|
||||||
output != outputs.end(); ++output)
|
|
||||||
{
|
|
||||||
fout << "\"" << output->c_str()
|
|
||||||
<< "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"";
|
|
||||||
// Write out all the dependencies for this rule.
|
|
||||||
for(std::set<std::string>::const_iterator d = depends.begin();
|
|
||||||
d != depends.end(); ++d)
|
|
||||||
{
|
|
||||||
fout << " \"" << d->c_str() << "\"";
|
|
||||||
}
|
|
||||||
fout << command << "\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
fout << "# End Custom Build\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
fout << "!ENDIF\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPBeginGroup(std::ostream& fout,
|
|
||||||
const char* group,
|
|
||||||
const char* filter)
|
|
||||||
{
|
|
||||||
fout << "# Begin Group \"" << group << "\"\n"
|
|
||||||
"# PROP Default_Filter \"" << filter << "\"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPEndGroup(std::ostream& fout)
|
|
||||||
{
|
|
||||||
fout << "# End Group\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::SetBuildType(BuildType b, const char *libName)
|
|
||||||
{
|
|
||||||
std::string root= cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
|
|
||||||
const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
|
|
||||||
|
|
||||||
if( def)
|
|
||||||
{
|
|
||||||
root = def;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
root += "/Templates";
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(b)
|
|
||||||
{
|
|
||||||
case STATIC_LIBRARY:
|
|
||||||
m_DSPHeaderTemplate = root;
|
|
||||||
m_DSPHeaderTemplate += "/staticLibHeader.dsptemplate";
|
|
||||||
m_DSPFooterTemplate = root;
|
|
||||||
m_DSPFooterTemplate += "/staticLibFooter.dsptemplate";
|
|
||||||
break;
|
|
||||||
case DLL:
|
|
||||||
m_DSPHeaderTemplate = root;
|
|
||||||
m_DSPHeaderTemplate += "/DLLHeader.dsptemplate";
|
|
||||||
m_DSPFooterTemplate = root;
|
|
||||||
m_DSPFooterTemplate += "/DLLFooter.dsptemplate";
|
|
||||||
break;
|
|
||||||
case EXECUTABLE:
|
|
||||||
m_DSPHeaderTemplate = root;
|
|
||||||
m_DSPHeaderTemplate += "/EXEHeader.dsptemplate";
|
|
||||||
m_DSPFooterTemplate = root;
|
|
||||||
m_DSPFooterTemplate += "/EXEFooter.dsptemplate";
|
|
||||||
break;
|
|
||||||
case WIN32_EXECUTABLE:
|
|
||||||
m_DSPHeaderTemplate = root;
|
|
||||||
m_DSPHeaderTemplate += "/EXEWinHeader.dsptemplate";
|
|
||||||
m_DSPFooterTemplate = root;
|
|
||||||
m_DSPFooterTemplate += "/EXEFooter.dsptemplate";
|
|
||||||
break;
|
|
||||||
case UTILITY:
|
|
||||||
m_DSPHeaderTemplate = root;
|
|
||||||
m_DSPHeaderTemplate += "/UtilityHeader.dsptemplate";
|
|
||||||
m_DSPFooterTemplate = root;
|
|
||||||
m_DSPFooterTemplate += "/UtilityFooter.dsptemplate";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// once the build type is set, determine what configurations are
|
|
||||||
// possible
|
|
||||||
std::ifstream fin(m_DSPHeaderTemplate.c_str());
|
|
||||||
|
|
||||||
cmRegularExpression reg("# Name ");
|
|
||||||
if(!fin)
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Error Reading ", m_DSPHeaderTemplate.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset m_Configurations
|
|
||||||
m_Configurations.erase(m_Configurations.begin(), m_Configurations.end());
|
|
||||||
// now add all the configurations possible
|
|
||||||
char buffer[2048];
|
|
||||||
while(fin)
|
|
||||||
{
|
|
||||||
fin.getline(buffer, 2048);
|
|
||||||
std::string line = buffer;
|
|
||||||
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
|
|
||||||
if (reg.find(line))
|
|
||||||
{
|
|
||||||
m_Configurations.push_back(line.substr(reg.end()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
|
|
||||||
const cmTarget &target)
|
|
||||||
{
|
|
||||||
// determine the link directories
|
|
||||||
std::string libOptions;
|
|
||||||
std::string libDebugOptions;
|
|
||||||
std::string libOptimizedOptions;
|
|
||||||
|
|
||||||
std::string libMultiLineOptions;
|
|
||||||
std::string libMultiLineDebugOptions;
|
|
||||||
std::string libMultiLineOptimizedOptions;
|
|
||||||
|
|
||||||
// suppoirt override in output directory
|
|
||||||
std::string libPath = "";
|
|
||||||
if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
|
|
||||||
{
|
|
||||||
libPath = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
|
|
||||||
}
|
|
||||||
std::string exePath = "";
|
|
||||||
if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"))
|
|
||||||
{
|
|
||||||
exePath = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(libPath.size())
|
|
||||||
{
|
|
||||||
// make sure there is a trailing slash
|
|
||||||
if(libPath[libPath.size()-1] != '/')
|
|
||||||
{
|
|
||||||
libPath += "/";
|
|
||||||
}
|
|
||||||
libOptions += " /LIBPATH:\"";
|
|
||||||
libOptions += libPath;
|
|
||||||
libOptions += "$(IntDir)\" ";
|
|
||||||
libOptions += " /LIBPATH:\"";
|
|
||||||
libOptions += libPath;
|
|
||||||
libOptions += "\" ";
|
|
||||||
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += libPath;
|
|
||||||
libMultiLineOptions += "$(IntDir)\" ";
|
|
||||||
libMultiLineOptions += " /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += libPath;
|
|
||||||
libMultiLineOptions += "\" \n";
|
|
||||||
}
|
|
||||||
if(exePath.size())
|
|
||||||
{
|
|
||||||
// make sure there is a trailing slash
|
|
||||||
if(exePath[exePath.size()-1] != '/')
|
|
||||||
{
|
|
||||||
exePath += "/";
|
|
||||||
}
|
|
||||||
libOptions += " /LIBPATH:\"";
|
|
||||||
libOptions += exePath;
|
|
||||||
libOptions += "$(IntDir)\" ";
|
|
||||||
libOptions += " /LIBPATH:\"";
|
|
||||||
libOptions += exePath;
|
|
||||||
libOptions += "\" ";
|
|
||||||
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += exePath;
|
|
||||||
libMultiLineOptions += "$(IntDir)\" ";
|
|
||||||
libMultiLineOptions += " /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += exePath;
|
|
||||||
libMultiLineOptions += "\" \n";
|
|
||||||
}
|
|
||||||
std::vector<std::string>::iterator i;
|
|
||||||
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
|
|
||||||
for(i = libdirs.begin(); i != libdirs.end(); ++i)
|
|
||||||
{
|
|
||||||
libOptions += " /LIBPATH:\"";
|
|
||||||
libOptions += *i;
|
|
||||||
libOptions += "/$(OUTDIR)\" ";
|
|
||||||
libOptions += " /LIBPATH:\"";
|
|
||||||
libOptions += *i;
|
|
||||||
libOptions += "\" ";
|
|
||||||
|
|
||||||
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += *i;
|
|
||||||
libMultiLineOptions += "/$(OUTDIR)\" ";
|
|
||||||
libMultiLineOptions += " /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += *i;
|
|
||||||
libMultiLineOptions += "\" \n";
|
|
||||||
}
|
|
||||||
// find link libraries
|
|
||||||
const cmTarget::LinkLibraries& libs = target.GetLinkLibraries();
|
|
||||||
cmTarget::LinkLibraries::const_iterator j;
|
|
||||||
for(j = libs.begin(); j != libs.end(); ++j)
|
|
||||||
{
|
|
||||||
// add libraries to executables and dlls (but never include
|
|
||||||
// a library in a library, bad recursion)
|
|
||||||
if (target.GetType() != cmTarget::LIBRARY ||
|
|
||||||
(m_LibraryBuildType == DLL && libName != j->first))
|
|
||||||
{
|
|
||||||
std::string lib = j->first;
|
|
||||||
if(j->first.find(".lib") == std::string::npos)
|
|
||||||
{
|
|
||||||
lib += ".lib";
|
|
||||||
}
|
|
||||||
lib = cmSystemTools::EscapeSpaces(lib.c_str());
|
|
||||||
if (j->second == cmTarget::GENERAL)
|
|
||||||
{
|
|
||||||
libOptions += " ";
|
|
||||||
libOptions += lib;
|
|
||||||
|
|
||||||
libMultiLineOptions += "# ADD LINK32 ";
|
|
||||||
libMultiLineOptions += lib;
|
|
||||||
libMultiLineOptions += "\n";
|
|
||||||
}
|
|
||||||
if (j->second == cmTarget::DEBUG)
|
|
||||||
{
|
|
||||||
libDebugOptions += " ";
|
|
||||||
libDebugOptions += lib;
|
|
||||||
|
|
||||||
libMultiLineDebugOptions += "# ADD LINK32 ";
|
|
||||||
libMultiLineDebugOptions += lib;
|
|
||||||
libMultiLineDebugOptions += "\n";
|
|
||||||
}
|
|
||||||
if (j->second == cmTarget::OPTIMIZED)
|
|
||||||
{
|
|
||||||
libOptimizedOptions += " ";
|
|
||||||
libOptimizedOptions += lib;
|
|
||||||
|
|
||||||
libMultiLineOptimizedOptions += "# ADD LINK32 ";
|
|
||||||
libMultiLineOptimizedOptions += lib;
|
|
||||||
libMultiLineOptimizedOptions += "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
libOptions += " /STACK:10000000 ";
|
|
||||||
libMultiLineOptions += "# ADD LINK32 /STACK:10000000 \n";
|
|
||||||
|
|
||||||
std::ifstream fin(m_DSPHeaderTemplate.c_str());
|
|
||||||
if(!fin)
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Error Reading ", m_DSPHeaderTemplate.c_str());
|
|
||||||
}
|
|
||||||
char buffer[2048];
|
|
||||||
|
|
||||||
while(fin)
|
|
||||||
{
|
|
||||||
fin.getline(buffer, 2048);
|
|
||||||
std::string line = buffer;
|
|
||||||
cmSystemTools::ReplaceString(line, "CM_LIBRARIES",
|
|
||||||
libOptions.c_str());
|
|
||||||
cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
|
|
||||||
libDebugOptions.c_str());
|
|
||||||
cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
|
|
||||||
libOptimizedOptions.c_str());
|
|
||||||
|
|
||||||
cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES",
|
|
||||||
libMultiLineOptions.c_str());
|
|
||||||
cmSystemTools::ReplaceString(line, "CM_MULTILINE_DEBUG_LIBRARIES",
|
|
||||||
libMultiLineDebugOptions.c_str());
|
|
||||||
cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIMIZED_LIBRARIES",
|
|
||||||
libMultiLineOptimizedOptions.c_str());
|
|
||||||
|
|
||||||
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
|
|
||||||
m_IncludeOptions.c_str());
|
|
||||||
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
|
|
||||||
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
|
|
||||||
libPath.c_str());
|
|
||||||
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
|
|
||||||
exePath.c_str());
|
|
||||||
cmSystemTools::ReplaceString(line,
|
|
||||||
"EXTRA_DEFINES",
|
|
||||||
m_Makefile->GetDefineFlags());
|
|
||||||
cmSystemTools::ReplaceString(line,
|
|
||||||
"CMAKE_CXX_FLAGS_RELEASE",
|
|
||||||
m_Makefile->
|
|
||||||
GetDefinition("CMAKE_CXX_FLAGS_RELEASE"));
|
|
||||||
cmSystemTools::ReplaceString(line,
|
|
||||||
"CMAKE_CXX_FLAGS_MINSIZEREL",
|
|
||||||
m_Makefile->
|
|
||||||
GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL")
|
|
||||||
);
|
|
||||||
cmSystemTools::ReplaceString(line,
|
|
||||||
"CMAKE_CXX_FLAGS_DEBUG",
|
|
||||||
m_Makefile->
|
|
||||||
GetDefinition("CMAKE_CXX_FLAGS_DEBUG"));
|
|
||||||
cmSystemTools::ReplaceString(line,
|
|
||||||
"CMAKE_CXX_FLAGS",
|
|
||||||
m_Makefile->
|
|
||||||
GetDefinition("CMAKE_CXX_FLAGS"));
|
|
||||||
|
|
||||||
fout << line.c_str() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPFooter(std::ostream& fout)
|
|
||||||
{
|
|
||||||
std::ifstream fin(m_DSPFooterTemplate.c_str());
|
|
||||||
if(!fin)
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Error Reading ",
|
|
||||||
m_DSPFooterTemplate.c_str());
|
|
||||||
}
|
|
||||||
char buffer[2048];
|
|
||||||
while(fin)
|
|
||||||
{
|
|
||||||
fin.getline(buffer, 2048);
|
|
||||||
fout << buffer << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,120 +0,0 @@
|
||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: Insight Segmentation & Registration Toolkit
|
|
||||||
Module: $RCSfile$
|
|
||||||
Language: C++
|
|
||||||
Date: $Date$
|
|
||||||
Version: $Revision$
|
|
||||||
|
|
||||||
Copyright (c) 2001 Insight Consortium
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
* The name of the Insight Consortium, nor the names of any consortium members,
|
|
||||||
nor of any contributors, may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
* Modified source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
#ifndef cmDSPMakefile_h
|
|
||||||
#define cmDSPMakefile_h
|
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
|
||||||
#include "cmMakefile.h"
|
|
||||||
|
|
||||||
/** \class cmDSPMakefile
|
|
||||||
* \brief Generate a Microsoft DSP project file.
|
|
||||||
*
|
|
||||||
* cmDSPMakefile generates a Microsoft DSP project file.
|
|
||||||
* See the *.dsptemplate files for information on the templates
|
|
||||||
* used for making the project files.
|
|
||||||
*/
|
|
||||||
class cmDSPMakefile
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cmDSPMakefile(cmMakefile*);
|
|
||||||
~cmDSPMakefile();
|
|
||||||
void OutputDSPFile();
|
|
||||||
enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify the type of the build: static, dll, or executable.
|
|
||||||
*/
|
|
||||||
void SetBuildType(BuildType,const char *name);
|
|
||||||
|
|
||||||
BuildType GetLibraryBuildType()
|
|
||||||
{
|
|
||||||
return m_LibraryBuildType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return array of created DSP names in a STL vector.
|
|
||||||
* Each executable must have its own dsp.
|
|
||||||
*/
|
|
||||||
std::vector<std::string> GetCreatedProjectNames()
|
|
||||||
{
|
|
||||||
return m_CreatedProjectNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the makefile.
|
|
||||||
*/
|
|
||||||
cmMakefile* GetMakefile()
|
|
||||||
{
|
|
||||||
return m_Makefile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string m_DSPHeaderTemplate;
|
|
||||||
std::string m_DSPFooterTemplate;
|
|
||||||
std::vector<std::string> m_CreatedProjectNames;
|
|
||||||
|
|
||||||
void CreateSingleDSP(const char *lname, cmTarget &tgt);
|
|
||||||
void WriteDSPFile(std::ostream& fout, const char *libName,
|
|
||||||
cmTarget &tgt);
|
|
||||||
void WriteDSPBeginGroup(std::ostream& fout,
|
|
||||||
const char* group,
|
|
||||||
const char* filter);
|
|
||||||
void WriteDSPEndGroup(std::ostream& fout);
|
|
||||||
|
|
||||||
void WriteDSPHeader(std::ostream& fout, const char *libName,
|
|
||||||
const cmTarget &tgt);
|
|
||||||
|
|
||||||
void WriteDSPFooter(std::ostream& fout);
|
|
||||||
void AddDSPBuildRule(cmSourceGroup&);
|
|
||||||
void WriteCustomRule(std::ostream& fout,
|
|
||||||
const char* source,
|
|
||||||
const char* command,
|
|
||||||
const std::set<std::string>& depends,
|
|
||||||
const std::set<std::string>& outputs);
|
|
||||||
|
|
||||||
std::string m_IncludeOptions;
|
|
||||||
cmMakefile* m_Makefile;
|
|
||||||
BuildType m_LibraryBuildType;
|
|
||||||
std::vector<std::string> m_Configurations;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -38,23 +38,23 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmDSPMakefile.h"
|
#include "cmDSPWriter.h"
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmRegularExpression.h"
|
#include "cmRegularExpression.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
cmDSPMakefile::~cmDSPMakefile()
|
cmDSPWriter::~cmDSPWriter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cmDSPMakefile::cmDSPMakefile(cmMakefile*mf)
|
cmDSPWriter::cmDSPWriter(cmMakefile*mf)
|
||||||
{
|
{
|
||||||
m_Makefile = mf;
|
m_Makefile = mf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmDSPMakefile::OutputDSPFile()
|
void cmDSPWriter::OutputDSPFile()
|
||||||
{
|
{
|
||||||
// If not an in source build, then create the output directory
|
// If not an in source build, then create the output directory
|
||||||
if(strcmp(m_Makefile->GetStartOutputDirectory(),
|
if(strcmp(m_Makefile->GetStartOutputDirectory(),
|
||||||
|
@ -129,7 +129,7 @@ void cmDSPMakefile::OutputDSPFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
|
void cmDSPWriter::CreateSingleDSP(const char *lname, cmTarget &target)
|
||||||
{
|
{
|
||||||
std::string fname;
|
std::string fname;
|
||||||
fname = m_Makefile->GetStartOutputDirectory();
|
fname = m_Makefile->GetStartOutputDirectory();
|
||||||
|
@ -147,7 +147,7 @@ void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
|
void cmDSPWriter::AddDSPBuildRule(cmSourceGroup& sourceGroup)
|
||||||
{
|
{
|
||||||
std::string dspname = *(m_CreatedProjectNames.end()-1);
|
std::string dspname = *(m_CreatedProjectNames.end()-1);
|
||||||
dspname += ".dsp";
|
dspname += ".dsp";
|
||||||
|
@ -177,7 +177,7 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
void cmDSPWriter::WriteDSPFile(std::ostream& fout,
|
||||||
const char *libName,
|
const char *libName,
|
||||||
cmTarget &target)
|
cmTarget &target)
|
||||||
{
|
{
|
||||||
|
@ -301,7 +301,7 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteCustomRule(std::ostream& fout,
|
void cmDSPWriter::WriteCustomRule(std::ostream& fout,
|
||||||
const char* source,
|
const char* source,
|
||||||
const char* command,
|
const char* command,
|
||||||
const std::set<std::string>& depends,
|
const std::set<std::string>& depends,
|
||||||
|
@ -359,7 +359,7 @@ void cmDSPMakefile::WriteCustomRule(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPBeginGroup(std::ostream& fout,
|
void cmDSPWriter::WriteDSPBeginGroup(std::ostream& fout,
|
||||||
const char* group,
|
const char* group,
|
||||||
const char* filter)
|
const char* filter)
|
||||||
{
|
{
|
||||||
|
@ -368,7 +368,7 @@ void cmDSPMakefile::WriteDSPBeginGroup(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPEndGroup(std::ostream& fout)
|
void cmDSPWriter::WriteDSPEndGroup(std::ostream& fout)
|
||||||
{
|
{
|
||||||
fout << "# End Group\n";
|
fout << "# End Group\n";
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ void cmDSPMakefile::WriteDSPEndGroup(std::ostream& fout)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::SetBuildType(BuildType b, const char *libName)
|
void cmDSPWriter::SetBuildType(BuildType b, const char *libName)
|
||||||
{
|
{
|
||||||
std::string root= cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
|
std::string root= cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
|
||||||
const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
|
const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
|
||||||
|
@ -450,7 +450,7 @@ void cmDSPMakefile::SetBuildType(BuildType b, const char *libName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
|
void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
|
||||||
const cmTarget &target)
|
const cmTarget &target)
|
||||||
{
|
{
|
||||||
// determine the link directories
|
// determine the link directories
|
||||||
|
@ -638,7 +638,7 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmDSPMakefile::WriteDSPFooter(std::ostream& fout)
|
void cmDSPWriter::WriteDSPFooter(std::ostream& fout)
|
||||||
{
|
{
|
||||||
std::ifstream fin(m_DSPFooterTemplate.c_str());
|
std::ifstream fin(m_DSPFooterTemplate.c_str());
|
||||||
if(!fin)
|
if(!fin)
|
||||||
|
|
|
@ -38,24 +38,24 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#ifndef cmDSPMakefile_h
|
#ifndef cmDSPWriter_h
|
||||||
#define cmDSPMakefile_h
|
#define cmDSPWriter_h
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
|
|
||||||
/** \class cmDSPMakefile
|
/** \class cmDSPWriter
|
||||||
* \brief Generate a Microsoft DSP project file.
|
* \brief Generate a Microsoft DSP project file.
|
||||||
*
|
*
|
||||||
* cmDSPMakefile generates a Microsoft DSP project file.
|
* cmDSPWriter generates a Microsoft DSP project file.
|
||||||
* See the *.dsptemplate files for information on the templates
|
* See the *.dsptemplate files for information on the templates
|
||||||
* used for making the project files.
|
* used for making the project files.
|
||||||
*/
|
*/
|
||||||
class cmDSPMakefile
|
class cmDSPWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmDSPMakefile(cmMakefile*);
|
cmDSPWriter(cmMakefile*);
|
||||||
~cmDSPMakefile();
|
~cmDSPWriter();
|
||||||
void OutputDSPFile();
|
void OutputDSPFile();
|
||||||
enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
|
enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
|
||||||
|
|
||||||
|
|
|
@ -1,261 +0,0 @@
|
||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: Insight Segmentation & Registration Toolkit
|
|
||||||
Module: $RCSfile$
|
|
||||||
Language: C++
|
|
||||||
Date: $Date$
|
|
||||||
Version: $Revision$
|
|
||||||
|
|
||||||
Copyright (c) 2001 Insight Consortium
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
* The name of the Insight Consortium, nor the names of any consortium members,
|
|
||||||
nor of any contributors, may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
* Modified source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
#include "cmDSWMakefile.h"
|
|
||||||
#include "cmStandardIncludes.h"
|
|
||||||
#include "cmSystemTools.h"
|
|
||||||
#include "cmDSPMakefile.h"
|
|
||||||
#include "cmMSProjectGenerator.h"
|
|
||||||
#include "cmCacheManager.h"
|
|
||||||
|
|
||||||
|
|
||||||
cmDSWMakefile::cmDSWMakefile(cmMakefile* m)
|
|
||||||
{
|
|
||||||
m_Makefile = m;
|
|
||||||
}
|
|
||||||
|
|
||||||
// output the DSW file
|
|
||||||
void cmDSWMakefile::OutputDSWFile()
|
|
||||||
{
|
|
||||||
// if this is an out of source build, create the output directory
|
|
||||||
if(strcmp(m_Makefile->GetStartOutputDirectory(),
|
|
||||||
m_Makefile->GetHomeDirectory()) != 0)
|
|
||||||
{
|
|
||||||
if(!cmSystemTools::MakeDirectory(m_Makefile->GetStartOutputDirectory()))
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Error creating output directory for DSW file",
|
|
||||||
m_Makefile->GetStartOutputDirectory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// create the dsw file name
|
|
||||||
std::string fname;
|
|
||||||
fname = m_Makefile->GetStartOutputDirectory();
|
|
||||||
fname += "/";
|
|
||||||
fname += m_Makefile->GetProjectName();
|
|
||||||
fname += ".dsw";
|
|
||||||
std::ofstream fout(fname.c_str());
|
|
||||||
if(!fout)
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Error can not open DSW file for write: "
|
|
||||||
,fname.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this->WriteDSWFile(fout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write a DSW file to the stream
|
|
||||||
void cmDSWMakefile::WriteDSWFile(std::ostream& fout)
|
|
||||||
{
|
|
||||||
// Write out the header for a DSW file
|
|
||||||
this->WriteDSWHeader(fout);
|
|
||||||
|
|
||||||
// Create a list of cmMakefile created from all the
|
|
||||||
// CMakeLists.txt files that are in sub directories of
|
|
||||||
// this one.
|
|
||||||
std::vector<cmMakefile*> allListFiles;
|
|
||||||
// add this makefile to the list
|
|
||||||
allListFiles.push_back(m_Makefile);
|
|
||||||
// add a special target that depends on ALL projects for easy build
|
|
||||||
// of Debug only
|
|
||||||
m_Makefile->AddUtilityCommand("ALL_BUILD", "echo \"Build all projects\"", false);
|
|
||||||
m_Makefile->FindSubDirectoryCMakeListsFiles(allListFiles);
|
|
||||||
// For each cmMakefile, create a DSP for it, and
|
|
||||||
// add it to this DSW file
|
|
||||||
for(std::vector<cmMakefile*>::iterator k = allListFiles.begin();
|
|
||||||
k != allListFiles.end(); ++k)
|
|
||||||
{
|
|
||||||
cmMakefile* mf = *k;
|
|
||||||
cmMSProjectGenerator* pg = 0;
|
|
||||||
// if not this makefile, then create a new generator
|
|
||||||
if(m_Makefile != mf)
|
|
||||||
{
|
|
||||||
// Create an MS generator with DSW off, so it only creates dsp files
|
|
||||||
pg = new cmMSProjectGenerator;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pg = (cmMSProjectGenerator*)m_Makefile->GetMakefileGenerator();
|
|
||||||
}
|
|
||||||
// make sure the generator is building dsp files
|
|
||||||
pg->BuildDSWOff();
|
|
||||||
mf->SetMakefileGenerator(pg);
|
|
||||||
mf->GenerateMakefile();
|
|
||||||
// Get the source directory from the makefile
|
|
||||||
std::string dir = mf->GetStartDirectory();
|
|
||||||
// Get the home directory with the trailing slash
|
|
||||||
std::string homedir = m_Makefile->GetHomeDirectory();
|
|
||||||
homedir += "/";
|
|
||||||
// remove the home directory and / from the source directory
|
|
||||||
// this gives a relative path
|
|
||||||
cmSystemTools::ReplaceString(dir, homedir.c_str(), "");
|
|
||||||
|
|
||||||
// Get the list of create dsp files names from the cmDSPMakefile, more
|
|
||||||
// than one dsp could have been created per input CMakeLists.txt file
|
|
||||||
// for each target
|
|
||||||
std::vector<std::string> dspnames =
|
|
||||||
pg->GetDSPMakefile()->GetCreatedProjectNames();
|
|
||||||
cmTargets &tgts = pg->GetDSPMakefile()->GetMakefile()->GetTargets();
|
|
||||||
cmTargets::iterator l = tgts.begin();
|
|
||||||
for(std::vector<std::string>::iterator si = dspnames.begin();
|
|
||||||
l != tgts.end(); ++l)
|
|
||||||
{
|
|
||||||
// special handling for the current makefile
|
|
||||||
if(mf == m_Makefile)
|
|
||||||
{
|
|
||||||
dir = "."; // no subdirectory for project generated
|
|
||||||
// if this is the special ALL_BUILD utility, then
|
|
||||||
// make it depend on every other non UTILITY project.
|
|
||||||
// This is done by adding the names to the GetUtilities
|
|
||||||
// vector on the makefile
|
|
||||||
if(l->first == "ALL_BUILD")
|
|
||||||
{
|
|
||||||
for(std::vector<cmMakefile*>::iterator a = allListFiles.begin();
|
|
||||||
a != allListFiles.end(); ++a)
|
|
||||||
{
|
|
||||||
const cmTargets &atgts = (*a)->GetTargets();
|
|
||||||
for(cmTargets::const_iterator al = atgts.begin();
|
|
||||||
al != atgts.end(); ++al)
|
|
||||||
{
|
|
||||||
if(al->second.IsInAll())
|
|
||||||
{
|
|
||||||
l->second.GetLinkLibraries().push_back(
|
|
||||||
cmTarget::LinkLibraries::value_type(al->first, cmTarget::GENERAL));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Write the project into the DSW file
|
|
||||||
if (l->second.GetType() != cmTarget::INSTALL)
|
|
||||||
{
|
|
||||||
this->WriteProject(fout, si->c_str(), dir.c_str(),
|
|
||||||
pg->GetDSPMakefile(),l->second);
|
|
||||||
++si;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// delete the cmMakefile which also deletes the cmMSProjectGenerator
|
|
||||||
if(mf != m_Makefile)
|
|
||||||
{
|
|
||||||
delete mf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Write the footer for the DSW file
|
|
||||||
this->WriteDSWFooter(fout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write a dsp file into the DSW file,
|
|
||||||
// Note, that dependencies from executables to
|
|
||||||
// the libraries it uses are also done here
|
|
||||||
void cmDSWMakefile::WriteProject(std::ostream& fout,
|
|
||||||
const char* dspname,
|
|
||||||
const char* dir,
|
|
||||||
cmDSPMakefile* project,
|
|
||||||
const cmTarget &l
|
|
||||||
)
|
|
||||||
{
|
|
||||||
fout << "#########################################################"
|
|
||||||
"######################\n\n";
|
|
||||||
fout << "Project: \"" << dspname << "\"="
|
|
||||||
<< dir << "\\" << dspname << ".dsp - Package Owner=<4>\n\n";
|
|
||||||
fout << "Package=<5>\n{{{\n}}}\n\n";
|
|
||||||
fout << "Package=<4>\n";
|
|
||||||
fout << "{{{\n";
|
|
||||||
|
|
||||||
// insert Begin Project Dependency Project_Dep_Name project stuff here
|
|
||||||
cmTarget::LinkLibraries::const_iterator j, jend;
|
|
||||||
j = l.GetLinkLibraries().begin();
|
|
||||||
jend = l.GetLinkLibraries().end();
|
|
||||||
for(;j!= jend; ++j)
|
|
||||||
{
|
|
||||||
if(j->first != dspname)
|
|
||||||
{
|
|
||||||
if (!(l.GetType() == cmTarget::LIBRARY) ||
|
|
||||||
project->GetLibraryBuildType() == cmDSPMakefile::DLL)
|
|
||||||
{
|
|
||||||
// is the library part of this DSW ? If so add dependency
|
|
||||||
const char* cacheValue
|
|
||||||
= cmCacheManager::GetInstance()->GetCacheValue(j->first.c_str());
|
|
||||||
if(cacheValue)
|
|
||||||
{
|
|
||||||
fout << "Begin Project Dependency\n";
|
|
||||||
fout << "Project_Dep_Name " << j->first << "\n";
|
|
||||||
fout << "End Project Dependency\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string>::iterator i, end;
|
|
||||||
// write utility dependencies.
|
|
||||||
i = project->GetMakefile()->GetUtilities().begin();
|
|
||||||
end = project->GetMakefile()->GetUtilities().end();
|
|
||||||
for(;i!= end; ++i)
|
|
||||||
{
|
|
||||||
if(*i != dspname)
|
|
||||||
{
|
|
||||||
fout << "Begin Project Dependency\n";
|
|
||||||
fout << "Project_Dep_Name " << *i << "\n";
|
|
||||||
fout << "End Project Dependency\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fout << "}}}\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Standard end of dsw file
|
|
||||||
void cmDSWMakefile::WriteDSWFooter(std::ostream& fout)
|
|
||||||
{
|
|
||||||
fout << "######################################################"
|
|
||||||
"#########################\n\n";
|
|
||||||
fout << "Global:\n\n";
|
|
||||||
fout << "Package=<5>\n{{{\n}}}\n\n";
|
|
||||||
fout << "Package=<3>\n{{{\n}}}\n\n";
|
|
||||||
fout << "#####################################################"
|
|
||||||
"##########################\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ouput standard header for dsw file
|
|
||||||
void cmDSWMakefile::WriteDSWHeader(std::ostream& fout)
|
|
||||||
{
|
|
||||||
fout << "Microsoft Developer Studio Workspace File, Format Version 6.00\n";
|
|
||||||
fout << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n";
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: Insight Segmentation & Registration Toolkit
|
|
||||||
Module: $RCSfile$
|
|
||||||
Language: C++
|
|
||||||
Date: $Date$
|
|
||||||
Version: $Revision$
|
|
||||||
|
|
||||||
Copyright (c) 2001 Insight Consortium
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
* The name of the Insight Consortium, nor the names of any consortium members,
|
|
||||||
nor of any contributors, may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
* Modified source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
#ifndef cmDSWMakefile_h
|
|
||||||
#define cmDSWMakefile_h
|
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
|
||||||
#include "cmMakefile.h"
|
|
||||||
|
|
||||||
class cmDSPMakefile;
|
|
||||||
class cmMSProjectGenerator;
|
|
||||||
|
|
||||||
/** \class cmDSWMakefile
|
|
||||||
* \brief Write a Microsoft Visual C++ DSW (workspace) file.
|
|
||||||
*
|
|
||||||
* cmDSWMakefile produces a Microsoft Visual C++ DSW (workspace) file.
|
|
||||||
*/
|
|
||||||
class cmDSWMakefile
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
cmDSWMakefile(cmMakefile*);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the DSW workspace file.
|
|
||||||
*/
|
|
||||||
virtual void OutputDSWFile();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void WriteDSWFile(std::ostream& fout);
|
|
||||||
void WriteDSWHeader(std::ostream& fout);
|
|
||||||
void WriteProject(std::ostream& fout,
|
|
||||||
const char* name, const char* path,
|
|
||||||
cmDSPMakefile* project, const cmTarget &t);
|
|
||||||
void WriteDSWFooter(std::ostream& fout);
|
|
||||||
cmMakefile* m_Makefile;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -38,21 +38,21 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmDSWMakefile.h"
|
#include "cmDSWWriter.h"
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmDSPMakefile.h"
|
#include "cmDSPWriter.h"
|
||||||
#include "cmMSProjectGenerator.h"
|
#include "cmMSProjectGenerator.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
|
|
||||||
cmDSWMakefile::cmDSWMakefile(cmMakefile* m)
|
cmDSWWriter::cmDSWWriter(cmMakefile* m)
|
||||||
{
|
{
|
||||||
m_Makefile = m;
|
m_Makefile = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the DSW file
|
// output the DSW file
|
||||||
void cmDSWMakefile::OutputDSWFile()
|
void cmDSWWriter::OutputDSWFile()
|
||||||
{
|
{
|
||||||
// if this is an out of source build, create the output directory
|
// if this is an out of source build, create the output directory
|
||||||
if(strcmp(m_Makefile->GetStartOutputDirectory(),
|
if(strcmp(m_Makefile->GetStartOutputDirectory(),
|
||||||
|
@ -82,7 +82,7 @@ void cmDSWMakefile::OutputDSWFile()
|
||||||
|
|
||||||
|
|
||||||
// Write a DSW file to the stream
|
// Write a DSW file to the stream
|
||||||
void cmDSWMakefile::WriteDSWFile(std::ostream& fout)
|
void cmDSWWriter::WriteDSWFile(std::ostream& fout)
|
||||||
{
|
{
|
||||||
// Write out the header for a DSW file
|
// Write out the header for a DSW file
|
||||||
this->WriteDSWHeader(fout);
|
this->WriteDSWHeader(fout);
|
||||||
|
@ -127,12 +127,12 @@ void cmDSWMakefile::WriteDSWFile(std::ostream& fout)
|
||||||
// this gives a relative path
|
// this gives a relative path
|
||||||
cmSystemTools::ReplaceString(dir, homedir.c_str(), "");
|
cmSystemTools::ReplaceString(dir, homedir.c_str(), "");
|
||||||
|
|
||||||
// Get the list of create dsp files names from the cmDSPMakefile, more
|
// Get the list of create dsp files names from the cmDSPWriter, more
|
||||||
// than one dsp could have been created per input CMakeLists.txt file
|
// than one dsp could have been created per input CMakeLists.txt file
|
||||||
// for each target
|
// for each target
|
||||||
std::vector<std::string> dspnames =
|
std::vector<std::string> dspnames =
|
||||||
pg->GetDSPMakefile()->GetCreatedProjectNames();
|
pg->GetDSPWriter()->GetCreatedProjectNames();
|
||||||
cmTargets &tgts = pg->GetDSPMakefile()->GetMakefile()->GetTargets();
|
cmTargets &tgts = pg->GetDSPWriter()->GetMakefile()->GetTargets();
|
||||||
cmTargets::iterator l = tgts.begin();
|
cmTargets::iterator l = tgts.begin();
|
||||||
for(std::vector<std::string>::iterator si = dspnames.begin();
|
for(std::vector<std::string>::iterator si = dspnames.begin();
|
||||||
l != tgts.end(); ++l)
|
l != tgts.end(); ++l)
|
||||||
|
@ -167,7 +167,7 @@ void cmDSWMakefile::WriteDSWFile(std::ostream& fout)
|
||||||
if (l->second.GetType() != cmTarget::INSTALL)
|
if (l->second.GetType() != cmTarget::INSTALL)
|
||||||
{
|
{
|
||||||
this->WriteProject(fout, si->c_str(), dir.c_str(),
|
this->WriteProject(fout, si->c_str(), dir.c_str(),
|
||||||
pg->GetDSPMakefile(),l->second);
|
pg->GetDSPWriter(),l->second);
|
||||||
++si;
|
++si;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,10 +185,10 @@ void cmDSWMakefile::WriteDSWFile(std::ostream& fout)
|
||||||
// Write a dsp file into the DSW file,
|
// Write a dsp file into the DSW file,
|
||||||
// Note, that dependencies from executables to
|
// Note, that dependencies from executables to
|
||||||
// the libraries it uses are also done here
|
// the libraries it uses are also done here
|
||||||
void cmDSWMakefile::WriteProject(std::ostream& fout,
|
void cmDSWWriter::WriteProject(std::ostream& fout,
|
||||||
const char* dspname,
|
const char* dspname,
|
||||||
const char* dir,
|
const char* dir,
|
||||||
cmDSPMakefile* project,
|
cmDSPWriter* project,
|
||||||
const cmTarget &l
|
const cmTarget &l
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -209,7 +209,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
|
||||||
if(j->first != dspname)
|
if(j->first != dspname)
|
||||||
{
|
{
|
||||||
if (!(l.GetType() == cmTarget::LIBRARY) ||
|
if (!(l.GetType() == cmTarget::LIBRARY) ||
|
||||||
project->GetLibraryBuildType() == cmDSPMakefile::DLL)
|
project->GetLibraryBuildType() == cmDSPWriter::DLL)
|
||||||
{
|
{
|
||||||
// is the library part of this DSW ? If so add dependency
|
// is the library part of this DSW ? If so add dependency
|
||||||
const char* cacheValue
|
const char* cacheValue
|
||||||
|
@ -241,7 +241,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard end of dsw file
|
// Standard end of dsw file
|
||||||
void cmDSWMakefile::WriteDSWFooter(std::ostream& fout)
|
void cmDSWWriter::WriteDSWFooter(std::ostream& fout)
|
||||||
{
|
{
|
||||||
fout << "######################################################"
|
fout << "######################################################"
|
||||||
"#########################\n\n";
|
"#########################\n\n";
|
||||||
|
@ -254,7 +254,7 @@ void cmDSWMakefile::WriteDSWFooter(std::ostream& fout)
|
||||||
|
|
||||||
|
|
||||||
// ouput standard header for dsw file
|
// ouput standard header for dsw file
|
||||||
void cmDSWMakefile::WriteDSWHeader(std::ostream& fout)
|
void cmDSWWriter::WriteDSWHeader(std::ostream& fout)
|
||||||
{
|
{
|
||||||
fout << "Microsoft Developer Studio Workspace File, Format Version 6.00\n";
|
fout << "Microsoft Developer Studio Workspace File, Format Version 6.00\n";
|
||||||
fout << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n";
|
fout << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n";
|
||||||
|
|
|
@ -38,27 +38,27 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#ifndef cmDSWMakefile_h
|
#ifndef cmDSWWriter_h
|
||||||
#define cmDSWMakefile_h
|
#define cmDSWWriter_h
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
|
|
||||||
class cmDSPMakefile;
|
class cmDSPWriter;
|
||||||
class cmMSProjectGenerator;
|
class cmMSProjectGenerator;
|
||||||
|
|
||||||
/** \class cmDSWMakefile
|
/** \class cmDSWWriter
|
||||||
* \brief Write a Microsoft Visual C++ DSW (workspace) file.
|
* \brief Write a Microsoft Visual C++ DSW (workspace) file.
|
||||||
*
|
*
|
||||||
* cmDSWMakefile produces a Microsoft Visual C++ DSW (workspace) file.
|
* cmDSWWriter produces a Microsoft Visual C++ DSW (workspace) file.
|
||||||
*/
|
*/
|
||||||
class cmDSWMakefile
|
class cmDSWWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
cmDSWMakefile(cmMakefile*);
|
cmDSWWriter(cmMakefile*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the DSW workspace file.
|
* Generate the DSW workspace file.
|
||||||
|
@ -70,7 +70,7 @@ private:
|
||||||
void WriteDSWHeader(std::ostream& fout);
|
void WriteDSWHeader(std::ostream& fout);
|
||||||
void WriteProject(std::ostream& fout,
|
void WriteProject(std::ostream& fout,
|
||||||
const char* name, const char* path,
|
const char* name, const char* path,
|
||||||
cmDSPMakefile* project, const cmTarget &t);
|
cmDSPWriter* project, const cmTarget &t);
|
||||||
void WriteDSWFooter(std::ostream& fout);
|
void WriteDSWFooter(std::ostream& fout);
|
||||||
cmMakefile* m_Makefile;
|
cmMakefile* m_Makefile;
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,14 +39,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmMSProjectGenerator.h"
|
#include "cmMSProjectGenerator.h"
|
||||||
#include "cmDSWMakefile.h"
|
#include "cmDSWWriter.h"
|
||||||
#include "cmDSPMakefile.h"
|
#include "cmDSPWriter.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
cmMSProjectGenerator::cmMSProjectGenerator()
|
cmMSProjectGenerator::cmMSProjectGenerator()
|
||||||
{
|
{
|
||||||
m_DSWMakefile = 0;
|
m_DSWWriter = 0;
|
||||||
m_DSPMakefile = 0;
|
m_DSPWriter = 0;
|
||||||
BuildDSWOn();
|
BuildDSWOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,24 +54,24 @@ void cmMSProjectGenerator::GenerateMakefile()
|
||||||
{
|
{
|
||||||
if(m_BuildDSW)
|
if(m_BuildDSW)
|
||||||
{
|
{
|
||||||
delete m_DSWMakefile;
|
delete m_DSWWriter;
|
||||||
m_DSWMakefile = 0;
|
m_DSWWriter = 0;
|
||||||
m_DSWMakefile = new cmDSWMakefile(m_Makefile);
|
m_DSWWriter = new cmDSWWriter(m_Makefile);
|
||||||
m_DSWMakefile->OutputDSWFile();
|
m_DSWWriter->OutputDSWFile();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete m_DSPMakefile;
|
delete m_DSPWriter;
|
||||||
m_DSPMakefile = 0;
|
m_DSPWriter = 0;
|
||||||
m_DSPMakefile = new cmDSPMakefile(m_Makefile);
|
m_DSPWriter = new cmDSPWriter(m_Makefile);
|
||||||
m_DSPMakefile->OutputDSPFile();
|
m_DSPWriter->OutputDSPFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmMSProjectGenerator::~cmMSProjectGenerator()
|
cmMSProjectGenerator::~cmMSProjectGenerator()
|
||||||
{
|
{
|
||||||
delete m_DSPMakefile;
|
delete m_DSPWriter;
|
||||||
delete m_DSWMakefile;
|
delete m_DSWWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMSProjectGenerator::SetLocal(bool local)
|
void cmMSProjectGenerator::SetLocal(bool local)
|
||||||
|
|
|
@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmMakefileGenerator.h"
|
#include "cmMakefileGenerator.h"
|
||||||
|
|
||||||
class cmDSPMakefile;
|
class cmDSPWriter;
|
||||||
class cmDSWMakefile;
|
class cmDSWWriter;
|
||||||
|
|
||||||
/** \class cmMSProjectGenerator
|
/** \class cmMSProjectGenerator
|
||||||
* \brief Write a Microsoft Visual C++ DSP (project) file.
|
* \brief Write a Microsoft Visual C++ DSP (project) file.
|
||||||
|
@ -87,16 +87,16 @@ public:
|
||||||
void BuildDSWOn() {m_BuildDSW = true;}
|
void BuildDSWOn() {m_BuildDSW = true;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a pointer to a cmDSWMakefile instance.
|
* Retrieve a pointer to a cmDSWWriter instance.
|
||||||
*/
|
*/
|
||||||
cmDSWMakefile* GetDSWMakefile()
|
cmDSWWriter* GetDSWWriter()
|
||||||
{return m_DSWMakefile;}
|
{return m_DSWWriter;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a pointer to a cmDSPMakefile instance.
|
* Retrieve a pointer to a cmDSPWriter instance.
|
||||||
*/
|
*/
|
||||||
cmDSPMakefile* GetDSPMakefile()
|
cmDSPWriter* GetDSPWriter()
|
||||||
{return m_DSPMakefile;}
|
{return m_DSPWriter;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to determine system infomation such as shared library
|
* Try to determine system infomation such as shared library
|
||||||
|
@ -105,8 +105,8 @@ public:
|
||||||
virtual void ComputeSystemInfo();
|
virtual void ComputeSystemInfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmDSWMakefile* m_DSWMakefile;
|
cmDSWWriter* m_DSWWriter;
|
||||||
cmDSPMakefile* m_DSPMakefile;
|
cmDSPWriter* m_DSPWriter;
|
||||||
bool m_BuildDSW;
|
bool m_BuildDSW;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue