-
Notifications
You must be signed in to change notification settings - Fork 5
/
conan_install.sh
executable file
·112 lines (99 loc) · 2.7 KB
/
conan_install.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
#!/bin/bash -x
UNAME=$(tr [A-Z] [a-z] <<< "$(uname)")
export SCRIPTS_DIR="$( cd "$( echo "${BASH_SOURCE[0]%/*}/" )"; pwd )"
. ${SCRIPTS_DIR}/functions.sh
. ${SCRIPTS_DIR}/system_capabilities.sh
CONAN_CHANNEL=@bottomline/stable
BUILD_TYPE=Release
CONANFILE_TXT=conanfile.txt
while getopts "o:e:c:f:b:l:" opt; do
case ${opt} in
o)
OPTIM_SPEC=$OPTARG
;;
c)
COMPILER=$OPTARG
;;
e)
COMPUTE_ENGINE=$OPTARG
;;
b)
BUILD_TYPE=$OPTARG
;;
l)
CONAN_CHANNEL=$OPTARG
;;
f)
CONANFILE_TXT=$OPTARG
;;
\?)
echo "Invalid option: $OPTARG" 1>&2
exit 1
;;
:)
echo "Invalid option: $OPTARG requires an argument" 1>&2
;;
esac
done
shift $((OPTIND -1))
if ! [[ "$OPTIM_SPEC" =~ ^(all|safe|none)$ ]]
then
if [ "x$OPTIM_SPEC" = "x" ]
then
get_optimisation_level 'OPTIM_SPEC'
echo "Warning: no optimisation level specified, automatically determined to be ${OPTIM_SPEC}"
else
echo "Error: unknown optimisation level '$OPTIM_SPEC'"
exit 1
fi
fi
if ! [[ "$COMPUTE_ENGINE" =~ ^(cpu|cuda_10)$ ]]
then
if [ "x$COMPUTE_ENGINE" = "x" ]
then
get_compute_engine_type 'COMPUTE_ENGINE'
echo "Warning: no compute engine specified, automatically determined to be ${COMPUTE_ENGINE}"
else
echo "Error: unknown compute engine type '$COMPUTE_ENGINE'"
exit 1
fi
fi
if [ "x$COMPILER" = "x" ]
then
get_compiler 'COMPILER'
echo "Warning: no compiler specified, automatically determined to be $COMPILER"
fi
if [ "x$CONAN_CHANNEL" = "x" ]
then
echo "Error, you must provide a properly formatted specification for the Conan channel"
exit 1
fi
if ! [[ "$BUILD_TYPE" =~ ^(Release|Debug)$ ]]
then
if [ "x$BUILD_TYPE" = "x" ]
then
echo "Warning: defaulting build type to Release"
BUILD_TYPE="Release"
else
echo "Error: unknown build type '$BUILD_TYPE'"
exit 1
fi
fi
if [ "x$CONANFILE_TXT" = "x" ]
then
CONANFILE_TXT=${SCRIPTS_DIR}/conanfile.txt
echo "Warning: no Conanfile specified, defaulting to $CONANFILE_TXT"
fi
if [ ! -f "$CONANFILE_TXT" ]
then
echo "File ${CONANFILE_TXT} does not exist"
exit 1
fi
EXTRA_BUILD_SPEC=$(get_extra_build_spec $COMPILER $COMPUTE_ENGINE $OPTIM_SPEC)
BUILD_PROFILE=$UNAME-$EXTRA_BUILD_SPEC
PROFILE_FILE="${SCRIPTS_DIR}/profiles/$BUILD_PROFILE"
INSTALL_FOLDER=${CONAN_USER_HOME}/CMakeModules/${EXTRA_BUILD_SPEC}
# Ensure that Conan uses the new ABI for the default profile
#conan profile update settings.compiler.libcxx=libstdc++11 default
#conan profile update settings.compiler.libcxx=libstdc++11 ${BUILD_PROFILE}
do_conan_install $CONANFILE_TXT $CONAN_CHANNEL $BUILD_TYPE $COMPILER $COMPUTE_ENGINE $OPTIM_SPEC $PROFILE_FILE $INSTALL_FOLDER