Creating a managed or Makefile project

When you create a Core Native app, a library, or a native extension, you can select a managed or a Makefile project.

Managed projects

A managed project doesn't use Makefiles, and the Momentics IDE controls all of the build settings.

You can't build most managed projects from the command line. There are also restrictions on what and how you build.

If you use the external make builder, a managed project can use Makefiles. It generates them automatically and they shouldn't be checked into source control. Managed make projects provide full Momentics IDE graphical control and configuration. A managed make project generates the Makefile for you automatically. It generates your Makefile dynamically based on the contents of your project folders. A managed make project monitors your project and updates the Makefile automatically when you add or remove files in a project.

Makefile projects

A Makefile project can start anything as an external builder in any folder. You can create a Makefile project for any project that has a Makefile by default. The Momentics IDE starts make, and after make exits, the Momentics IDE refreshes the workspace to show what was created. You can change the make command or run specific make targets, but the Momentics IDE has no control over what make does.

Because the Momentics IDE doesn't know what make builds, it can have problems when it parses source files (which it does internally to allow navigation, code completion, syntax highlighting, code generation, and refactoring).

If you use a Makefile project, you must change the indexer (the internal parser) to point to the includes and the defines that your parser uses for conditional compilation. This process is called discovery. To control discovery, right-click a project and select Properties > C/C++ Build > Discovery Options.

If you know which includes and defines you want to use, you can specify them directly. Right-click a project and select Properties > C/C++ General > Path and Symbols.

To create a Makefile that can be launched outside of the Momentics IDE:

  1. In the Project Explorer view, right-click a project, and then select Properties.
  2. In the Properties dialog box, click C/C++ Build.
  3. On the Builder Settings tab, select the Generate Makefiles automatically and the Expand Env. Variable Refs in Makefiles check boxes.
  4. Expand C/C++ Build, and then select Tool chain editor.
  5. In the Current builder list, select the external make builder.
  6. Click OK.

The Momentics IDE generates several .mk files and a top-level Makefile for each processed configuration (the last one in the configuration folder). To process this Makefile from the command line, use the make utility:

make -f [configuration]/makefile [target]

Every time you change, update, or delete any configuration, you need to refresh the make infrastructure. To refresh the make infrastructure, you can either regenerate the Makefiles or change the existing files manually.

Set the include paths and define directives

Many of the enhanced source navigation features (including opening header files) and code development accelerators that are available in the C/C++ editor are extracted from the source code. To enable these features and provide the most accurate data representation, you must configure the project with the correct include paths and define directives that are used to compile the source.

For BlackBerry projects, the include paths and definitions are set automatically based on the compiler and architecture. You can set additional values in the project's properties.

For Makefile projects, you must define the values. You can define the values manually in the project properties or define them automatically using the Set QNX Build Environment option in the project's context menu.

To set the include paths and define directives for a C/C++ Make project:

  1. In the Project Explorer view, right-click your project and click Properties.
  2. In the Properties dialog box, expand C/C++ Build, and click Settings.
  3. On the General settings tab, select the appropriate compiler for your project, and then click OK.
  4. On the left, expand C/C++ General, and click Paths and Symbols.
  5. Specify any required include information, and then click OK.

Set build properties for a project

In the Momentics IDE, you can set build properties for managed and Makefile projects.

Setting project build properties for a managed project

You can change the build properties for managed projects using project properties (right-click on a project in the Project Explorer view and click Properties). You can do the following with project properties for a managed project:

  • Add extra libraries and library paths (click C/C++ Build > Settings > QCC Linker > Libraries). Alternatively, you can click Open Add Library Wizard to easily choose libraries and dependencies.
  • Change the output options, such as adding Debug, or the Optimize or Instrumentation options (click C/C++ Build > Settings > QCC Compiler > Output Control). Some options require you to change the option in both the compiler and linker.
  • Add custom linker or compiler options.
  • Add another build variant also known as a build configuration (click C/C++ Build and click Manage Configuration).

To exclude a file from a build, right-click the file and then select Exclude from build. To include a folder in the build, it must be a source folder.

Setting project build properties for a Makefile project

For a Makefile project, you can change the location that the build starts from, and you can also change the make arguments (as well as the command to launch make itself). In addition, you can change the environment variables for the make invocation in the environment subcategory of the C/C++ Build options. If they are defined in make itself, environment variables can't override them unless you use make -e. For all of the other options, you set them in your Makefile.

Last modified: 2015-07-24

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus