QM  4.1.1
QM Compiler (qmc)

The QM™ installation folder contains the command-line utility called qmc (QM Compiler), which can generate code from a given QM model file. The `qmc` utility allows you to incorporate the code generation step into an automated build process, such as `Makefiles`, build scripts, or extra pre-compile steps in project files.

By design, the `qmc` utility generates identical code as the QM™ graphical tool. In particular, `qmc` is aware of the QM session file and applies the same QP licensing terms as QM™ (see also generating comments).

Note
The `qmc` command-line utility uses the same code generator source code as the graphical QM™ tool, but it is a separate and independent program from the QM™ graphical modeling tool. Among others, this means that `qmc` does not require any graphical display and does not rely on the presence of any graphic libraries on the host system. Thus automated builds can be performed on "headless" servers and other such systems.

# Invoking qmc on Windows

On Windows, the `qmc.exe` executable is located in the `<qm>\bin\` directory, where `<qm>` denotes the directory, in which you have installed QM. Assuming that you have installed QM in `C:\qp\qm\`, you can invoke the `qmc` as follows:

C:\qp\qm\bin\qmc <qm-model-file>

where `<qm-model-file>` stands for the QM model file to process. The `<qm-model-file>` can contain the whole absolute or relative path to the QM model file.

The following screen shot illustrates the invocation of the `qmc` utility from the Windows Command-Prompt:

Example of qmc invocation and output

# Invoking qmc on Linux

On Linux, you invoke `qmc` by means of the shell script `qmc.sh`, which is located in the `<qm>/bin/` directory, where `<qm>` denotes the directory, in which you have installed QM. Assuming that you have installed QM in `/home/<user>/qp/qm`, you can invoke the `qmc` as follows:

/home/<user>/qp/bin/qm.sh <qm-model-file>

where `<qm-model-file>` stands for the QM model file to process. The `<qm-model-file>` can contain the whole absolute or relative path to the QM model file.

# Invoking qmc on MacOS

On MacOS, the `qmc` executable is located in the the same bundle as the QM graphical modeling tool. Assuming that you have installed QM into the `/Applications/` folder, you can invoke the `qmc` as follows:

/Applications/qm.app/Contents/MacOS/qmc <qm-model-file>

where `<qm-model-file>` stands for the QM model file to process. The `<qm-model-file>` can contain the whole absolute or relative path to the QM model file.

Next: Revision History