diff --git a/webserver/scripts/compile_program.sh b/webserver/scripts/compile_program.sh index d104780..b7f2d4a 100755 --- a/webserver/scripts/compile_program.sh +++ b/webserver/scripts/compile_program.sh @@ -150,6 +150,35 @@ elif [ "$OPENPLC_PLATFORM" = "rpi" ]; then fi echo "Compilation finished successfully!" exit 0 + +elif [ "$OPENPLC_PLATFORM" = "opi" ]; then + WIRINGOP_INC="-I/usr/local/include -L/usr/local/lib -lwiringPi -lwiringPiDev" + echo "Compiling for Orange Pi" + echo "Generating object files..." + g++ -std=gnu++11 -I ./lib -c Config0.c -lasiodnp3 -lasiopal -lopendnp3 -lopenpal -w $WIRINGOP_INC + if [ $? -ne 0 ]; then + echo "Error compiling C files" + echo "Compilation finished with errors!" + exit 1 + fi + g++ -std=gnu++11 -I ./lib -c Res0.c -lasiodnp3 -lasiopal -lopendnp3 -lopenpal -w $WIRINGOP_INC + if [ $? -ne 0 ]; then + echo "Error compiling C files" + echo "Compilation finished with errors!" + exit 1 + fi + echo "Generating glueVars..." + ./glue_generator + echo "Compiling main program..." + g++ -std=gnu++11 *.cpp *.o -o openplc -I ./lib -lrt -lpthread -fpermissive `pkg-config --cflags --libs libmodbus` -lasiodnp3 -lasiopal -lopendnp3 -lopenpal -w $WIRINGOP_INC + if [ $? -ne 0 ]; then + echo "Error compiling C files" + echo "Compilation finished with errors!" + exit 1 + fi + echo "Compilation finished successfully!" + exit 0 + else echo "Error: Undefined platform! OpenPLC can only compile for Windows, Linux and Raspberry Pi environments" echo "Compilation finished with errors!"