This is my project file:
include(C:\Qt\4.5\qt\src\qtsingleapplication\src\qtsingleapplication.pri)
TEMPLATE = app
QT += gui \
core \
network
CONFIG += qt \
warn_on \
resources \
debug
DESTDIR = bin
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
SOURCES += src/main.cpp \
src/mainwindow.cpp \
src/about.cpp \
src/settings.cpp \
src/parser.cpp
HEADERS += src/mainwindow.h \
src/about.h \
src/settings.h \
src/parser.h
FORMS += ui/mainwindow.ui \
ui/about.ui
RESOURCES += res/main.qrc
RC_FILE += src/main.rc
include(C:\Qt\4.5\qt\src\qtsingleapplication\src\qtsingleapplication.pri)
TEMPLATE = app
QT += gui \
core \
network
CONFIG += qt \
warn_on \
resources \
debug
DESTDIR = bin
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
SOURCES += src/main.cpp \
src/mainwindow.cpp \
src/about.cpp \
src/settings.cpp \
src/parser.cpp
HEADERS += src/mainwindow.h \
src/about.h \
src/settings.h \
src/parser.h
FORMS += ui/mainwindow.ui \
ui/about.ui
RESOURCES += res/main.qrc
RC_FILE += src/main.rc
To copy to clipboard, switch view to plain text mode
And then qtsingleapplication.pri is like this:
include(../common.pri)
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
QT *= network
qtsingleapplication-uselib:!qtsingleapplication-buildlib {
LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME
} else {
SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
}
win32 {
contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT
else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT
}
include(../common.pri)
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
QT *= network
qtsingleapplication-uselib:!qtsingleapplication-buildlib {
LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME
} else {
SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
}
win32 {
contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT
else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT
}
To copy to clipboard, switch view to plain text mode
And common.pri:
infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtsingleapplication-uselib
TEMPLATE += fakelib
QTSINGLEAPPLICATION_LIBNAME = $$qtLibraryTarget(QtSolutions_SingleApplication-2.6)
TEMPLATE -= fakelib
QTSINGLEAPPLICATION_LIBDIR = $$PWD/lib
unix:qtsingleapplication-uselib:!qtsingleapplication-buildlib:QMAKE_RPATHDIR += $$QTSINGLEAPPLICATION_LIBDIR
infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtsingleapplication-uselib
TEMPLATE += fakelib
QTSINGLEAPPLICATION_LIBNAME = $$qtLibraryTarget(QtSolutions_SingleApplication-2.6)
TEMPLATE -= fakelib
QTSINGLEAPPLICATION_LIBDIR = $$PWD/lib
unix:qtsingleapplication-uselib:!qtsingleapplication-buildlib:QMAKE_RPATHDIR += $$QTSINGLEAPPLICATION_LIBDIR
To copy to clipboard, switch view to plain text mode
Bookmarks