|
List Info
Thread: Using the new CMake buildtool manager
|
|
| Using the new CMake buildtool manager |

|
2006-09-30 04:21:52 |
Hi,
As you may have noticed, I've updated the CMake build
manager so that it's
functional again after the removal of all of the old cmake
code. In order for
cmake support to work, you will need to modify your copy of
cmake. There is a
patch and 4 files contained at http://matt.rogers.nam
e/cmake. The 4 files
will need to be copied into the Source directory under your
main cmake
folder. The patch will need to be applied as well. I can't
remember at the
moment where the patch was made from, so it may need some
path fiddling in
order to apply it.
Once you have your new cmake built, you'll need to recreate
your project's
build directory. When you run cmake again to reconfigure, be
sure to pass "-G
XML" to the ccmake or cmake commandline along with any
other parameters in
order for the xml file to be generated.
Once the XML file has been generated, you'll need to tell
KDevelop where your
build directory is. Either change the CMake settings or add
a "Build Dir" key
to your kdevelop 4 project file. There are still a few bugs
in the settings
stuff, so editing the main kdevelop 4 project file is the
best way to go
right now.
Let me know if you have any questions or are having problems
getting it to
work, and I'll assist any way I can.
Thanks,
Matt
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel barney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
|
|
| Using the new CMake buildtool manager |

|
2006-09-30 06:41:14 |
On 29.09.06 23:21:52, Matt Rogers wrote:
> In order for cmake support to work, you will need to
modify your copy
> of cmake. There is a patch and 4 files contained at
> http://matt.rogers.nam
e/cmake.
...
> Let me know if you have any questions or are having
problems getting it to
> work, and I'll assist any way I can.
Just one question: Are those patches being integrated in
upstream cmake
and is there some kind of schedule for this to happen?
I'm asking because currently I use cmake distributed by
Debian (2.4.3)
and if it's taking only a couple of weeks until this results
in 2.4.4 or
something like that I'd spent my time better than compiling
it myself.
Andreas
--
Just to have it is enough.
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel barney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
|
|
| Using the new CMake buildtool manager |

|
2006-09-30 07:51:33 |
On 29.09.06 23:21:52, Matt Rogers wrote:
> As you may have noticed, I've updated the CMake build
manager so that it's
> functional again after the removal of all of the old
cmake code. In order for
> cmake support to work, you will need to modify your
copy of cmake. There is a
> patch and 4 files contained at http://matt.rogers.nam
e/cmake. The 4 files
> will need to be copied into the Source directory under
your main cmake
> folder. The patch will need to be applied as well. I
can't remember at the
> moment where the patch was made from, so it may need
some path fiddling in
> order to apply it.
Not sure wether this is of interest to you or anybody else
here, the
attached patch applies against CMake CVS Head and includes
the changes
needed at CMakeLists.txt and cmake.cxx as well as the new
files.
Andreas
--
Beware of low-flying butterflies.
diff -u -x CVS -Nur CMake/Source/cmake.cxx
CMake.new/Source/cmake.cxx
--- CMake/Source/cmake.cxx 2006-08-07 23:22:58.000000000
+0200
+++ CMake.new/Source/cmake.cxx 2006-09-30 09:47:09.000000000
+0200
 -67,6
+67,7 
#ifdef CMAKE_USE_KDEVELOP
# include "cmGlobalKdevelopGenerator.h"
+# include "cmGlobalXmlGenerator.h"
#endif
#include <stdlib.h> // required for atoi
 -1901,6
+1902,8 
#ifdef CMAKE_USE_KDEVELOP
this->Generators[cmGlobalKdevelopGenerator::GetActualName
()] =
&cmGlobalKdevelopGenerator::New;
+
this->Generators[cmGlobalXmlGenerator::GetActualName()] =
+ &cmGlobalXmlGenerator::New;
#endif
}
diff -u -x CVS -Nur CMake/Source/CMakeLists.txt
CMake.new/Source/CMakeLists.txt
--- CMake/Source/CMakeLists.txt 2006-08-21
18:37:40.000000000 +0200
+++ CMake.new/Source/CMakeLists.txt 2006-09-30
09:45:29.000000000 +0200
 -168,7
+168,9 
IF(UNIX)
SET(SRCS $
cmGlobalKdevelopGenerator.cxx
- cmLocalKdevelopGenerator.cxx)
+ cmLocalKdevelopGenerator.cxx
+ cmGlobalXmlGenerator.cxx
+ cmLocalXmlGenerator.cxx)
ENDIF(UNIX)
# XCode only works on apple
IF(APPLE)
diff -u -x CVS -Nur CMake/Source/cmGlobalXmlGenerator.cxx
CMake.new/Source/cmGlobalXmlGenerator.cxx
--- CMake/Source/cmGlobalXmlGenerator.cxx 1970-01-01
01:00:00.000000000 +0100
+++ CMake.new/Source/cmGlobalXmlGenerator.cxx 2006-09-30
09:48:37.000000000 +0200
 -0,0
+1,193 
+/*=========================================================
================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile: cmGlobalXmlGenerator.cxx,v $
+ Language: C++
+ Date: $Date: 2006/08/29 20:08:32 $
+ Version: $Revision: 1.17 $
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium.
All rights reserved.
+ Copyright (c) 2004 Alexander Neundorf neundorf kde.org,
All rights reserved.
+ Copyright (c) 2006 Matt Rogers, mattr kde.org.
All rights reserved.
+ See Copyright.txt or http://www.c
make.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 "cmGlobalXmlGenerator.h"
+#include "cmLocalKdevelopGenerator.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+#include "cmSourceFile.h"
+#include "cmGeneratedFileStream.h"
+
+#include <sstream>
+#include <string>
+
+cmGlobalXmlGenerator::cmGlobalXmlGenerator()
+{
+ // This type of makefile always requires unix style paths
+ this->ForceUnixPaths = true;
+ this->FindMakeProgramFile =
"CMakeUnixFindMake.cmake";
+ this->ToolSupportsColor = false;
+}
+
+///! Create a local generator appropriate to this Global
Generator
+cmLocalGenerator
*cmGlobalXmlGenerator::CreateLocalGenerator()
+{
+ cmLocalGenerator *lg = new cmLocalKdevelopGenerator;
+ lg->SetGlobalGenerator(this);
+ return lg;
+}
+
+//---------------------------------------------------------
-------------------
+void cmGlobalXmlGenerator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.name = this->GetName();
+ entry.brief = "Generates XML files describing the
build system.";
+ entry.full = "";
+}
+
+void cmGlobalXmlGenerator::Generate()
+{
+ this->cmGlobalUnixMakefileGenerator3::Generate();
+ // for each sub project in the project create
+ // a kdevelop project
+ if(!this->CreateXmlFile())
+ {
+ cmSystemTools::Error("Can not create XML
file");
+ return;
+ }
+}
+
+bool cmGlobalXmlGenerator::CreateXmlFile()
+{
+ cmake* cmakeInstance = this->GetCMakeInstance();
+ //Add the xml file to the builddir
+ std::string buildDir =
cmakeInstance->GetStartOutputDirectory();
+ std::string xmlFile = buildDir +
"/cmakeinfo.xml";
+ cmGeneratedFileStream fout(xmlFile.c_str());
+ if(!fout)
+ {
+ return false;
+ }
+
+ fout << "<?xml version='1.0'?>"
<< std::endl;
+ fout << "<project name=""
<< this->GetProjectName() << ""
root="";
+ fout << cmakeInstance->GetStartDirectory()
<< "">" << std::endl;
+ cmLocalGenerator* localGenerator =
this->FindLocalGenerator(
cmakeInstance->GetStartDirectory() );
+ addXmlForGenerator( localGenerator, fout );
+ fout << "</project>" <<
std::endl;
+
+ return true;
+}
+
+void cmGlobalXmlGenerator::addXmlForGenerator(
cmLocalGenerator* generator,
+
cmGeneratedFileStream& fout )
+{
+ //add the folder
+ cmMakefile* makefile = generator->GetMakefile();
+ cmTargets targets = makefile->GetTargets();
+ std::string folderName =
makefile->GetStartDirectory();
+ fout << " <folder name=""
<< folderName << "">"
<< std::endl; //1 space
+
+ std::vector<cmLocalGenerator*> generatorVector =
generator->GetChildren();
+ std::vector<cmLocalGenerator*>::iterator git;
+ for ( git = generatorVector.begin(); git !=
generatorVector.end(); ++git )
+ {
+ addXmlForGenerator( (*git), fout );
+ }
+ //add the includes
+ fout << " <includes>" <<
std::endl; //2 spaces
+ std::vector<std::string> includeList =
makefile->GetIncludeDirectories();
+ std::vector<std::string>::iterator iit, iitEnd =
includeList.end();
+
+ for ( iit = includeList.begin(); iit != iitEnd; ++iit )
+ fout << " <include>"
<< (*iit) << "</include>"
<< std::endl; //3 spaces
+ fout << " </includes>" <<
std::endl;
+
+ //add the definitions
+ fout << " <definitions>"
<< std::endl; //2 spaces
+ std::string definitionList =
makefile->GetDefineFlags();
+ std::vector<std::string> definitions = tokenize(
definitionList, " tn" );
+ for ( std::vector<std::string>::iterator dit =
definitions.begin(); dit != definitions.end(); ++dit )
+ fout << " <define>"
<< (*dit) << "</define>"
<< std::endl; //3 spaces
+ fout << " </definitions>"
<< std::endl;
+
+ //add the targets
+ cmTargets::iterator it = targets.begin(), itEnd =
targets.end();
+ for ( ; it != itEnd; ++it )
+ {
+ cmTarget target = ( *it ).second;
+ fout << " <target name=""
<< target.GetFullName()
+ << "" type=""
<< target.GetProperty( "TYPE" )
+ << "">" <<
std::endl; //2 spaces
+ fout << " <sources>"
<< std::endl; //3 spaces
+ std::vector<std::string> sourceLists =
target.GetSourceLists();
+ std::vector<std::string>::iterator sit,
sitEnd = sourceLists.end();
+ for ( sit = sourceLists.begin(); sit != sitEnd;
++sit )
+ {
+ std::string sourceName = ( *sit );
+ cmSourceFile* sf =
makefile->GetSourceFileWithOutput( (*sit).c_str() );
+ if ( sf )
+ {
+ sourceName = sf->GetSourceName();
+ sourceName += ".";
+ sourceName +=
sf->GetSourceExtension().c_str();
+ }
+ fout << " <source>"
<< sourceName << "</source>"
<< std::endl; //4 spaces
+ }
+ fout << " </sources>"
<< std::endl; //3 spaces
+ fout << " </target>"
<< std::endl; //2 spaces
+ }
+ fout << " </folder>" <<
std::endl; //1 space
+}
+
+
+std::string cmGlobalXmlGenerator::GetProjectName()
+{
+ cmake* cmakeInstance = this->GetCMakeInstance();
+ std::string sourceDir =
cmakeInstance->GetStartDirectory();
+ cmLocalGenerator* localGen =
this->FindLocalGenerator( sourceDir.c_str() );
+ cmMakefile* mf = localGen->GetMakefile();
+ return mf->GetProjectName();
+}
+
+std::vector<std::string>
+cmGlobalXmlGenerator::tokenize( const std::string&
input,
+ const std::string&
delimiters )
+{
+
+ std::vector<std::string> tokens;
+ std::string stream = removeWhitespace( input );
+ std::string::size_type pos = 0;
+ while ( pos != std::string::npos )
+ {
+ pos = stream.find_first_of(delimiters);
+ std::string token = stream.substr(0, pos);
+ stream.erase(0, pos + 1);
+ token = removeWhitespace( token );
+ tokens.insert(tokens.end(), token);
+ }
+
+ return tokens;
+}
+
+std::string cmGlobalXmlGenerator::removeWhitespace( const
std::string& input )
+{
+ try {
+ std::string stream = input;
+ std::string::size_type pos = 0;
+ pos = stream.find_first_not_of(" tn");
+ if ( pos != std::string::npos )
+ stream = stream.substr(pos, std::string::npos);
+ pos = stream.find_last_not_of(" tn");
+ if ( pos != std::string::npos )
+ stream = stream.substr(0, pos+1);
+ return stream;
+ } catch(...) { std::cout << "whoops.
expection in removeWhitespace" << std::endl; }
+}
diff -u -x CVS -Nur CMake/Source/cmGlobalXmlGenerator.h
CMake.new/Source/cmGlobalXmlGenerator.h
--- CMake/Source/cmGlobalXmlGenerator.h 1970-01-01
01:00:00.000000000 +0100
+++ CMake.new/Source/cmGlobalXmlGenerator.h 2006-09-30
09:48:37.000000000 +0200
 -0,0
+1,60 
+/*=========================================================
================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile: cmGlobalKdevelopGenerator.h,v $
+ Language: C++
+ Date: $Date: 2006/02/18 16:03:36 $
+ Version: $Revision: 1.4 $
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium.
All rights reserved.
+ Copyright (c) 2004 Alexander Neundorf, neundorf kde.org.
All rights reserved.
+ Copyright (c) 2006 Matt Rogers, mattr kde.org.
All rights reserved.
+ See Copyright.txt or http://www.c
make.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.
+
+===========================================================
==============*/
+#ifndef cmGlobalXmlGenerator_h
+#define cmGlobalXmlGenerator_h
+
+#include "cmGlobalUnixMakefileGenerator3.h"
+
+/** class cmGlobalXmlGenerator
+ * brief Write Unix Makefiles accompanied by xml files
describing the project.
+ */
+class cmGlobalXmlGenerator : public
cmGlobalUnixMakefileGenerator3
+{
+public:
+ cmGlobalXmlGenerator();
+ static cmGlobalGenerator* New() { return new
cmGlobalXmlGenerator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalXmlGenerator::GetActualName();}
+ static const char* GetActualName() {return
"XML";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry&
entry) const;
+
+ ///! Create a local generator appropriate to this Global
Generator
+ virtual cmLocalGenerator *CreateLocalGenerator();
+
+ /**
+ * Generate the all required files for building this
project/tree. This
+ * basically creates a series of LocalGenerators for each
directory and
+ * requests that they Generate.
+ */
+ virtual void Generate();
+
+ bool CreateXmlFile();
+
+private:
+ std::string GetProjectName();
+ void addXmlForGenerator( cmLocalGenerator*,
cmGeneratedFileStream& );
+ std::vector<std::string> tokenize( const
std::string&, const std::string& );
+ std::string removeWhitespace( const std::string& );
+};
+
+#endif
diff -u -x CVS -Nur CMake/Source/cmLocalXmlGenerator.cxx
CMake.new/Source/cmLocalXmlGenerator.cxx
--- CMake/Source/cmLocalXmlGenerator.cxx 1970-01-01
01:00:00.000000000 +0100
+++ CMake.new/Source/cmLocalXmlGenerator.cxx 2006-09-30
09:48:37.000000000 +0200
 -0,0
