Installation
Embedded Proto has a few dependencies, mainly:
- Python
- Pip
- Protobuf
- Git
Embedded Proto makes use of the Python library of Protobuf. The library is installed when running the setup script (see below). It is, however, required that the version of the Protobuf compiler matches the version of the Python library. If this is not the case, you may get a warning from the setup script.
Please read the installation section of the README file for an up-to-date overview of the dependencies’ versions.
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 ~/protobuf/protoc-21.5
.
You can check out the latest command line parameters of the setup script using the help parameter:
python setup.py --help
For Embedded Proto developers
Embedded Proto uses CMake to build unit tests. You need to install CMake before building the unit tests.
Source code
Check the minimum CMake version currently in use in the CMakeLists.txt file in the root folder of Embedded Proto.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:
./build_test.sh
Running the unit tests is done by running the executable in the build/test folder:
./build/test/test_EmbeddedProto