Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

"build" versus "qmake" ? ( question )



  • What are Qt definitions of these ?

    I believe there is an option to ""always use qmake " when using "build" or something to that effect somewhere.

    When I use SUD_DIRS wizards they always refer to "build" using "qmake" .

    I generally bypass both "buidl " or "qmake" by letting the IDE do its job and just use "Run".



  • @AnneRanch

    "run qmake" does as it says. qmake produces makefiles which are used by compiler tool called generally "make". The make ensures the proper compilation in order. "run" does as says as well. However, changes are typically handled correctly and qmake/build will be called beforehand.

    Sometimes it may be required to start the different steps manually, when something happened or the project setup is not a 100% error free. That is the reason for some people are advising to "rerun qmake" and sometimes to do a complete "rebuild". Basically it is meant to ensure that everything has been handled correctly.



  • @koahnig Allow me to rewrite your post.
    You are not answering the question - you are describing the functions , and their commonly used definitions. ( I am asking for difference , comparison of functions of "Build and "qmake".

    You explanation of "make " is fine.
    To reshuffle your post -
    "make" - in general , not specifically "qmake" prepares "makefile" for compiler to work on.

    "qmake" is a Qt version of "make" and still has same function .
    The "qmake" options are implemented in .pro file.

    To me it is still unclear how "(run) build " differs from (run) qmake.

    Is "Build " yet another layer - above "qmake"?


  • Lifetime Qt Champion

    Yes @koahnig answered your question.

    qmake is a project manager tool. It reads a .pro file and (re)generate Makefiles.

    make does not prepare anything, it reads Makefiles and execute whatever was defined in there.

    As @koahnig explained very well "Run qmake" is literally just that: execute qmake on your project which will generate or regenerate all the files required for "make" to do its job in the build folder.

    Build is: call make in the build folder.

    So no, make and qmake do not serve the same purpose. qmake is not Qt's implementation of make.

    For more information there is a dedicated chapter for qmake in Qt's documentation.


  • Moderators

    "build" versus "qmake" ?

    @AnneRanch This was answered at https://forum.qt.io/post/649204 -- Not in the exact format you asked for here, but it shows the link from "qmake" to "build".

    "qmake" is a Qt version of "make" and still has same function .

    Wrong. Read https://forum.qt.io/post/649204 carefully.



  • @JKSH
    I am still trying to relate all of this to SUB_DIRS.
    And still missing parts.

    Starting with
    New project ...
    choose template
    Other projects
    Subdir project
    selecting (main) project

    Now I have
    .pro file created by ???

    At this point I can execute project ->Run
    and if the "main" project selected is "window" based
    I get a window on my desktop.

    Executing "Run" actually
    qmake "reads " .pro file and builds "makefile"
    "build" uses "make" which reads "makefile"
    and then compiler does its job and last the linker takes its turn.

    Does that makes sense or not ?
    Did I missed some part?

    I am not trying to be smart , I am trying to understand how these piece parts manage basic C header / source relationship in SUB_DIRS concept.

    At present it appears that header / source pair will compile using "include header" -normal - , but "header" is duplicated in .pro file . Sort of "upstream ".

    .


  • Moderators

    @AnneRanch said in "build" versus "qmake" ? ( question ):

    qmake "reads " .pro file and builds "makefile"

    Yes. (But don't use the word "build" here -- it just makes things confusing)

    "build" uses "make" which reads "makefile"

    Yes. The Makefile contains the instructions for the build process.

    and then compiler does its job and last the linker takes its turn.

    Yes. You have described the building process.

    Did I missed some part?

    You missed the last part: "Run" actually runs the built file -- hence the name.

    I am trying to understand how these piece parts manage basic C header / source relationship in SUB_DIRS concept.

    At present it appears that header / source pair will compile using "include header" -normal - , but "header" is duplicated in .pro file . Sort of "upstream ".

    You're not supposed to have duplicated headers in a SUBDIRS hierarchy. Something doesn't sound right.

    But this is really a separate concept from "build" and "qmake". It sounds like you need to learn the difference between using a "header that comes from your current project" versus using a "header that comes from a library".

    Can you explain the difference, in your own words?



  • @JKSH OK, it is beginning to gel. I am going on my morning walk and will have about an hour to think about all what was said so far.
    Later



  • @JKSH OK
    in general /generic terms "files are created" would be more appropriate.

    You missed the last part: "Run" actually runs the built file -- hence the name.

    Where did the "build " file came from ?

    I think it would be helpful to separate process and "object" of the process - if feasible.
    In a essence :
    make (object) reads ( process) makefile ( object)

    I am not sure to get hung up in semantics - I am still looking for simple one on one relations type "cause" -> "result".


  • Moderators

    @AnneRanch said in "build" versus "qmake" ? ( question ):

    Where did the "build " file came from ?

    The "build file" is the end result of whole build process.

    You start with source code and end with an executable program (or a library).

    I think it would be helpful to separate process and "object" of the process - if feasible.
    In a essence :
    make (object) reads ( process) makefile ( object)

    I am not sure to get hung up in semantics - I am still looking for simple one on one relations type "cause" -> "result".

    I'll split what you called "objects" into "tools" and "inputs"/"outputs". Tools read inputs and write outputs.

    Tool Input Process Output
    qmake .pro/.pri files Converts Qt configuration in the .pro file into build instructions in the Makefile Makefile
    make Makefile Carries out the build instructions in the Makefile; Runs the tools specified by those instructions (like the Compiler and Linker) (none)
    Compiler Human-readable source code (.cpp/.h files) Converts human-readable source code into machine code Machine-readable object files (.o files)
    Linker .o files Combines all .o files into a single application (or library) Final executable file (or library file)

    Once you understand all this, your next task is to figure out where moc and uic fits in the picture.



  • @JKSH
    That it a pretty, well-laid out table! I don't even know how you achieve that from making a post here, I don't see any command-icon for that at all!?


  • Moderators

    @JonB said in "build" versus "qmake" ? ( question ):

    That it a pretty, well-laid out table!

    Why thank you :-D

    I don't even know how you achieve that from making a post here, I don't see any command-icon for that at all!?

    The forum supports Markdown syntax: https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf (Tables on the bottom-right corner of Page 2)


Log in to reply