mirror of
https://github.com/thiagoralves/OpenPLC_v3.git
synced 2026-09-25 17:14:35 +08:00
ethercat install options added
This commit is contained in:
@@ -8,6 +8,7 @@ fi
|
||||
cd scripts &>/dev/null
|
||||
|
||||
OPENPLC_PLATFORM=$(cat openplc_platform)
|
||||
ETHERCAT_OPT=$(cat ethercat)
|
||||
|
||||
#store the active program filename
|
||||
echo "$1" > ../active_program
|
||||
@@ -23,8 +24,12 @@ if [ $? -ne 0 ]; then
|
||||
echo "Compilation finished with errors!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# stick reference to ethercat_src in there for CoE access etc functionality that needs to be accessed from PLC
|
||||
sed -i '7s/^/#include "ethercat_src.h" /' Res0.c
|
||||
if [ "$ETHERCAT_OPT" = "ethercat" ]; then
|
||||
sed -i '7s/^/#include "ethercat_src.h" /' Res0.c
|
||||
fi
|
||||
|
||||
echo "Moving Files..."
|
||||
mv -f POUS.c POUS.h LOCATED_VARIABLES.h VARIABLES.csv Config0.c Config0.h Res0.c ./core/
|
||||
if [ $? -ne 0 ]; then
|
||||
@@ -33,6 +38,13 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$ETHERCAT_OPT" = "ethercat" ]; then
|
||||
echo "Including EtherCAT"
|
||||
ETHERCAT_INC="-L../../utils/ethercat_src/build/lib -lethercat_src -I../../utils/ethercat_src/src -D _ethercat_src"
|
||||
else
|
||||
ETHERCAT_INC=""
|
||||
fi
|
||||
|
||||
#compiling for each platform
|
||||
cd core
|
||||
if [ "$OPENPLC_PLATFORM" = "win" ]; then
|
||||
@@ -71,7 +83,7 @@ elif [ "$OPENPLC_PLATFORM" = "linux" ]; then
|
||||
echo "Compilation finished with errors!"
|
||||
exit 1
|
||||
fi
|
||||
g++ -std=gnu++11 -I ./lib -c Res0.c -lasiodnp3 -lasiopal -lopendnp3 -lopenpal -w -L../../utils/ethercat_src/build/lib -lethercat_src -I../../utils/ethercat_src/src
|
||||
g++ -std=gnu++11 -I ./lib -c Res0.c -lasiodnp3 -lasiopal -lopendnp3 -lopenpal -w $ETHERCAT_INC
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error compiling C files"
|
||||
echo "Compilation finished with errors!"
|
||||
@@ -80,7 +92,7 @@ elif [ "$OPENPLC_PLATFORM" = "linux" ]; then
|
||||
echo "Generating glueVars..."
|
||||
./glue_generator
|
||||
echo "Compiling main program..."
|
||||
g++ -std=gnu++11 *.cpp *.o -o openplc -I ./lib -pthread -fpermissive `pkg-config --cflags --libs libmodbus` -lasiodnp3 -lasiopal -lopendnp3 -lopenpal -w -L../../utils/ethercat_src/build/lib -lethercat_src -I../../utils/ethercat_src/src
|
||||
g++ -std=gnu++11 *.cpp *.o -o openplc -I ./lib -pthread -fpermissive `pkg-config --cflags --libs libmodbus` -lasiodnp3 -lasiopal -lopendnp3 -lopenpal -w $ETHERCAT_INC
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error compiling C files"
|
||||
echo "Compilation finished with errors!"
|
||||
|
||||
Reference in New Issue
Block a user