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).
qmc
utility has been specifically designed to run on "headless" servers, where GUI libraries are not installed.QMC supports the following command-line options:
qmc 5.0.4 (c) Quantum Leaps. https://www.state-machine.com/qm Usage: qmc <model-file> [-h][-c [item]] or: qmc [-h][-c [item]] [--] <model-file> Notes: The argument <model-file> must be provided The option -c [item] might be repeated multiple times [item] is the fully-qualified model item name, e.g., ${foo::bar} Examples: qmc my_model.qm (generate code for entire model "my_model.qm") qmc xyz\my_model.qm (generate code for entire model "xyz\my_model.qm") qmc D:\xyz\my_model.qm (generate code for entire model "D:\xyz\my_model.qm") qmc -c ${pkgA} my_model.qm (generate code for item ${pkgA}) qmc -c -- my_model.qm (generate code for entire model "my_model.qm") qmc my_model.qm -c ${pkgA} (generate code for item ${pkgA}) qmc my_model.qm -c ${pkgA} -c${pkgB::.} (generate code for item ${pkgA} and ${pkgB::.}) qmc my_model.qm -c ${.::main.c} (generate code for item ${.::main.c})
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.
On Windows, the QMC executable is located in the <qm>/bin/
directory, where <qm>
denotes the QM installation directory.
c:\qp\qm\bin\qmc.exe <qm-model-file>
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.
On MacOS, the qmc
executable is located in 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.