# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
# # , # pro- . TEMPLATE = lib DESTDIR = dist # . VERSION = 1 . 0 . 0 # TARGET = $$ qtLibraryTarget ( MyLibrary ) # , release debug CONFIG += build_all
- #ifndef MYLIBRARY_GLOBAL_H
- #define MYLIBRARY_GLOBAL_H
- #include <QtCore / qglobal.h>
- #if defined (MyLibrary_LIBRARY)
- # define MyLibrary_EXPORT Q_DECL_EXPORT
- #else
- # define MyLibrary_EXPORT Q_DECL_IMPORT
- #endif
- #endif / * MYLIBRARY_GLOBAL_H * /
- HEADERS + = MyLibrary_global . h
- # And we add a mandatory line with the export macro:
- DEFINES + = MyLibrary_LIBRARY
- #include "MyLibrary_global.h"
- class MyLibrary_EXPORT ComputerManager : public QObject {
- Q_OBJECT
- ...
- }
- // or function:
- MyLibrary_EXPORT QDebug operator << ( QDebug d , const MyObject & object ) ;
This part of the pro-file will simultaneously create dynamic libraries in debug and release versions on windows, linux, mac.
- # If the operating system is from the unix family
- unix : {
- CONFIG ( debug , debug | release ) {
- # This name has a debug-version of the library.
- TARGET = ComputerManagerd
- } else {
- # And such a release version
- TARGET = ComputerManager
- }
- } else {
- TARGET = $$ qtLibraryTarget ( ComputerManager )
- }
- VERSION = 1 . 0 0
- # The first parameter is required to build # libraries in linux (qmake, make all),
- # second to build under the rest of the OS.
- CONFIG + = debug_and_release build_all
- # Specify folders for object files. For unix-like operating systems, this is critical.
- # If this is not done, then only the release version of the library will be collected,
- # or debug only. This is due to the fact that the files will replace each other.
- CONFIG ( debug , debug | release ) {
- OBJECTS_DIR = build / debug
- } else {
- OBJECTS_DIR = build / release
- }
- # Connect the library header files
- INCLUDEPATH + = include / MyLibrary
- CONFIG ( debug , debug | release ) {
- # We connect debug-versions of libraries for different platforms
- win32 : LIBS + = - Llib - lMyLibraryd1
- unix : LIBS + = - Llib - L. - lMyLibraryd - Wl , - rpath , lib - Wl , - rpath,.
- } else {
- # We connect release-versions of libraries for different platforms
- win32 : LIBS + = - Llib - lMyLibrary1
- unix : LIBS + = - Llib - L. - lMyLibrary - Wl , - rpath , lib - Wl , - rpath,.
- }
Source: https://habr.com/ru/post/101994/
All Articles