building a library using gtk+



I have code that works but requires an awful sequence of gtk libraries.
For speed of development, if nothing else, I want to collapse that
sequence into a single libary of mine, then just link to it.

Here's the make lines:

OBJ3=Component.o Container.o Viewer.o Controller.o Style.o
ECOMModelGrid.o

glpp3: $(OBJ3) test2.o GLPPmain.o Makefile
     g++ $(OPT) $(DEBUG) $(OBJ3) GLPPmain.o test2.o -o glpp3 `pkg-config
--libs gtk+-2.0` $(LIBS) -lftgl


If I run pkg-config and capture the output, this is what it puts out:
-Wl,--export-dynamic -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0
-lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0

So I want to build a library that builds in all the links to these
libraries, because the user code does none of this and therefore
shouldn't need to see all this nonsense. My code needs to be built
against the gtk+ code, not the applications built on top of it.

So I try to build a library.
libglpp.a: $(OBJ3) GLPPmain.o
     #g++ -shared $(OPT) $(DEBUG) $(OBJ3) GLPPmain.o -o glpp.so
`pkg-config --libs gtk+-2.0` $(LIBS) -lftgl
     ar r libglpp.a $(OBJ3) GLPPmain.o

The first line did not work, and I'm hoping someone can give me the
right set of command line arguments. I want to resolve the links to all
the libraries and build a library of my own.
The ar line works, but all it does is combine the objects into a library
which does nothing to resolve the dependencies.
I would like the following to work:

glpp3b: test2.o libglpp.a
     g++ $(OPT) $(DEBUG) test2.o libglpp.a -o glpp3b 

If libglpp.a has to be a .so, that's fine.

Is this possible under Linux?

thanks!




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]