Coder32
Coder32

Reputation: 181

Getting waf to output solution to another directory

I recently wrote this simple waf build script:

#! /usr/bin/env python
# encoding: utf-8

def options(opt):
    opt.load('compiler_cxx')
    opt.load('msvs')

def configure(conf):
    conf.load('compiler_cxx')

def build(bld):
    print('build')

but the problem is that the outputed solution file is at the root of the project (where wscript is);

Project Structure after running waf

Would there be a way to generate the ide specific files into another directory (for instance, ide/msvs) ?

Upvotes: 2

Views: 1067

Answers (1)

user69453
user69453

Reputation: 1405

You can redirect the output of the solution by using

out = os.path.join('my', 'out', 'dir')

which is relative to the top_dir (https://waf.io/apidocs/Context.html?highlight=top_dir#waflib.Context.top_dir).

So in your case:

#! /usr/bin/env python
# encoding: utf-8
import os

out = os.path.join('my', 'out', 'dir')

def options(opt):
    opt.load('compiler_cxx')
    opt.load('msvs')

def configure(conf):
    conf.load('compiler_cxx')

def build(bld):
    print('build')

Upvotes: 1

Related Questions