Skip to content

Commit b55fd88

Browse files
committed
Improves documentation
1 parent 6cf037e commit b55fd88

File tree

2 files changed

+64
-73
lines changed

2 files changed

+64
-73
lines changed

README.md

+63-73
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,29 @@ Should work.
2929
Code is written and tested a few times.
3030
There are no known bugs, but there might be bugs.
3131

32-
### How to Build Trust in the Computed Result
32+
## Quick Get Started
33+
Fetch And Run The Development Image:
34+
```
35+
$ ./docker-shell.sh
36+
```
37+
38+
Compile The Binary:
39+
```
40+
# cd /line-collision-detector/linc
41+
# faster
42+
# b
43+
```
44+
45+
Run The Binary:
46+
```
47+
# run
48+
```
49+
50+
It will tell you how it wants to be used.
51+
52+
If something didn't work, see [troubleshooting](#troubleshooting):
53+
54+
## How to Build Trust in the Computed Result
3355

3456
If you get collision detected:
3557
Use the -o flag and generate a debug model.
@@ -41,70 +63,25 @@ Scale up your model gradually until you get collision detected.
4163
Inspect the collision with -o.
4264
Convince yourself that any smaller version would avoid collision.
4365

44-
## Toolchain
45-
46-
This project compiles in Docker
66+
## More In Depth Info For Developers
4767

48-
Everything inside `.` will be available from Docker at compile time.
49-
This means you can edit the source files from your own OS, using any IDE or text editor you'd like.
68+
### Structure
5069

51-
Generally, everything one might need from the OS in order to compile and work on this project
52-
should be available in this directory.
70+
This project has a Docker environment in which it compiles and runs.
71+
The Docker project lives in this (`line-collision-detector`) directory.
5372

54-
One level deeper, that is inside `./linc`, we have a build2 project defined.
73+
One level deeper, that is inside `line-collision-detector/linc`, we have a build2 project defined.
5574
The build2 build tool, and its norms, dictates the structure and contents of that folder.
5675
See [Canonical Project Structure](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#structure-canonical)
5776
in the build2 introduction.
5877

59-
Yet another level deeper, inside `./linc/linc`, is the actual source.
78+
Yet another level deeper, inside `line-collision-detector/linc/linc`, is the actual source.
6079

61-
## Compiling
62-
Starting from a Debian/Ubuntu OS:
63-
```
64-
$ sudo apt install docker docker.io
65-
$ sudo usermod -a -G docker $USER
66-
$ sudo reboot
67-
... <lots of time>
68-
$ docker pull gcc
69-
$ ./build-docker.sh
70-
... <lots of time>
71-
$ ./docker-shell.sh
72-
#
73-
```
74-
... and from there on you have access to one bash shell within the compile-container.
75-
This is the suggested way to compile in that terminal
76-
```
77-
# cd /line-collision-detector/linc
78-
# faster
79-
# b
80-
```
81-
If it complains that buildfile doesn't exist, then the linc submodule hasn't been updated.
82-
On the host system, do this:
83-
```
84-
$ git submodule update --init --recursive
85-
```
86-
... and try again to build like described above.
87-
88-
89-
After a successful build, execute with:
90-
```
91-
# /line-collision-detector/linc-gcc/linc/linc
92-
```
93-
Or simply
94-
```
95-
# run
96-
```
97-
98-
It will tell you how it wants to be used.
99-
Be aware that it will create a file called `linc.log`.
100-
It may also create a debug model, if you asked for it.
101-
This model is meant to be inspected visually in another program.
102-
103-
## Compilation database
80+
### Compilation database
10481
If you need the compilation database (`compile_commands.json`), this can
10582
be generated within the Docker container with the following command:
10683
```
107-
# make-compilation-database.sh
84+
# make-compilation-database
10885
```
10986
It actually creates two versions:
11087
```
@@ -121,46 +98,59 @@ $ cd linc
12198
$ rdm &
12299
$ rc -J .
123100
```
124-
## Indent your code
101+
### Indent your code
125102
In a docker shell, from anywhere, do
126103
```
127-
# indent.sh
104+
# indent
128105
```
129106
This will indent both c++ code and Bash code in this repo.
130107

131-
## Tidy your code
108+
### Tidy your code
132109
In a docker shell, from anywhere, do
133110
```
134-
# tidy.sh
111+
# tidy
135112
```
136113
If you only want to tidy one file, give the filename as an argument
137114

138115
This will check the c++ code and complain about places where we break our tidy-rules.
139116
It will also apply fixes automatically where it can.
140117

141-
## Build and run all tests
118+
### Build and run all tests
142119
In the Docker shell, do
143120
```
144-
# cd /line-collision-detector/linc/
145-
# b test
121+
# t
146122
```
147-
There's an abbreviation for that, so you can just do
123+
124+
### Build Docker Image Locally
125+
The `docker-shell.sh` script uses an "official" Docker image that it fetches from [here](https://gitlab.com/hangprinter/line-collision-detector/container_registry).
126+
You might want to build the Docker Image yourself, for example if
127+
128+
- The official image is outdated.
129+
- You have local changes in the Dockerfile.
130+
- You don't trust the official image.
131+
132+
You build your own with:
133+
148134
```
149-
# t
135+
$ ./build-docker.sh
150136
```
151137

152-
## Compile faster
153-
Some of our header-only dependencies can be built into static library files instead.
154-
This is useful during development since it gives faster compile times.
155-
To enable this, do
138+
### Troubleshooting
139+
#### Docker not installed
140+
Starting from a Debian/Ubuntu OS:
156141
```
157-
# faster.sh
142+
$ sudo apt install docker docker.io
143+
$ sudo usermod -a -G docker $USER
144+
$ sudo reboot
158145
```
159146

147+
Starting from other OSes, check [Docker's official documentation](https://docs.docker.com/get-docker/).
160148

161-
## Update gcc
162-
If a new version of gcc/g++ comes out, and you want to use it, do
149+
#### Buildfile doesn't exist
150+
The linc submodule hasn't been updated.
151+
On the host system, do this:
163152
```
164-
$ docker pull gcc
165-
$ ./build-docker.sh
166-
... <wait a long time>
153+
$ git submodule update --init --recursive
154+
```
155+
... and try to compile again.
156+

build-docker.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/usr/bin/env bash
22

3+
docker pull gcc
34
docker build -t registry.gitlab.com/hangprinter/line-collision-detector:latest .

0 commit comments

Comments
 (0)