Skip to content

Commit 708f9c8

Browse files
andrestrakerSSingh5845
authored andcommitted
Added files to test the build on a clean Docker container.
1 parent bf82a07 commit 708f9c8

File tree

6 files changed

+574
-0
lines changed

6 files changed

+574
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Use Ubuntu 22.04 as base (matches JetPack 6.2.1 environment)
2+
# This will use the ARM64 version when built on Jetson
3+
FROM ubuntu:22.04
4+
5+
# Build arguments for branch selection
6+
ARG ADCAM_BRANCH=main
7+
ARG LIBADITOF_BRANCH=main
8+
ARG BUILD_JOBS=6
9+
10+
# Prevent interactive prompts during package installation
11+
ENV DEBIAN_FRONTEND=noninteractive
12+
13+
# Install build dependencies
14+
RUN apt-get update && apt-get install -y \
15+
cmake \
16+
g++ \
17+
git \
18+
python3.10 \
19+
python3.10-dev \
20+
libopencv-contrib-dev \
21+
libopencv-dev \
22+
libgl1-mesa-dev \
23+
libglfw3-dev \
24+
libxinerama-dev \
25+
libxcursor-dev \
26+
libxi-dev \
27+
libxrandr-dev \
28+
doxygen \
29+
graphviz \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
# Set working directory
33+
WORKDIR /workspace
34+
35+
# Copy the local libs folder to the workspace
36+
COPY libs /workspace/libs
37+
38+
# Clone the repository
39+
RUN git clone https://github.com/analogdevicesinc/ADCAM.git
40+
41+
# Set working directory to the cloned repo
42+
WORKDIR /workspace/ADCAM
43+
44+
# Checkout specified branch for ADCAM
45+
RUN echo "Checking out ADCAM branch: $ADCAM_BRANCH" && \
46+
git checkout $ADCAM_BRANCH
47+
48+
# Initialize submodules
49+
RUN git submodule update --init
50+
51+
# Checkout specified branch for libaditof submodule
52+
RUN echo "Checking out libaditof branch: $LIBADITOF_BRANCH" && \
53+
cd libaditof && \
54+
git checkout $LIBADITOF_BRANCH && \
55+
cd ..
56+
57+
# Create build directory
58+
RUN mkdir build
59+
60+
# Set working directory to build
61+
WORKDIR /workspace/ADCAM/build
62+
63+
# Configure with CMake - output will be visible during docker build
64+
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
65+
66+
# Build the project with verbose output
67+
RUN cmake --build . -j ${BUILD_JOBS} --verbose
68+
69+
# Default command to show build succeeded
70+
CMD ["echo", "Build completed successfully!"]
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Use Ubuntu 22.04 as base (matches JetPack 6.2.1 environment)
2+
# This will use the ARM64 version when built on Jetson
3+
FROM ubuntu:22.04
4+
5+
# Build arguments
6+
ARG BUILD_JOBS=6
7+
8+
# Prevent interactive prompts during package installation
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# Install build dependencies
12+
RUN apt-get update && apt-get install -y \
13+
cmake \
14+
g++ \
15+
git \
16+
python3.10 \
17+
python3.10-dev \
18+
libopencv-contrib-dev \
19+
libopencv-dev \
20+
libgl1-mesa-dev \
21+
libglfw3-dev \
22+
libxinerama-dev \
23+
libxcursor-dev \
24+
libxi-dev \
25+
libxrandr-dev \
26+
doxygen \
27+
graphviz \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
# Set working directory
31+
WORKDIR /workspace
32+
33+
# Copy the local libs folder to the workspace
34+
COPY libs /workspace/libs
35+
36+
# Copy local ADCAM code (excluding build, libaditof/build, scripts)
37+
COPY local_code /workspace/ADCAM
38+
39+
# Set working directory to the local code
40+
WORKDIR /workspace/ADCAM
41+
42+
# Create build directory
43+
RUN mkdir -p build
44+
45+
# Set working directory to build
46+
WORKDIR /workspace/ADCAM/build
47+
48+
# Configure with CMake - output will be visible during docker build
49+
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
50+
51+
# Build the project with verbose output
52+
RUN cmake --build . -j ${BUILD_JOBS} --verbose
53+
54+
# Default command to show build succeeded
55+
CMD ["echo", "Build completed successfully!"]

