Project structure help/suggestions.
-
I am creating a project that I want to structure a little bit differently from the usual default way, mainly out of interest, thus what I will show below might be wrong or not a good idea. In any case this is what I have until now
- Poject/
- project.pro
- App/
- Engine/
- Logger/
- root.pri
The contents of these files are as follows:
include(root.pri) TEMPLATE = subdirs SUBDIRS = Logger Engine App DISTFILES += doc/* mainpage.dox Doxyfile OTHER_FILES += README.md \ TODO \ Copyright \ Changelog # build should be last. CONFIG += ordered SUBDIRS += build PACKAGE_VERSION = $$ProjectVersion PACKAGE_NAME= Project
App.pro, Engine.pro, Logger.pro (Empty for now)
INCLUDEPATH += $$PWD DEPENDPATH += $$PWD TEMPLATE = lib UI_DIR = uics MOC_DIR = mocs OBJECTS_DIR = objs QT += CONFIG(debug, debug|release) { DEFINES += SUPERVERBOSE } HEADERS += SOURCES +=
root.pri
exists(user.conf): include(user.conf) isEmpty(ProjectVersion) { ProjectVersion = 1.1 cache(ProjectVersion, set, ProjectVersion) } WARNINGS += -Wall
INCLUDEPATH += $$PWD DEPENDPATH += $$PWD TEMPLATE = app SOURCES += main.cpp #LIBS += -L../Logger -L../Engine -L../App -llogger -lengine -lapp TARGET = ../
The idea is that
build/
will take care of packaging everything into a final application. All other components, like the logger, will be libraries loaded in the app.App/
will contain the applications ui, written in qml, andEngine/
all the code that will provide functionality to the ui.Can someone identify any issues with the approach on general. Suggestions or ideas on improving my structure are always welcomed. Maybe you have your own way of structuring your apps and would care to share it.
EDIT:
TEMPLATE = lib
is only generating a .dll file and not a .a file. I am not sure if this is correct or not though. Should I link to that dll directly with something like this:CONFIG( debug, debug|release ) { LIBS += "../dist/debug/Loggerd.dll" LIBS += "../dist/debug/Engined.dll" DESTDIR += "../dist/debug" } else { LIBS += "../dist/release/Logger.dll" LIBS += "../dist/release/Engine.dll" DESTDIR += "../dist/release" }
or use
CONFIG -= dll CONFIG += shared static
and link to the resulting .lib?
Thanks.
- Poject/