ONNC/onnc

[Enhancement][CLI] Add `--version` to each tool

Opened this issue · 0 comments

What to add:

For all tools: onnc, onni, onnx2g and readonnx, there should be a command --version as most of command line tools.

Why it is necessary:

A single command guarantees to output the corresponding version string is very helpful for building a project that depends on ONNC tools. Without that, either parsing or file reading will be necessary, while these 2 ways are not simple and safe as a specific command. To have such command and unified version definition will also help ONNC to have better version control in the future.

How to achieve it:

  1. Move all version strings from tools above to AboutData.h as a mapping macro already defined by CMake PACKAGE_VERSION
  2. Modify AboutData.cpp to load the version number from the macro, instead of as a constructor variable. Since while version string comes from one static project build, there is no need to define it as a variable.
  3. Modify main.cpp in each tool to have --version command, which just print the string out with a newline character.