forked from shanhaicoder/XENGPUMiner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
43 lines (34 loc) · 823 Bytes
/
build.sh
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
#!/bin/bash
# Save the current working directory
original_dir=$(pwd)
# Default values
COMPUTE_TYPE="CUDA"
# Read parameters
while [[ "$#" -gt 0 ]]; do
case $1 in
-compute_type) COMPUTE_TYPE="$2"; shift ;;
-cuda_arch) CUDA_ARCH="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
# Create and navigate to the build directory
mkdir -p build
cd build || exit
# Check if CUDA_ARCH is set, if not, perform a different action
if [ -z "$CUDA_ARCH" ]; then
# Run CMake and pass the arguments
cmake ..
make
else
cmake -DCUDA_ARCH=$CUDA_ARCH ..
# Compile the project
make
fi
# Return to the original working directory
cd "$original_dir" || exit
if [ -e miner.sh ]; then
chmod +x miner.sh
else
echo "miner.sh does not exist."
fi