-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathMakefile
More file actions
208 lines (184 loc) · 8.34 KB
/
Makefile
File metadata and controls
208 lines (184 loc) · 8.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
.DEFAULT_GOAL := help
.PHONY: build tests clean lint-all lint-clang lint-python lint-yaml lint-githubactions lint-bash lint-markdown lint-json source-package help local-build local-tests local-clean local-debug local-opencv-free
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
# Version info for packaging
COMMIT := $(shell git rev-parse --short HEAD)
DATE := $(shell git log -1 --format=%cd --date=format:"%Y%m%d")
VERSION := $(COMMIT)-$(DATE)
ROS_DISTRO ?= humble
ifeq ($(ROS_DISTRO),humble)
UBUNTU_CODENAME := jammy
else
UBUNTU_CODENAME := noble
endif
build:
@# Help: Build code using colcon with complete oneAPI 2025.3 clean build environment
docker run --rm -t --platform linux/amd64 \
-v $(ROOT_DIR):/src \
-e DEBIAN_FRONTEND=noninteractive \
-e ROS_DISTRO=$(ROS_DISTRO) \
-e http_proxy=${http_proxy} \
-e https_proxy=${https_proxy} \
-e no_proxy=${no_proxy} \
--pull never \
amd64/ros:${ROS_DISTRO}-ros-base \
bash -c "curl https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | \
gpg --yes --dearmor --output /usr/share/keyrings/oneapi-archive-keyring.gpg && \
echo \"deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main\" > /etc/apt/sources.list.d/oneAPI.list && \
if [ \"\$$ROS_DISTRO\" = \"humble\" ]; then \
curl https://eci.intel.com/repos/gpg-keys/GPG-PUB-KEY-INTEL-ECI.gpg | gpg --yes --dearmor --output /usr/share/keyrings/eci-archive-keyring.gpg && \
echo 'deb [signed-by=/usr/share/keyrings/eci-archive-keyring.gpg] https://eci.intel.com/repos/${UBUNTU_CODENAME} isar main' | tee /etc/apt/sources.list.d/eci.list > /dev/null && \
echo 'deb-src [signed-by=/usr/share/keyrings/eci-archive-keyring.gpg] https://eci.intel.com/repos/${UBUNTU_CODENAME} isar main' | tee -a /etc/apt/sources.list.d/eci.list > /dev/null; \
fi && \
apt-get -qq update --allow-unauthenticated && \
apt-get install -y clang devscripts equivs && \
echo 'Cleaning all build artifacts for oneAPI 2025.3 compatibility...' && \
cd /src && \
rm -rf ./debian ./build ./build-orbtest ./build-* ./CMakeCache.txt ./CMakeFiles ./cmake_install.cmake ./*.cmake && \
find . -name 'CMakeCache.txt' -delete && \
find . -name 'CMakeFiles' -type d -exec rm -rf {} + 2>/dev/null || true && \
find . -name '*.cmake' \( -path '*/build' -o -path '*/build-*' \) -delete 2>/dev/null || true && \
cp -r ./${ROS_DISTRO}/debian ./debian && \
echo 'Installing build dependencies with clean environment...' && \
mk-build-deps -i --host-arch amd64 --build-arch amd64 \
-t \"apt-get -y -q -o Debug::pkgProblemResolver=yes --no-install-recommends --allow-downgrades\" debian/control && \
echo 'Starting clean CMake build for oneAPI 2025.3 SYCL compatibility...' && \
export CMAKE_GENERATOR_PLATFORM='' && \
export CMAKE_BUILD_PARALLEL_LEVEL=1 && \
dpkg-buildpackage && \
mv ../*.deb . && \
echo 'Successfully built packages with oneAPI 2025.3 fixes'"
tests:
@# Help: Run comprehensive tests (both OpenCV-free and OpenCV modes) in containerized environment
@echo "=== Running Comprehensive Test Suite ==="
@echo "Testing both OpenCV-free (packaged) and OpenCV (full) variants..."
docker run --rm -t --platform linux/amd64 \
-v $(ROOT_DIR):/src \
-e DEBIAN_FRONTEND=noninteractive \
-e ROS_DISTRO=$(ROS_DISTRO) \
--privileged \
--device /dev/dri:/dev/dri \
-w /src \
-e no_proxy=${no_proxy} \
amd64/ros:${ROS_DISTRO}-ros-base \
./scripts/test.sh
clean:
@# Help: Clean build artifacts
rm -rf build* debian/ ros-* *.deb tests/build*
license-check:
@# Help: Perform a REUSE license check using docker container https://hub.docker.com/r/fsfe/reuse
docker run --rm --volume ${ROOT_DIR}:/data fsfe/reuse:5.0.2 lint
lint:
@# Help: Run all sub-linters using super-linter (using linters defined for this repo only)
VALIDATE_GITHUB_ACTIONS=true \
VALIDATE_YAML=true \
VALIDATE_JSON=true \
VALIDATE_PYTHON_PYLINT=true \
VALIDATE_PYTHON_FLAKE8=true \
VALIDATE_BASH=true \
VALIDATE_MARKDOWN=true \
VALIDATE_CLANG_FORMAT=true \
make lint-all
lint-all:
@# Help: Run super-linter over entire repository (auto-detects code to lint)
docker run --rm --platform linux/amd64 \
-e SHELL=/bin/bash \
-e RUN_LOCAL=true \
--env-file ".github/linters/super-linter.env" \
$(if $(VALIDATE_GITHUB_ACTIONS),-e VALIDATE_GITHUB_ACTIONS=$(VALIDATE_GITHUB_ACTIONS)) \
$(if $(VALIDATE_YAML),-e VALIDATE_YAML=$(VALIDATE_YAML)) \
$(if $(VALIDATE_JSON),-e VALIDATE_JSON=$(VALIDATE_JSON)) \
$(if $(VALIDATE_PYTHON_PYLINT),-e VALIDATE_PYTHON_PYLINT=$(VALIDATE_PYTHON_PYLINT)) \
$(if $(VALIDATE_PYTHON_FLAKE8),-e VALIDATE_PYTHON_FLAKE8=$(VALIDATE_PYTHON_FLAKE8)) \
$(if $(VALIDATE_BASH),-e VALIDATE_BASH=$(VALIDATE_BASH)) \
$(if $(VALIDATE_MARKDOWN),-e VALIDATE_MARKDOWN=$(VALIDATE_MARKDOWN)) \
$(if $(VALIDATE_CLANG_FORMAT),-e VALIDATE_CLANG_FORMAT=$(VALIDATE_CLANG_FORMAT)) \
-v $(ROOT_DIR):/tmp/lint \
ghcr.io/super-linter/super-linter:slim-v8.1.0
lint-clang:
@# Help: Run clang linter using super-linter
VALIDATE_CLANG_FORMAT=true make lint-all
lint-python:
@# Help: Run Python linter using super-linter
VALIDATE_PYTHON_PYLINT=true VALIDATE_PYTHON_FLAKE8=true make lint-all
lint-yaml:
@# Help: Run YAML linter using super-linter
VALIDATE_YAML=true make lint-all
lint-githubactions:
@# Help: Run Github Actions linter using super-linter
VALIDATE_GITHUB_ACTIONS=true make lint-all
lint-bash:
@# Help: Run Bash linter using super-linter
VALIDATE_BASH=true make lint-all
lint-markdown:
@# Help: Run Markdown linter using super-linter
VALIDATE_MARKDOWN=true make lint-all
lint-json:
@# Help: Run JSON linter using super-linter
VALIDATE_JSON=true make lint-all
source-package:
@# Help: Create source package tarball
git archive --format=zip -o orb-extractor-$(VERSION).zip HEAD \
Makefile README.md README-external.md REUSE.toml \
CMakeLists.txt orblzeConfig.cmake.in orblze.pc.in \
.github/linters cmake images include LICENSES samples src tests \
humble jazzy
local-build:
@# Help: Fast local CMake build (preserves build cache, no Docker/packaging overhead)
mkdir -p build && \
cd build && \
if [ -f "/opt/intel/oneapi/setvars.sh" ]; then . "/opt/intel/oneapi/setvars.sh"; fi && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENCV=ON \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-DCMAKE_INSTALL_LIBDIR=lib && \
make -j$$(nproc)
local-tests:
@# Help: Build and run tests locally (fast, no Docker overhead)
mkdir -p build-test && \
cd build-test && \
if [ -f "/opt/intel/oneapi/setvars.sh" ]; then . "/opt/intel/oneapi/setvars.sh"; fi && \
cmake ../tests -DCMAKE_BUILD_TYPE=Release && \
make -j$$(nproc) && \
echo "Running tests..." && \
export LD_LIBRARY_PATH="../build/src/sycl_utils:$$LD_LIBRARY_PATH" && \
ctest --output-on-failure || echo "Note: Some tests may require Intel GPU hardware"
local-debug:
@# Help: Fast local debug build (preserves build cache, includes debug symbols)
mkdir -p build-debug && \
cd build-debug && \
if [ -f "/opt/intel/oneapi/setvars.sh" ]; then . "/opt/intel/oneapi/setvars.sh"; fi && \
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_OPENCV=AUTO \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-DCMAKE_INSTALL_LIBDIR=lib && \
make -j$$(nproc)
local-clean:
@# Help: Clean only local build directories (preserves Docker build cache)
rm -rf build build-test build-debug build-ocvfree
local-opencv-free:
@# Help: Fast local build in OPENCV_FREE mode (matches the packaged version)
mkdir -p build-ocvfree && \
cd build-ocvfree && \
if [ -f "/opt/intel/oneapi/setvars.sh" ]; then . "/opt/intel/oneapi/setvars.sh"; fi && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENCV=OFF \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-DCMAKE_INSTALL_LIBDIR=lib && \
make -j$$(nproc)
help:
@printf "%-20s %s\n" "Target" "Description"
@printf "%-20s %s\n" "------" "-----------"
@grep -E '^[a-zA-Z0-9_%-]+:|^[[:space:]]+@# Help:' Makefile | \
awk '\
/^[a-zA-Z0-9_%-]+:/ { \
target = $$1; \
sub(":", "", target); \
} \
/^[[:space:]]+@# Help:/ { \
if (target != "") { \
help_line = $$0; \
sub("^[[:space:]]+@# Help: ", "", help_line); \
printf "%-20s %s\n", target, help_line; \
target = ""; \
} \
}' | sort -k1,1