Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build SCons projects with Eclipse CDT?

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).

like image 790
nos Avatar asked Jun 27 '09 12:06

nos


People also ask

What is Eclipse CDT builder?

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.

What is CDT managed build system?

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.


5 Answers

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.

like image 109
dmeister Avatar answered Oct 06 '22 01:10

dmeister


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

like image 38
PeterSom Avatar answered Oct 06 '22 02:10

PeterSom


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.

like image 43
richq Avatar answered Oct 06 '22 02:10

richq


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.

like image 29
Torsten Avatar answered Oct 06 '22 00:10

Torsten


http://sconsolidator.com/ Sconsolidator should work though.

like image 33
Benjamin Avatar answered Oct 06 '22 02:10

Benjamin