Results 1 to 5 of 5

Thread: How to compile a project, with the same folder structure as the source code.

  1. #1
    Join Date
    Jan 2015
    Location
    Barquisimeto, Venezuela
    Posts
    24
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default How to compile a project, with the same folder structure as the source code.

    Good friends, today I come to the next question that has me going around for a long time.

    I started developing a small application that would allow me to generate classes for PHP, where I would create all the class structure and all the dependencies that required the same, as well as the documentation.

    The point is that now he created a kind of "frame" in PHP and thought about developing a small text editor that allowed me to streamline its use and how I have not worked in Qt / C ++ I thought I would do this with . The detail is in what was supposed to be something small has become a fairly large project.

    The problem is the following:

    I have the following project structure:

    Qt Code:
    1. src/
    2. /addons/ // Structure to accommodate any add-ons you wish to add and / or develop for the application
    3. /addon_1/
    4. /controller/
    5. /model/
    6. /view/
    7. /addon_2/
    8. /controller/
    9. /model/
    10. /view/
    11. /addon_3/
    12. /controller/
    13. /model/
    14. /view/
    15. /bin/ // Main Application
    16. /controller/
    17. /model/
    18. /view/
    19. /com/ecosoftware/ // General libraries for handling the common functions of any application that has been developed
    20. /app/
    21. /patterns/
    22. /singleinstance/
    23. /window/
    24. /components/
    25. /expandtoolbar/
    26. /menubar/
    27. /statusbar/
    28. /tabbar/
    29. /tabpanel/
    30. /workspace/
    31. /mainwindow/
    32. /common/ // Libraries commonly used for the application and / or any component thereof
    33. /actions/
    34. /files/
    35. /language/
    36. /utils/
    37. /config/
    38. /data/
    39. /doc/
    40. /editor/ // Text Editor Tools
    41. /controller/
    42. /model/
    43. /view/
    To copy to clipboard, switch view to plain text mode 

    The point is, I want to compile the whole project, I stay the same way I have my source code.

    From what I researched by different means, is that thing by the makefile, but I can not understand how.

    On the other hand qMake can apparently help me with this, but in the documentation I do not know how to get the final build structure.

    In addition to this, I have managed to create all my code as Dynamic libraries (to reduce the size of it, to reach 500 MB, which is not good hehehe), but adding them to the project, but to the added ones, when Compilo, tell me what to do.

    To recap, How to compile my project and to stay in the same way that I have my source code.

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to compile a project, with the same folder structure as the source code.

    You basically just need a ".pro" file in each directory that has the same name as the directory itself.

    Depending on whether the directory is just a container for sub directories or an actual build target, the .pro TEMPLATE type is either "subdirs" or the respective "lib" or "app".

    E.g. in src/ you would have a src.pro
    Qt Code:
    1. TEMPLATE = subdirs
    2.  
    3. SUBDIRS = addon bin com common editor
    To copy to clipboard, switch view to plain text mode 
    You can define dependencies for getting the right build order if neccessary, e..g if "bin" depends on "com" being built first this would do that
    Qt Code:
    1. bin.depends = com
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  3. #3
    Join Date
    Jan 2015
    Location
    Barquisimeto, Venezuela
    Posts
    24
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Re: How to compile a project, with the same folder structure as the source code.

    Thank you very much for your quick reply anda_skoa.

    By making some tests about the structure of the project and the compilation of it, I have already achieved a pretty good approach of how I want to see the fruit of many sleepless nights hehehe.

    What I had to do in effect is what you advised me and in the "final folder" the project and / or library that I want to compile.

    An example of this is the following:

    Qt Code:
    1. src/
    2. mainproject.pro
    3. /addons/
    4. /addon_1/
    5. addon_1.pro
    6. /addon_2/
    7. addon_2.pro
    8. /addon_3/
    9. addon_3.pro
    10. /bin/
    11. addon_1.pro
    12. .
    13. .
    14. .
    To copy to clipboard, switch view to plain text mode 

    Thus, when compiling everything is in the place indicated, except a small detail.

    I want different dynamic libraries to be in the same folder, but as they are different projects, there are the folders of the projects and within them obviously a single file that is the compiled library, not that it is my biggest problem, but the truth to me You do not see anything elegant.

    I know that I can compile each project separately and append the already compiled libraries to the project, but I'm having problems adding them because compiling does not recognize the libraries, so the need to create them all within the same project.

    So, if I need to make any modifications I can do it directly inside the project and not in a separate project where I have to compile and re-attach the library to the main project.

    The point is, as I could do to compile several libraries in the same folder, for example:

    Qt Code:
    1. Src/common/
    2. Library_1.so
    3. Library_2.so
    4. Library_3.so
    To copy to clipboard, switch view to plain text mode 

    Instead of

    Qt Code:
    1. Src/common/
    2. Library_1/Library_1.so
    3. Library_2/Library_2.so
    4. Library_3/Library_3.so
    To copy to clipboard, switch view to plain text mode 

    I would have to do it in separate projects and add the libraries to the main project or there is some way to do this that I am thinking.

    As I said in the first post, I read that with adjusting the makefile can be done, but the truth is not much or little like manipulating the makefile.

    Thanks in advance.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to compile a project, with the same folder structure as the source code.

    You can set DESTDIR to have the final build artifact in a different directory than where the build happens.

    E.g. in your Library_1.pro you could try
    Qt Code:
    1. DESDIR= ..
    2. # or
    3. DESTDIR = ../
    4. # or
    5. DESTDIR = $$PWD/..
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  5. #5
    Join Date
    Jan 2015
    Location
    Barquisimeto, Venezuela
    Posts
    24
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Re: How to compile a project, with the same folder structure as the source code.

    Many thanks anda_skoa, with your guidance and rereading the qmake documentation now if I have managed to understand how the compilation process works for an end application.

    In effect with

    Qt Code:
    1. DESTDIR = ../path/where/we/want/our/library/or/binary/
    To copy to clipboard, switch view to plain text mode 

    Now everything is where I want.

    I hope this post will serve to anyone who has the same doubt as me.

    Thank you again, theme solved.

    I do not know how to put it solved in the title

Similar Threads

  1. QT Project source code
    By darpan in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2012, 17:16
  2. How do I add a qt source code library to my project ?
    By Paulo Fernando Pimenta in forum Newbie
    Replies: 5
    Last Post: 14th January 2011, 22:33
  3. Replies: 0
    Last Post: 13th October 2010, 05:27
  4. Qt Creator How to make Creator be aware of the Qt source code project?
    By kartwall in forum Qt Tools
    Replies: 5
    Last Post: 27th September 2010, 09:39
  5. compile source code file
    By eva in forum Qt Programming
    Replies: 6
    Last Post: 16th March 2009, 12:15

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.