Setting Up a Qbs Project

To use Qbs to build a project, you must create a .qbs file for the project. You can use Qt Creator to create a C or C++ project that is built with Qbs. For more information about Qbs, see the Qbs Manual.

Building Qbs

If you build Qt Creator yourself from the Qt Creator Git repository, you also need to fetch the Qbs submodule to get Qbs support:

  1. Fetch the Qbs submodule in your Qt Creator git checkout with git submodule update --init.
  2. Run qmake on Qt Creator and build Qt Creator again.

Building Applications with Qbs

To build your application with Qbs:

  1. Select File > New File or Project > Plain C Project (Qbs Build) or Plain C++ Project (Qbs Build) > Choose, and follow the instructions of the wizard to create a Qbs project.

  2. Edit the .qbs file for you project. Usually, you must add the Depends item for a Qt application. For examples, see the examples directory in the qbs repository.
  3. Select Projects to specify Build Settings for the project.
  4. Select Build Steps > Details to specify build steps:

    1. In the Build variant field, select Debug to include debug symbols in the build for debugging the application and Release to create the final installation file.
    2. In the Parallel jobs field, specify the number of parallel jobs to use for building.
    3. Select the Enable QML debugging check box to debug Qt Quick application projects.

      Note: Debugging requires opening a socket at a well-known port, which presents a security risk. Anyone on the Internet could connect to the application that you are debugging and execute any JavaScript functions. Therefore, you must make sure that the port is properly protected by a firewall.

    4. In the Properties field, specify the properties to pass to the project. Use colons (:) to separate keys from values. For more information, see Modules in the Qbs Manual.
    5. In the Flags field:
      • Select Dry run to test building without executing commands or making permanent changes to the build graph.
      • Select Keep going to continue building when errors occur, if possible.

    The Equivalent command line field displays the build command that is constructed based on the selected options.

  5. Select Clean Steps > Details to specify flags for the cleaning step.

    • Select Clean all artifacts to remove all build artifacts.
    • Select Dry run to test cleaning without executing commands or making permanent changes to the build graph.
    • Select Keep going to continue cleaning when errors occur, if possible.

    The Equivalent command line field displays the clean command that is constructed based on the selected options.

  6. Select Build > Build Project to build the application.
  7. Click the (Run) button to deploy and run the application.

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.