Managing multiple qt sub-projects with git submodules



  • I had that dream in which I could have multiple "small" projects like "mainApp", "utils", "worker" where eg. all other projects uses utils. In that dream, each imaginary project would be kept in a separate git repository and if needed, it would have submodules for other-imaginary-project that it uses.

    And that is the time I wake up screaming with dread. The fear of complex hand-held building one after the other and versions mismatch between submodules gave me insomnia.

    But I feel there is a solution for my torment. Maybe qt SUBDIRS (sequenced building) with properly created "shared" git tag for each repo (for not sharing submodules of submodules) and separate branch (for standalone module testing with all the needed submodules) ?

    There is also a question (that has no proper answer) what should be used - shared libs or "code-include" like sharing.

    Do you had such problems? Maybe some articles?


  • Lifetime Qt Champion

    Hi,

    How many levels of subprojects do you have in mind and what kind of dependencies ?



  • Hi,

    How many levels of subprojects

    I think at least 3 (main project, subproject, subproject's subproject)

    what kind of dependencies

    I mean code reusing done by just sharing source code or by linking to a library (not sure what will be better, probably "it depends").

    for instance (let's put 'dependencies' in brackets)
    Utils ()
    Renderer(Utils)
    Loader(Utils)
    Main(Renderer, Loader, Utils)

    and I'd like to have separate repos for each and use git submodules for easier access and edits. But If I make it like that, there are two problems:

    (1). when I update (download) submoudle Loader in Main I'll also downlaod it's Utils (same for Renderer) and in given situation I'll have 3 Utils.

    (2). Those 3 Utils can have different versions

    So to fix this (1) I can make 2 branches for each (not Main) subproject: one for standalone testing and hacking (let's say "master" as it is) that contains needed submodules and one for using as a subproject (let's name it "shared"). Main pulls shared branch of Renderer that does not contain Utils and Main has to include (in it's repo's submodules) Utils that is shared also for eg. Loader. Submodules would be stored as Qt SUBDIR project structure for easy building.

    So as to (partly) fix (2) I can make a tag for specific release or keep the branch as minimal as I can (release-branch like).

    Another, maybe simpler approach is to use some environment for keeping those submodules as libraries (shared or static) in some environment but than there are problems too:

    1. No auto-download all the dependencies while pulling repo
    2. No version restriction (some1 can use Main with Reader 2.0 and some1 can with Reader 2.1)
    3. One can not simply hack a subproject(s) from "Main" repo

    So basically what I have in mind is probably some C++ packaging system magically built on top of git and qmake.


  • Lifetime Qt Champion

    Something like qt-pods ?



  • Something like qt-pods ?

    Yea!

    Please be careful. This software is in early state, use it with caution. Make backups of your repositories.

    This line scares me, but I'll look the project up, thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.