We have a fairly large C/C++ project using scons for the building. I'd like to go at an attempt to build this through Eclipse-CDT. Anyone have any experience with this and can tell me the steps to set up scons as a builder. (NOT using the SConsBuilder plugin, it will not work with the Eclipse-CDT from Fedora-11).
A CDT project typically has two builders. The first one is the CDT builder which is responsible for compiling your code. If you are using an external build tool you are most likely using a "makefile project", in which case the CDT builder simply invokes your build tool for you.
The managed build system generates the buildfiles and automatically obtains the build information based upon the following info: 1. Tool-chain/tool/builder definitions provided by an ISV used for the given project 2. User-modified/specified settings 3. The set of project resources.
You can use a Makefile that simply delegates the important targets to scons
.PHONY: all clean install
default: all
all:
scons
clean:
scons -c
install:
scons install
Then it is possible to use "Standard Make C Project" out of the box.
One of our students implemented a new SCons integration for Eclipse CDT that works bi-directional, i.e., it can import SCons files and populate Eclipse CDT projects with the corresponding settings and it can generate SCons files from Eclipse project settings. In addition it provides an interactive SCons mode that speeds up incremental building of larger SCons projects significantly. It will be released to the public for free soon, see http://sconsolidator.com
I've tried Waf in Eclipse CDT before now, SCons would be really similar. The solution was to create an empty Makefile project, then simply change "make" to "scons" in the options. On Windows that would probably need the scons.bat file in your path. That is not much better than creating a dummy Makefile that has an all:\n\tscons
type pattern in it, but is the least work.
The SConsBuilder plugin is not a good idea. It has a whole bunch of hard coded python code in there that it spits out to a SConstruct. It hasn't been updated in ages and a lot of code is probably deprecated in SCons by now. I think a better approach is to do what SCons does for Visual Studio, or what CMake does for Eclipse CDT. That means generating a .cproject file on the fly based on your build configuration.
I wrote an Eclipse project generator for Waf at one point, which walks the build nodes gathering source files and spits out a .project and .cproject file. Similar to how CMake does it, but Waf's default behaviour of creating a variant directory means you don't have to deal with out-of-source build issues. This has since been added as an extra in waf itself. It uses only part of the Waf API so it would be possible to convert it to SCons with some small-ish amount of work. In other words, there's nothing much out there. The .cproject format is not really documented anywhere and is really ugly compared to the Java version.
I didn't get on too well with CDT though - it is a long way behind the Java dev tools - and I still use Vim with :make
, so it was all a bit academic in the end.
Just change builder settings, no plugins required. Choose external builder and set scons instead of make and set workdir to dir where SConstruct placed.
Now, you can use make targets view to create scons build commands and execute it like make commands. Error parsers with scons works fine by default, no additional configuration required.
http://sconsolidator.com/ Sconsolidator should work though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With