meson build - Link static library to shared library or to a binary -
i have static library project a
(let's call liba.so
) , want compile shared library in project b
(let's call libb.so
) , embed liba.so
in it.
also, have binary in project b
depends on liba.so
, want embed in binary.
is possible? how?
when separate code base
what build , install project a. create dependency on project in project b's definition.
that looks this:
a_dep = dependency('a', version : '>=1.2.8') lib_b = shared_library('proj_b', sources: 'prog_b.c', dependencies : a_dep)
the version section in dependency
optional.
when in same meson project b
when , b in same meson project, it's little uglier. have declare dependency anchor in a.
that looks this:
incdirs = include_directories('include') lib_a = static_library('a', 'proj_a.c', include_directories : indirs) liba_dependency = declare_dependency( include_directories : incdirs, link_with : lib_a, sources : ['proj_a.c'])
then project b becomes:
lib_b = shared_library('proj_b', sources: 'prog_b.c', dependencies : lib_a)
Comments
Post a Comment