-
Notifications
You must be signed in to change notification settings - Fork 3
/
install_vcpkg
executable file
·54 lines (40 loc) · 1.2 KB
/
install_vcpkg
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
#!/bin/bash
function vcpkg::env() {
local -r vcpkg_dir='${HOME}/Documents/sources/vcpkg'
local -r zshrc_path="${HOME}/.zshrc.user"
echo "export PATH=\"\${PATH}:${vcpkg_dir}\"" >> "${zshrc_path}"
echo "export VCPKG_INSTALLED_DIR=\"${vcpkg_dir}/installed/x64-linux\"" >> "${zshrc_path}"
echo "export VCPKG_ROOT=\"${vcpkg_dir}\"" >> "${zshrc_path}"
}
function vcpkg::install() {
local -r vcpkg_dir="${root_dir}/vcpkg"
local i=""
echo "Create directory '${root_dir}'"
mkdir -p "${root_dir}"
echo "Run 'git clone ${args[@]} https://github.com/Microsoft/vcpkg.git ${vcpkg_dir}'"
git clone ${args[@]} https://github.com/Microsoft/vcpkg.git "${vcpkg_dir}"
cd "${vcpkg_dir}"
echo "Install vcpkg"
./bootstrap-vcpkg.sh
./vcpkg integrate install
for i in .git* buildtrees downloads packages; do
echo "Remove '${vcpkg_dir}/${i}'"
rm -rf "${vcpkg_dir}/${i}"
done
cd ~-
}
function main() {
root_dir="${HOME}/Documents/sources"
local flag OPTARG OPTIND
args=("--depth 1")
while getopts 'b:d:' flag; do
case "${flag}" in
b) args+=("--branch ${OPTARG}") ;;
d) root_dir="${OPTARG}"
esac
done
shift $(( ${OPTIND} - 1 ))
vcpkg::install
vcpkg::env
}
main "$@"