aboutsummaryrefslogtreecommitdiff
path: root/install_ubuntu.sh
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-22 13:08:02 +0100
committerdec05eba <dec05eba@protonmail.com>2022-03-22 13:08:02 +0100
commitb8f643a7e196962bf3f76b431ff2cfe4a683a55b (patch)
treed1ccc5a8b98a1a913e05d5f21e4e75921a3811a1 /install_ubuntu.sh
parentd4bc7b420ec258040f8f36234d7f2b08f2dd1c38 (diff)
Add install script for ubuntu based distros
Diffstat (limited to 'install_ubuntu.sh')
-rwxr-xr-xinstall_ubuntu.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/install_ubuntu.sh b/install_ubuntu.sh
new file mode 100755
index 0000000..e443c4c
--- /dev/null
+++ b/install_ubuntu.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+script_dir=$(dirname "$0")
+cd "$script_dir"
+
+[ $(id -u) -ne 0 ] && echo "You need root privileges to run the install script" && exit 1
+
+dpkg -l nvidia-cuda-dev > /dev/null 2>&1
+cuda_missing="$?"
+
+set -e
+apt-get -y install build-essential nvidia-cuda-dev\
+ libswresample-dev libavformat-dev libavcodec-dev libavutil-dev\
+ libx11-dev libxcomposite-dev\
+ libglew-dev libglfw3-dev\
+ libpulse-dev
+
+dependencies="glew libavcodec libavformat libavutil x11 xcomposite glfw3 libpulse-simple libswresample"
+includes="$(pkg-config --cflags $dependencies) -I/opt/cuda/targets/x86_64-linux/include"
+libs="$(pkg-config --libs $dependencies) /usr/lib/x86_64-linux-gnu/stubs/libcuda.so -ldl -pthread -lm"
+g++ -c src/sound.cpp -O2 $includes -DPULSEAUDIO=1
+g++ -c src/main.cpp -O2 $includes -DPULSEAUDIO=1
+g++ -o gpu-screen-recorder -O2 sound.o main.o -s $libs
+install -Dm755 "gpu-screen-recorder" "/usr/local/bin/gpu-screen-recorder"
+
+echo "Successfully installed gpu-screen-recorder"
+[ "$cuda_missing" -eq 1 ] && echo "You need to reboot your computer before using gpu-screen-recorder because cuda was installed"