Skip to content

Commit c1bea71

Browse files
committed
Add dependency installation scripts for Windows and Linux
Introduce `install_dependencies_windows.bat` and `install_dependencies_linux.sh` to simplify setup for Vulkan projects. Updated documentation with instructions for using the scripts and clarified Vulkan SDK installation steps.
1 parent aef0b4a commit c1bea71

File tree

3 files changed

+178
-1
lines changed

3 files changed

+178
-1
lines changed

en/02_Development_environment.adoc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,31 @@ except for the compiler, are compatible with Windows, Linux and macOS, but the
88
steps for installing them differ a bit, which is why they're described
99
separately here.
1010

11-
First, some common considerations for all platforms:
11+
== Dependency Install Scripts
12+
13+
To make the setup process easier, we've provided dependency install scripts for Windows and Linux:
14+
15+
=== Windows
16+
17+
For Windows, we provide a script that uses vcpkg to install all the required dependencies:
18+
19+
1. Make sure you have vcpkg installed. If not, follow the instructions at https://github.com/microsoft/vcpkg
20+
2. Run the `scripts/install_dependencies_windows.bat` script
21+
3. Follow the instructions to install the Vulkan SDK
22+
23+
While we are using vcpkg to enable this install script; the entire
24+
process is outlined below in detail and can be achieved without using the
25+
install script or needing vcpkg. That's just a convenience to make the setup
26+
process easier.
27+
28+
=== Linux
29+
30+
For Linux, we provide a script that detects your package manager and installs all the required dependencies:
31+
32+
1. Run the `scripts/install_dependencies_linux.sh` script
33+
2. Follow the instructions to install the Vulkan SDK
34+
35+
If you prefer to install the dependencies manually, or if you're using macOS, follow the platform-specific instructions below.
1236

1337
== Common considerations
1438

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/bash
2+
3+
echo "Installing dependencies for Vulkan Tutorial..."
4+
5+
# Function to detect the package manager
6+
detect_package_manager() {
7+
if command -v apt-get &> /dev/null; then
8+
echo "apt"
9+
elif command -v dnf &> /dev/null; then
10+
echo "dnf"
11+
elif command -v pacman &> /dev/null; then
12+
echo "pacman"
13+
else
14+
echo "unknown"
15+
fi
16+
}
17+
18+
# Install dependencies based on the package manager
19+
PACKAGE_MANAGER=$(detect_package_manager)
20+
21+
case $PACKAGE_MANAGER in
22+
apt)
23+
echo "Detected Ubuntu/Debian-based system"
24+
echo "Installing build essentials..."
25+
sudo apt-get update
26+
sudo apt-get install -y build-essential cmake ninja-build
27+
28+
echo "Installing GLFW..."
29+
sudo apt-get install -y libglfw3-dev
30+
31+
echo "Installing GLM..."
32+
sudo apt-get install -y libglm-dev
33+
34+
echo "Installing tinyobjloader..."
35+
sudo apt-get install -y libtinyobjloader-dev || echo "tinyobjloader not found in apt, will need to be installed manually or via CMake FetchContent"
36+
37+
echo "Installing stb..."
38+
sudo apt-get install -y libstb-dev || echo "stb not found in apt, will need to be installed manually or via CMake FetchContent"
39+
40+
echo "Installing X Window System dependencies..."
41+
sudo apt-get install -y libxxf86vm-dev libxi-dev
42+
;;
43+
dnf)
44+
echo "Detected Fedora/RHEL-based system"
45+
echo "Installing build essentials..."
46+
sudo dnf install -y gcc-c++ cmake ninja-build
47+
48+
echo "Installing GLFW..."
49+
sudo dnf install -y glfw-devel
50+
51+
echo "Installing GLM..."
52+
sudo dnf install -y glm-devel
53+
54+
echo "Installing tinyobjloader..."
55+
sudo dnf install -y tinyobjloader-devel || echo "tinyobjloader not found in dnf, will need to be installed manually or via CMake FetchContent"
56+
57+
echo "Installing X Window System dependencies..."
58+
sudo dnf install -y libXxf86vm-devel libXi-devel
59+
;;
60+
pacman)
61+
echo "Detected Arch-based system"
62+
echo "Installing build essentials..."
63+
sudo pacman -S --needed base-devel cmake ninja
64+
65+
echo "Installing GLFW..."
66+
sudo pacman -S --needed glfw-x11 || sudo pacman -S --needed glfw-wayland
67+
68+
echo "Installing GLM..."
69+
sudo pacman -S --needed glm
70+
71+
echo "Installing tinyobjloader..."
72+
sudo pacman -S --needed tinyobjloader || echo "tinyobjloader not found in pacman, will need to be installed manually or via CMake FetchContent"
73+
;;
74+
*)
75+
echo "Unsupported package manager. Please install the following packages manually:"
76+
echo "- build-essential or equivalent (gcc, g++, make)"
77+
echo "- cmake"
78+
echo "- ninja-build"
79+
echo "- libglfw3-dev or equivalent"
80+
echo "- libglm-dev or equivalent"
81+
echo "- libtinyobjloader-dev or equivalent"
82+
echo "- libstb-dev or equivalent"
83+
echo "- libxxf86vm-dev and libxi-dev or equivalent"
84+
exit 1
85+
;;
86+
esac
87+
88+
# Vulkan SDK installation instructions
89+
echo ""
90+
echo "Now you need to install the Vulkan SDK:"
91+
echo "1. Download the tarball from https://vulkan.lunarg.com/"
92+
echo "2. Extract it to a convenient location, for example:"
93+
echo " mkdir -p ~/vulkansdk"
94+
echo " tar -xzf vulkansdk-linux-x86_64-<version>.tar.gz -C ~/vulkansdk"
95+
echo " cd ~/vulkansdk"
96+
echo " ln -s <version> default"
97+
echo ""
98+
echo "3. Add the following to your ~/.bashrc or ~/.zshrc:"
99+
echo " source ~/vulkansdk/default/setup-env.sh"
100+
echo ""
101+
echo "4. Restart your terminal or run: source ~/.bashrc"
102+
echo ""
103+
echo "5. Verify installation by running: vkcube"
104+
echo ""
105+
106+
echo "All dependencies have been installed successfully!"
107+
echo "You can now use CMake to build your Vulkan project:"
108+
echo "cmake -B build -S . -G Ninja"
109+
echo "cmake --build build"
110+
111+
exit 0
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@echo off
2+
echo Installing dependencies for Vulkan Tutorial...
3+
4+
:: Check if vcpkg is installed
5+
where vcpkg >nul 2>nul
6+
if %ERRORLEVEL% neq 0 (
7+
echo vcpkg not found. Please install vcpkg first.
8+
echo Visit https://github.com/microsoft/vcpkg for installation instructions.
9+
echo Typically, you would:
10+
echo 1. git clone https://github.com/Microsoft/vcpkg.git
11+
echo 2. cd vcpkg
12+
echo 3. .\bootstrap-vcpkg.bat
13+
echo 4. Add vcpkg to your PATH
14+
exit /b 1
15+
)
16+
17+
:: Install dependencies using vcpkg
18+
echo Installing GLFW...
19+
vcpkg install glfw3:x64-windows
20+
21+
echo Installing GLM...
22+
vcpkg install glm:x64-windows
23+
24+
echo Installing tinyobjloader...
25+
vcpkg install tinyobjloader:x64-windows
26+
27+
echo Installing stb...
28+
vcpkg install stb:x64-windows
29+
30+
:: Remind about Vulkan SDK
31+
echo.
32+
echo Don't forget to install the Vulkan SDK from https://vulkan.lunarg.com/
33+
echo.
34+
35+
echo All dependencies have been installed successfully!
36+
echo You can now use CMake to build your Vulkan project.
37+
echo.
38+
echo Example CMake command:
39+
echo cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=[path\to\vcpkg]\scripts\buildsystems\vcpkg.cmake
40+
echo cmake --build build
41+
42+
exit /b 0

0 commit comments

Comments
 (0)