+1,42 
+/*=========================================================
================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile: cmLocalKdevelopGenerator.cxx,v $
+ Language: C++
+ Date: $Date: 2006/04/08 18:15:06 $
+ Version: $Revision: 1.19 $
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium.
All rights reserved.
+ Copyright (c) 2004 Alexander Neundorf, neundorf kde.org.
All rights reserved.
+ Copyright (c) 2006 Matt Rogers, mattr kde.org.
All rights reserved.
+ See Copyright.txt or http://www.c
make.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 "cmGlobalGenerator.h"
+#include "cmLocalXmlGenerator.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmSourceFile.h"
+#include "cmCacheManager.h"
+#include "cmGeneratedFileStream.h"
+#include "cmake.h"
+#include <cmsys/RegularExpression.hxx>
+
+
+cmLocalXmlGenerator::cmLocalXmlGenerator()
+ :cmLocalUnixMakefileGenerator3()
+{
+ // KDevelop can itself shorten the output, so it should
+ // always get the full output, otherwise the "full
output"
+ // option in kdevelop doesn't make much sense, Alex
+ this->ForceVerboseMakefiles=true;
+}
+
+cmLocalXmlGenerator::~cmLocalXmlGenerator()
+{
+}
+
diff -u -x CVS -Nur CMake/Source/cmLocalXmlGenerator.h
CMake.new/Source/cmLocalXmlGenerator.h
--- CMake/Source/cmLocalXmlGenerator.h 1970-01-01
01:00:00.000000000 +0100
+++ CMake.new/Source/cmLocalXmlGenerator.h 2006-09-30
09:48:37.000000000 +0200
 -0,0
+1,39 
+/*=========================================================
================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile: cmLocalKdevelopGenerator.h,v $
+ Language: C++
+ Date: $Date: 2005/06/09 15:39:12 $
+ Version: $Revision: 1.7 $
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium.
All rights reserved.
+ Copyright (c) 2004 Alexander Neundorf, neundorf kde.org.
All rights reserved.
+ Copyright (c) 2006 Matt Rogers, mattr kde.org.
All rights reserved.
+ See Copyright.txt or http://www.c
make.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.
+
+===========================================================
==============*/
+#ifndef cmLocalXmlGenerator_h
+#define cmLocalXmlGenerator_h
+
+#include "cmLocalUnixMakefileGenerator3.h"
+
+class cmDependInformation;
+class cmMakeDepend;
+class cmTarget;
+class cmSourceFile;
+
+class cmLocalXmlGenerator : public
cmLocalUnixMakefileGenerator3
+{
+public:
+ ///! Set cache only and recurse to false by default.
+ cmLocalXmlGenerator();
+
+ virtual ~cmLocalXmlGenerator();
+
+};
+
+#endif
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel barney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
|
|
| Using the new CMake buildtool manager |

