Since this is the first thing on google for 'header only library waf', I thought I should post the generic solution.
bld(name = 'libname', export_includes = 'PATH/TO/lib/')
Which works for me.
Question
Good day, before fully migrating to waf (1.7.5), I have tried to create a simple project of this structure:
wafproject
├── application
│ ├── main.cpp
│ └── wscript
├── library1
│ ├── foo1.hpp
│ ├── foo2.hpp
│ └── wscript
└── wscript
This is the root wscript
:
def options(opt) :
opt.load('compiler_cxx')
def configure(cnf) :
cnf.load('compiler_cxx')
def build(bld) :
bld.recurse('library1')
bld.recurse('application')
This is the application
wscript
:
def build(bld) :
bld( features = 'cxx cxxprogram'
, target = 'application'
, source = 'main.cpp'
, use = ['library1']
)
This is the library1
wscript
def build(bld) :
bld( name = 'library1'
, inludes = '../../'
, export_inludes = '../../'
)
(Note: I have tried using target
instead of name
for library1
, and I have also
tried enabling cxx cxxshlib
features for library1
.)
This is the main.cpp
:
#include <wafproject/library1/foo1.hpp>
#include <wafproject/library1/foo2.hpp>
int main()
{
}
And this is the error I get:
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']
I do not want to change the way I include the headers, but for that I apparentely need to change the way my project is set up.
I would be glad for any input, thanks.
EDIT: Solved, it was just a typo (inludes
instead of includes
and export_inludes
instead of export_includes
).
No correct solution
OTHER TIPS
Since this is the first thing on google for 'header only library waf', I thought I should post the generic solution.
bld(name = 'libname', export_includes = 'PATH/TO/lib/')
Which works for me.