cmake: Don't explicitly look for python2
[apps/agl-service-can-low-level.git] / README.txt
1 Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is
2 especially suitable for use in microcontrollers, but fits any memory
3 restricted system.
4
5 Homepage: http://kapsi.fi/~jpa/nanopb/
6 Downloads: http://koti.kapsi.fi/~jpa/nanopb/download/
7 Forum: https://groups.google.com/forum/#!forum/nanopb
8
9
10
11 Using the nanopb library
12 ========================
13 To use the nanopb library, you need to do two things:
14
15 1) Compile your .proto files for nanopb, using protoc.
16 2) Include pb_encode.c and pb_decode.c in your project.
17
18 The easiest way to get started is to study the project in "examples/simple".
19 It contains a Makefile, which should work directly under most Linux systems.
20 However, for any other kind of build system, see the manual steps in
21 README.txt in that folder.
22
23
24
25 Using the Protocol Buffers compiler (protoc)
26 ============================================
27 The nanopb generator is implemented as a plugin for the Google's own protoc
28 compiler. This has the advantage that there is no need to reimplement the
29 basic parsing of .proto files. However, it does mean that you need the
30 Google's protobuf library in order to run the generator.
31
32 If you have downloaded a binary package for nanopb (either Windows, Linux or
33 Mac OS X version), the 'protoc' binary is included in the 'generator-bin'
34 folder. In this case, you are ready to go. Simply run this command:
35
36     generator-bin/protoc --nanopb_out=. myprotocol.proto
37
38 However, if you are using a git checkout or a plain source distribution, you
39 need to provide your own version of protoc and the Google's protobuf library.
40 On Linux, the necessary packages are protobuf-compiler and python-protobuf.
41 On Windows, you can either build Google's protobuf library from source or use
42 one of the binary distributions of it. In either case, if you use a separate
43 protoc, you need to manually give the path to nanopb generator:
44
45     protoc --plugin=protoc-gen-nanopb=nanopb/generator/protoc-gen-nanopb ...
46
47
48
49 Running the tests
50 =================
51 If you want to perform further development of the nanopb core, or to verify
52 its functionality using your compiler and platform, you'll want to run the
53 test suite. The build rules for the test suite are implemented using Scons,
54 so you need to have that installed. To run the tests:
55
56     cd tests
57     scons
58
59 This will show the progress of various test cases. If the output does not
60 end in an error, the test cases were successful.
61
62 Note: Mac OS X by default aliases 'clang' as 'gcc', while not actually
63 supporting the same command line options as gcc does. To run tests on
64 Mac OS X, use: "scons CC=clang CXX=clang". Same way can be used to run
65 tests with different compilers on any platform.