5

I've just started using Eclipse for Python development since we can make use of a lovely plugin I've found to enable distributed pair-programming. Anyway, the next step to getting Eclipse to integrate properly with our existing environment, would be finding a way to drive our current build tool (Waf) from within the IDE.

So the question is, is there a way I can set up Eclipse to drive Waf in a Make-like fashion? I see for Make it has some quite advanced functionality, such as being able to work out what targets are available etc. Bonus points for telling me if there is a way I could go as far as this! (I suspect the answer is that this is all built in to the Make plugin for Ecplipse).

jkp
  • 78,960
  • 28
  • 103
  • 104

3 Answers3

3

In eclipse CDT I run waf by simply changing the build program in ProjectPreferences->C/C++ Build->BuilderSettings Choose External builder and then put in the path to waf

for example I use /Users/mark/bin/waf -v -k -j2

Note that waf and make do not agree on the -j setting and you have to give i explicitly and not use the eclipse dialog.

You can use the Make targets view add the targets to call waf e.g. configure, build etc.

One issue I had is that Eclipse is hard coded to see the output from Make say Make when i changes directory so I had to patch waf see waf issue

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
2

You could try and define a Custom builder, calling Waf with the appropriate options for the python compilation step.

http://nmake.alcatel-lucent.com/manual/eclipse/jdt_lu38/builders.png

(From eclipsejdt alcatel-lucent manual)

That picture (not related to Waf at all) illustrates the fact a builder can be defined as an external tool (meaning any .bat or shell you may want to call)

In that "eclipsejdt" example, the custom builder was configured like so:

To set up the builder, bring up the property dialog for project "jex1p" by selecting the project in the Package Explorer and selecting Project > Properties > Builders. Then click New..., select Program, and click OK.

Configure the builder Main tab using values:

Name             : nmbldr_pre
Location         : ${system_path:ksh}
Working Directory: ${build_project}
Arguments        : nmbldr -p 2 -t ${build_type} -s jpre
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

As VonC says, the elegant way is to use a Custom builder.

Alternatively it is less work (in the short term) to hack together an ant script to do the heavy lifting and define an external builder to configure it onto the project. You may find the drawbacks of an external builder (e.g. no incremental support) mean it is worth investing the effort to do it "properly".

Rich Seller
  • 83,208
  • 23
  • 172
  • 177