-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathMakefile-build.toml
More file actions
93 lines (82 loc) · 2.66 KB
/
Makefile-build.toml
File metadata and controls
93 lines (82 loc) · 2.66 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
#
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
REPO_ROOT = { script = [
"dirname $(cargo locate-project --message-format plain --workspace)",
] }
[tasks.build-component-local]
category = "Build"
description = "compile carbide package"
workspace = false
script = '''
echo "building ${CARBIDE_PROFILE}/${CARBIDE_ARCH} of ${CARBIDE_CRATE}"
if [ "${CARBIDE_PROFILE}" = "release" ]
then
profile_arg="--release"
fi
pkg_args="${pkg_args} -p ${CARBIDE_CRATE}"
cargo build ${profile_arg} --target=${CARBIDE_ARCH}-unknown-linux-gnu ${pkg_args}
'''
[tasks.build-component-in-container]
category = "Build"
description = "compile carbide package x86_64"
workspace = false
script = '''
echo "building ${CARBIDE_PROFILE}/${CARBIDE_ARCH} of ${CARBIDE_CRATE}"
if [ "${CARBIDE_PROFILE}" = "release" ]
then
profile_arg="--release"
fi
case "${CARBIDE_ARCH}" in
"x86_64")
IMAGE_NAME="urm.nvidia.com/swngc-ngcc-docker-local/forge/carbide/x86-64/build-container:latest"
;;
"aarch64")
IMAGE_NAME="build-artifacts-container-cross-aarch64:latest"
;;
*)
echo "Unknown architecture"
exit 1
;;
esac
pkg_args="${pkg_args} -p ${CARBIDE_CRATE}"
docker run \
--rm \
--workdir /carbide \
--env CARGO_HOME=/cargo \
--user $(id -u):$(id -g) \
--volume $REPO_ROOT:/carbide \
--volume $CARGO_HOME:/cargo \
$IMAGE_NAME \
cargo build ${profile_arg} --target=${CARBIDE_ARCH}-unknown-linux-gnu ${pkg_args}
if [ "${CARBIDE_PROFILE}" = "release" ] && [ "${CARBIDE_ARCH}" = "x86_64" ]
then
docker run \
--rm \
--user $(id -u):$(id -g) \
--volume $REPO_ROOT:/carbide \
urm.nvidia.com/swngc-ngcc-docker-local/forge/carbide/x86-64/build-container:latest \
x86_64-linux-gnu-strip /carbide/target/x86_64-unknown-linux-gnu/release/forge-scout
else
echo "Skipping strip of sysmbols in profile ${CARBIDE_PROFILE}"
fi
'''
dependencies = [
{ name = "build-x86-build-container", path = "${REPO_ROOT}" },
{ name = "build-cross-docker-image", path = "${REPO_ROOT}" },
]