|
2006-09-30 08:44:32 |
On Saturday 30 September 2006 08:41, Andreas Pakulat wrote:
> On 29.09.06 23:21:52, Matt Rogers wrote:
> > In order for cmake support to work, you will need
to modify your copy
> > of cmake. There is a patch and 4 files contained
at
> > http://matt.rogers.nam
e/cmake.
>
> ...
>
> > Let me know if you have any questions or are
having problems getting it
> > to work, and I'll assist any way I can.
>
> Just one question: Are those patches being integrated
in upstream cmake
Once they are good enough, yes.
> and is there some kind of schedule for this to happen?
Not yet AFAIK.
Alex
--
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org - http://www.kde.org
alex AT neundorf.net - http://www.neundorf.net
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel barney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
|
|
| Using the new CMake buildtool manager |

|
2006-09-30 13:26:29 |
On Saturday 30 September 2006 02:51, Andreas Pakulat wrote:
> On 29.09.06 23:21:52, Matt Rogers wrote:
> > As you may have noticed, I've updated the CMake
build manager so that
> > it's functional again after the removal of all of
the old cmake code. In
> > order for cmake support to work, you will need to
modify your copy of
> > cmake. There is a patch and 4 files contained at
> > http://matt.rogers.nam
e/cmake. The 4 files will need to be copied into
> > the Source directory under your main cmake folder.
The patch will need to
> > be applied as well. I can't remember at the moment
where the patch was
> > made from, so it may need some path fiddling in
order to apply it.
>
> Not sure wether this is of interest to you or anybody
else here, the
> attached patch applies against CMake CVS Head and
includes the changes
> needed at CMakeLists.txt and cmake.cxx as well as the
new files.
>
> Andreas
there's a patch to do that on the website already.
--
Matt
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel barney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
|
|
| Using the new CMake buildtool manager |

