4

こんにちは、waf (1.7.5) に完全に移行する前に、次の構造の単純なプロジェクトを作成しようとしました。

wafproject
├── application
│   ├── main.cpp
│   └── wscript
├── library1
│   ├── foo1.hpp
│   ├── foo2.hpp
│   └── wscript
└── wscript

これはルートwscriptです:

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

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

def build(bld) :
    bld.recurse('library1')
    bld.recurse('application')

これは次のapplication wscriptとおりです。

def build(bld) :
    bld( features = 'cxx cxxprogram'
       , target = 'application'
       , source = 'main.cpp'
       , use = ['library1']
       )

これはlibrary1 wscript

def build(bld) :
    bld( name = 'library1'
       , inludes = '../../'
       , export_inludes = '../../'
       )

(注: fortargetの代わりにを使用してみました。また、 の機能を有効にしようとしました。)namelibrary1cxx cxxshliblibrary1

これは次のmain.cppとおりです。

#include <wafproject/library1/foo1.hpp>
#include <wafproject/library1/foo2.hpp>

int main()
{
}

そして、これは私が得るエラーです:

Setting top to                           : /home/<path>/wafproject 
Setting out to                           : /home/<path>/wafproject/build 
Checking for 'g++' (c++ compiler)        : /usr/bin/g++ 
'configure' finished successfully (0.038s)
Waf: Entering directory `/home/<path>/wafproject/build'
[1/3] cxxshlib:  -> build/library1/liblibrary1.so
[2/3] cxx: application/main.cpp -> build/application/main.cpp.1.o
../application/main.cpp:1:40: fatal error: wafproject/library1/foo1.hpp: Directory or file does not exist.
compilation terminated.
Waf: Leaving directory `/home/<path>/wafproject/build'
Build failed
 -> task in 'application' failed (exit status 1): 
        {task 139729350901264: cxx main.cpp -> main.cpp.1.o}
['/usr/bin/g++', '../application/main.cpp', '-c', '-o', 'application/main.cpp.1.o']

ヘッダーを含める方法を変更したくありませんが、そのためには、プロジェクトの設定方法を変更する必要があるようです。

ご意見をお寄せいただければ幸いです。ありがとうございます。

EDIT:解決しました、それは単なるタイプミスでした(inludes代わりにincludesandexport_inludesの代わりにexport_includes)。

4

1 に答える 1

1

これは「ヘッダーのみのライブラリ waf」の Google での最初のものであるため、一般的な解決策を投稿する必要があると考えました。

bld(name = 'libname', export_includes = 'PATH/TO/lib/')

これは私にとってはうまくいきます。

于 2014-12-22T23:35:40.110 に答える