Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-16 Thread Alexander Neundorf
On Wednesday 16 November 2011, Dan Kegel wrote:
> On Wed, Nov 16, 2011 at 9:43 AM, Alexander Neundorf
> 
>  wrote:
> >> I suspect that the only way to make source code control
> >> plugins happy is to link to dummy projects like you
> >> do for the main source directory.
> >> And then there's no need for those individual source file links.
> > 
> > AFAIK svn etc. work only if you either build in-source, or in the
> > additional in-source project.
> > I.e. AFAIK it doesn't work in the build tree project.
> 
> Then don't.  

Don't what ?

> My users expect each top level source directory to

What is a top level source directory ?

> have a top level eclipse project connected to svn.  They will
> do all their svn and editing via those top-level source projects.
> They expect Eclipse to rebuild when they click "Build Project"
> in the build tree project, so the build tree project has to link
> to the source projects.

It does that, right ?
Or would you expect it do it in a different way ?
 
> I already posted a shell script that does this for my special case.
> I'm not quite sure how the cdt generator would figure out how
> what directories to create phony source projects for, but maybe
> it's something like

I'd go with the one link to each subproject.
So if you want a link, add a project() call to the respective CMakeLists.txt.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-16 Thread Dan Kegel
On Wed, Nov 16, 2011 at 9:43 AM, Alexander Neundorf
 wrote:
>> I suspect that the only way to make source code control
>> plugins happy is to link to dummy projects like you
>> do for the main source directory.
>> And then there's no need for those individual source file links.
>
> AFAIK svn etc. work only if you either build in-source, or in the additional
> in-source project.
> I.e. AFAIK it doesn't work in the build tree project.

Then don't.  My users expect each top level source directory to
have a top level eclipse project connected to svn.  They will
do all their svn and editing via those top-level source projects.
They expect Eclipse to rebuild when they click "Build Project"
in the build tree project, so the build tree project has to link
to the source projects.

I already posted a shell script that does this for my special case.
I'm not quite sure how the cdt generator would figure out how
what directories to create phony source projects for, but maybe
it's something like
  candidates = all CMakeList.txt files
  For each candidate
Remove all candidates in child directories
  Create phony projects and links for all remaining candidates

The links can be hidden deep in the project hierarchy without
harm because users will ignore them; they're only there to inform
Eclipse of the dependencies.
- Dan
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-16 Thread Alexander Neundorf
On Wednesday 16 November 2011, Dan Kegel wrote:
> On Tue, Nov 15, 2011 at 1:28 PM, Dan Kegel  wrote:
> > Tried it.  It seems to get the linking right, though I'm not
> > sure how excited my users are going to be about how
> > deeply buried those source files are in the GUI.  There's
> > a whole lot of visual cruft around them.
> 
> Worse, the Team menu is inactive for these files.
> 
> I suspect that the only way to make source code control
> plugins happy is to link to dummy projects like you
> do for the main source directory.
> And then there's no need for those individual source file links.

AFAIK svn etc. work only if you either build in-source, or in the additional 
in-source project.
I.e. AFAIK it doesn't work in the build tree project.
I tried to ask on the ctd development list for what needs to be done to get 
that working, but without useful results.

I think the only way to get that working is if somebody who wants to get this 
(svn in build dir in Eclipse) working actually works on the Eclipse and/or ctd 
sources and makes it work there.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-15 Thread Dan Kegel
On Tue, Nov 15, 2011 at 1:28 PM, Dan Kegel  wrote:
> Tried it.  It seems to get the linking right, though I'm not
> sure how excited my users are going to be about how
> deeply buried those source files are in the GUI.  There's
> a whole lot of visual cruft around them.

Worse, the Team menu is inactive for these files.

I suspect that the only way to make source code control
plugins happy is to link to dummy projects like you
do for the main source directory.
And then there's no need for those individual source file links.
- Dan
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-15 Thread Dan Kegel
On Mon, Nov 14, 2011 at 3:37 PM, Dan Kegel  wrote:
> On Sat, Nov 12, 2011 at 11:04 AM, Alexander Neundorf
>  wrote:
>> * please give current cmake master a try, it has several improvements.
>
> I'll give cmake master a spin sometime this week.