|
2006-09-30 14:28:15 |
On 30.09.06 08:26:29, Matt Rogers wrote:
> On Saturday 30 September 2006 02:51, Andreas Pakulat
wrote:
> > On 29.09.06 23:21:52, Matt Rogers wrote:
> > > As you may have noticed, I've updated the
CMake build manager so that
> > > it's functional again after the removal of
all of the old cmake code. In
> > > order for cmake support to work, you will
need to modify your copy of
> > > cmake. There is a patch and 4 files contained
at
> > > http://matt.rogers.nam
e/cmake. The 4 files will need to be copied into
> > > the Source directory under your main cmake
folder. The patch will need to
> > > be applied as well. I can't remember at the
moment where the patch was
> > > made from, so it may need some path fiddling
in order to apply it.
> >
> > Not sure wether this is of interest to you or
anybody else here, the
> > attached patch applies against CMake CVS Head and
includes the changes
> > needed at CMakeLists.txt and cmake.cxx as well as
the new files.
>
> there's a patch to do that on the website already.
Well, not quite. From a quick look it cannot be applied by
running patch
-p1 <patchfile and it doesn't include the new files in
the patch. One
has to manually copy them.
Anyway, I will stop bugging you with that now, just thought
it might
save some time;)
Andreas
--
You prefer the company of the opposite sex, but are well
liked by your own.
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel barney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
|
|
[1-6]
|
|