美好的一天,在完全迁移到 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 = '../../'
)
(注意:我尝试过使用target
而不是name
for library1
,并且我也尝试过为 启用cxx cxxshlib
功能library1
。)
这是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']
我不想改变包含标题的方式,但为此我显然需要改变我的项目设置方式。
我很高兴有任何意见,谢谢。
编辑:已解决,这只是一个错字(inludes
而不是includes
和export_inludes
而不是export_includes
)。