Tried it.  It seems to get the linking right, though I'm not
sure how excited my users are going to be about how
deeply buried those source files are in the GUI.  There's
a whole lot of visual cruft around them.

I may stick with a hybrid approach: use the links you generate now,
but also generate my own phony .projects.  That way the source
files show up uncluttered at the top level, but the dependencies
now work thanks to your new links.
- Dan
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-14 Thread Dan Kegel
On Sat, Nov 12, 2011 at 11:04 AM, Alexander Neundorf
 wrote:
> Ok. So two things:
> * please give current cmake master a try, it has several improvements.
> * please create a ticket in the cmake bug tracker for this, improved source-
> project generator for Eclipse, or something like this.
>
> My goal is to have no open bugs for Eclipse when 2.8.7 wil be released.

OK, I filed http://public.kitware.com/Bug/view.php?id=12579
for this

I'll give cmake master a spin sometime this week.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-12 Thread Alexander Neundorf
On Saturday 12 November 2011, Dan Kegel wrote:
> In http://www.cmake.org/pipermail/cmake/2011-November/047250.html
> I wrote
> 
> "I can't reorganize the source tree on the developers,
> so I'm making do by putting the enclosing CMakeLists.txt next to all
> the projects:
>toplevel/trunk/CMakeLists.txt
> which is checked out to
>toplevel/CMakeLists.txt
> It does
>add_subdirectory(../libfoo libfoo)
>add_subdirectory(../libbar libbar)
>add_subdirectory(../baz baz)
> This has the possible advantage that one can have multiple
> "top levels" (say, one for server code, and one for client).
> I don't know how many shops suffer from this svn layout, but I'll probably
> add an example covering it anyway for completeness once I'm sure
> it doesn't explode in practice."
> 
> Right, well, I found out where it explodes in practice.  Here's an example:
> http://code.google.com/p/winezeug/source/browse/trunk/cmake_examples/ex7/
> 
> The problem comes when using the cdt generator.  We can't use
> -DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE
> since there are more than one source project, but the
> source project that generates is really trivial, so I generate
> one for each source directory myself with a bit of shell:
> 
> for dir in demo libsrc
> do
> sed "s/PROJNAME/_$dir/" < ../skeleton.project > ../$dir/.project
> done
> 
> before or after running cmake.
> 
> It all works great, the source projects all show up, the project builds...
> BUT when you edit a source file and tell eclipse to rebuild, it just
> sits there.  It doesn't know that the source projects are related to
> the build project.
> 
> It looks like adding a link does the trick:
> 
> --- .project.old  2011-11-11 22:51:56.797674441 +
> +++ .project  2011-11-11 22:52:25.380913484 +
> @@ -113,5 +113,11 @@
>   2
>   
> /home/dank/winezeug/cmake_examples/ex7/demo
>   
> + 
> + [Source directory 2]
> + 2
> + 
/home/dank/winezeug/cmake_examples/ex7/libsrc
> + 
> +
>   
>  
> 
> After I add those lines to the .project, saved changes in libsrc do seem
> to cause a rebuild the next time you click "build project".
> 
> So, I guess to support this style of project, the cdt generator
> should call cmExtraEclipseCDT4Generator::AppendLinkedResource()
> once for each call in my outer CMakeLists.txt like
> add_subdirectory(../libsrc libsrc).

Ok. So two things:
* please give current cmake master a try, it has several improvements.
* please create a ticket in the cmake bug tracker for this, improved source-
project generator for Eclipse, or something like this.

My goal is to have no open bugs for Eclipse when 2.8.7 wil be released.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Multiple source directory scenario and cdt generator

2011-11-11 Thread Dan Kegel
On Fri, Nov 11, 2011 at 11:01 PM, Dan Kegel  wrote:
> I have no idea how to make that happen inside the cdt generator.  I could 
> kludge
> it in the shell script that runs cmake, but then it would break whenever
> the project was updated and cmake rebuilt the project automatically.

