forked from KhronosGroup/Vulkan-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_dependencies_linux.sh
More file actions
executable file
·141 lines (113 loc) · 5.21 KB
/
install_dependencies_linux.sh
File metadata and controls
executable file
·141 lines (113 loc) · 5.21 KB
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
137
138
139
140
141
#!/bin/bash
echo "Installing dependencies for Vulkan Tutorial..."
# Function to detect the package manager
detect_package_manager() {
if command -v apt-get &> /dev/null; then
echo "apt"
elif command -v dnf &> /dev/null; then
echo "dnf"
elif command -v pacman &> /dev/null; then
echo "pacman"
else
echo "unknown"
fi
}
# Install dependencies based on the package manager
PACKAGE_MANAGER=$(detect_package_manager)
case $PACKAGE_MANAGER in
apt)
echo "Detected Ubuntu/Debian-based system"
echo "Installing build essentials..."
sudo apt-get update
sudo apt-get install -y build-essential cmake ninja-build
echo "Installing GLFW..."
sudo apt-get install -y libglfw3-dev
echo "Installing GLM..."
sudo apt-get install -y libglm-dev
echo "Installing tinyobjloader..."
sudo apt-get install -y libtinyobjloader-dev || echo "tinyobjloader not found in apt, will need to be installed manually or via CMake FetchContent"
echo "Installing stb..."
sudo apt-get install -y libstb-dev || echo "stb not found in apt, will need to be installed manually or via CMake FetchContent"
echo "Installing tinygltf..."
sudo apt-get install -y libtinygltf-dev || echo "tinygltf not found in apt, will need to be installed manually or via CMake FetchContent"
echo "Installing nlohmann-json..."
sudo apt-get install -y nlohmann-json3-dev || echo "nlohmann-json not found in apt, will need to be installed manually or via CMake FetchContent"
echo "Installing X Window System dependencies..."
sudo apt-get install -y libxxf86vm-dev libxi-dev
echo "Installing clang compiler..."
sudo apt-get install -y clang
;;
dnf)
echo "Detected Fedora/RHEL-based system"
echo "Installing build essentials..."
sudo dnf install -y gcc-c++ cmake ninja-build
echo "Installing GLFW..."
sudo dnf install -y glfw-devel
echo "Installing GLM..."
sudo dnf install -y glm-devel
echo "Installing tinyobjloader..."
sudo dnf install -y tinyobjloader-devel || echo "tinyobjloader not found in dnf, will need to be installed manually or via CMake FetchContent"
echo "Installing tinygltf..."
sudo dnf install -y tinygltf-devel || echo "tinygltf not found in dnf, will need to be installed manually or via CMake FetchContent"
echo "Installing nlohmann-json..."
sudo dnf install -y nlohmann-json-devel || echo "nlohmann-json not found in dnf, will need to be installed manually or via CMake FetchContent"
echo "Installing X Window System dependencies..."
sudo dnf install -y libXxf86vm-devel libXi-devel
echo "Installing clang compiler..."
sudo dnf install -y clang
;;
pacman)
echo "Detected Arch-based system"
echo "Installing build essentials..."
sudo pacman -S --needed base-devel cmake ninja
echo "Installing GLFW..."
sudo pacman -S --needed glfw-x11 || sudo pacman -S --needed glfw-wayland
echo "Installing GLM..."
sudo pacman -S --needed glm
echo "Installing tinyobjloader..."
sudo pacman -S --needed tinyobjloader || echo "tinyobjloader not found in pacman, will need to be installed manually or via CMake FetchContent"
echo "Installing tinygltf..."
sudo pacman -S --needed tinygltf || echo "tinygltf not found in pacman, will need to be installed manually or via CMake FetchContent"
echo "Installing nlohmann-json..."
sudo pacman -S --needed nlohmann-json || echo "nlohmann-json not found in pacman, will need to be installed manually or via CMake FetchContent"
echo "Installing clang compiler..."
sudo pacman -S --needed clang
;;
*)
echo "Unsupported package manager. Please install the following packages manually:"
echo "- build-essential or equivalent (gcc, g++, make)"
echo "- cmake"
echo "- ninja-build"
echo "- libglfw3-dev or equivalent"
echo "- libglm-dev or equivalent"
echo "- libtinyobjloader-dev or equivalent"
echo "- libstb-dev or equivalent"
echo "- libtinygltf-dev or equivalent"
echo "- nlohmann-json3-dev or equivalent"
echo "- libxxf86vm-dev and libxi-dev or equivalent"
echo "- clang compiler"
exit 1
;;
esac
# Vulkan SDK installation instructions
echo ""
echo "Now you need to install the Vulkan SDK:"
echo "1. Download the tarball from https://vulkan.lunarg.com/"
echo "2. Extract it to a convenient location, for example:"
echo " mkdir -p ~/vulkansdk"
echo " tar -xzf vulkansdk-linux-x86_64-<version>.tar.gz -C ~/vulkansdk"
echo " cd ~/vulkansdk"
echo " ln -s <version> default"
echo ""
echo "3. Add the following to your ~/.bashrc or ~/.zshrc:"
echo " source ~/vulkansdk/default/setup-env.sh"
echo ""
echo "4. Restart your terminal or run: source ~/.bashrc"
echo ""
echo "5. Verify installation by running: vkcube"
echo ""
echo "All dependencies have been installed successfully!"
echo "You can now use CMake to build your Vulkan project:"
echo "cmake -B build -S . -G Ninja"
echo "cmake --build build"
exit 0