Skip to content

Commit

Permalink
Update readme and usage hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ahankinson committed Feb 9, 2023
1 parent 27cc57e commit 5ef1f98
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
39 changes: 31 additions & 8 deletions libmei/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ LibMEI is a C++ library for reading and writing [MEI](http://music-encoding.org)

It was originally developed by the [Distributed Digital Music Archives and Libraries Lab](http://ddmal.music.mcgill.ca/) at the Schulich School of Music at McGill University, Montréal, Canada

This is a modified version that is used for generating C++ code for Verovio. The main differences with LibMEI are:
This is a modified version that is used for generating C++ code for Verovio.

1. it generates only attribute classes (Mixin in LibMEI) by default,
2. each attribute has a C++ type deduced from the MEI schema or given in a separated configuration file,
3. it uses the MEI page-based customization not included in the MEI 2013 v2.1.0 (see [MEI](http://www.music-encoding.org)).
1. it generates only attribute classes by default,
2. each attribute has a C++ type deduced from the MEI schema or given in a separated datatypes configuration file,
3. it uses the MEI page-based customization by default.


License
Expand All @@ -21,9 +21,32 @@ Compilation & Usage

To generate the code, do:

python3 tools/parseschema2.py mei/develop/mei-verovio_compiled.odd
python3 parseschema2.py ../mei/develop/mei-verovio_compiled.odd

Where the positional argument points to an ODD file for which you wish to
generate code.

Other options are:
* `-o`: specific output directory. It will contain `dist` with the generated files and `addons` with the other files
* `-e`: will generate element classes in addition to the attribute classes. This option disables the generation of the Verovio specific code `attmodule.h/cpp`
* `-ns`: specify the CPP namespaces to be used. This option should only be used with `-o` and `-e`.
* `-c`: A path to a YML config file.

Config file
-----------

The config file can contain several options:

```yaml
debug: true|false # determines the log level while running
output_dir: "../dist" # path to where the output should go
addons_dir: "../addons" # path to an optional addons directory
elements: true|false # whether or not code for element handling should be generated
namespace: "vrv" # the namespace to use in generated CPP code
datatypes: "./datatypes.yml" # path to a datatypes mapping file
basic_odd: "../mei/develop/mei-basic_compiled.odd" # path to an MEI basic ODD file
```
For the `basic_odd` option, if provided the generator will generate a map of notes and allowed
attributes within the MEI basic ODD file and write it to a file called `meibasic.h`.

If the `addons_dir` is provided, the files in that directory will be copied to the output directory.
The files will also have the namespace in the addons replaced with the value provided in the
`namespace` option.
3 changes: 1 addition & 2 deletions libmei/tools/parseschema2.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def main(configure: dict) -> bool:


if __name__ == "__main__":
# Custom usage message to show user [compiled] should go before all other flags
p = ArgumentParser(usage='%(prog)s [compiled | -sl] [-e] [-h] [-df DEFINE] [-o OUTDIR] [-d]')
p = ArgumentParser(usage='%(prog)s [-c config path] [compiled odd path]')

p.add_argument("compiled", help="A compiled ODD file", type=Path)
p.add_argument("-c", "--config", help="Path to a config file", type=Path)
Expand Down

0 comments on commit 5ef1f98

Please sign in to comment.