2004-10-11 19:32:14 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
2006-05-11 18:40:28 +04:00
|
|
|
Copyright (c) 2004 Alexander Neundorf neundorf@kde.org, All rights reserved.
|
2004-10-11 19:32:14 +04:00
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
|
|
|
|
#include "cmGlobalKdevelopGenerator.h"
|
2007-01-25 23:44:52 +03:00
|
|
|
#include "cmLocalUnixMakefileGenerator3.h"
|
2004-10-11 19:32:14 +04:00
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmake.h"
|
2005-02-10 07:22:06 +03:00
|
|
|
#include "cmSourceFile.h"
|
|
|
|
#include "cmGeneratedFileStream.h"
|
2004-10-11 19:32:14 +04:00
|
|
|
|
2006-10-02 18:49:55 +04:00
|
|
|
#include <cmsys/SystemTools.hxx>
|
|
|
|
|
2004-10-11 19:32:14 +04:00
|
|
|
cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
|
|
|
|
{
|
|
|
|
// This type of makefile always requires unix style paths
|
2006-03-15 19:02:08 +03:00
|
|
|
this->ForceUnixPaths = true;
|
|
|
|
this->FindMakeProgramFile = "CMakeUnixFindMake.cmake";
|
2006-04-27 05:31:39 +04:00
|
|
|
this->ToolSupportsColor = false;
|
2004-10-11 19:32:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
///! Create a local generator appropriate to this Global Generator
|
|
|
|
cmLocalGenerator *cmGlobalKdevelopGenerator::CreateLocalGenerator()
|
|
|
|
{
|
2007-01-25 23:44:52 +03:00
|
|
|
cmLocalUnixMakefileGenerator3 *lg = new cmLocalUnixMakefileGenerator3;
|
|
|
|
lg->SetForceVerboseMakefiles(true);
|
2004-10-11 19:32:14 +04:00
|
|
|
lg->SetGlobalGenerator(this);
|
|
|
|
return lg;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2006-05-11 18:40:28 +04:00
|
|
|
void cmGlobalKdevelopGenerator
|
|
|
|
::GetDocumentation(cmDocumentationEntry& entry) const
|
2004-10-11 19:32:14 +04:00
|
|
|
{
|
|
|
|
entry.name = this->GetName();
|
|
|
|
entry.brief = "Generates KDevelop 3 project files.";
|
|
|
|
entry.full =
|
2006-05-11 18:40:28 +04:00
|
|
|
"Project files for KDevelop 3 will be created in the top directory "
|
|
|
|
"and in every subdirectory which features a CMakeLists.txt file "
|
|
|
|
"containing a PROJECT() call. "
|
2004-10-28 00:00:26 +04:00
|
|
|
"If you change the settings using KDevelop cmake will try its best "
|
|
|
|
"to keep your changes when regenerating the project files. "
|
2006-05-11 18:40:28 +04:00
|
|
|
"Additionally a hierarchy of UNIX makefiles is generated into the "
|
|
|
|
"build tree. Any "
|
2004-10-11 19:32:14 +04:00
|
|
|
"standard UNIX-style make program can build the project through the "
|
2004-10-28 00:00:26 +04:00
|
|
|
"default make target. A \"make install\" target is also provided.";
|
2004-10-11 19:32:14 +04:00
|
|
|
}
|
2005-02-10 07:22:06 +03:00
|
|
|
|
|
|
|
void cmGlobalKdevelopGenerator::Generate()
|
|
|
|
{
|
2005-06-09 19:46:39 +04:00
|
|
|
this->cmGlobalUnixMakefileGenerator3::Generate();
|
2005-02-10 07:22:06 +03:00
|
|
|
// for each sub project in the project create
|
|
|
|
// a kdevelop project
|
|
|
|
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
|
2006-03-15 19:02:08 +03:00
|
|
|
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
cmMakefile* mf = it->second[0]->GetMakefile();
|
|
|
|
std::string outputDir=mf->GetStartOutputDirectory();
|
|
|
|
std::string projectDir=mf->GetHomeDirectory();
|
|
|
|
std::string projectName=mf->GetProjectName();
|
|
|
|
std::string cmakeFilePattern("CMakeLists.txt;*.cmake;");
|
2006-02-18 19:03:36 +03:00
|
|
|
std::string fileToOpen;
|
2006-04-24 05:12:22 +04:00
|
|
|
std::vector<cmLocalGenerator*>& lgs= it->second;
|
2005-02-10 07:22:06 +03:00
|
|
|
// create the project.kdevelop.filelist file
|
2006-04-24 05:12:22 +04:00
|
|
|
if(!this->CreateFilelistFile(it->second[0], lgs,
|
2005-02-10 07:22:06 +03:00
|
|
|
outputDir, projectDir,
|
2006-02-18 19:03:36 +03:00
|
|
|
projectName, cmakeFilePattern, fileToOpen))
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
cmSystemTools::Error("Can not create filelist file");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//try to find the name of an executable so we have something to
|
|
|
|
//run from kdevelop for now just pick the first executable found
|
|
|
|
std::string executable;
|
2006-04-24 17:39:50 +04:00
|
|
|
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
|
|
|
|
lg!=lgs.end(); lg++)
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
2006-04-24 17:39:50 +04:00
|
|
|
cmMakefile* makefile=(*lg)->GetMakefile();
|
|
|
|
cmTargets& targets=makefile->GetTargets();
|
|
|
|
for (cmTargets::iterator ti = targets.begin();
|
|
|
|
ti != targets.end(); ti++)
|
|
|
|
{
|
|
|
|
if (ti->second.GetType()==cmTarget::EXECUTABLE)
|
|
|
|
{
|
|
|
|
executable = ti->second.GetProperty("LOCATION");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!executable.empty())
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// now create a project file
|
|
|
|
this->CreateProjectFile(outputDir, projectDir, projectName,
|
2006-02-18 19:03:36 +03:00
|
|
|
executable, cmakeFilePattern, fileToOpen);
|
2005-02-10 07:22:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cmGlobalKdevelopGenerator
|
2005-02-10 16:27:26 +03:00
|
|
|
::CreateFilelistFile(cmLocalGenerator* ,
|
2005-02-10 07:22:06 +03:00
|
|
|
std::vector<cmLocalGenerator*>& lgs,
|
|
|
|
const std::string& outputDir,
|
|
|
|
const std::string& projectDirIn,
|
|
|
|
const std::string& projectname,
|
2006-02-18 19:03:36 +03:00
|
|
|
std::string& cmakeFilePattern,
|
|
|
|
std::string& fileToOpen)
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
std::string projectDir = projectDirIn + "/";
|
2005-02-10 15:44:06 +03:00
|
|
|
std::string filename = outputDir+ "/" + projectname +".kdevelop.filelist";
|
2005-02-10 07:22:06 +03:00
|
|
|
|
|
|
|
std::set<cmStdString> files;
|
|
|
|
std::string tmp;
|
|
|
|
|
|
|
|
for (std::vector<cmLocalGenerator*>::const_iterator it=lgs.begin();
|
|
|
|
it!=lgs.end(); it++)
|
|
|
|
{
|
|
|
|
cmMakefile* makefile=(*it)->GetMakefile();
|
|
|
|
const std::vector<std::string>& listFiles=makefile->GetListFiles();
|
|
|
|
for (std::vector<std::string>::const_iterator lt=listFiles.begin();
|
|
|
|
lt!=listFiles.end(); lt++)
|
|
|
|
{
|
|
|
|
tmp=*lt;
|
|
|
|
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
|
|
|
|
// make sure the file is part of this source tree
|
2006-06-14 20:28:32 +04:00
|
|
|
if ((tmp[0]!='/') &&
|
|
|
|
(strstr(tmp.c_str(),
|
|
|
|
cmake::GetCMakeFilesDirectoryPostSlash())==0))
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
files.insert(tmp);
|
|
|
|
tmp=cmSystemTools::GetFilenameName(tmp);
|
|
|
|
//add all files which dont match the default
|
|
|
|
// */CMakeLists.txt;*cmake; to the file pattern
|
|
|
|
if ((tmp!="CMakeLists.txt")
|
|
|
|
&& (strstr(tmp.c_str(), ".cmake")==0))
|
|
|
|
{
|
|
|
|
cmakeFilePattern+=tmp+";";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//get all sources
|
|
|
|
cmTargets& targets=makefile->GetTargets();
|
2005-06-22 17:06:46 +04:00
|
|
|
for (cmTargets::iterator ti = targets.begin();
|
2005-02-10 07:22:06 +03:00
|
|
|
ti != targets.end(); ti++)
|
|
|
|
{
|
|
|
|
const std::vector<cmSourceFile*>& sources=ti->second.GetSourceFiles();
|
|
|
|
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
|
|
|
|
si!=sources.end(); si++)
|
|
|
|
{
|
|
|
|
tmp=(*si)->GetFullPath();
|
2006-10-02 18:49:55 +04:00
|
|
|
std::string headerBasename=cmSystemTools::GetFilenamePath(tmp);
|
|
|
|
headerBasename+="/";
|
|
|
|
headerBasename+=cmSystemTools::GetFilenameWithoutExtension(tmp);
|
|
|
|
|
2005-02-10 07:22:06 +03:00
|
|
|
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
|
2006-10-02 18:49:55 +04:00
|
|
|
|
2006-06-14 20:28:32 +04:00
|
|
|
if ((tmp[0]!='/') &&
|
2006-06-15 19:51:51 +04:00
|
|
|
(strstr(tmp.c_str(),
|
2006-10-02 18:49:55 +04:00
|
|
|
cmake::GetCMakeFilesDirectoryPostSlash())==0) &&
|
|
|
|
(cmSystemTools::GetFilenameExtension(tmp)!=".moc"))
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
files.insert(tmp);
|
2006-10-02 18:49:55 +04:00
|
|
|
|
|
|
|
// check if there's a matching header around
|
2006-10-03 17:12:27 +04:00
|
|
|
for(std::vector<std::string>::const_iterator
|
|
|
|
ext = makefile->GetHeaderExtensions().begin();
|
|
|
|
ext != makefile->GetHeaderExtensions().end(); ++ext)
|
2006-10-02 18:49:55 +04:00
|
|
|
{
|
|
|
|
std::string hname=headerBasename;
|
|
|
|
hname += ".";
|
|
|
|
hname += *ext;
|
|
|
|
if(cmSystemTools::FileExists(hname.c_str()))
|
|
|
|
{
|
2007-01-25 23:44:52 +03:00
|
|
|
cmSystemTools::ReplaceString(hname, projectDir.c_str(), "");
|
2006-10-02 18:49:55 +04:00
|
|
|
files.insert(hname);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-02-10 07:22:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (std::vector<std::string>::const_iterator lt=listFiles.begin();
|
|
|
|
lt!=listFiles.end(); lt++)
|
|
|
|
{
|
|
|
|
tmp=*lt;
|
|
|
|
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
|
2006-06-14 20:28:32 +04:00
|
|
|
if ((tmp[0]!='/') &&
|
2006-06-15 19:51:51 +04:00
|
|
|
(strstr(tmp.c_str(),
|
|
|
|
cmake::GetCMakeFilesDirectoryPostSlash())==0))
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
files.insert(tmp.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//check if the output file already exists and read it
|
|
|
|
//insert all files which exist into the set of files
|
|
|
|
std::ifstream oldFilelist(filename.c_str());
|
|
|
|
if (oldFilelist)
|
|
|
|
{
|
|
|
|
while (cmSystemTools::GetLineFromStream(oldFilelist, tmp))
|
|
|
|
{
|
|
|
|
if (tmp[0]=='/')
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
std::string completePath=projectDir+tmp;
|
|
|
|
if (cmSystemTools::FileExists(completePath.c_str()))
|
|
|
|
{
|
|
|
|
files.insert(tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
oldFilelist.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
//now write the new filename
|
|
|
|
cmGeneratedFileStream fout(filename.c_str());
|
|
|
|
if(!fout)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-02-18 19:03:36 +03:00
|
|
|
fileToOpen="";
|
2005-02-10 07:22:06 +03:00
|
|
|
for (std::set<cmStdString>::const_iterator it=files.begin();
|
|
|
|
it!=files.end(); it++)
|
|
|
|
{
|
|
|
|
// get the full path to the file
|
|
|
|
tmp=cmSystemTools::CollapseFullPath(it->c_str(), projectDir.c_str());
|
2006-02-18 19:03:36 +03:00
|
|
|
// just select the first source file
|
|
|
|
if (fileToOpen.empty())
|
|
|
|
{
|
|
|
|
std::string ext = cmSystemTools::GetFilenameExtension(tmp);
|
2006-05-11 18:40:28 +04:00
|
|
|
if ((ext==".c") || (ext==".cc") || (ext==".cpp")
|
|
|
|
|| (ext==".C") || (ext==".h"))
|
2006-02-18 19:03:36 +03:00
|
|
|
{
|
2006-05-11 18:40:28 +04:00
|
|
|
fileToOpen=tmp;
|
2006-02-18 19:03:36 +03:00
|
|
|
}
|
|
|
|
}
|
2005-02-10 07:22:06 +03:00
|
|
|
// make it relative to the project dir
|
|
|
|
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
|
|
|
|
// only put relative paths
|
|
|
|
if (tmp.size() && tmp[0] != '/')
|
|
|
|
{
|
|
|
|
fout << tmp.c_str() <<"\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* create the project file, if it already exists, merge it with the
|
|
|
|
existing one, otherwise create a new one */
|
2006-05-11 18:40:28 +04:00
|
|
|
void cmGlobalKdevelopGenerator
|
|
|
|
::CreateProjectFile(const std::string& outputDir,
|
|
|
|
const std::string& projectDir,
|
|
|
|
const std::string& projectname,
|
|
|
|
const std::string& executable,
|
|
|
|
const std::string& cmakeFilePattern,
|
|
|
|
const std::string& fileToOpen)
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
std::string filename=outputDir+"/";
|
|
|
|
filename+=projectname+".kdevelop";
|
2006-02-18 19:03:36 +03:00
|
|
|
std::string sessionFilename=outputDir+"/";
|
|
|
|
sessionFilename+=projectname+".kdevses";
|
2005-02-10 07:22:06 +03:00
|
|
|
|
|
|
|
if (cmSystemTools::FileExists(filename.c_str()))
|
|
|
|
{
|
|
|
|
this->MergeProjectFiles(outputDir, projectDir, filename,
|
2006-05-11 18:40:28 +04:00
|
|
|
executable, cmakeFilePattern,
|
|
|
|
fileToOpen, sessionFilename);
|
2005-02-10 07:22:06 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->CreateNewProjectFile(outputDir, projectDir, filename,
|
2006-05-11 18:40:28 +04:00
|
|
|
executable, cmakeFilePattern,
|
|
|
|
fileToOpen, sessionFilename);
|
2005-02-10 07:22:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-05-11 18:40:28 +04:00
|
|
|
void cmGlobalKdevelopGenerator
|
|
|
|
::MergeProjectFiles(const std::string& outputDir,
|
|
|
|
const std::string& projectDir,
|
|
|
|
const std::string& filename,
|
|
|
|
const std::string& executable,
|
|
|
|
const std::string& cmakeFilePattern,
|
|
|
|
const std::string& fileToOpen,
|
|
|
|
const std::string& sessionFilename)
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
std::ifstream oldProjectFile(filename.c_str());
|
|
|
|
if (!oldProjectFile)
|
|
|
|
{
|
2006-05-11 18:40:28 +04:00
|
|
|
this->CreateNewProjectFile(outputDir, projectDir, filename,
|
|
|
|
executable, cmakeFilePattern,
|
|
|
|
fileToOpen, sessionFilename);
|
2005-02-10 07:22:06 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the existing project file (line by line), copy all lines
|
|
|
|
into the new project file, except the ones which can be reliably
|
|
|
|
set from contents of the CMakeLists.txt */
|
|
|
|
std::string tmp;
|
|
|
|
std::vector<std::string> lines;
|
|
|
|
while (cmSystemTools::GetLineFromStream(oldProjectFile, tmp))
|
|
|
|
{
|
|
|
|
lines.push_back(tmp);
|
|
|
|
}
|
|
|
|
oldProjectFile.close();
|
|
|
|
|
|
|
|
cmGeneratedFileStream fout(filename.c_str());
|
|
|
|
if(!fout)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (std::vector<std::string>::const_iterator it=lines.begin();
|
|
|
|
it!=lines.end(); it++)
|
|
|
|
{
|
|
|
|
const char* line=(*it).c_str();
|
|
|
|
// skip these tags as they are always replaced
|
|
|
|
if ((strstr(line, "<projectdirectory>")!=0)
|
|
|
|
|| (strstr(line, "<projectmanagement>")!=0)
|
|
|
|
|| (strstr(line, "<absoluteprojectpath>")!=0)
|
|
|
|
|| (strstr(line, "<filelistdirectory>")!=0)
|
|
|
|
|| (strstr(line, "<buildtool>")!=0)
|
|
|
|
|| (strstr(line, "<builddir>")!=0))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// output the line from the file if it is not one of the above tags
|
|
|
|
fout<<*it<<"\n";
|
2006-05-11 18:40:28 +04:00
|
|
|
// if this is the <general> tag output the stuff that goes in the
|
|
|
|
// general tag
|
2005-02-10 07:22:06 +03:00
|
|
|
if (strstr(line, "<general>"))
|
|
|
|
{
|
2006-05-11 18:40:28 +04:00
|
|
|
fout<< " <projectmanagement>KDevCustomProject</projectmanagement>\n";
|
|
|
|
fout<< " <projectdirectory>" <<projectDir.c_str()
|
|
|
|
<< "</projectdirectory>\n"; //this one is important
|
|
|
|
fout<<" <absoluteprojectpath>true</absoluteprojectpath>\n";
|
|
|
|
//and this one
|
2005-02-10 07:22:06 +03:00
|
|
|
}
|
|
|
|
// inside kdevcustomproject the <filelistdirectory> must be put
|
|
|
|
if (strstr(line, "<kdevcustomproject>"))
|
|
|
|
{
|
|
|
|
fout<<" <filelistdirectory>"<<outputDir.c_str()
|
|
|
|
<<"</filelistdirectory>\n";
|
|
|
|
}
|
|
|
|
// buildtool and builddir go inside <build>
|
|
|
|
if (strstr(line, "<build>"))
|
|
|
|
{
|
|
|
|
fout<<" <buildtool>make</buildtool>\n";
|
|
|
|
fout<<" <builddir>"<<outputDir.c_str()<<"</builddir>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-11 18:40:28 +04:00
|
|
|
void cmGlobalKdevelopGenerator
|
|
|
|
::CreateNewProjectFile(const std::string& outputDir,
|
|
|
|
const std::string& projectDir,
|
|
|
|
const std::string& filename,
|
|
|
|
const std::string& executable,
|
|
|
|
const std::string& cmakeFilePattern,
|
|
|
|
const std::string& fileToOpen,
|
|
|
|
const std::string& sessionFilename)
|
2005-02-10 07:22:06 +03:00
|
|
|
{
|
|
|
|
cmGeneratedFileStream fout(filename.c_str());
|
|
|
|
if(!fout)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fout<<"<?xml version = '1.0'?>\n";
|
|
|
|
fout<<"<kdevelop>\n";
|
|
|
|
fout<<" <general>\n";
|
|
|
|
fout<<" <author></author>\n";
|
|
|
|
fout<<" <email></email>\n";
|
|
|
|
fout<<" <version>$VERSION$</version>\n";
|
|
|
|
fout<<" <projectmanagement>KDevCustomProject</projectmanagement>\n";
|
|
|
|
fout<<" <primarylanguage>C++</primarylanguage>\n";
|
|
|
|
fout<<" <ignoreparts/>\n";
|
2006-05-11 18:40:28 +04:00
|
|
|
fout<<" <projectdirectory>"<<projectDir.c_str()
|
|
|
|
<<"</projectdirectory>\n"; //this one is important
|
|
|
|
fout<<" <absoluteprojectpath>true</absoluteprojectpath>\n"; //and this one
|
2005-02-10 07:22:06 +03:00
|
|
|
fout<<" <secondaryLanguages>\n";
|
|
|
|
fout<<" <language>C</language>\n";
|
|
|
|
fout<<" </secondaryLanguages>\n";
|
|
|
|
fout<<" </general>\n";
|
|
|
|
fout<<" <kdevcustomproject>\n";
|
2006-05-11 18:40:28 +04:00
|
|
|
fout<<" <filelistdirectory>"<<outputDir.c_str()
|
|
|
|
<<"</filelistdirectory>\n";
|
2005-02-10 07:22:06 +03:00
|
|
|
fout<<" <run>\n";
|
2006-02-18 19:03:36 +03:00
|
|
|
fout<<" <mainprogram>"<<executable.c_str()<<"</mainprogram>\n";
|
2005-02-10 07:22:06 +03:00
|
|
|
fout<<" <directoryradio>custom</directoryradio>\n";
|
2006-08-30 00:08:32 +04:00
|
|
|
fout<<" <customdirectory>"<<outputDir.c_str()<<"</customdirectory>\n";
|
2005-02-10 07:22:06 +03:00
|
|
|
fout<<" <programargs></programargs>\n";
|
|
|
|
fout<<" <terminal>false</terminal>\n";
|
|
|
|
fout<<" <autocompile>true</autocompile>\n";
|
|
|
|
fout<<" <envvars/>\n";
|
|
|
|
fout<<" </run>\n";
|
|
|
|
fout<<" <build>\n";
|
2006-05-11 18:40:28 +04:00
|
|
|
fout<<" <buildtool>make</buildtool>\n"; //this one is important
|
|
|
|
fout<<" <builddir>"<<outputDir.c_str()<<"</builddir>\n"; //and this one
|
2005-02-10 07:22:06 +03:00
|
|
|
fout<<" </build>\n";
|
|
|
|
fout<<" <make>\n";
|
|
|
|
fout<<" <abortonerror>false</abortonerror>\n";
|
|
|
|
fout<<" <numberofjobs>1</numberofjobs>\n";
|
|
|
|
fout<<" <dontact>false</dontact>\n";
|
|
|
|
fout<<" <makebin></makebin>\n";
|
|
|
|
fout<<" <selectedenvironment>default</selectedenvironment>\n";
|
|
|
|
fout<<" <environments>\n";
|
|
|
|
fout<<" <default/>\n";
|
|
|
|
fout<<" </environments>\n";
|
|
|
|
fout<<" </make>\n";
|
|
|
|
fout<<" </kdevcustomproject>\n";
|
|
|
|
fout<<" <kdevfilecreate>\n";
|
|
|
|
fout<<" <filetypes/>\n";
|
|
|
|
fout<<" <useglobaltypes>\n";
|
|
|
|
fout<<" <type ext=\"ui\" />\n";
|
|
|
|
fout<<" <type ext=\"cpp\" />\n";
|
|
|
|
fout<<" <type ext=\"h\" />\n";
|
|
|
|
fout<<" </useglobaltypes>\n";
|
|
|
|
fout<<" </kdevfilecreate>\n";
|
|
|
|
fout<<" <kdevdoctreeview>\n";
|
|
|
|
fout<<" <projectdoc>\n";
|
|
|
|
fout<<" <userdocDir>html/</userdocDir>\n";
|
|
|
|
fout<<" <apidocDir>html/</apidocDir>\n";
|
|
|
|
fout<<" </projectdoc>\n";
|
|
|
|
fout<<" <ignoreqt_xml/>\n";
|
|
|
|
fout<<" <ignoredoxygen/>\n";
|
|
|
|
fout<<" <ignorekdocs/>\n";
|
|
|
|
fout<<" <ignoretocs/>\n";
|
|
|
|
fout<<" <ignoredevhelp/>\n";
|
|
|
|
fout<<" </kdevdoctreeview>\n";
|
|
|
|
fout<<" <cppsupportpart>\n";
|
|
|
|
fout<<" <filetemplates>\n";
|
|
|
|
fout<<" <interfacesuffix>.h</interfacesuffix>\n";
|
|
|
|
fout<<" <implementationsuffix>.cpp</implementationsuffix>\n";
|
|
|
|
fout<<" </filetemplates>\n";
|
|
|
|
fout<<" </cppsupportpart>\n";
|
|
|
|
fout<<" <kdevcppsupport>\n";
|
|
|
|
fout<<" <codecompletion>\n";
|
|
|
|
fout<<" <includeGlobalFunctions>true</includeGlobalFunctions>\n";
|
|
|
|
fout<<" <includeTypes>true</includeTypes>\n";
|
|
|
|
fout<<" <includeEnums>true</includeEnums>\n";
|
|
|
|
fout<<" <includeTypedefs>false</includeTypedefs>\n";
|
|
|
|
fout<<" <automaticCodeCompletion>true</automaticCodeCompletion>\n";
|
|
|
|
fout<<" <automaticArgumentsHint>true</automaticArgumentsHint>\n";
|
|
|
|
fout<<" <automaticHeaderCompletion>true</automaticHeaderCompletion>\n";
|
|
|
|
fout<<" <codeCompletionDelay>250</codeCompletionDelay>\n";
|
|
|
|
fout<<" <argumentsHintDelay>400</argumentsHintDelay>\n";
|
|
|
|
fout<<" <headerCompletionDelay>250</headerCompletionDelay>\n";
|
|
|
|
fout<<" </codecompletion>\n";
|
|
|
|
fout<<" <references/>\n";
|
|
|
|
fout<<" </kdevcppsupport>\n";
|
|
|
|
fout<<" <kdevfileview>\n";
|
|
|
|
fout<<" <groups>\n";
|
2006-05-11 18:40:28 +04:00
|
|
|
fout<<" <group pattern=\""<<cmakeFilePattern.c_str()
|
|
|
|
<<"\" name=\"CMake\" />\n";
|
2005-02-10 07:22:06 +03:00
|
|
|
fout<<" <group pattern=\"*.h;*.hxx\" name=\"Header\" />\n";
|
|
|
|
fout<<" <group pattern=\"*.cpp;*.c;*.C;*.cxx\" name=\"Sources\" />\n";
|
|
|
|
fout<<" <group pattern=\"*.ui\" name=\"Qt Designer files\" />\n";
|
|
|
|
fout<<" <hidenonprojectfiles>true</hidenonprojectfiles>\n";
|
|
|
|
fout<<" </groups>\n";
|
|
|
|
fout<<" <tree>\n";
|
|
|
|
fout<<" <hidepatterns>*.o,*.lo,CVS,*~,cmake*</hidepatterns>\n";
|
|
|
|
fout<<" <hidenonprojectfiles>true</hidenonprojectfiles>\n";
|
|
|
|
fout<<" </tree>\n";
|
|
|
|
fout<<" </kdevfileview>\n";
|
|
|
|
fout<<"</kdevelop>\n";
|
|
|
|
|
2006-02-18 19:03:36 +03:00
|
|
|
if (sessionFilename.empty())
|
|
|
|
return;
|
|
|
|
|
2006-05-11 18:40:28 +04:00
|
|
|
// and a session file, so that kdevelop opens a file if it opens the
|
|
|
|
// project the first time
|
2006-02-18 19:03:36 +03:00
|
|
|
cmGeneratedFileStream devses(sessionFilename.c_str());
|
|
|
|
if(!devses)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
devses<<"<?xml version = '1.0' encoding = \'UTF-8\'?>\n";
|
|
|
|
devses<<"<!DOCTYPE KDevPrjSession>\n";
|
|
|
|
devses<<"<KDevPrjSession>\n";
|
|
|
|
devses<<" <DocsAndViews NumberOfDocuments=\"1\" >\n";
|
2006-05-11 18:40:28 +04:00
|
|
|
devses<<" <Doc0 NumberOfViews=\"1\" URL=\"file://"
|
|
|
|
<<fileToOpen.c_str()<<"\" >\n";
|
2006-02-18 19:03:36 +03:00
|
|
|
devses<<" <View0 line=\"0\" Type=\"Source\" />\n";
|
|
|
|
devses<<" </Doc0>\n";
|
|
|
|
devses<<" </DocsAndViews>\n";
|
|
|
|
devses<<"</KDevPrjSession>\n";
|
2005-02-10 07:22:06 +03:00
|
|
|
}
|
|
|
|
|