Combining multiple static libraries into single share library in Boost Jam file

712 views Asked by At

Hi I have following project hirarcy:
-Top
------lib1
----------Jamfile
------lib2
----------Jamfile
------Jamroot

Both the libs:lib1 and lib2 are static libs(.a) and their Jamfile consist of following command:

lib $(library) : [ glob *.cpp ] : <link>static ;

Now at Jamroot level, I have to create a single shared library(.so) by combining all above two static libs:lib1.a and lib2.a should be combined and form a libmain.so.

Can you tell me how can I write required bjam statement to achieve above purpose in my Jamroot.jam file?

2

There are 2 answers

0
Steve Lorimer On

Have you tried something like this?

shared-lib main
  : /lib1//lib1
    /lib2//lib2
  : <link>shared
    <cxxflags>-fPIC
  ;
0
syvex On

I do this for Android libraries. The trick is to just add /<link>static after each library.

lib shared-library
  :
    /lib1//lib1/<link>static
    /lib2//lib2/<link>static
  :
    <link>shared
  ;