Re: Configure EDE project in project dir

Eric Ludlam <[email protected]> Mon, 09 Feb 2015 20:27:49 -0500
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>

On 02/03/2015 03:10 AM, Florian Lindner wrote:
> Hello,
>
> I'm using the CEDET tools boundled with Emacs 24.4.
>
> I'm experimenting with ede right now. My main goal so far is to make
> semantic finds the includes.
>
> (ede-cpp-root-project "preCICE"
>                        :name "preCICE"
>                        :file "/home/florian/scratch/la/precice/SConstruct"
>                        :include-path '("/src")
>                        )
>
> in my .emacs works so far.
>
> Occasionally I copy my project directory somewhere and don't want to
> copy/paste this snippet. Is there a way to include this information in
> project dir and have ede look it up recursively, just like dir-local.el?

The ede-cpp-root-project type needs a custom snippet for each directory 
you want to put a project into.  This is basically by request from 
people who didn't want .ede files cluttering their directories.

EDE's project loader is, however, easy to extend.  If you look in 
ede/cpp-root.el, there is a snippet at the end of the commentary section 
that describes how to write your own loader for loading in this type of 
project.

It's been a long time since I tested that type of code.  I think it is 
compatible with the 24.4 version, though I'm not entirely sure about 
emacs 25 due to changes I made to the autoloader.

> Or use dir-locals to set? I can probably directly set semanticdb-project-
> roots in my dir-locals.el, but I want to try ede and see what further
> benefits it has.
>
> There is a Project.ede that is created when using ede-new but I wasn't
> really able to figure out what for.

That project type is if you want EDE to create Makefiles, or 
Automakefiles for you.  ede-cpp-root-project is if you just want a thin 
project wrapper around an existing project.

> Adding :include-path '("/src") to it yields strange errors when opening the
> file. Without it does not fix set my semantic include path. Curious I still
> need to open it so that (ede-toplevel-project-or-nil ".") in a subdir of
> the
> project returns non-nil. But why is there an (ede-project-directories
> (quote
> ("/home/florian/scratch/la/precice"))) is my .emacs if it shows no effect?

The version of ede in 24.4 is flawed in that it can't find a project 
from a subdirectory unless there is a tag file in it.  (ie - a file that 
says it belongs to EDE).   This is fixed in the version in the CEDET 
repository.

ede-cpp-root-project fixes this by having you instantiate the project at 
the beginning, and then it knows where the root is and can then identify 
projects in it.

I'm not sure exactly what situation you are trying to describe above. 
Are you saying it can't find your project from a subdir at all, or only 
before you instantiate a project with .dir-locals.el?

> ede-new offers to project type, Make or Automake, mine is scons driven.
>
> Sorry, but I'm a kind of confused....

There are many kinds of projects provided by EDE.  Each one offers 
something different.  The "Make" and "Automake" project types create a 
Project.ede.  You have to explicitly add files to targets via 
keybindings or menu and then when you 'compile' with the 
ede-compile-project or ede-compile-target command.

ede-cpp-root-project doesn't have a way to be created from 'ede-new', 
and is a simple wrapper for folks you don't want to deal with the 
complexity of targets and projects.

There can also be arduino and android projects from ede-new, though I'm 
not sure those were integrated into Emacs src.  Those create special 
kinds of projects based on the the SDKs of each.

There is also a 'generic' project type which is disabled by default. 
This project is a thin wrapper of existing code, and you can add your 
own custom detector.  One of the built-in ones is for SCons.  This might 
be something you want, as after it detects a project, you can do:

M-x customize-project RET

and update include paths and the like similarly to cpp-root project.  To 
try it out, use:

M-x ede-enable-generic-projects RET

and it should automatically add a EDEConfig.el to your src dir at the root.

To make sure it works, just pull up your SConstruct file before opening 
other files in your project.  This caveat is fixed with the version in 
Emacs 25, or from the CEDET git repository.

I hope this helps.
Eric



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/