From cad34541b0a8252b71e328ef2f945d565e5733a2 Mon Sep 17 00:00:00 2001 From: "michelwijnja@gmail.com" Date: Thu, 9 Nov 2023 13:27:11 +0100 Subject: [PATCH] changed the build system to first make the lcnc original version, after that the cmake build system overwrites it. This because of several .comp files that halcompiles refuses to compile for now on some pc's. --- cmake/build_all | 96 +++++++++++++++++------------- cmake/check_build_deps | 13 ++++ cmake/classicladder/CMakeLists.txt | 2 +- cmake/deplist.txt | 18 ++++++ cmake/start_halshow | 12 ++++ cmake/start_lcnc | 7 +++ 6 files changed, 105 insertions(+), 43 deletions(-) create mode 100755 cmake/check_build_deps create mode 100644 cmake/deplist.txt create mode 100755 cmake/start_halshow create mode 100755 cmake/start_lcnc diff --git a/cmake/build_all b/cmake/build_all index 818f87209dd..34d9b9db7ea 100755 --- a/cmake/build_all +++ b/cmake/build_all @@ -7,51 +7,63 @@ echo "check dependencies. \n" sudo apt-get install libeigen3-dev echo "removing rtapi_app & linuxcnc_module_helper to overwrite. \n" -rm -f ../bin/rtapi_app -rm -f ../bin/linuxcnc_module_helper +cd ../bin +rm -f rtapi_app +rm -f linuxcnc_module_helper +cd .. -#echo "copy python scripts to ~/bin folder. \n" -#cd .. -#cd scripts -#cp -rf * ../bin -#cd .. + #echo "copy python scripts to ~/bin folder. \n" + #cd .. + #cd scripts + #cp -rf * ../bin + #cd .. echo "run check and set scripts. \n" -cd .. cd src ./autogen.sh ./configure --enable-non-distributable=yes --with-realtime=uspace + # Use lcnc's original make process for now. The problem is there are .comp files + # that on some pc's will not be installed --install using halcompile. Halcompile fails to find a file. + # To resolve installion problems for now we use the original compilation first, then later on + # we overwrite it with the cmake build system. + # Another problem is that halcompile --preprocess .comp to .c files don't always work correctly. +make -j2 cd .. -echo "Copying header files into the include directory to use with halcompile \n" -cd src/rtapi -cp *.h ../../include -cd .. -cd hal -cp *.h ../../include -cd .. -cd .. + # echo "Copying header files into the include directory to use with halcompile \n" + # cd src/rtapi + # cp *.h ../../include + # cd .. + # cd hal + # cp *.h ../../include + # cd .. + # cd .. + + # echo "Building & installing components needed by the axis gui. \nBuilding with halcompile. \n" + # cd scripts + # ./rip-environment halcompile --install ../src/hal/components/ddt.comp + # ./rip-environment halcompile --install ../src/hal/components/hypot.comp + # ./rip-environment halcompile --install ../src/hal/components/sim_spindle.comp + # ./rip-environment halcompile --install ../src/hal/components/limit2.comp + # ./rip-environment halcompile --install ../src/hal/components/lowpass.comp + # ./rip-environment halcompile --install ../src/hal/components/near.comp + # ./rip-environment halcompile --install ../src/hal/components/scale.comp + # ./rip-environment halcompile --install ../src/hal/components/or2.comp + # ./rip-environment halcompile --install ../src/hal/components/comp.comp + # ./rip-environment halcompile --install ../src/hal/components/and2.comp + # ./rip-environment halcompile --install ../src/hal/components/wcomp.comp + # ./rip-environment halcompile --install ../src/hal/components/match8.comp + # ./rip-environment halcompile --install ../src/hal/components/mux2.comp + # ./rip-environment halcompile --install ../src/hal/components/mux4.comp + # ./rip-environment halcompile --install ../src/hal/components/mux8.comp + # ./rip-environment halcompile --install ../src/hal/components/mux16.comp + # ./rip-environment halcompile --install ../src/hal/components/sim_home_switch.comp + # cd .. -echo "Building & installing components needed by the axis gui. \nBuilding with halcompile. \n" -cd scripts -./rip-environment halcompile --install ../src/hal/components/ddt.comp -./rip-environment halcompile --install ../src/hal/components/hypot.comp -./rip-environment halcompile --install ../src/hal/components/sim_spindle.comp -./rip-environment halcompile --install ../src/hal/components/limit2.comp -./rip-environment halcompile --install ../src/hal/components/lowpass.comp -./rip-environment halcompile --install ../src/hal/components/near.comp -./rip-environment halcompile --install ../src/hal/components/scale.comp -./rip-environment halcompile --install ../src/hal/components/or2.comp -./rip-environment halcompile --install ../src/hal/components/comp.comp -./rip-environment halcompile --install ../src/hal/components/and2.comp -./rip-environment halcompile --install ../src/hal/components/wcomp.comp -./rip-environment halcompile --install ../src/hal/components/match8.comp -./rip-environment halcompile --install ../src/hal/components/mux2.comp -./rip-environment halcompile --install ../src/hal/components/mux4.comp -./rip-environment halcompile --install ../src/hal/components/mux8.comp -./rip-environment halcompile --install ../src/hal/components/mux16.comp -./rip-environment halcompile --install ../src/hal/components/sim_home_switch.comp -cd .. + +echo "removing rtapi_app & linuxcnc_module_helper to overwrite it with cmake. \n" +rm -f rtapi_app +rm -f linuxcnc_module_helper echo "Building linuxcnc with cmake. \n" cd cmake @@ -66,9 +78,9 @@ cd .. echo "current folder:" echo $PWD echo "\n" - -# Recreate the Sudo Make Setuid command (needed for running real machines) -# This version is from : https://github.com/grotius-cnc/hal-core/blob/main/make + + # Recreate the Sudo Make Setuid command (needed for running real machines) + # This version is from : https://github.com/grotius-cnc/hal-core/blob/main/make echo "Running equivalent of Sudo Make Setuid. \n" sudo chown 777 -R bin/rtapi_app sudo chown 777 -R bin/linuxcnc_module_helper @@ -79,6 +91,6 @@ echo "Start linuxcnc. \n" cd scripts ./rip-environment linuxcnc ../configs/sim/axis/axis_mm.ini -# Example to start with custom trajectory planner or use in ini file : [TRAJ]TPMOD=user_tpcomp -# ./rip-environment linuxcnc -t tpmod_scurve ../configs/sim/axis/axis_mm.ini - + # Example to start with custom trajectory planner or use in ini file : [TRAJ]TPMOD=user_tpcomp + # ./rip-environment linuxcnc -t tpmod_scurve ../configs/sim/axis/axis_mm.ini + diff --git a/cmake/check_build_deps b/cmake/check_build_deps new file mode 100755 index 00000000000..9817c776ac6 --- /dev/null +++ b/cmake/check_build_deps @@ -0,0 +1,13 @@ +#!/bin/sh + +sudo apt-get install dpkg-dev + +echo "Check what dependencies has to be installed. \n" +cd .. +cd debian +./configure uspace +cd .. +dpkg-checkbuilddeps + +echo "Now run : $ sudo apt-get install ... to install your deps. \n" + diff --git a/cmake/classicladder/CMakeLists.txt b/cmake/classicladder/CMakeLists.txt index 0544120ca65..0842ceea43e 100644 --- a/cmake/classicladder/CMakeLists.txt +++ b/cmake/classicladder/CMakeLists.txt @@ -78,7 +78,7 @@ add_executable(${PROJECT_NAME} ${SOURCES}) add_definitions(-DULAPI -DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER -DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER # -DGNOME_PRINT_USE - -DGTK_INTERFACE -DGTK2 -Wno-deprecated-declarations) + -DGTK_INTERFACE -DGTK2 -DGTK3 -Wno-deprecated-declarations) # Set include paths for libraries to link. add_library(linuxcnchal SHARED IMPORTED) # or STATIC instead of SHARED diff --git a/cmake/deplist.txt b/cmake/deplist.txt new file mode 100644 index 00000000000..c19c244390a --- /dev/null +++ b/cmake/deplist.txt @@ -0,0 +1,18 @@ +virtual machine installed with debian 12. + +# Outcomment search from cd, to install new stuff. +sudo nano /etc/apt/sources.list + +# For ./autogen to work, we need automake. +sudo apt-get install git cmake automake + +sudo apt-get install libudev-dev libmodbus-dev libusb-1.0-0-dev libgpiod-dev libgtk-3-dev libgtk2.0-dev + +sudo apt-get install libglib2.0-dev yapps2 intltool libboost-dev python3-dev bwidget +sudo apt-get install libboost-python-dev tklib tcl8.6-dev tk-dev bwidget tclx libreadline-dev libeditreadline-dev +sudo apt-get install python3-tk tclx + +git clone https://github.com/grotius-cnc/linuxcnc.git +cd linuxcnc/cmake +./build_all + diff --git a/cmake/start_halshow b/cmake/start_halshow new file mode 100755 index 00000000000..2d30f559a0f --- /dev/null +++ b/cmake/start_halshow @@ -0,0 +1,12 @@ +#!/bin/sh + +echo "Start halshow. \n" +cd .. +cd scripts +./rip-environment halshow + +echo "start linuxcnc server program." +linuxcncsrv +# Start emc server program. /bin/linuxcncsrv + + diff --git a/cmake/start_lcnc b/cmake/start_lcnc new file mode 100755 index 00000000000..4c827dd84fb --- /dev/null +++ b/cmake/start_lcnc @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "Start linuxcnc. \n" +cd .. +cd scripts +./rip-environment linuxcnc ../configs/sim/axis/axis_mm.ini +