Skip to content

Commit 5005305

Browse files
author
Avi SZYCHTER
committed
Update README
1 parent 96604a3 commit 5005305

File tree

1 file changed

+52
-7
lines changed

1 file changed

+52
-7
lines changed

README.md

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,45 @@ This project provides a C++ library that reads and parses [CAN](https://en.wikip
44

55
Currently the library only understand a subset of the DBC file format.
66

7+
## Compile and include the library
8+
9+
### The public headers
10+
11+
You need to put the public headers in an appropriate place:
12+
13+
```
14+
your_project/
15+
|_ src/
16+
|_ include/
17+
|_ cpp-can-parser/ # <-- Put here the public headers
18+
```
19+
20+
### Compilation
21+
22+
cpp-can-parser is not a header-only library. I recommand CMake to include the library into your project:
23+
24+
```cmake
25+
# After including cpp-can-parser into your project's CMakeLists.txt...
26+
target_link_libraries(MyAwesomeProject cpp-can-parser)
27+
```
28+
29+
By default, `cpp-can-parser` is linked as a shared object. If you want to use a static library, you can add `set(CPP_CAN_PARSER_USE_STATIC TRUE)` or set it at "command-line time": `cmake -DCPP_CAN_PARSER_USE_STATIC=TRUE ...`
30+
31+
32+
**If you are not using CMake to manage your whole project:**
33+
34+
cpp-can-parser is not provided with an already existing Makefile. You will still need CMake to manage the compilation of the library and then include it with traditional means:
35+
36+
```bash
37+
> cd cpp-can-parser
38+
> mkdir build && cd build
39+
> cmake .. && cmake --build . --target cpp-can-parser
40+
```
41+
42+
```Makefile
43+
LD_FLAGS=-Lpath/to/the/library -lcpp-can-parser
44+
```
45+
746
## Parsing a CAN database
847

948
The main feature of the library is the possibility of parsing a file representing the CAN database. There are several popular file formats and the list of the currently ones is available at the end of this README.
@@ -12,7 +51,7 @@ The main feature of the library is the possibility of parsing a file representin
1251

1352
```c++
1453
#include <iostream>
15-
#include "CANDatabase.h"
54+
#include "cpp-can-parser/CANDatabase.h"
1655

1756
int main(int argc, char** argv) {
1857
try {
@@ -100,12 +139,6 @@ for(const auto& frame : db) {
100139
}
101140
```
102141

103-
## Compiling the project
104-
105-
The project uses CMake to be compiled. It can also be used to easily include the library in your own project.
106-
107-
C++ CAN Parser currently is compiled as a static library.
108-
109142
## can-parse
110143

111144
`can-parse` is a utility program that allows you to parse the content of a CAN database which is then output to the standard output.
@@ -135,5 +168,17 @@ Possible actions:
135168
if CAN ID is specified, print the check details of the given frame
136169
-h / --help Print the present help message
137170
```
171+
172+
**Compilation:**
173+
To compile, just use the following instructions:
174+
175+
```bash
176+
> cd cpp-can-parser
177+
> mkdir build && cd build
178+
> cmake .. && cmake --build . --target can-parse
179+
```
180+
181+
There you got yourself a very nice installation of `can-parse` :) !
182+
138183
## Supported standards:
139184
* DBC (in progress)

0 commit comments

Comments
 (0)