forked from thiagoralves/OpenPLC_v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_win.sh
executable file
·135 lines (128 loc) · 4.15 KB
/
build_win.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
echo Building OpenPLC environment:
echo [MATIEC COMPILER]
cp ./matiec_src/bin_win32/iec2c.exe ./
cp ./matiec_src/bin_win32/*.dll ./
echo [LADDER]
./iec2c.exe ./st_files/blank_program.st
mv -f POUS.c POUS.h LOCATED_VARIABLES.h VARIABLES.csv Config0.c Config0.h Res0.c ./core/
echo [ST OPTIMIZER]
cd st_optimizer_src
g++ st_optimizer.cpp -o st_optimizer
cd ..
cp ./st_optimizer_src/st_optimizer.exe ./
echo [GLUE GENERATOR]
cd glue_generator_src
g++ glue_generator.cpp -o glue_generator
cd ..
cp ./glue_generator_src/glue_generator.exe ./core/glue_generator.exe
clear
echo Disabling DNP3 support \(opendnp3 is not compatible with Cygwin\)...
mv ./core/dnp3.cpp ./core/dnp3.disabled 2> /dev/null
mv ./core/dnp3_dummy.disabled ./core/dnp3_dummy.cpp 2> /dev/null
cp -f ./core/core_builders/dnp3_disabled/*.* ./core/core_builders/
cd core
rm -f ./hardware_layer.cpp
rm -f ../build_core.sh
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 Modbus Fischertechnik RaspberryPi UniPi PiXtend PiXtend_2S Arduino ESP8266 Arduino+RaspberryPi Simulink "
select opt in $OPTIONS; do
if [ "$opt" = "Blank" ]; then
cp ./hardware_layers/blank.cpp ./hardware_layer.cpp
cp ./core_builders/build_normal.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "Modbus" ]; then
cp ./hardware_layers/modbus_master.cpp ./hardware_layer.cpp
cp ./core_builders/build_modbus_win.sh ../build_core.sh
echo [LIBMODBUS]
cd ..
cd libmodbus_src
./autogen.sh
./configure
make install
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "Fischertechnik" ]; then
cp ./hardware_layers/fischertechnik.cpp ./hardware_layer.cpp
cp ./core_builders/build_rpi.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "RaspberryPi" ]; then
cp ./hardware_layers/raspberrypi.cpp ./hardware_layer.cpp
cp ./core_builders/build_rpi.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "UniPi" ]; then
cp ./hardware_layers/unipi.cpp ./hardware_layer.cpp
cp ./core_builders/build_rpi.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "PiXtend" ]; then
cp ./hardware_layers/pixtend.cpp ./hardware_layer.cpp
cp ./core_builders/build_rpi.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "PiXtend_2S" ]; then
cp ./hardware_layers/pixtend2s.cpp ./hardware_layer.cpp
cp ./core_builders/build_rpi.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
exit
elif [ "$opt" = "Arduino" ]; then
cp ./hardware_layers/arduino.cpp ./hardware_layer.cpp
cp ./core_builders/build_normal.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "ESP8266" ]; then
cp ./hardware_layers/esp8266.cpp ./hardware_layer.cpp
cp ./core_builders/build_normal.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "Arduino+RaspberryPi" ]; then
cp ./hardware_layers/arduino.cpp ./hardware_layer.cpp
cp ./core_builders/build_rpi.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
elif [ "$opt" = "Simulink" ]; then
cp ./hardware_layers/simulink.cpp ./hardware_layer.cpp
cp ./core_builders/build_normal.sh ../build_core.sh
echo [OPENPLC]
cd ..
./build_core.sh
echo 'export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"' >> ~/.bashrc
exit
else
#clear
echo bad option
fi
done