Question

I'm trying to use -include preprocessor option. GCC Preprocessor Options I've failed to do that in my configure method as regular CXXFLAGS option

def configure(conf):
    conf.load('compiler_cxx')
    conf.env.append_value('CXXFLAGS', ['-g', '-include global.h'])

due to it add's it before -I options. And gcc could not find my header. How I can add -include global.h after all -I options?

Was it helpful?

Solution 2

the solution is:

def build(bld):
    bld.env.MYFLAGS = ['-include', 'global.h']
    from waflib import Task
    class cxx(Task.classes['cxx']):
        run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS}${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK}${CPPPATH_ST:INCPATHS} ${MYFLAGS} ${DEFINES_ST:DEFINES}${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT}' 

OTHER TIPS

Well I think you can look at the waf book § 10.3.2. You can attach a specific method to the cxx feature in order to add the '-include' option after the include paths.

Another way is to monkeypatch the cxx class and modify the run_str string that manage the comilation.

Third option : Ask on waf mailing list, you usually get an answer very quickly ^^

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top