how to only run subprojects?



  • I have a created a subdirs huge project which is structured as follows:

    <MAIN_PROJECT>
    |---sources
    |---<subproject_1>
    |---<subproject_2>
    |---<subproject_3>
    |---<testunits>
        |---<test_1>
        |    |---sources
        |
        |---<test_2>
        |    |---sources
        |
        |---<test_3>
             |---sources
    

    There is the main project which is a subdirs project, followed by many app or lib projects, and then another subdirs project called testunits with its own app subprojects.
    The whole structure is configured properly and Qt Creator loads them perfectly.
    Building separately each subproject (especially testunits) works fine. But if I try to run a subproject, Qt Creator will try to run main project's exe, instead of the subproject exe only. When I try to run the built subproject exe it will also complain about missing DLLs (including some gcc runtime libs) so I can't run it unless I figure out all the DLLs it needs.

    Can I somehow tell Qt Creator to only run the subproject exe instead of the main one?
    Or am I using subdirs projects the wrong way? How should I configure such a project with testunits?
    I was looking for a way to configure each subproject (of the main project) with its own testunit subproject, but I haven't had much luck... any suggestions?


  • Lifetime Qt Champion

    Hi,

    AFAIK, it's possible to have each project having it's own unit tests subproject and calling them independently from Qt Creator. It might come from your pro files setup. How did you write them ?



  • Please have a look at this project:
    https://drive.google.com/file/d/0B9uTCyb7q8yXdXdPNTAzd3RjbHc/view?usp=sharing
    sorry, I made it on the fly... I'm a bit tired and I don't have much time to properly make a runnable project with some not dummy code... however that is the exact same project structure I am using right now.

    As I said before, subprojects and testunits build fine, but if right-click one of them and choose "Run", Qt Creator will try to compile the main project and run its exe rather than simply running the testunit (or subproject) exe.

    Since it's not working as I expect it to, I suppose I am doing it the wrong way... is it you could give me an example project with testunits that can run on their own?



  • Guys, sorry to bump... any suggestions, please?



  • I have a BIG project with 10 executables and more than 100 TestExecutables.

    I manage in in Qt Creator using multiple build/run configurations



  • Finally! I've been able to properly configure a subdirs project in a way that I like!
    https://drive.google.com/file/d/0B9uTCyb7q8yXdDg5b21kSFBTY3c/view?usp=sharing
    if you could please have a look, I would gladly accept any suggestions for making it better (unlike the previous one, the project is fully runnable).
    Also, although it works fine like this, would it be possible to have testunits under the same sub_project that is to test? I mean having this kind of structure

    BIG_PROJECT
    --sub_project_1
    ----unit_sources
    ----testunit
    ------testunit_sources
    --sub_project_2
    ----unit_sources
    ----testunit
    ------testunit_sources


  • I'm not sure if I should open a new thread or not, since it's related but not the same argument.

    Anyway, with the project structure above It works fine. But everytime I make a change in a file, and I run single subproject, Qt creator will actually recompile all the subprojects opened, even if I don't need the other units. This takes a lot more time than compiling a single unit and it's frustrating.

    How can I tell Qt Creator to compile a single "unit" instead of all the projects?
    EDIT
    Ok, so, it doesn't always compile all the units. It only does so when I Run the unit.
    But still, how can I stop it from doing that? My project is not very large now, but it will grow significantly in time... I can't imagine waiting for it to recompile 10 big units before I get a single run...


Log in to reply
 

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