How to build SCons projects with Eclipse CDT?

前端 未结 6 1987
太阳男子
太阳男子 2021-01-31 10:14

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

相关标签:
6条回答
  • 2021-01-31 10:44

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

    0 讨论(0)
  • 2021-01-31 10:50

    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.

    0 讨论(0)
  • 2021-01-31 10:54

    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

    0 讨论(0)
  • 2021-01-31 11:08

    Be VERY VERY careful about using Sconsolidator with an existing project!! It will blindly overwrite any existing SConstruct/SConscript files you have in the root directory of your project when you click the link to add a SCons nature to your project. (I'm trying to report this as a bug to the project, but being blocked at every turn so far.)

    0 讨论(0)
  • 2021-01-31 11:09

    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.

    0 讨论(0)
  • 2021-01-31 11:11

    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.

    0 讨论(0)
提交回复
热议问题