forked from thiagoralves/OpenPLC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·54 lines (52 loc) · 1.48 KB
/
build.sh
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
#!/bin/bash
echo Building OpenPLC environment:
echo [OPLC_COMPILER]
cd OPLC_Compiler_source
g++ *.cpp -o OPLC_Compiler &> /dev/null
echo [LADDER]
cd ..
cp ./OPLC_Compiler_source/OPLC_Compiler ./
./OPLC_Compiler ./ladder_files/blank_ladder.ld &> /dev/null
rm -f ./core/ladder.cpp
mv ./ladder.cpp ./core/
echo [OPLC_STARTER]
cd OPLC_starter_source
g++ *.cpp -o OPLC_starter
cd ..
cp ./OPLC_starter_source/OPLC_starter ./
cd core
rm -f ./hardware_layer.cpp
echo The OpenPLC needs a driver to be able to control physical or virtual hardware.
echo Please select the driver you would like to use:
OPTIONS="Blank Fischertechnik RaspberryPi Simulink Unipi"
select opt in $OPTIONS; do
if [ "$opt" = "Blank" ]; then
cp ./hardware_layers/blank.cpp ./hardware_layer.cpp
echo [OPENPLC]
g++ -pthread *.cpp -o openplc
exit
elif [ "$opt" = "Fischertechnik" ]; then
cp ./hardware_layers/fischertechnik.cpp ./hardware_layer.cpp
echo [OPENPLC]
g++ -lrt -lwiringPi -lpthread *.cpp -o openplc
exit
elif [ "$opt" = "RaspberryPi" ]; then
cp ./hardware_layers/raspberrypi.cpp ./hardware_layer.cpp
echo [OPENPLC]
g++ -lrt -lwiringPi -lpthread *.cpp -o openplc
exit
elif [ "$opt" = "Simulink" ]; then
cp ./hardware_layers/simulink.cpp ./hardware_layer.cpp
echo [OPENPLC]
g++ -pthread *.cpp -o openplc
exit
elif [ "$opt" = "Unipi" ]; then
cp ./hardware_layers/unipi.cpp ./hardware_layer.cpp
echo [OPENPLC]
g++ -lrt -lwiringPi -lpthread *.cpp -o openplc
exit
else
#clear
echo bad option
fi
done