[cmake-commits] alex committed cmExtraCodeBlocksGenerator.h 1.4 1.5
cmExtraCodeBlocksGenerator.cxx 1.17 1.18
cmake-commits at cmake.org
cmake-commits at cmake.org
Sun Nov 25 07:45:20 EST 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv2669
Modified Files:
cmExtraCodeBlocksGenerator.h cmExtraCodeBlocksGenerator.cxx
Log Message:
STYLE: move the code for generating the XML for one target in a separate
function AppendTarget()
-add "all" target
-some syncing with the Eclipse generator
Alex
Index: cmExtraCodeBlocksGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExtraCodeBlocksGenerator.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmExtraCodeBlocksGenerator.h 29 Aug 2007 14:12:09 -0000 1.4
+++ cmExtraCodeBlocksGenerator.h 25 Nov 2007 12:45:18 -0000 1.5
@@ -23,6 +23,7 @@
class cmLocalGenerator;
class cmMakefile;
class cmTarget;
+class cmGeneratedFileStream;
/** \class cmExtraCodeBlocksGenerator
* \brief Write CodeBlocks project files for Makefile based projects
@@ -55,6 +56,12 @@
int GetCBTargetType(cmTarget* target);
std::string BuildMakeCommand(const std::string& make, const char* makefile,
const char* target);
+ void AppendTarget(cmGeneratedFileStream& fout,
+ const char* targetName,
+ cmTarget* target,
+ const char* make,
+ const cmMakefile* makefile,
+ const char* compiler);
};
Index: cmExtraCodeBlocksGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExtraCodeBlocksGenerator.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cmExtraCodeBlocksGenerator.cxx 25 Nov 2007 11:21:38 -0000 1.17
+++ cmExtraCodeBlocksGenerator.cxx 25 Nov 2007 12:45:18 -0000 1.18
@@ -145,7 +145,6 @@
" <Option compiler=\"" << compiler << "\" />\n"
" <Build>\n";
- bool preinstallTargetCreated = false;
bool installTargetCreated = false;
bool installStripTargetCreated = false;
bool testTargetCreated = false;
@@ -154,8 +153,11 @@
bool packageTargetCreated = false;
bool packageSourceTargetCreated = false;
bool rebuildCacheTargetCreated = false;
-
- // add all executable and library targets and some of the GLOBAL targets
+
+ this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str());
+
+ // add all executable and library targets and some of the GLOBAL
+ // and UTILITY targets
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++)
{
@@ -166,13 +168,10 @@
{
switch(ti->second.GetType())
{
+ case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
- // only add these global targets once
- if ((ti->first=="preinstall") && (preinstallTargetCreated==false))
- {
- preinstallTargetCreated=true;
- }
- else if ((ti->first=="install") && (installTargetCreated==false))
+ // only add these targets once
+ if ((ti->first=="install") && (installTargetCreated==false))
{
installTargetCreated=true;
}
@@ -212,57 +211,23 @@
{
break;
}
+ this->AppendTarget(fout, ti->first.c_str(), 0,
+ make.c_str(), makefile, compiler.c_str());
+ break;
case cmTarget::EXECUTABLE:
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
{
- int cbTargetType = this->GetCBTargetType(&ti->second);
- std::string makefileName = makefile->GetStartOutputDirectory();
- makefileName += "/Makefile";
- makefileName = cmSystemTools::ConvertToOutputPath(
- makefileName.c_str());
-
- fout<<" <Target title=\"" << ti->first << "\">\n"
- " <Option output=\"" << ti->second.GetLocation(0)
- << "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
- " <Option working_dir=\"" <<makefile->GetStartOutputDirectory()
- <<"\" />\n"
- " <Option object_output=\"./\" />\n"
- " <Option type=\"" << cbTargetType << "\" />\n"
- " <Option compiler=\"" << compiler << "\" />\n"
- " <Compiler>\n";
-
- // the include directories for this target
- const std::vector<std::string>& incDirs =
- ti->second.GetMakefile()->GetIncludeDirectories();
- for(std::vector<std::string>::const_iterator dirIt=incDirs.begin();
- dirIt != incDirs.end();
- ++dirIt)
- {
- fout <<" <Add directory=\"" << dirIt->c_str() << "\" />\n";
- }
-
- fout<<" </Compiler>\n"
- " <MakeCommands>\n"
- " <Build command=\""
- << this->BuildMakeCommand(make, makefileName.c_str(), ti->first.c_str())
- << "\" />\n"
- " <CompileFile command=\""
- << this->BuildMakeCommand(make, makefileName.c_str(),""$file"")
- << "\" />\n"
- " <Clean command=\""
- << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
- << "\" />\n"
- " <DistClean command=\""
- << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
- << "\" />\n"
- " </MakeCommands>\n"
- " </Target>\n";
+ this->AppendTarget(fout, ti->first.c_str(), &ti->second,
+ make.c_str(), makefile, compiler.c_str());
+ std::string fastTarget = ti->first;
+ fastTarget += "/fast";
+ this->AppendTarget(fout, fastTarget.c_str(), &ti->second,
+ make.c_str(), makefile, compiler.c_str());
}
break;
// ignore these:
- case cmTarget::UTILITY:
case cmTarget::INSTALL_FILES:
case cmTarget::INSTALL_PROGRAMS:
case cmTarget::INSTALL_DIRECTORY:
@@ -320,6 +285,67 @@
}
+// Generate the xml code for one target.
+void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
+ const char* targetName,
+ cmTarget* target,
+ const char* make,
+ const cmMakefile* makefile,
+ const char* compiler)
+{
+ std::string makefileName = makefile->GetStartOutputDirectory();
+ makefileName += "/Makefile";
+ makefileName = cmSystemTools::ConvertToOutputPath(makefileName.c_str());
+
+ fout<<" <Target title=\"" << targetName << "\">\n";
+ if (target!=0)
+ {
+ int cbTargetType = this->GetCBTargetType(target);
+ fout<<" <Option output=\"" << target->GetLocation(0)
+ << "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
+ " <Option working_dir=\""
+ << makefile->GetStartOutputDirectory() << "\" />\n"
+ " <Option object_output=\"./\" />\n"
+ " <Option type=\"" << cbTargetType << "\" />\n"
+ " <Option compiler=\"" << compiler << "\" />\n"
+ " <Compiler>\n";
+ // the include directories for this target
+ const std::vector<std::string>& incDirs =
+ target->GetMakefile()->GetIncludeDirectories();
+ for(std::vector<std::string>::const_iterator dirIt=incDirs.begin();
+ dirIt != incDirs.end();
+ ++dirIt)
+ {
+ fout <<" <Add directory=\"" << dirIt->c_str() << "\" />\n";
+ }
+ fout<<" </Compiler>\n";
+ }
+ else // e.g. all and the GLOBAL and UTILITY targets
+ {
+ fout<<" <Option working_dir=\""
+ << makefile->GetStartOutputDirectory() << "\" />\n"
+ <<" <Option type=\"" << 4 << "\" />\n";
+ }
+
+ fout<<" <MakeCommands>\n"
+ " <Build command=\""
+ << this->BuildMakeCommand(make, makefileName.c_str(), targetName)
+ << "\" />\n"
+ " <CompileFile command=\""
+ << this->BuildMakeCommand(make, makefileName.c_str(),""$file"")
+ << "\" />\n"
+ " <Clean command=\""
+ << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
+ << "\" />\n"
+ " <DistClean command=\""
+ << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
+ << "\" />\n"
+ " </MakeCommands>\n"
+ " </Target>\n";
+
+}
+
+
// Translate the cmake compiler id into the CodeBlocks compiler id
std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
{
More information about the Cmake-commits
mailing list