-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
92 lines (74 loc) · 3.09 KB
/
Makefile
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
# format the source code
format: src/*.cpp src/*.hpp test/*.cpp
ls src/*.cpp src/*.hpp test/*.cpp | xargs clang-format -i --style="{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 100}"
SANITIZE ?= OFF
viam-camera-realsense: src/*
rm -rf build/ && \
mkdir build && \
cd build && \
cmake -G Ninja -DENABLE_SANITIZER=$(SANITIZE) .. && \
ninja all -j 4 && \
cp viam-camera-realsense ../
realsense-integration-tests: integration/tests/*
cd integration && \
go test -c -o realsense-integration-tests ./tests/ && \
cp realsense-integration-tests ../
default: viam-camera-realsense
all: default
clean:
rm -rf viam-camera-realsense
clean-all: clean
git clean -fxd
# Docker
BUILD_CMD = docker buildx build --pull $(BUILD_PUSH) --force-rm --no-cache --build-arg MAIN_TAG=$(MAIN_TAG) --build-arg BASE_TAG=$(BUILD_TAG) --platform linux/$(BUILD_TAG) -f $(BUILD_FILE) -t '$(MAIN_TAG):$(BUILD_TAG)' .
BUILD_PUSH = --load
BUILD_FILE = ./etc/Dockerfile.debian.bookworm
docker: docker-build docker-upload
docker-build: docker-arm64
docker-arm64: MAIN_TAG = ghcr.io/viam-modules/viam-camera-realsense
docker-arm64: BUILD_TAG = arm64
docker-arm64:
$(BUILD_CMD)
docker-upload:
docker push 'ghcr.io/viam-modules/viam-camera-realsense:arm64'
# CI targets that automatically push, avoid for local test-first-then-push workflows
docker-arm64-ci: MAIN_TAG = ghcr.io/viam-modules/viam-camera-realsense
docker-arm64-ci: BUILD_TAG = arm64
docker-arm64-ci: BUILD_PUSH = --push
docker-arm64-ci:
$(BUILD_CMD)
docker-amd64-ci: MAIN_TAG = ghcr.io/viam-modules/viam-camera-realsense
docker-amd64-ci: BUILD_TAG = amd64
docker-amd64-ci: BUILD_PUSH = --push
docker-amd64-ci:
$(BUILD_CMD)
TAG_VERSION?=latest
# Define a function for building AppImages
define BUILD_APPIMAGE
export TAG_NAME=$(TAG_VERSION); \
cd packaging/appimages && \
mkdir -p deploy && \
rm -f deploy/$(1)* && \
appimage-builder --recipe $(1)-$(2).yml
endef
# Targets for building AppImages
appimage-arm64: export OUTPUT_NAME = viam-camera-realsense
appimage-arm64: export ARCH = aarch64
appimage-arm64: viam-camera-realsense
$(call BUILD_APPIMAGE,$(OUTPUT_NAME),$(ARCH))
cp ./packaging/appimages/$(OUTPUT_NAME)-*-$(ARCH).AppImage ./packaging/appimages/deploy/
appimage-amd64: export OUTPUT_NAME = viam-camera-realsense
appimage-amd64: export ARCH = x86_64
appimage-amd64: viam-camera-realsense
$(call BUILD_APPIMAGE,$(OUTPUT_NAME),$(ARCH))
cp ./packaging/appimages/$(OUTPUT_NAME)-*-$(ARCH).AppImage ./packaging/appimages/deploy/
integration-appimage-arm64: export OUTPUT_NAME = realsense-integration-tests
integration-appimage-arm64: export ARCH = aarch64
integration-appimage-arm64: realsense-integration-tests
$(call BUILD_APPIMAGE,$(OUTPUT_NAME),$(ARCH))
cp ./packaging/appimages/$(OUTPUT_NAME)-*-$(ARCH).AppImage ./packaging/appimages/deploy/
integration-appimage-amd64: export OUTPUT_NAME = realsense-integration-tests
integration-appimage-amd64: export ARCH = x86_64
integration-appimage-amd64: realsense-integration-tests
$(call BUILD_APPIMAGE,$(OUTPUT_NAME),$(ARCH))
cp ./packaging/appimages/$(OUTPUT_NAME)-*-$(ARCH).AppImage ./packaging/appimages/deploy/