Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup CLion to use waf as build system

I am trying to configure my Intellij Clion IDE for working with ns-3. Since ns-3 is using waf, it is more tricky than i thought and would be really happy to hear any advice

like image 559
Benjamin Reim Avatar asked Apr 29 '16 15:04

Benjamin Reim


2 Answers

CLion supports compilation databases for quite some while, which waf, luckily, is able to generate using the clang_compilation_database extension.

You'll need to load it within your configuration and option step; i.e. like this:

def options(ctx):
    # Assuming you just copied the script into a directory called tools
    ctx.load('clang_compilation_database', tooldir='tools')
    # ...

def configure(ctx):
    ctx.load('clang_compilation_database', tooldir='tools')
    # ...

Now you can call waf clangdb; you'll be presented a file called 'compile_commands.json' in your build directory.

like image 91
Julian Kirsch Avatar answered Oct 21 '22 16:10

Julian Kirsch


CLion only uses cmake for its internal project definition - so you have to have a cmake config.

It can be very simple and mirror parts of another build system you actually use, but how CLion treats files and what it does when you tell it to build something is defined by cmake and only cmake.

like image 1
xaxxon Avatar answered Oct 21 '22 15:10

xaxxon