-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathvcpkg_install.sh
executable file
·121 lines (90 loc) · 3.49 KB
/
vcpkg_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
113
114
115
116
117
118
119
120
121
#!/bin/bash
vcpkg_target_dir=$1
# For Fedora
FEDORA_PACKAGES="gcc gcc-c++ make curl tar unzip zip git ninja-build opencv opencv-devel perl dbus-devel libXi-devel libXtst-devel"
# For Debian-based systems like Ubuntu
DEBIAN_PACKAGES="build-essential tar curl zip unzip git ninja-build libopencv-dev perl libdbus-1-dev libxi-dev libxtst-dev"
# For CentOS
CENTOS_PACKAGES="gcc gcc-c++ make curl tar unzip zip git ninja-build opencv opencv-devel perl dbus-devel libXi-devel libXtst-devel"
# For Arch Linux
ARCH_PACKAGES="base-devel curl tar unzip zip git ninja opencv perl dbus libxi libxtst"
# For MacOS (uses Homebrew)
MACOS_PACKAGES="cmake curl unzip tar git ninja opencv perl dbus libxi libxtst"
# For Alpine Linux (uses apk)
APK_PACKAGES="gcc g++ make curl tar unzip zip git ninja perl dbus-dev libxi-dev libxtst-dev"
# Function to install packages on Debian
function install_packages_debian() {
apt-get update
apt-get install -y ${DEBIAN_PACKAGES}
}
# Function to install packages on Fedora
function install_packages_fedora() {
dnf install -y ${FEDORA_PACKAGES}
}
# Function to install packages on CentOS
function install_packages_centos() {
yum install -y ${CENTOS_PACKAGES}
}
# Function to install packages on Arch Linux
function install_packages_arch() {
pacman -Syu --needed ${ARCH_PACKAGES}
}
function install_packages_musl() {
apk add --no-cache ${APK_PACKAGES}
}
# Function to install packages on MacOS
function install_packages_macos() {
# Verify if 'brew' is installed
if ! command -v brew &> /dev/null
then
echo "Brew is not installed. Install it first and run the script again."
exit 1
fi
# If 'brew' is installed, use it to install the packages
for PACKAGE in ${MACOS_PACKAGES}
do
brew install ${PACKAGE}
done
}
echo $OSTYPE
# Identify the Linux distribution
if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "linux-musl"* ]] || [[ "$OSTYPE" == "linux"* ]]; then
if type apt-get > /dev/null 2>&1; then
install_packages_debian
elif type dnf > /dev/null 2>&1; then
install_packages_fedora
elif type yum > /dev/null 2>&1; then
install_packages_centos
elif type pacman > /dev/null 2>&1; then
install_packages_arch
elif type apk > /dev/null 2>&1; then
install_packages_musl
else
echo "Unknown package manager. Please install the dependencies manually."
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
install_packages_macos
elif [[ "$OSTYPE" == "cygwin" ]]; then
echo "Cygwin detected. Please install the required dependencies manually."
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Git Bash detected. Please install the required dependencies manually."
else
echo "Unknown operating system. Please install the required dependencies manually."
fi
# Clone or update Vcpkg
if [ ! -d "$vcpkg_target_dir/vcpkg" ]; then
cd $vcpkg_target_dir && git clone https://github.com/Microsoft/vcpkg.git
else
cd $vcpkg_target_dir/vcpkg && git pull && cd ..
fi
# Build and install Vcpkg
$vcpkg_target_dir/vcpkg/bootstrap-vcpkg.sh
$vcpkg_target_dir/vcpkg/vcpkg integrate install
# Get absolute path to current directory of this script realpath
CURRENT_FILE=$(realpath "${BASH_SOURCE:-$0}")
CURRENT_DIR=$(dirname "${CURRENT_FILE}")
# Install libraries from txt file
while read library; do
$vcpkg_target_dir/vcpkg/vcpkg install $library
done < $CURRENT_DIR/vcpkg_dependencies.txt
cat /project/build/temp.linux-x86_64-cpython-38/vcpkg/buildtrees/gtk3/config-x64-linux-dbg-out.log