What is required to be able to generate source files based on .proto files:
- Python 3.8 and up
- Protobuf v21.5
After installing the requirements, continue by cloning the Embedded Proto repo. We advised using Embedded Proto as a submodule in your project. This way, you can track the version of Embedded Proto with the version of your project.
cd your_project_dir git submodule add https://github.com/Embedded-AMS/EmbeddedProto.git git commit -m "Added the latest version of Embedded Proto as a submodule."
Next, enter the Embedded Proto folder and run the setup script. The script will create a self-contained python environment. In this environment, various python packages will be installed, which are required by Embedded Proto.
cd EmbeddedProto python setup.py
Did you install protoc in a custom folder, or is the include folder of protobuf not in your path? In these cases, you may get an error from the setup script. You have to provide the location of the include with the –include parameter:
python setup.py --include ~/protobuf/protoc-21.5/include
In this example, you have installed a specific version of protoc, and you named its installation folder
For Embedded Proto developers
Embedded Proto makes use of CMake 3.16.3 to build unit tests. You need to install CMake when intending to build the unit tests.
Further requirements for the unit tests are GTest and GMock. Both are included in a single git submodule. You can clone the submodule at the same time you clone Embedded Proto. Do this by using the recursive option:
git clone --recursive https://github.com/Embedded-AMS/EmbeddedProto.git
Next, you enter the Embedded Proto folder and run the setup script like a normal installation.
cd embeddedproto python setup.py
After running the setup script, use the Embedded Proto protoc plugin in your projects. You are also ready to build the PC unit tests if you have installed CMake:
Running the unit tests is done by running the executable in the build/test folder: