Skip to content

Commit 4699571

Browse files
committed
Modified install.sh to use CMake with local libraries instead of using the package manager
1 parent 9de51c6 commit 4699571

File tree

1 file changed

+16
-74
lines changed

1 file changed

+16
-74
lines changed

install.sh

+16-74
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,24 @@
11
#!/usr/bin/env bash
2-
compile() {
3-
# Detect is SFML libraries are installed, if not, install them
4-
ldconfig -p | grep -q libsfml
5-
if [ $? -ne 0 ]; then
6-
install_sfml
7-
fi
8-
9-
# Compile visualizer
10-
echo Compiling visualizer...
11-
g++ ./src/*.cpp -o sorting-visualizer -lsfml-graphics -lsfml-window -lsfml-system
12-
}
13-
14-
install_sfml() {
15-
# Detect packet manager
16-
17-
# Arch
18-
if command -v pacman &>/dev/null; then
19-
sudo pacman -S sfml
20-
21-
# Debian
22-
elif command -v apt-get &>/dev/null; then
23-
sudo apt-get install libsfml-dev
24-
25-
# Fedora
26-
elif command -v dnf &>/dev/null; then
27-
sudo dnf install SFML
28-
29-
# Void linux (not tested)
30-
elif command -v xbps &>/dev/null; then
31-
# add multilib repo
32-
sudo xbps-install -Su void-repo-multilib
33-
# install sfml
34-
sudo xbps-install -Su SFML-32bit
35-
36-
# Packet manager not found
37-
else
38-
# TODO: Implement issue #10 fix here
39-
echo "Could not install SFML using the system package manager."
40-
echo "Please install SFML yourself and run this script again."
41-
exit
42-
fi
43-
}
44-
452
main() {
46-
# Select option
47-
48-
echo "Where do you want to install the visualizer?"
49-
echo "1.- Compile and leave the executable in this directory"
50-
echo "2.- Compile and move the executable into /usr/bin (requires root)"
51-
echo ""
52-
read -n 1 -p "Option: " option
3+
echo "Building Makefile..."
4+
cmake CMakeLists.txt
5+
6+
echo ""
7+
echo "Compiling project..."
8+
make
9+
10+
echo ""
11+
echo "Would you like to move the visualizer to /usr/bin? (Requires root)"
12+
read -n 1 -p "yes / no: " option
5313
echo ""
5414
echo ""
5515

56-
# 1: Compile
57-
if [ "$option" = "1" ]; then
58-
compile
59-
60-
echo "Done!"
61-
exit
62-
63-
# 2: Compile and move binary to /usr/bin
64-
elif [ "$option" = "2" ]; then
65-
66-
compile
67-
68-
# Move executable to /usr/bin
69-
echo Moving executable into /usr/bin...
70-
sudo mv ./sorting-visualizer /usr/bin
71-
echo Done!
72-
exit
73-
74-
# -: Not a valid option
75-
else
76-
echo "Select a valid option!"
77-
exit
78-
16+
if [ "$option" = "y" ]; then
17+
sudo mv ./sorting-visualizer /usr/bin
7918
fi
19+
20+
echo "Done!"
21+
exit
8022
}
8123

82-
main
24+
main

0 commit comments

Comments
 (0)