File tree 1 file changed +37
-2
lines changed
1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
compile () {
3
- # Compile and clean using Makefile
3
+ # determine if sfml is already installed,
4
+ # if its not then install it
5
+ ldconfig -p | grep -q libsfml
6
+ if [ $? -ne 0 ]; then
7
+ install_sfml
8
+ fi
9
+
10
+ # Compile; Makefile is not used for now because
11
+ # it is not working as intended
4
12
echo Compiling visualizer...
5
- make
13
+ g++ * .cpp -o sorting-visualizer -lsfml-graphics -lsfml-window -lsfml-system
14
+ }
15
+
16
+ install_sfml () {
17
+ # detect the package manager and install sfml
18
+ # accordingly
19
+
20
+ # we need to be root to install packages
21
+ if [ " $EUID " -ne 0 ]; then
22
+ echo " The SFML library needs to be installed to compile the program."
23
+ echo " This script can attempt to install SFML using the system package manager if run as root."
24
+ echo " Please run it again as root (sudo ./install.sh) or install SFML yourself."
25
+ exit
26
+ fi
27
+
28
+ if command -v pacman & > /dev/null; then
29
+ pacman -S sfml
30
+ elif command -v apt-get & > /dev/null; then
31
+ apt-get install libsfml-dev
32
+ elif command -v dnf & > /dev/null; then
33
+ dnf install SFML
34
+ else
35
+ # package manager was not found
36
+ # maybe compile sfml ourselves?
37
+ echo " Could not install SFML using the system package manager."
38
+ echo " Please install SFML yourself and run this script again."
39
+ exit
40
+ fi
6
41
}
7
42
8
43
main () {
You can’t perform that action at this time.
0 commit comments