Skip to content

Commit

Permalink
Make sure resources are built just once
Browse files Browse the repository at this point in the history
Currently, the project resources are built twice: the first time in the
"main" directory and the second time in the "src" directory.

This is because they are specified both in main.pro and src.pro qmake
project files (and in qtpass.pro, too).

They should be specified in just one such project file instead so they
are built just once.

Let's leave them in src.pro since that's where localization *.ts -> *.qm
dependencies are provided.
For this, a Q_INIT_RESOURCE() statement is needed so they are properly
linked to by the main application.
  • Loading branch information
maciejsszmigiero committed Sep 29, 2019
1 parent fd1369d commit 65aa495
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#endif

#include <QApplication>
#include <QDir>
#include <QTranslator>

/*! \mainpage QtPass
Expand Down Expand Up @@ -67,6 +68,8 @@ int main(int argc, char *argv[]) {
QApplication app(argc, argv);
#endif

Q_INIT_RESOURCE(resources);

QCoreApplication::setOrganizationName("IJHack");
QCoreApplication::setOrganizationDomain("ijhack.org");
QCoreApplication::setApplicationName("QtPass");
Expand Down
2 changes: 0 additions & 2 deletions main/main.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ macx {

SOURCES += main.cpp

RESOURCES += ../resources.qrc

isEmpty(PREFIX) {
PREFIX = $$(PREFIX)
}
Expand Down
2 changes: 0 additions & 2 deletions qtpass.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ OTHER_FILES += LICENSE \
README.md \
qtpass.1

RESOURCES += resources.qrc

# add Makefile target to generate code coverage using gcov
gcov.target = gcov
gcov.commands += cd src/$$OBJECTS_DIR && gcov "*.gcda" 1>/dev/null $$escape_expand(\\n\\t)
Expand Down

0 comments on commit 65aa495

Please sign in to comment.