-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·106 lines (97 loc) · 2.83 KB
/
install.sh
File metadata and controls
executable file
·106 lines (97 loc) · 2.83 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
#!/bin/bash
#
# Copyright 2025 Moore Threads Technology Co., Ltd.
#
# 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.
BUILD_DIR="build"
DEFAULT_JOBS=12
ENABLE_MCC=OFF
ENABLE_NVCC=OFF
ENABLE_DEBUG=OFF
ENABLE_CUBRIDGE=OFF
# Function to print usage information
print_usage() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -R : Rebuild (clean build directory and rebuild)"
echo " -j N : Number of parallel jobs for make (default: j12)"
echo " -h : Display this help message"
echo " -m : Enable MCC Compiler (default: OFF)"
echo " -x : Enable MACA Compiler (default: OFF)"
echo " -n : Enable NVCC Compiler (default: OFF), Cannot enable both MCC and NVCC at the same time"
echo " -d : Enable Debug Mode (default: OFF)"
exit 1
}
# Process command line arguments
while getopts "Rj:nmdxh" opt; do
case $opt in
R)
REBUILD=true
;;
j)
JOBS=$OPTARG
;;
m)
ENABLE_MCC=ON
;;
n)
ENABLE_NVCC=ON
;;
d)
ENABLE_DEBUG=ON
;;
x)
ENABLE_CUBRIDGE=ON
;;
h)
print_usage
;;
*)
print_usage
;;
esac
done
if [ -z "$JOBS" ]; then
JOBS=$DEFAULT_JOBS
fi
# Check if the build directory exists, if not, create it
if [ ! -d "$BUILD_DIR" ]; then
echo "Creating '$BUILD_DIR' directory..."
mkdir "$BUILD_DIR"
cd "$BUILD_DIR"
if [ "$ENABLE_CUBRIDGE" = "ON" ]; then
cmake_maca .. "-DENABLE_CUBRIDGE=ON" "-DENABLE_DEBUG=$ENABLE_DEBUG"
else
cmake .. "-DENABLE_MCC=$ENABLE_MCC" "-DENABLE_DEBUG=$ENABLE_DEBUG" "-DENABLE_NVCC=$ENABLE_NVCC"
fi
cd ..
fi
# Navigate to build directory
cd "$BUILD_DIR"
# If REBUILD is true, clean build directory and rebuild
if [ ! -f "Makefile" ] || [ "$REBUILD" = true ]; then
if [ "$ENABLE_CUBRIDGE" = "ON" ]; then
cmake_maca .. "-DENABLE_CUBRIDGE=ON" "-DENABLE_DEBUG=$ENABLE_DEBUG"
make_maca "-j$JOBS"
else
cmake .. "-DENABLE_MCC=$ENABLE_MCC" "-DENABLE_DEBUG=$ENABLE_DEBUG" "-DENABLE_NVCC=$ENABLE_NVCC"
make "-j$JOBS"
fi
else
if [ "$ENABLE_CUBRIDGE" = "ON" ]; then
make_maca "-j$JOBS"
else
make "-j$JOBS"
fi
fi
echo "Build completed."