Demo5 - Building the code as a static library

This fifth demo, shows how to build qdmilib into static libraries, and also how to build new libraries which use qmdilib classes and how to link those libraries into your application.

This application uses the same code as demo2 and demo4, with a single difference: all the classes of qmdilib are compiled into a static library (libqmdi.a), and the extended text editor and help browser into another library (libqexedit.a). The final binary will be linked with those libraries. This demo will provide the same functionality as demo2 and demo4, but unlike demo4 the binary produced will be slightly bigger because of the static linking, it should be more or less the same size as demo2.

The main project on this demo is a subdirs project, which will build the qmdilib library, the qexedit library and finally also the main application.

This is the project file for qmdilib:

TEMPLATE = lib
TARGET = qmdi
CONFIG += staticlib
VERSION = 0.0.4

DESTDIR = ../
MOC_DIR =  ../../../tmp/
RCC_DIR =  ../../../tmp/
UI_DIR =  ../../../tmp/
OBJECTS_DIR = ../../../tmp/
INCLUDEPATH += . ../../../src

# Input
HEADERS += ../../../src/actiongroup.h \
           ../../../src/actiongrouplist.h \
           ../../../src/qmdiclient.h \
           ../../../src/qmdihost.h \
           ../../../src/qmdiserver.h \
           ../../../src/qmditabwidget.h

SOURCES += ../../../src/actiongroup.cpp \
           ../../../src/actiongrouplist.cpp \
           ../../../src/qmdiclient.cpp \
           ../../../src/qmdihost.cpp \
           ../../../src/qmdiserver.cpp \
           ../../../src/qmditabwidget.cpp

This is the project file for qexedit, see how it also links the qmdi library:

TEMPLATE = lib
TARGET = qexedit
CONFIG += staticlib
VERSION = 0.0.4

DESTDIR = ../
MOC_DIR =  ../../../tmp/
RCC_DIR =  ../../../tmp/
UI_DIR =  ../../../tmp/
OBJECTS_DIR = ../../../tmp/
INCLUDEPATH += . ../../../src

# Input
unix:LIBS += -L../ -lqmdi

HEADERS += ../../demo2/qexeditor.h \
           ../../demo2/helpbrowse.h

SOURCES += ../../demo2/qexeditor.cpp \
           ../../demo2/helpbrowse.cpp

This is the project file for the main application, see how it links qmdi and qexedit. Unlike demo4, the wrapper script is not needed on Unix, and the *.a files are not needed on the release package.

TEMPLATE = app
TARGET = demo5
CONFIG += static

DESTDIR = ../
MOC_DIR =  ../../../tmp/
RCC_DIR =  ../../../tmp/
UI_DIR =  ../../../tmp/
OBJECTS_DIR = ../../../tmp/
INCLUDEPATH += . ../../../src/ ../../demo2/

# Input
unix:LIBS += -L../ -lqmdi  -lqexedit
win32:LIBS += ../libqexedit.a ../libqmdi.a

RESOURCES += demo5.qrc
HEADERS += mainwindow5.h
SOURCES += mainwindow5.cpp  main5.cpp

See also:
Demo2 - Using the new tab widget to display dynamic menus

Demo4 - Building the code as a shared library

Small tutorial and introduction

Next: Demo6 - l10n and i18n when using qmdilib


Generated on Fri Jun 29 21:56:34 2007 for qmdilib by  doxygen 1.5.1