OK, the following shell script is a kludgy prototype of what I think I need,
it seems to work for me.  Set top to the parent directory of all the peers,
src to the directory containing the master CMakeLists.txt, and
run this after running cmake.   (Presumably inside cdt there's some
more artful way of detecting CMakeLists.txt instances that are outside
the normal tree, and which need this special treatment.)

# Generate null projects for each source directory by hand
# rather than asking the cdt generator to do it, since
# it can't handle more than one
projnames=`grep '^[^#]*add_subdirectory(\.\.' $SRC/CMakeLists.txt |
sed 's,.*/,,;s, .*,,' | sort -u`
for dir in $projnames
do
sed "s/PROJNAME/_$dir/" < $SRC/skeleton.project > ../$dir/.project
done

# And now link those directories to the binary project
# so changes in them cause Eclipse to know the binary project
# needs rebuilding.
# FIXME: this needs to be inside the cdt generator, else
# the links will be lost when cmake regenerates itself on
# CMakeLists.txt changes
sed '/<\/linkedResources>/,$d' < .project > .newproject
for dir in $projnames
do
cat >> .newproject <<_EOF_

[_$dir]
2
$top/$dir

_EOF_
done
sed '1,/<\/link>/d' < .project >> .newproject
mv .project .oldproject
mv .newproject .project
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Multiple source directory scenario and cdt generator

2011-11-11 Thread Dan Kegel
In http://www.cmake.org/pipermail/cmake/2011-November/047250.html
I wrote

"I can't reorganize the source tree on the developers,
so I'm making do by putting the enclosing CMakeLists.txt next to all
the projects:
   toplevel/trunk/CMakeLists.txt
which is checked out to
   toplevel/CMakeLists.txt
It does
   add_subdirectory(../libfoo libfoo)
   add_subdirectory(../libbar libbar)
   add_subdirectory(../baz baz)
This has the possible advantage that one can have multiple
"top levels" (say, one for server code, and one for client).
I don't know how many shops suffer from this svn layout, but I'll probably
add an example covering it anyway for completeness once I'm sure
it doesn't explode in practice."

Right, well, I found out where it explodes in practice.  Here's an example:
http://code.google.com/p/winezeug/source/browse/trunk/cmake_examples/ex7/

The problem comes when using the cdt generator.  We can't use
-DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE
since there are more than one source project, but the
source project that generates is really trivial, so I generate
one for each source directory myself with a bit of shell:

for dir in demo libsrc
do
sed "s/PROJNAME/_$dir/" < ../skeleton.project > ../$dir/.project
done

before or after running cmake.

It all works great, the source projects all show up, the project builds...
BUT when you edit a source file and tell eclipse to rebuild, it just
sits there.  It doesn't know that the source projects are related to
the build project.

It looks like adding a link does the trick:

--- .project.old2011-11-11 22:51:56.797674441 +
+++ .project2011-11-11 22:52:25.380913484 +
@@ -113,5 +113,11 @@
2

/home/dank/winezeug/cmake_examples/ex7/demo

+   
+   [Source directory 2]
+   2
+   
/home/dank/winezeug/cmake_examples/ex7/libsrc
+   
+

 

After I add those lines to the .project, saved changes in libsrc do seem
to cause a rebuild the next time you click "build project".

So, I guess to support this style of project, the cdt generator
should call cmExtraEclipseCDT4Generator::AppendLinkedResource()
once for each call in my outer CMakeLists.txt like
add_subdirectory(../libsrc libsrc).

I have no idea how to make that happen inside the cdt generator.  I could kludge
it in the shell script that runs cmake, but then it would break whenever
the project was updated and cmake rebuilt the project automatically.

Was http://public.kitware.com/Bug/view.php?id=9978 /
https://github.com/rpavlik/CMake/commit/10aece0d8199409fbb695478eab2c60545fcf310
related at all?
- Dan
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake