-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.sh
executable file
·136 lines (127 loc) · 3.67 KB
/
config.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
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
#!/bin/bash
#
# @copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.
#
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m'
PROJECT_SOURCE_DIR=$(dirname "$0")
ABSOLUE_PATH=$(dirname $(realpath "$0"))
while getopts ":tevhi:scdx" opt; do
case $opt in
t) ##### Building tests enabled #####
echo -e "${GREEN}Building tests enabled${NC}"
BUILDING_TESTS="ON"
;;
e) ##### Building examples enabled #####
echo -e "${GREEN}Building examples enabled${NC}"
BUILDING_EXAMPLES="ON"
;;
i) ##### Define installation path #####
echo -e "${BLUE}Installation path set to $OPTARG${NC}"
INSTALL_PATH=$OPTARG
;;
v) ##### printing full output of make #####
echo -e "${YELLOW}printing make with details${NC}"
VERBOSE=ON
;;
c) ##### Using cuda enabled #####
echo -e "${YELLOW}Cuda enabled ${NC}"
USE_CUDA=ON
;;
s) ##### Using sycl enabled #####
echo -e "${YELLOW}Sycl enabled ${NC}"
USE_SYCL=ON
;;
d) ##### Using debug mode to build #####
echo -e "${RED}Debug mode enabled ${NC}"
BUILD_TYPE="DEBUG"
;;
x) ##### Using Timer for debugging enabled #####
echo -e "${BLUE}Timer for Debugging enabled ${NC}"
HCOREPP_USE_TIMER=ON
;;
\?) ##### using default settings #####
echo -e "${RED}Building tests disabled${NC}"
echo -e "${RED}Building examples disabled${NC}"
echo -e "${BLUE}Installation path set to /usr/local${NC}"
echo -e "${RED}Using CUDA disabled${NC}"
echo -e "${GREEN}Building in release mode${NC}"
BUILDING_EXAMPLES="OFF"
BUILDING_TESTS="OFF"
INSTALL_PATH="/usr/local"
VERBOSE=OFF
USE_CUDA="OFF"
USE_SYCL="OFF"
BUILD_TYPE="RELEASE"
;;
:) ##### Error in an option #####
echo "Option $OPTARG requires parameter(s)"
exit 0
;;
h) ##### Prints the help #####
echo "Usage of $(basename "$0"):"
echo ""
printf "%20s %s\n" "-t :" "to enable building tests"
echo ""
printf "%20s %s\n" "-e :" "to enable building examples"
echo ""
printf "%20s %s\n" "-c :" "to enable cuda support on"
echo ""
printf "%20s %s\n" "-s :" "to enable Sycl support on"
echo ""
printf "%20s %s\n" "-d :" "to build in debug mode"
echo ""
printf "%20s %s\n" "-i [path] :" "specify installation path"
printf "%20s %s\n" "" "default = /usr/local"
echo ""
printf "%20s %s\n" "-x :" "to enable Timer for debugging on"
echo ""
exit 1
;;
esac
done
if [ -z "$BUILDING_TESTS" ]; then
BUILDING_TESTS="OFF"
echo -e "${RED}Building tests disabled${NC}"
fi
if [ -z "$BUILDING_EXAMPLES" ]; then
BUILDING_EXAMPLES="OFF"
echo -e "${RED}Building examples disabled${NC}"
fi
if [ -z "$INSTALL_PATH" ]; then
INSTALL_PATH="/usr/local"
echo -e "${BLUE}Installation path set to $INSTALL_PATH${NC}"
fi
if [ -z "$USE_CUDA" ]; then
USE_CUDA="OFF"
echo -e "${RED}Using CUDA disabled${NC}"
fi
if [ -z "$USE_SYCL" ]; then
USE_SYCL="OFF"
echo -e "${RED}Using SYCL disabled${NC}"
fi
if [ -z "$BUILD_TYPE" ]; then
BUILD_TYPE="RELEASE"
echo -e "${GREEN}Building in release mode${NC}"
fi
if [ -z "$HCOREPP_USE_TIMER" ]; then
HCOREPP_USE_TIMER="OFF"
echo -e "${RED}Using Timer for debugging disabled${NC}"
fi
rm -rf bin/
mkdir bin/
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DHCOREPP_BUILD_TESTS=$BUILDING_TESTS \
-DHCOREPP_BUILD_EXAMPLES=$BUILDING_EXAMPLES \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=$VERBOSE \
-H"${PROJECT_SOURCE_DIR}" \
-B"${PROJECT_SOURCE_DIR}/bin" \
-DUSE_CUDA="$USE_CUDA" \
-DUSE_SYCL="$USE_SYCL" \
-DHCOREPP_USE_TIMER=$HCOREPP_USE_TIMER