scripts/jetson_orin_nano/README.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# ADCAM Docker Build Test Environment
2+
3+
This Docker container provides a clean environment to test building the [ADCAM repository](https://github.com/analogdevicesinc/ADCAM) before making a PR, ensuring no dependencies are missing.
4+
5+
## Quick Start
6+
7+
Build with default settings (main branches):
8+
```bash
9+
./build.sh -l /path/to/libs
10+
```
11+
12+
Build with specific branches:
13+
```bash
14+
./build.sh -l /path/to/libs <adcam-branch> <libaditof-branch>
15+
```
16+
17+
Build using local workspace code:
18+
```bash
19+
./build.sh --local -l /path/to/libs
20+
```
21+
22+
## Usage
23+
24+
```bash
25+
./build.sh [OPTIONS] [ADCAM_BRANCH] [LIBADITOF_BRANCH]
26+
```
27+
28+
### Options
29+
30+
- `-h, --help` - Show help message
31+
- `-l, --libs PATH` - Path to libs folder to copy into container **(required)**
32+
- `-j, --jobs N` - Number of parallel build jobs (default: 6)
33+
- `-t, --tag NAME` - Docker image tag name (default: adcam-build-test)
34+
- `--no-cache` - Build without using Docker cache
35+
- `--local` - Use local workspace code instead of cloning from GitHub
36+
37+
### Examples
38+
39+
```bash
40+
# Use main for both repos (default)
41+
./build.sh -l /path/to/libs
42+
43+
# Use specific branches
44+
./build.sh -l /path/to/libs feature-branch main
45+
46+
# Build with 4 parallel jobs
47+
./build.sh -j 4 -l /path/to/libs main main
48+
49+
# Force clean build without cache
50+
./build.sh --no-cache -l /path/to/libs main main
51+
52+
# Custom image tag
53+
./build.sh -t my-test-build -l /path/to/libs main main
54+
55+
# Use local workspace code (test uncommitted changes)
56+
./build.sh --local -l /path/to/libs
57+
58+
# Use local code with clean build
59+
./build.sh --local --no-cache -l /path/to/libs
60+
```
61+
62+
### Manual Docker Build
63+
64+
**Standard Mode:**
65+
```bash
66+
# First copy libs to the Docker context
67+
cp -r /path/to/libs ./libs
68+
69+
# Then build
70+
sudo docker build \
71+
--progress=plain \
72+
--build-arg ADCAM_BRANCH=main \
73+
--build-arg LIBADITOF_BRANCH=main \
74+
--build-arg BUILD_JOBS=6 \
75+
-t adcam-build-test .
76+
```
77+
78+
**Local Mode:**
79+
```bash
80+
# First copy libs and local code to the Docker context
81+
cp -r /path/to/libs ./libs
82+
rsync -a --exclude='build' --exclude='libaditof/build' --exclude='scripts' --exclude='.git' ../../ ./local_code/
83+
84+
# Then build using Dockerfile.local
85+
sudo docker build \
86+
--progress=plain \
87+
--build-arg BUILD_JOBS=6 \
88+
-f Dockerfile.local \
89+
-t adcam-build-test .
90+
```
91+
92+
## What's Included
93+
94+
- Ubuntu 22.04 base image
95+
- All required build dependencies:
96+
- CMake
97+
- g++
98+
- Python 3.10 with dev libraries
99+
- OpenCV (with contrib modules)
100+
- OpenGL and GLFW3
101+
- X11 libraries (Xinerama, Xcursor, Xi, Xrandr)
102+
- Doxygen and Graphviz (for documentation)
103+
- ADCAM code (cloned from GitHub or copied from local workspace)
104+
- Pre-built project (Release configuration)
105+
106+
## Viewing Build Output
107+
108+
The build script saves full output to `build_output.log`. Use the view-log helper script:
109+
110+
```bash
111+
./view-log.sh # Follow last 50 lines in real-time
112+
./view-log.sh errors # Show all errors and warnings
113+
./view-log.sh grep cmake # Search for specific text
114+
./view-log.sh all # Browse entire log with less
115+
```
116+
117+
Or view directly:
118+
```bash
119+
tail -f build_output.log # Follow in real-time
120+
grep -i error build_output.log # Search for errors
121+
less build_output.log # Browse the full log
122+
```
123+
124+
## Build Process
125+
126+
The Dockerfile performs the following steps:
127+
128+
### Standard Mode (default)
129+
1. Copies local `libs` folder into the container (if present)
130+
2. Installs all dependencies from the ADCAM README
131+
3. Clones the ADCAM repository
132+
4. Checks out specified branches for ADCAM and libaditof
133+
5. Initializes git submodules (ToF-drivers and libaditof)
134+
6. Runs CMake configuration (Release mode)
135+
7. Builds the project with configurable parallel jobs and verbose output
136+
137+
### Local Mode (--local flag)
138+
1. Copies local `libs` folder into the container
139+
2. Installs all dependencies from the ADCAM README
140+
3. Copies local workspace code (excluding `build/`, `libaditof/build/`, `scripts/`, and `.git/`)
141+
4. Runs CMake configuration (Release mode)
142+
5. Builds the project with configurable parallel jobs and verbose output
143+
144+
All build output is visible during the Docker build process, allowing you to catch any issues early.
145+
146+
## Customization
147+
148+
**Testing specific branches:**
149+
Use the branch arguments when running `build.sh`:
150+
```bash
151+
./build.sh -l /path/to/libs <adcam-branch> <libaditof-branch>
152+
```
153+
154+
**Testing local uncommitted changes:**
155+
Use the `--local` flag:
156+
```bash
157+
./build.sh --local -l /path/to/libs
158+
```
159+
160+
**Inspecting the built container:**
161+
```bash
162+
docker run --rm -it adcam-build-test bash
163+
```
164+
165+
## Cleanup
166+
167+
Since this is a build testing environment, you should clean up Docker artifacts after testing:
168+
169+
```bash
170+
./cleanup.sh
171+
```
172+
173+
This will:
174+
- Remove the adcam-build-test image
175+
- Remove any custom tagged images
176+
- Clean up dangling images and build cache
177+
- Remove temporary folders (`libs/`, `local_code/`)
178+
- Remove build log file (`build_output.log`)
179+
- Reclaim disk space
180+
181+
Manual cleanup:
182+
```bash
183+
sudo docker image rm adcam-build-test
184+
sudo docker system prune -f
185+
```
186+
187+
## Notes
188+
189+
- The build uses `-j 6` for parallel compilation (6 jobs)
190+
- Build type is set to `Release`
191+
- The container is based on Ubuntu 22.04, matching the JetPack 6.2.1 environment

0 commit comments

Comments
 (0)