From 13a18d92fb5aed955139d18752466dc9bae13be8 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Fri, 29 Apr 2022 20:18:55 +0900 Subject: [PATCH 01/18] irteus/Makefile: clean up irtc.c dependency, which is introduced in https://github.com/euslisp/jskeus/commit/b66b6fa5635a7e920d10f5e4e87f4ce24e88a378 --- irteus/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/irteus/Makefile b/irteus/Makefile index d86193f7..59b71f11 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -167,7 +167,7 @@ $(LIBIRTEUS): $(IRTEUSOBJS) $(IRTCOBJECTS) $(LIBNR) $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUS) $(IRTEUSOBJS) \ $(IRTCOBJECTS) $(IMPLIB) -$(LIBIRTEUSG): $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(LIBNR) +$(LIBIRTEUSG): $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(LIBNR) $(PQPLIBSTATIC) $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSG) $(IRTEUSGOBJS) \ $(IRTGCOBJECTS) $(IMPLIB) $(PQPLIB) $(BULLETLIB) @@ -269,11 +269,11 @@ $(INSTALLOBJDIR)/pgsql.$(OSFX): $(EUSDIR)/lib/llib/pgsql.l $(INSTALLOBJDIR)/time.$(OSFX): $(EUSDIR)/lib/llib/time.l $(INSTALLOBJDIR)/eusjpeg.$(OSFX): $(EUSDIR)/lisp/image/jpeg/eusjpeg.l -$(INSTALLOBJDIR)/irtc.$(OSFX): irtc.c $(filter-out $(INSTALLOBJDIR)/irtc.$(OSFX),$(IRTEUSOBJS) $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(PQPLIBSTATIC) $(IRTEUSXOBJS) $(INSTALLLIBDIR)/jpegmemcd.$(LSFX) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(IRTEUSGLOBJS) $(IRTGLCOBJECTS)) defun.h +$(INSTALLOBJDIR)/irtc.$(OSFX): irtc.c defun.h $(CC) $(CFLAGS) $(WFLAGS) -c irtc.c $(OBJOPT)$(INSTALLOBJDIR)/irtc.$(OSFX) -$(INSTALLOBJDIR)/irtglc.$(OSFX): irtglc.c $(filter-out $(INSTALLOBJDIR)/irtglc.$(OSFX),$(IRTEUSOBJS) $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(PQPLIBSTATIC) $(IRTEUSXOBJS) $(INSTALLLIBDIR)/jpegmemcd.$(LSFX) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(IRTEUSGLOBJS) $(IRTGLCOBJECTS)) defun.h +$(INSTALLOBJDIR)/irtglc.$(OSFX): irtglc.c defun.h $(CC) $(CFLAGS) $(WFLAGS) -c irtglc.c $(OBJOPT)$(INSTALLOBJDIR)/irtglc.$(OSFX) -$(INSTALLOBJDIR)/irtgeoc.$(OSFX): irtgeoc.c $(filter-out $(INSTALLOBJDIR)/irtgeoc.$(OSFX), $(IRTEUSOBJS) $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(PQPLIBSTATIC) $(IRTEUSXOBJS) $(INSTALLLIBDIR)/jpegmemcd.$(LSFX) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(IRTEUSGLOBJS) $(IRTGLCOBJECTS)) defun.h +$(INSTALLOBJDIR)/irtgeoc.$(OSFX): irtgeoc.c defun.h $(CC) $(CFLAGS) $(WFLAGS) -c irtgeoc.c $(OBJOPT)$(INSTALLOBJDIR)/irtgeoc.$(OSFX) $(INSTALLOBJDIR)/CPQP.$(OSFX): CPQP.C defun.h $(CXX) $(CXXFLAGS) $(PQPCFLAGS) -c CPQP.C $(OBJOPT)$(INSTALLOBJDIR)/CPQP.$(OSFX) From 913b9a9096e8fedffe5533790d9fa4ae19f79c16 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 12:54:59 +0900 Subject: [PATCH 02/18] irteus/Makefile: clean up Makefile code, fix dependencies --- irteus/Makefile | 63 ++++++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 40 deletions(-) diff --git a/irteus/Makefile b/irteus/Makefile index 59b71f11..44ca8cbe 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -155,8 +155,8 @@ NROBJECTS=$(INSTALLOBJDIR)/nr.$(OSFX) all: defun.h $(LIBNR) $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) $(LIBIRTEUSGL) make-link install-irtext.l -.PHONY: defun.h -defun.h: + +defun.h: $(EUSDIR)/include/eus.h echo '#include "eus.h"\n#undef defun\npointer TEST();\nvoid test(void) {register context *ctx; pointer mod; defun(ctx,"TEST",mod,TEST,NULL);}' > test.c echo "// redefine defun for update defun() API () https://github.com/euslisp/EusLisp/pull/116" > defun.h echo "#undef defun" >> defun.h @@ -180,28 +180,39 @@ $(LIBIRTEUSIMG): $(INSTALLLIBDIR)/jpegmemcd.$(LSFX) $(IRTEUSIMGOBJS) $(IRTIMGCOB $(LIBIRTEUSGL): $(IRTEUSGLOBJS) $(IRTGLCOBJECTS) $(LIBNR) $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSGL) $(IRTEUSGLOBJS) $(IRTGLCOBJECTS) $(IMPLIB) -$(IRTEUSOBJS): $(INSTALLOBJDIR)/compile_irt.log -$(IRTEUSOBJS) $(INSTALLOBJDIR)/compile_irt.log: $(IRTEUS_L) +$(filter-out $(INSTALLOBJDIR)/pgsql.o $(INSTALLOBJDIR)/time.o,$(IRTEUSOBJS)): $(INSTALLOBJDIR)/%.o: %.l compile_irt.l + @[ compile_irt.l -nt $< ] && (set -x; rm -f $(IRTEUSOBJS)) || echo "if compile_irt.l is older then target, so do not remove existing target object" $(BINDIR)/eus2$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irt.l > $(INSTALLOBJDIR)/compile_irt.log -rm -f $(IRTEUS_C) $(IRTEUS_H) +$(INSTALLOBJDIR)/pgsql.$(OSFX): $(EUSDIR)/lib/llib/pgsql.l + $(BINDIR)/eus2$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irt.l > $(INSTALLOBJDIR)/compile_irt.log + -rm -f $(INSTALLOBJDIR)/pgsql.c $(INSTALLOBJDIR)/pgsql.h +$(INSTALLOBJDIR)/time.$(OSFX): $(EUSDIR)/lib/llib/time.l + $(BINDIR)/eus2$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irt.l > $(INSTALLOBJDIR)/compile_irt.log + -rm -f $(INSTALLOBJDIR)/time.c $(INSTALLOBJDIR)/time.h + -$(IRTEUSGOBJS): $(INSTALLOBJDIR)/compile_irtg.log -$(IRTEUSGOBJS) $(INSTALLOBJDIR)/compile_irtg.log: $(IRTEUSG_L) +$(IRTEUSGOBJS): $(INSTALLOBJDIR)/%.o: %.l compile_irtg.l + @[ compile_irtg.l -nt $< ] && (set -x; rm -f $(IRTEUSGOBJS)) || echo "if compile_irtg.l is older then target, so do not remove existing target object" $(BINDIR)/eusgl$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtg.l > $(INSTALLOBJDIR)/compile_irtg.log -rm -f $(IRTEUSG_C) $(IRTEUSG_H) -$(IRTEUSXOBJS): $(INSTALLOBJDIR)/compile_irtx.log -$(IRTEUSXOBJS) $(INSTALLOBJDIR)/compile_irtx.log: $(IRTEUSX_L) +$(IRTEUSXOBJS): $(INSTALLOBJDIR)/%.o: %.l compile_irtx.l + @[ compile_irtx.l -nt $< ] && (set -x; rm -f $(IRTEUSXOBJS)) || echo "if compile_irtx.l is older then target, so do not remove existing target object" $(BINDIR)/eusx$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtx.l > $(INSTALLOBJDIR)/compile_irtx.log -rm -f $(IRTEUSX_C) $(IRTEUSX_H) -$(IRTEUSIMGOBJS): $(INSTALLOBJDIR)/compile_irtimg.log -$(IRTEUSIMGOBJS) $(INSTALLOBJDIR)/compile_irtimg.log: $(IRTEUSIMG_L) +$(filter-out $(INSTALLOBJDIR)/eusjpeg.o,$(IRTEUSIMGOBJS)): $(INSTALLOBJDIR)/%.o: %.l compile_irtimg.l + @[ compile_irtimg.l -nt $< ] && (set -x; rm -f $(IRTEUSIMGOBJS)) || echo "if compile_irtimg.l is older then target, so do not remove existing target object" $(BINDIR)/eusx$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtimg.l > $(INSTALLOBJDIR)/compile_irtimg.log -rm -f $(IRTEUSIMG_C) $(IRTEUSIMG_H) +$(INSTALLOBJDIR)/eusjpeg.$(OSFX): $(EUSDIR)/lisp/image/jpeg/eusjpeg.l + $(BINDIR)/eusx$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtimg.l > $(INSTALLOBJDIR)/compile_irtimg.log + -rm -f $(INSTALLOBJDIR)/eusjpeg.c $(INSTALLOBJDIR)/eusjpeg.h + -$(IRTEUSGLOBJS): $(INSTALLOBJDIR)/compile_irtgl.log -$(IRTEUSGLOBJS) $(INSTALLOBJDIR)/compile_irtgl.log: $(IRTEUSGL_L) +$(IRTEUSGLOBJS): $(INSTALLOBJDIR)/%.o: %.l compile_irtgl.l + @[ compile_irtgl.l -nt $< ] && (set -x; rm -f $(IRTEUSGLOBJS)) || echo "if compile_irtgl.l is older then target, so do not remove existing target object" $(BINDIR)/eusgl$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtgl.l > $(INSTALLOBJDIR)/compile_irtgl.log -rm -f $(IRTEUSGL_C) $(IRTEUSGL_H) @@ -241,34 +252,6 @@ clean: -rm -f $(EUSDIR)/lib/llib/pgsql.c $(EUSDIR)/lib/llib/pgsql.h -rm -f $(EUSDIR)/lib/llib/time.c $(EUSDIR)/lib/llib/time.h -$(INSTALLOBJDIR)/irtmath.$(OSFX): irtmath.l -$(INSTALLOBJDIR)/irtutil.$(OSFX): irtutil.l -$(INSTALLOBJDIR)/irtgraph.$(OSFX): irtgraph.l -$(INSTALLOBJDIR)/irtgeo.$(OSFX): irtgeo.l -$(INSTALLOBJDIR)/irtscene.$(OSFX): irtscene.l -$(INSTALLOBJDIR)/irtmodel.$(OSFX): irtmodel.l -$(INSTALLOBJDIR)/irtdyna.$(OSFX): irtdyna.l -$(INSTALLOBJDIR)/irtcollada.$(OSFX): irtcollada.l -$(INSTALLOBJDIR)/irtstl.$(OSFX): irtstl.l -$(INSTALLOBJDIR)/irtwrl.$(OSFX): irtwrl.l -$(INSTALLOBJDIR)/irtsensor.$(OSFX): irtsensor.l -$(INSTALLOBJDIR)/irtpointcloud.$(OSFX): irtpointcloud.l -$(INSTALLOBJDIR)/irtrobot.$(OSFX): irtrobot.l -$(INSTALLOBJDIR)/irtbvh.$(OSFX): irtbvh.l -$(INSTALLOBJDIR)/irtx.$(OSFX): irtx.l -$(INSTALLOBJDIR)/irtgl.$(OSFX): irtgl.l -$(INSTALLOBJDIR)/irtglrgb.$(OSFX): irtglrgb.l -$(INSTALLOBJDIR)/irtviewer.$(OSFX): irtviewer.l -$(INSTALLOBJDIR)/irtimage.$(OSFX): irtimage.l -$(INSTALLOBJDIR)/irtcollision.$(OSFX): irtcollision.l -$(INSTALLOBJDIR)/gnuplotlib.$(OSFX): gnuplotlib.l -$(INSTALLOBJDIR)/pqp.$(OSFX): pqp.l -$(INSTALLOBJDIR)/bullet.$(OSFX): bullet.l -$(INSTALLOBJDIR)/png.$(OSFX): png.l -$(INSTALLOBJDIR)/pgsql.$(OSFX): $(EUSDIR)/lib/llib/pgsql.l -$(INSTALLOBJDIR)/time.$(OSFX): $(EUSDIR)/lib/llib/time.l -$(INSTALLOBJDIR)/eusjpeg.$(OSFX): $(EUSDIR)/lisp/image/jpeg/eusjpeg.l - $(INSTALLOBJDIR)/irtc.$(OSFX): irtc.c defun.h $(CC) $(CFLAGS) $(WFLAGS) -c irtc.c $(OBJOPT)$(INSTALLOBJDIR)/irtc.$(OSFX) $(INSTALLOBJDIR)/irtglc.$(OSFX): irtglc.c defun.h From a5b2fbfbce912a6bde9590c89fcf172abecf09eb Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 13:03:27 +0900 Subject: [PATCH 03/18] irteus/Makefile: add irteusg irteusx irteusgl target --- irteus/Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/irteus/Makefile b/irteus/Makefile index 44ca8cbe..0ce9421f 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -153,8 +153,11 @@ IRTIMGCOBJECTS=$(INSTALLOBJDIR)/euspng.$(OSFX) IRTGLCOBJECTS=$(INSTALLOBJDIR)/irtglc.$(OSFX) NROBJECTS=$(INSTALLOBJDIR)/nr.$(OSFX) -all: defun.h $(LIBNR) $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) $(LIBIRTEUSGL) make-link install-irtext.l +all: irteusg irteusx irteusgl +irteusg: $(INSTALLBINDIR)/irteusg$(ESFX) +irteusx: $(INSTALLBINDIR)/irteusx$(ESFX) +irteusgl: $(INSTALLBINDIR)/irteusgl$(ESFX) defun.h: $(EUSDIR)/include/eus.h echo '#include "eus.h"\n#undef defun\npointer TEST();\nvoid test(void) {register context *ctx; pointer mod; defun(ctx,"TEST",mod,TEST,NULL);}' > test.c @@ -222,11 +225,16 @@ PQP/$(ARCHDIR)/libPQP-static.a: $(LIBNR): $(NROBJECTS) $(LD) $(SOFLAGS) $(OUTOPT)$(LIBNR) $(NROBJECTS) -BINS=$(BINDIR)/irteus$(ESFX) $(BINDIR)/irteusgl$(ESFX) -make-link: $(BINS) $(EUSDIR)/irteus -$(BINS): +$(INSTALLBINDIR)/irteusg$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) make-link install-irtext.l + (cd $(INSTALLBINDIR); ln -sf eusg$(ESFX) irteusg$(ESFX)) +$(INSTALLBINDIR)/irteusx$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) make-link install-irtext.l + (cd $(INSTALLBINDIR); ln -sf eusx$(ESFX) irteusx$(ESFX)) +$(INSTALLBINDIR)/irteusgl$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) $(LIBIRTEUSGL) make-link install-irtext.l (cd $(INSTALLBINDIR); ln -sf eus$(ESFX) irteus$(ESFX)) (cd $(INSTALLBINDIR); ln -sf eusgl$(ESFX) irteusgl$(ESFX)) + +make-link: $(EUSDIR)/irteus + $(EUSDIR)/irteus: (cd $(IRTEUSDIR); ln -sf ../irteus irteus) @@ -246,6 +254,7 @@ clean: -rm -f *~ *.stackdump -rm -f $(EUSDIR)/irteus -rm -f $(INSTALLOBJDIR)/compile_*.log + -rm -f $(INSTALLBINDIR)/irteus$(ESFX) $(INSTALLBINDIR)/irteusg$(ESFX) $(INSTALLBINDIR)/irteusx$(ESFX) $(INSTALLBINDIR)/irteusgl$(ESFX) chmod a-x Makefile* *.l *.c [ -e PQP ] && (cd PQP;make clean) if [ -w $(EUSDIR)/lisp/image/jpeg/ ]; then make -C $(EUSDIR)/lisp/image/jpeg/ clean; else echo "EUSDIR/lisp/image/jpeg/ is not writable"; fi From 4e38b171083f33ad8e059b906f733c7360a13295 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 14:01:45 +0900 Subject: [PATCH 04/18] irteus/Makefile: run compile_irtg.l with eusg --- irteus/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irteus/Makefile b/irteus/Makefile index 0ce9421f..63b92939 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -197,7 +197,7 @@ $(INSTALLOBJDIR)/time.$(OSFX): $(EUSDIR)/lib/llib/time.l $(IRTEUSGOBJS): $(INSTALLOBJDIR)/%.o: %.l compile_irtg.l @[ compile_irtg.l -nt $< ] && (set -x; rm -f $(IRTEUSGOBJS)) || echo "if compile_irtg.l is older then target, so do not remove existing target object" - $(BINDIR)/eusgl$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtg.l > $(INSTALLOBJDIR)/compile_irtg.log + $(BINDIR)/eusg$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtg.l > $(INSTALLOBJDIR)/compile_irtg.log -rm -f $(IRTEUSG_C) $(IRTEUSG_H) $(IRTEUSXOBJS): $(INSTALLOBJDIR)/%.o: %.l compile_irtx.l From d5fc099f8f60f29ede5bb1c1f9a9ebf7104ca0a1 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 14:22:50 +0900 Subject: [PATCH 05/18] irteus/irtge.l, irteus/irtgl.l: move geo code to irtgeo.l for irteusg move (defmethod polygon :draw-on, (defmethod line :draw-on (defmethod faceset :draw-on :set-color from irtgl.l define dummy (defmethod faceset :set-color, :paste-texture-from-file it will be defined in irtgl.l with opengl code move (defmethod faceset :draw-on, from irtgl.l move (defmethod coordinates :vertices :draw-on, (defmethod geo::float-vector :vertices :draw-on from irtgl.l --- irteus/irtgeo.l | 118 ++++++++++++++++++++++++++++++++++++++++++++++++ irteus/irtgl.l | 108 ++------------------------------------------ 2 files changed, 122 insertions(+), 104 deletions(-) diff --git a/irteus/irtgeo.l b/irteus/irtgeo.l index 6cb9a1d8..eaa6fc88 100644 --- a/irteus/irtgeo.l +++ b/irteus/irtgeo.l @@ -813,6 +813,124 @@ (normalize-vector (float-vector w (elt vec 0) (elt vec 1) (elt vec 2))))))) +;; 2022.04.30 move (defmethod polygon :draw-on, (defmethod line :draw-on (defmethod faceset :draw-on :set-color from irtgl.l +(defmethod polygon + (:draw-on + (&key ((:viewer vwer) *viewer*) + flush (width 1) (color #f(1 1 1))) + (if flush (send vwer :viewsurface :makecurrent)) + (let ((pwidth (send vwer :viewsurface :line-width)) + (pcolor (send vwer :viewsurface :color)) + (v (float-vector 0 0 0))) + (send vwer :viewsurface :line-width width) + (send vwer :viewsurface :color color) + (send vwer :viewsurface :3d-lines (send self :vertices)) + (send vwer :viewsurface :line-width pwidth) + (send vwer :viewsurface :color pcolor) + (if flush (send vwer :viewsurface :flush)) + )) + ) + +(defmethod line + (:draw-on + (&key ((:viewer vwer) *viewer*) + flush (width 1) (color #f(1 1 1))) + (if flush (send vwer :viewsurface :makecurrent)) + (let ((pwidth (send vwer :viewsurface :line-width)) + (pcolor (send vwer :viewsurface :color)) + (v (float-vector 0 0 0))) + (send vwer :viewsurface :line-width width) + (send vwer :viewsurface :color color) + (send vwer :viewsurface :3d-line pvert nvert) + (send vwer :viewsurface :line-width pwidth) + (send vwer :viewsurface :color pcolor) + (if flush (send vwer :viewsurface :flush)) + )) + ) + +;; 2022.04.30 define dummy (defmethod faceset :set-color, :paste-texture-to-face it will be defined in irtgl.l with opengl code +;; 2022.04.30 move (defmethod faceset :draw-on, from irtgl.l +(defmethod faceset + (:set-color (col &rest args) (setf (get self :face-color) col)) + (:paste-texture-to-face + (&rest args) + (warning-message 1 ";; call :paste-texture-to-face ~A from irteusg, which does not support GL~%" args)) + (:draw-on + (&key ((:viewer vwer) *viewer*) + flush (width 1) (color #f(1 1 1))) + (if flush (send vwer :viewsurface :makecurrent)) + (let ((pwidth (send vwer :viewsurface :line-width)) + (pcolor (send vwer :viewsurface :color))) + (send vwer :viewsurface :line-width width) + (send vwer :viewsurface :color color) + (dolist (f (send self :faces)) + (send vwer :viewsurface :3d-lines (send f :vertices))) + (send vwer :viewsurface :line-width pwidth) + (send vwer :viewsurface :color pcolor) + (if flush (send vwer :viewsurface :flush)) + )) + ;; + ) + +;; 2022.04.30 move (defmethod coordinates :vertices :draw-on, (defmethod geo::float-vector :vertices :draw-on from irtgl.l +(defmethod coordinates + (:vertices () (list (send self :worldpos))) + (:draw-on + (&key ((:viewer vwer) user::*viewer*) + flush (width (get self :width)) (color (get self :color)) + (size (get self :size))) + (if flush (send vwer :viewsurface :makecurrent)) + (let ((pwidth (send vwer :viewsurface :line-width)) + (pcolor (send vwer :viewsurface :color)) + (v (float-vector 0 0 0)) v2) + (if (null width) (setq width 1)) + (if (null color) (setq color #f(1 1 1))) + (if (null size) (setq size 50)) + (setq v2 (float-vector (* 0.3 size) 0 (* 0.7 size))) + (send vwer :viewsurface :line-width width) + (send vwer :viewsurface :color color) + (dotimes (i 3) + (setf (elt v i) size) + (send vwer :viewsurface :3d-line + (send self :worldpos) + (send self :transform-vector v)) + (setf (elt v i) 0)) + (setf (elt v 2) size) + (send vwer :viewsurface :3d-line + (send self :transform-vector v) + (send self :transform-vector v2)) + (setf (elt v2 1) (elt v2 0) (elt v2 0) 0) + (send vwer :viewsurface :3d-line + (send self :transform-vector v) + (send self :transform-vector v2)) + (send vwer :viewsurface :line-width pwidth) + (send vwer :viewsurface :color pcolor) + (if flush (send vwer :viewsurface :flush)) + )) + ) + +(defmethod geo::float-vector + (:vertices () (list self)) + (:draw-on + (&key ((:viewer vwer) *viewer*) + flush (width 1) (color #f(1 1 1)) (size 50)) + (if flush (send vwer :viewsurface :makecurrent)) + (let ((pwidth (send vwer :viewsurface :line-width)) + (pcolor (send vwer :viewsurface :color)) + (v (float-vector 0 0 0))) + (send vwer :viewsurface :line-width width) + (send vwer :viewsurface :color color) + (dotimes (i 3) + (setf (elt v i) size) + (send vwer :viewsurface :3d-line self (v+ self v)) + (setf (elt v i) 0)) + (send vwer :viewsurface :line-width pwidth) + (send vwer :viewsurface :color pcolor) + (if flush (send vwer :viewsurface :flush)) + )) + ) + + (provide :irtgeo "$Id$") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/irteus/irtgl.l b/irteus/irtgl.l index e3e07033..3a6dd22b 100644 --- a/irteus/irtgl.l +++ b/irteus/irtgl.l @@ -404,40 +404,9 @@ (setf (get abody :GL-DISPLAYLIST-ID) nil) fc))) -(defmethod polygon - (:draw-on - (&key ((:viewer vwer) *viewer*) - flush (width 1) (color #f(1 1 1))) - (if flush (send vwer :viewsurface :makecurrent)) - (let ((pwidth (send vwer :viewsurface :line-width)) - (pcolor (send vwer :viewsurface :color)) - (v (float-vector 0 0 0))) - (send vwer :viewsurface :line-width width) - (send vwer :viewsurface :color color) - (send vwer :viewsurface :3d-lines (send self :vertices)) - (send vwer :viewsurface :line-width pwidth) - (send vwer :viewsurface :color pcolor) - (if flush (send vwer :viewsurface :flush)) - )) - ) - -(defmethod line - (:draw-on - (&key ((:viewer vwer) *viewer*) - flush (width 1) (color #f(1 1 1))) - (if flush (send vwer :viewsurface :makecurrent)) - (let ((pwidth (send vwer :viewsurface :line-width)) - (pcolor (send vwer :viewsurface :color)) - (v (float-vector 0 0 0))) - (send vwer :viewsurface :line-width width) - (send vwer :viewsurface :color color) - (send vwer :viewsurface :3d-line pvert nvert) - (send vwer :viewsurface :line-width pwidth) - (send vwer :viewsurface :color pcolor) - (if flush (send vwer :viewsurface :flush)) - )) - ) - +;; 2022.04.30 move (defmethod polygon :draw-on, (defmethod line :draw-on to irtgeo.l +;; 2022.04.30 add dummy (defmethod faceset :set-color in irtgeo.l +;; 2022.04.30 move (defmethod faceset :draw-on to irtgeo.l (defmethod faceset (:set-color (color &optional (transparent)) @@ -452,20 +421,6 @@ (t (setf (get self :face-color) (gl::find-color color))) )) - (:draw-on - (&key ((:viewer vwer) *viewer*) - flush (width 1) (color #f(1 1 1))) - (if flush (send vwer :viewsurface :makecurrent)) - (let ((pwidth (send vwer :viewsurface :line-width)) - (pcolor (send vwer :viewsurface :color))) - (send vwer :viewsurface :line-width width) - (send vwer :viewsurface :color color) - (dolist (f (send self :faces)) - (send vwer :viewsurface :3d-lines (send f :vertices))) - (send vwer :viewsurface :line-width pwidth) - (send vwer :viewsurface :color pcolor) - (if flush (send vwer :viewsurface :flush)) - )) ;; (:paste-texture-to-face (aface &key file image @@ -507,62 +462,7 @@ )) ) -(defmethod coordinates - (:vertices () (list (send self :worldpos))) - (:draw-on - (&key ((:viewer vwer) user::*viewer*) - flush (width (get self :width)) (color (get self :color)) - (size (get self :size))) - (if flush (send vwer :viewsurface :makecurrent)) - (let ((pwidth (send vwer :viewsurface :line-width)) - (pcolor (send vwer :viewsurface :color)) - (v (float-vector 0 0 0)) v2) - (if (null width) (setq width 1)) - (if (null color) (setq color #f(1 1 1))) - (if (null size) (setq size 50)) - (setq v2 (float-vector (* 0.3 size) 0 (* 0.7 size))) - (send vwer :viewsurface :line-width width) - (send vwer :viewsurface :color color) - (dotimes (i 3) - (setf (elt v i) size) - (send vwer :viewsurface :3d-line - (send self :worldpos) - (send self :transform-vector v)) - (setf (elt v i) 0)) - (setf (elt v 2) size) - (send vwer :viewsurface :3d-line - (send self :transform-vector v) - (send self :transform-vector v2)) - (setf (elt v2 1) (elt v2 0) (elt v2 0) 0) - (send vwer :viewsurface :3d-line - (send self :transform-vector v) - (send self :transform-vector v2)) - (send vwer :viewsurface :line-width pwidth) - (send vwer :viewsurface :color pcolor) - (if flush (send vwer :viewsurface :flush)) - )) - ) - -(defmethod geo::float-vector - (:vertices () (list self)) - (:draw-on - (&key ((:viewer vwer) *viewer*) - flush (width 1) (color #f(1 1 1)) (size 50)) - (if flush (send vwer :viewsurface :makecurrent)) - (let ((pwidth (send vwer :viewsurface :line-width)) - (pcolor (send vwer :viewsurface :color)) - (v (float-vector 0 0 0))) - (send vwer :viewsurface :line-width width) - (send vwer :viewsurface :color color) - (dotimes (i 3) - (setf (elt v i) size) - (send vwer :viewsurface :3d-line self (v+ self v)) - (setf (elt v i) 0)) - (send vwer :viewsurface :line-width pwidth) - (send vwer :viewsurface :color pcolor) - (if flush (send vwer :viewsurface :flush)) - )) - ) +;; 2022.04.30 move (defmethod coordinates :vertices :draw-on, (defmethod geo::float-vector :vertices :draw-on to irtgeo.l (defclass glvertices :super cascaded-coords From d41326e1b027454622a52453d084af0aba8dac97 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 14:30:47 +0900 Subject: [PATCH 06/18] .github/workflows/config.yml: add linux-nox --- .github/workflows/config.yml | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 8cadbbec..fe2fb0a0 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -52,6 +52,56 @@ jobs: echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME" docker run --rm $QEMU_VOLUME -v $CI_SOURCE_PATH:$CI_SOURCE_PATH -e "DOCKER_IMAGE=$DOCKER_IMAGE" -e "COLLISION_LIB=$COLLISION_LIB" -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -t $DOCKER_IMAGE sh -c "cd $CI_SOURCE_PATH; ./.travis.sh" + # test for non X11/GL environment, i.e. embedded environment + linux-nox: + runs-on: ubuntu-latest + container: ubuntu:20.04 + timeout-minutes: 60 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Checkout eus (on support_nonx, git install x11 lib, so auto-remove it) + shell: bash + run: | + set -xe + apt update -y -qq && apt install -y -qq git + git clone --branch support_nonx https://github.com/euslisp/EusLisp eus + apt purge -y -qq git + apt autoremove -y -qq + - name: Setup environmnet + shell: bash + run: | + set -xe + apt update -y -qq && apt install -y -qq make gcc g++ libjpeg-dev libpng-dev + dpkg --get-selections | egrep -e '(x11|gl)' || echo "OK" ## show selected X/GL + dpkg --get-selections | egrep -q -e '(x11|gl)' && exit 1 ## exit 1, when X/GL found + exit 0 + - name: Compile eusg (on support_nonx) + shell: bash + run: | + set -xe + make bashrc.eus + source bashrc.eus + cd eus/lisp + ln -sf Makefile.$ARCHDIR Makefile + make eus0 eus1 eus2 eusg + - name: Compile irteusg + shell: bash + run: | + set -xe + source bashrc.eus + cd irteus + make irteusg + - name: Run test + shell: bash + run: | + # fix eus/models for irteusg + sed -i 's/(send x:\*root\* :size)/#f\(1000\)/' eus/models/irt-all-*.l + sed -i '/\(send self :def-gl-vertices\)/ s/^/;/' eus/models/*.l + sed -i '/\(send self :make-collision-model-for-links\)/ s/^/;/' eus/models/*.l + source bashrc.eus + export EXIT_STATUS=0; for test_l in irteus/test/*.l; do irteusg $test_l; export TMP_EXIT_STATUS=$?; export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`; done; [ $EXIT_STATUS == 0 ] || exit 1 + doc: runs-on: ubuntu-latest timeout-minutes: 60 From a4cd5e4381dd93cee1688cc5fad0a2a4346c2adf Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 14:31:19 +0900 Subject: [PATCH 07/18] ***DEBUG***: comment out existing test for debug --- .github/workflows/config.yml | 180 +++++++++++++++++------------------ 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index fe2fb0a0..7302079d 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -8,49 +8,49 @@ env: DISPLAY: '0:0' jobs: - linux: - strategy: - matrix: - include: - - DOCKER_IMAGE: ubuntu:trusty - - DOCKER_IMAGE: ubuntu:xenial - - DOCKER_IMAGE: ubuntu:bionic - - DOCKER_IMAGE: ubuntu:bionic - COLLISION_LIB: PQP - - DOCKER_IMAGE: ubuntu:bionic - COLLISION_LIB: BULLET - - DOCKER_IMAGE: ubuntu:focal - - DOCKER_IMAGE: debian:stretch - - DOCKER_IMAGE: osrf/ubuntu_armhf:trusty - - DOCKER_IMAGE: osrf/ubuntu_armhf:xenial - - DOCKER_IMAGE: osrf/ubuntu_arm64:trusty - - DOCKER_IMAGE: osrf/ubuntu_arm64:xenial - - DOCKER_IMAGE: arm64v8/ubuntu:bionic - - DOCKER_IMAGE: arm64v8/ubuntu:focal - - DOCKER_IMAGE: osrf/debian_arm64:stretch - fail-fast: false + # linux: + # strategy: + # matrix: + # include: + # - DOCKER_IMAGE: ubuntu:trusty + # - DOCKER_IMAGE: ubuntu:xenial + # - DOCKER_IMAGE: ubuntu:bionic + # - DOCKER_IMAGE: ubuntu:bionic + # COLLISION_LIB: PQP + # - DOCKER_IMAGE: ubuntu:bionic + # COLLISION_LIB: BULLET + # - DOCKER_IMAGE: ubuntu:focal + # - DOCKER_IMAGE: debian:stretch + # - DOCKER_IMAGE: osrf/ubuntu_armhf:trusty + # - DOCKER_IMAGE: osrf/ubuntu_armhf:xenial + # - DOCKER_IMAGE: osrf/ubuntu_arm64:trusty + # - DOCKER_IMAGE: osrf/ubuntu_arm64:xenial + # - DOCKER_IMAGE: arm64v8/ubuntu:bionic + # - DOCKER_IMAGE: arm64v8/ubuntu:focal + # - DOCKER_IMAGE: osrf/debian_arm64:stretch + # fail-fast: false - runs-on: ubuntu-18.04 - timeout-minutes: 90 + # runs-on: ubuntu-18.04 + # timeout-minutes: 90 - name: linux + # name: linux - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run test - shell: bash - run: | - set -x - export CI_SOURCE_PATH=$(pwd) - export REPOSITORY_NAME=${PWD##*/} - export TRAVIS_BRANCH=${GITHUB_REF#refs/heads/} - export TRAVIS_OS_NAME=linux - export DOCKER_IMAGE=${{matrix.DOCKER_IMAGE}} - if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then sudo apt-get install -y -qq qemu-user-static git; fi - if [[ "$DOCKER_IMAGE" == *"arm64v8"* ]]; then export QEMU_VOLUME="-v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static"; fi # - echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME" - docker run --rm $QEMU_VOLUME -v $CI_SOURCE_PATH:$CI_SOURCE_PATH -e "DOCKER_IMAGE=$DOCKER_IMAGE" -e "COLLISION_LIB=$COLLISION_LIB" -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -t $DOCKER_IMAGE sh -c "cd $CI_SOURCE_PATH; ./.travis.sh" + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # - name: Run test + # shell: bash + # run: | + # set -x + # export CI_SOURCE_PATH=$(pwd) + # export REPOSITORY_NAME=${PWD##*/} + # export TRAVIS_BRANCH=${GITHUB_REF#refs/heads/} + # export TRAVIS_OS_NAME=linux + # export DOCKER_IMAGE=${{matrix.DOCKER_IMAGE}} + # if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then sudo apt-get install -y -qq qemu-user-static git; fi + # if [[ "$DOCKER_IMAGE" == *"arm64v8"* ]]; then export QEMU_VOLUME="-v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static"; fi # + # echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME" + # docker run --rm $QEMU_VOLUME -v $CI_SOURCE_PATH:$CI_SOURCE_PATH -e "DOCKER_IMAGE=$DOCKER_IMAGE" -e "COLLISION_LIB=$COLLISION_LIB" -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -t $DOCKER_IMAGE sh -c "cd $CI_SOURCE_PATH; ./.travis.sh" # test for non X11/GL environment, i.e. embedded environment linux-nox: @@ -102,56 +102,56 @@ jobs: source bashrc.eus export EXIT_STATUS=0; for test_l in irteus/test/*.l; do irteusg $test_l; export TMP_EXIT_STATUS=$?; export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`; done; [ $EXIT_STATUS == 0 ] || exit 1 - doc: - runs-on: ubuntu-latest - timeout-minutes: 60 + # doc: + # runs-on: ubuntu-latest + # timeout-minutes: 60 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run test - shell: bash - run: | - set -x - sudo apt-get install -y -qq git make gcc g++ libjpeg-dev libxext-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev libpq-dev libpng-dev xfonts-100dpi xfonts-75dpi pkg-config libbullet-dev - make - sudo apt-get install -y -qq texlive-binaries texlive-lang-cjk texlive-lang-japanese poppler-utils nkf latex2html - (source bashrc.eus; cd doc/; make pdf) - (source bashrc.eus; cd doc/; make html) + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # - name: Run test + # shell: bash + # run: | + # set -x + # sudo apt-get install -y -qq git make gcc g++ libjpeg-dev libxext-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev libpq-dev libpng-dev xfonts-100dpi xfonts-75dpi pkg-config libbullet-dev + # make + # sudo apt-get install -y -qq texlive-binaries texlive-lang-cjk texlive-lang-japanese poppler-utils nkf latex2html + # (source bashrc.eus; cd doc/; make pdf) + # (source bashrc.eus; cd doc/; make html) - osx: - runs-on: macos-latest - timeout-minutes: 60 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Get brew cache directory - id: brew-cache - run: echo "::set-output name=dir::$(brew --cache)/downloads" - - name: Brew cache - uses: actions/cache@v2 - with: - path: ${{ steps.brew-cache.outputs.dir }} - key: ${{ runner.os }}-${{ hashFiles('.github/workflows/Brewfile') }} - - name: Brew config - run: | - cd .github/workflows/ - brew config - - name: Run test - shell: bash - run: | - set -x - export CI_SOURCE_PATH=$(pwd) - export REPOSITORY_NAME=${PWD##*/} - export TRAVIS_BRANCH=${GITHUB_REF#refs/heads/} - export LC_CTYPE=C - echo insecure >> ~/.curlrc - export HOMEBREW_CURLRC=1 - HOMEBREW_NO_AUTO_UPDATE=1 brew install coreutils - export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" - # since macos-11, we need to install GL/gl.h - HOMEBREW_NO_AUTO_UPDATE=1 brew install mesa-glu - ./.travis-osx.sh - - name: Cleanup some brew downloads - run: cd ${{ steps.brew-cache.outputs.dir }} && ls -lsS | head -n 10 | awk '{ print $10 }' | xargs rm -rf + # osx: + # runs-on: macos-latest + # timeout-minutes: 60 + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # - name: Get brew cache directory + # id: brew-cache + # run: echo "::set-output name=dir::$(brew --cache)/downloads" + # - name: Brew cache + # uses: actions/cache@v2 + # with: + # path: ${{ steps.brew-cache.outputs.dir }} + # key: ${{ runner.os }}-${{ hashFiles('.github/workflows/Brewfile') }} + # - name: Brew config + # run: | + # cd .github/workflows/ + # brew config + # - name: Run test + # shell: bash + # run: | + # set -x + # export CI_SOURCE_PATH=$(pwd) + # export REPOSITORY_NAME=${PWD##*/} + # export TRAVIS_BRANCH=${GITHUB_REF#refs/heads/} + # export LC_CTYPE=C + # echo insecure >> ~/.curlrc + # export HOMEBREW_CURLRC=1 + # HOMEBREW_NO_AUTO_UPDATE=1 brew install coreutils + # export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" + # # since macos-11, we need to install GL/gl.h + # HOMEBREW_NO_AUTO_UPDATE=1 brew install mesa-glu + # ./.travis-osx.sh + # - name: Cleanup some brew downloads + # run: cd ${{ steps.brew-cache.outputs.dir }} && ls -lsS | head -n 10 | awk '{ print $10 }' | xargs rm -rf From 08d42156cf8b034d0a39987dda7dff05a22df32d Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 22:08:31 +0900 Subject: [PATCH 08/18] irtues/demo/*.l, irteus/test/*.l: fix demo/test for irteusg, check boundp 'x::*display* or add #+:gl for gl::transparent functions --- irteus/demo/hanoi.l | 3 ++- irteus/demo/walk-motion.l | 10 +++++----- irteus/gnuplotlib.l | 4 +++- irteus/test/all-robots-objects.l | 2 +- irteus/test/graph.l | 1 + irteus/test/interpolator.l | 4 ++-- irteus/test/irteus-demo.l | 2 +- irteus/test/joint.l | 4 ++-- irteus/test/rendering.l | 6 ++++++ irteus/test/transparent.l | 1 + 10 files changed, 24 insertions(+), 13 deletions(-) diff --git a/irteus/demo/hanoi.l b/irteus/demo/hanoi.l index f09d0273..feb9aee5 100644 --- a/irteus/demo/hanoi.l +++ b/irteus/demo/hanoi.l @@ -111,7 +111,8 @@ (dotimes (i n) (setq disks (cons (hanoi-disk (+ (* (/ 27 n) i) 12) 20) disks)) - (send (car disks) :set-color (send (elt gl::*face-colors* (* (+ i 4) 32)) :name)) + (when (memq :gl *features*) + (send (car disks) :set-color (send (elt gl::*face-colors* (* (+ i 4) 32)) :name))) (send (car disks) :name (format nil "disk~A" i)) ) (reverse disks)) diff --git a/irteus/demo/walk-motion.l b/irteus/demo/walk-motion.l index af389067..e8036238 100644 --- a/irteus/demo/walk-motion.l +++ b/irteus/demo/walk-motion.l @@ -294,7 +294,7 @@ (format f "~A ~A ~A ~A~%" tm zmp cog refzmp)) tm-list (reverse zmp-list) (reverse cog-list) (reverse ref-zmp-list2)) ) - (unless (or (null x::*display*) (= x::*display* 0)) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) ;; graph-view (graph-view (list (reverse zmp-list) (reverse cog-list) (reverse ref-zmp-list2)) tm-list :xlabel "Time [s]" :ylabel "ZMP X [mm]" @@ -353,7 +353,7 @@ (format f "~A ~A ~A ~A~%" tm zmp cog refzmp)) tm-list (reverse zmp-list) (reverse cog-list) (reverse ref-zmp-list2)) ) - (unless (or (null x::*display*) (= x::*display* 0)) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) (let ((gp-command-list (list "set xlabel 'Time [s]';" "set ylabel 'ZMP X [mm]';" @@ -407,7 +407,7 @@ (format f "~A ~A ~A ~A~%" tm zmp cog refzmp)) tm-list (reverse zmp-list) (reverse cog-list) (reverse ref-zmp-list2)) ) - (unless (or (null x::*display*) (= x::*display* 0)) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) (let ((gp-command-list (list "set xlabel 'Time [s]';" "set ylabel 'ZMP X [mm]';" @@ -454,7 +454,7 @@ (format f "~A ~A ~A ~A~%" tm zmp cog refzmp)) tm-list (reverse zmp-list) (reverse cog-list) (reverse ref-zmp-list2)) ) - (unless (or (null x::*display*) (= x::*display* 0)) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) (let ((gp-command-list (list "set xlabel 'Time [s]';" "set ylabel 'ZMP X [mm]';" @@ -509,7 +509,7 @@ (mapcar #'(lambda (x) (elt (cadr (memq :output-cog x)) 1)) data) (mapcar #'(lambda (x) (elt (cadr (memq :input-cog x)) 1)) data) )) - (unless (or (null x::*display*) (= x::*display* 0)) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) (let ((gp-command-list (list "set xlabel 'Time [s]';" "set ylabel 'ZMP X [mm]';" diff --git a/irteus/gnuplotlib.l b/irteus/gnuplotlib.l index 17df0090..f7a0f35e 100644 --- a/irteus/gnuplotlib.l +++ b/irteus/gnuplotlib.l @@ -32,7 +32,9 @@ (:init (host &key (clear t) ((:debug _debug))) "Initialize gnuplot interface object with given host name" (when (eq (unix:system "which gnuplot") 256) - (error "gnuplot is not installed. $ sudo apt-get install gnuplot")) + (setq strm t) + (warning-message 1 "gnuplot is not installed. $ sudo apt-get install gnuplot~%") + (return-from :init self)) (setq strm (cond ((string= (unix:gethostname) host) diff --git a/irteus/test/all-robots-objects.l b/irteus/test/all-robots-objects.l index 9776868a..49bffa91 100644 --- a/irteus/test/all-robots-objects.l +++ b/irteus/test/all-robots-objects.l @@ -11,7 +11,7 @@ (eval `(deftest ,(read-from-string (format nil "test-~A" model-func-name)) (load (format nil "models/irt-all-~A.l" ,model-type-name)) - (unless x::*root* (defun ,model-func-name ())) ;; do not create viwer + (when (and (boundp 'x::*root*) (null x::*root*)) (defun ,model-func-name ())) ;; do not create viwer (setq model-viewers (,model-func-name)) (let (fname (fname-list "")) (dolist (viewer model-viewers) diff --git a/irteus/test/graph.l b/irteus/test/graph.l index 12e50ebf..a0337dc9 100644 --- a/irteus/test/graph.l +++ b/irteus/test/graph.l @@ -224,6 +224,7 @@ (load "models/h4-robot.l") (load "models/h7-robot.l") +#+:gl (deftest test-image-node () (let ((g (instance graph)) (node-h3 (instance node :name "h3")) diff --git a/irteus/test/interpolator.l b/irteus/test/interpolator.l index 51d23e06..21949098 100644 --- a/irteus/test/interpolator.l +++ b/irteus/test/interpolator.l @@ -139,7 +139,7 @@ ip))) )) (ret-list2 (mapcar #'(lambda (x) (elt x 0)) (cadr (memq :data ret-list))))) - (when (and (not (or (null x::*display*) (= x::*display* 0))) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0))) (functionp 'graph-view)) (let ((r-pos (mapcar #'(lambda (x) (elt x 0)) (cadr (memq :data ret-list)))) (r-vel (mapcar #'(lambda (x) (* 10 (elt x 0))) (cadr (memq :velocity ret-list)))) @@ -227,7 +227,7 @@ (format nil "~A vel: ~A, acc:~A, acc:~A, diff:~A~%" i (elt velocity i) real-acc calc-acc (norm (v- real-acc calc-acc))))) )) - (when (and (not (or (null x::*display*) (= x::*display* 0))) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) (functionp 'graph-view)) (let ((r-pos (mapcar #'(lambda (x) (elt x 0)) (cadr (memq :data ret-list)))) (r-vel (mapcar #'(lambda (x) (* 0.001 (elt x 0))) (cadr (memq :velocity ret-list)))) diff --git a/irteus/test/irteus-demo.l b/irteus/test/irteus-demo.l index dfb097c2..77448918 100644 --- a/irteus/test/irteus-demo.l +++ b/irteus/test/irteus-demo.l @@ -3,7 +3,7 @@ (init-unit-test) (load "irteus/demo/demo.l") -(if (or (null x::*display*) (= x::*display* 0)) ;; aboid to show (window-main-one nil) was called, but no display is found. message to reduce outputs in travis +(if (and (boundp 'x::*display*) (or (null x::*display*) (= x::*display* 0))) ;; aboid to show (window-main-one nil) was called, but no display is found. message to reduce outputs in travis (defun x::window-main-one (&rest args) )) (defmacro do-until-key (&rest forms) (with-gensyms (do-until-key-counter tm) `(progn (setq tm (instance mtimer :init)) (dotimes (do-until-key-counter 10) ,@forms)))) diff --git a/irteus/test/joint.l b/irteus/test/joint.l index 5007ff1a..c58fc6f3 100644 --- a/irteus/test/joint.l +++ b/irteus/test/joint.l @@ -122,7 +122,7 @@ (list j1-min-max-table j2-min-max-table)) ;; display min-max table if needed - (unless (or (null x::*display*) (= x::*display* 0)) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) (setq min-max-table-view (instance x::panel :create :width (round (- j1-org-max-angle j1-org-min-angle)) @@ -269,7 +269,7 @@ (send *robot* :make-joint-min-max-table (send (send *robot* :j1) :parent-link) (send (send *robot* :j2) :child-link) (send *robot* :j1) (send *robot* :j2) :margin margin) - (unless (or (null x::*display*) (= x::*display* 0)) + (when (and (boundp 'x::*display*) (not (or (null x::*display*) (= x::*display* 0)))) (send *robot* :plot-joint-min-max-table (send *robot* :j1) (send *robot* :j2)) ";; plot joint-min-max-table") (prog1 diff --git a/irteus/test/rendering.l b/irteus/test/rendering.l index 6f062824..8f4ac224 100644 --- a/irteus/test/rendering.l +++ b/irteus/test/rendering.l @@ -11,6 +11,12 @@ (assert (setq *img* (read-image-file *test-img-path*)) "failed to read-image-file pr2.png") (assert (> (send (send *img* :monochromize) :brightest-pixel) 0.0) "nothing is drawn in image") + ) + +#+:gl +(deftest gl-transpose-image () + (setq *test-img-path* (format nil "~A/irteus/test/pr2.png" *eusdir*)) + (setq *img* (read-image-file *test-img-path*)) (setq *src-img* (copy-object *img*)) (gl::transpose-image-rows *img*) (assert (not (string= (send *src-img* :entity) (send *img* :entity))) diff --git a/irteus/test/transparent.l b/irteus/test/transparent.l index a819e3cc..850b85ad 100644 --- a/irteus/test/transparent.l +++ b/irteus/test/transparent.l @@ -16,6 +16,7 @@ ret)) ;;memory_leak_transparent +#+:gl (deftest memory-leak-transparent (let (vmrss-orig vmrss) (setq *cubes* (make-cubes 5000)) From 4f5312c135bf81dd427ea6b62c385ba9181adba8 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 22:10:19 +0900 Subject: [PATCH 09/18] irteus/irtgeo.l, irteus/irtviewer.l: move objects, make-irtviewr, irtviewer-dummy, mkae-irtviewer-dummp from irtviewer.l to irtget.l for irteusg --- irteus/irtgeo.l | 79 ++++++++++++++++++++++++++++++++++++++++++++++ irteus/irtviewer.l | 62 ++---------------------------------- 2 files changed, 81 insertions(+), 60 deletions(-) diff --git a/irteus/irtgeo.l b/irteus/irtgeo.l index eaa6fc88..51019bc1 100644 --- a/irteus/irtgeo.l +++ b/irteus/irtgeo.l @@ -930,6 +930,85 @@ )) ) +;; 2022.04.30 move objects, make-irtviwer, irtviewer-dummy, make-irtviewer-dummy from irtviewer.l +(in-package "USER") +(defun objects (&optional (objs t) vw) + (when + (and objs (not (boundp '*irtviewer*)) (null vw)) + (warn ";; (make-irtviewer) executed~%") + (make-irtviewer)) + (if (null vw) (setq vw *irtviewer*)) + (let (objects) + (if (eq objs t) (setq objects (send vw :objects)) + (setq objects (send vw :objects objs))) + (send vw :look-all) + objects)) + + +(proclaim '(special *irtviewer*)) +;; make-irtviewer is re-defined in irtviwer.l to instantiate x::irtviewer +(defun make-irtviewer (&rest args) + (warning-message 1 ";; call make-irtviewer from irteusg, which does not support X/GL~%") + (make-irtviewer-dummy) + *irtviewer*) + +(defclass viewer-dummy + :super propertied-object + :slots ()) +(defmethod viewer-dummy + (:nomethod (&rest args) t) + ) + +(defclass irtviewer-dummy + :super propertied-object + :slots (objects draw-things)) +(defmethod irtviewer-dummy + (:objects (&rest args) + (when + args + (cond + ((null (car args)) + (setq objects nil)) + ((consp (car args)) + (setq objects (car args))) + ((atom (car args)) + (setq objects (append args objects))) + )) + (send-all objects :worldcoords) + (setq draw-things (x::draw-things objects)) + objects) + (:nomethod (&rest args) t) + ) ;; + +(defun make-irtviewer-dummy (&rest args) + (warning-message 1 ";; no display is found. exit from (make-irtviewer)~%") + (setq *irtviewer* (instance irtviewer-dummy)) + (setq *viewer* (instance viewer-dummy)) + (setf (get *viewer* :pickviewer) *irtviewer*) + *irtviewer*) + +(in-package "X") +;; 2022.04.30 move draw-things from irtviewer.l +(defun draw-things (objs) + (cond + ((atom objs) + (cond + ((null objs) nil) + ((find-method objs :draw) (list objs)) + ((find-method objs :bodies) (send objs :bodies)) + (t (list objs)))) + (t + (append (draw-things (car objs)) + (draw-things (cdr objs)))) + )) + +(defun window-main-one (&rest args)) ;; define to call lisp code with (x::window-main-one) with irteusg, this function will be override in irtx.l + +(in-package "GL") +(defun transparent (&rest args) ;; define to call lisp code with (gl::transparent) with irteusg, this function will be override in irtx.l + (warning-message 1 ";; call gl::transparent from irteusg, which does not support GL~%")) + +(in-package "GEOMETRY") (provide :irtgeo "$Id$") diff --git a/irteus/irtviewer.l b/irteus/irtviewer.l index 29f40782..6d9e4367 100644 --- a/irteus/irtviewer.l +++ b/irteus/irtviewer.l @@ -542,18 +542,7 @@ :height (send viewer :viewsurface :height)))) ) -(defun draw-things (objs) - (cond - ((atom objs) - (cond - ((null objs) nil) - ((find-method objs :draw) (list objs)) - ((find-method objs :bodies) (send objs :bodies)) - (t (list objs)))) - (t - (append (draw-things (car objs)) - (draw-things (cdr objs)))) - )) +;; 2022.04.30 move draw-things to irtgeo.l (in-package "GEOMETRY") @@ -583,21 +572,9 @@ (in-package "USER") -(defun objects (&optional (objs t) vw) - (when - (and objs (not (boundp '*irtviewer*)) (null vw)) - (warn ";; (make-irtviewer) executed~%") - (make-irtviewer)) - (if (null vw) (setq vw *irtviewer*)) - (let (objects) - (if (eq objs t) (setq objects (send vw :objects)) - (setq objects (send vw :objects objs))) - (send vw :look-all) - objects)) - +;; 2022.04.30 move objects, make-irtviwer, irtviewer-dummy, make-irtviewer-dummy to irtgeo.l ;; ;; -(proclaim '(special *irtviewer*)) (defun make-irtviewer (&rest args) "Create irtviewer :view-name title @@ -618,34 +595,6 @@ (setq *irtviewer* (send-lexpr (instantiate x::irtviewer) :create args)))) *irtviewer*) -(defclass viewer-dummy - :super propertied-object - :slots ()) -(defmethod viewer-dummy - (:nomethod (&rest args) t) - ) - -(defclass irtviewer-dummy - :super propertied-object - :slots (objects draw-things)) -(defmethod irtviewer-dummy - (:objects (&rest args) - (when - args - (cond - ((null (car args)) - (setq objects nil)) - ((consp (car args)) - (setq objects (car args))) - ((atom (car args)) - (setq objects (append args objects))) - )) - (send-all objects :worldcoords) - (setq draw-things (x::draw-things objects)) - objects) - (:nomethod (&rest args) t) - ) ;; - (defclass irtviewer-no-window :super propertied-object :slots (irtviewer)) @@ -670,13 +619,6 @@ (send* irtviewer args)) ) ;; -(defun make-irtviewer-dummy (&rest args) - (warning-message 1 ";; no display is found. exit from (make-irtviewer)~%") - (setq *irtviewer* (instance irtviewer-dummy)) - (setq *viewer* (instance viewer-dummy)) - (setf (get *viewer* :pickviewer) *irtviewer*) - *irtviewer*) - (defun geo::default-pixmapsurface (&rest args) (send-lexpr (instantiate gl::glpixmapsurface) :create args)) (defun make-irtviewer-no-window (&rest args) From 81118c62686d3d448fecca497816b278cf89860c Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 30 Apr 2022 22:14:29 +0900 Subject: [PATCH 10/18] irteus/Maekfile, irteus/irtext.l: enable to use irtimage in irteusg; compile IRTEUSIMGOBJS with eusg, and link LIBIRTEUSIMG with irteusg --- irteus/Makefile | 10 +++++----- irteus/irtext.l | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/irteus/Makefile b/irteus/Makefile index 63b92939..a99d8f7a 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -207,10 +207,10 @@ $(IRTEUSXOBJS): $(INSTALLOBJDIR)/%.o: %.l compile_irtx.l $(filter-out $(INSTALLOBJDIR)/eusjpeg.o,$(IRTEUSIMGOBJS)): $(INSTALLOBJDIR)/%.o: %.l compile_irtimg.l @[ compile_irtimg.l -nt $< ] && (set -x; rm -f $(IRTEUSIMGOBJS)) || echo "if compile_irtimg.l is older then target, so do not remove existing target object" - $(BINDIR)/eusx$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtimg.l > $(INSTALLOBJDIR)/compile_irtimg.log + $(BINDIR)/eusg$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtimg.l > $(INSTALLOBJDIR)/compile_irtimg.log -rm -f $(IRTEUSIMG_C) $(IRTEUSIMG_H) $(INSTALLOBJDIR)/eusjpeg.$(OSFX): $(EUSDIR)/lisp/image/jpeg/eusjpeg.l - $(BINDIR)/eusx$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtimg.l > $(INSTALLOBJDIR)/compile_irtimg.log + $(BINDIR)/eusg$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtimg.l > $(INSTALLOBJDIR)/compile_irtimg.log -rm -f $(INSTALLOBJDIR)/eusjpeg.c $(INSTALLOBJDIR)/eusjpeg.h @@ -225,11 +225,11 @@ PQP/$(ARCHDIR)/libPQP-static.a: $(LIBNR): $(NROBJECTS) $(LD) $(SOFLAGS) $(OUTOPT)$(LIBNR) $(NROBJECTS) -$(INSTALLBINDIR)/irteusg$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) make-link install-irtext.l +$(INSTALLBINDIR)/irteusg$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSIMG) make-link install-irtext.l (cd $(INSTALLBINDIR); ln -sf eusg$(ESFX) irteusg$(ESFX)) -$(INSTALLBINDIR)/irteusx$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) make-link install-irtext.l +$(INSTALLBINDIR)/irteusx$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSIMG) $(LIBIRTEUSX) make-link install-irtext.l (cd $(INSTALLBINDIR); ln -sf eusx$(ESFX) irteusx$(ESFX)) -$(INSTALLBINDIR)/irteusgl$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) $(LIBIRTEUSGL) make-link install-irtext.l +$(INSTALLBINDIR)/irteusgl$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSIMG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) $(LIBIRTEUSGL) make-link install-irtext.l (cd $(INSTALLBINDIR); ln -sf eus$(ESFX) irteus$(ESFX)) (cd $(INSTALLBINDIR); ln -sf eusgl$(ESFX) irteusgl$(ESFX)) diff --git a/irteus/irtext.l b/irteus/irtext.l index b2141688..90aba9f3 100644 --- a/irteus/irtext.l +++ b/irteus/irtext.l @@ -54,19 +54,19 @@ (format nil "~A~A/lib/libirteusg" *eusdir* (unix:getenv "ARCHDIR")) '("irtgeo" "euspqp" "pqp" "irtscene" "irtmodel" "irtdyna" "irtrobot" "irtsensor" "irtbvh" "irtcollada" "irtstl" "irtwrl" "irtpointcloud" "eusbullet" "bullet" "irtcollision")) + (in-package "IMAGE") + (load-library + (format nil "~A~A/lib/libirteusimg" + *eusdir* (unix:getenv "ARCHDIR")) + '("eusjpeg" "euspng" "png" "irtimage")) (in-package "USER") - (import '(collada::convert-irtmodel-to-collada collada::eus2collada))) + (import '(collada::convert-irtmodel-to-collada collada::eus2collada image::read-image-file image::write-image-file))) (defun load-irteusx () (in-package "X") (load-library (format nil "~A~A/lib/libirteusx" *eusdir* (unix:getenv "ARCHDIR")) '("irtx")) - (in-package "IMAGE") - (load-library - (format nil "~A~A/lib/libirteusimg" - *eusdir* (unix:getenv "ARCHDIR")) - '("eusjpeg" "euspng" "png" "irtimage")) (in-package "USER") ) (defun load-irteusgl () From e40fc3553d7dae2e87a6cda460296195c6cbb92c Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 1 May 2022 15:43:46 +0900 Subject: [PATCH 11/18] irteus/Makefile* : clean up to use CC/CXX for cross compile --- irteus/Makefile | 12 ++++++------ irteus/Makefile.Cygwin | 7 +++---- irteus/Makefile.Darwin | 7 +++---- irteus/Makefile.Linux | 8 +++----- irteus/Makefile.Linux64 | 7 +++---- irteus/Makefile.LinuxARM | 7 +++---- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/irteus/Makefile b/irteus/Makefile index a99d8f7a..8c3e4523 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -167,21 +167,21 @@ defun.h: $(EUSDIR)/include/eus.h cat defun.h $(LIBIRTEUS): $(IRTEUSOBJS) $(IRTCOBJECTS) $(LIBNR) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUS) $(IRTEUSOBJS) \ + $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUS) $(IRTEUSOBJS) \ $(IRTCOBJECTS) $(IMPLIB) $(LIBIRTEUSG): $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(LIBNR) $(PQPLIBSTATIC) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSG) $(IRTEUSGOBJS) \ + $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSG) $(IRTEUSGOBJS) \ $(IRTGCOBJECTS) $(IMPLIB) $(PQPLIB) $(BULLETLIB) $(LIBIRTEUSX): $(IRTEUSXOBJS) $(LIBNR) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSX) $(IRTEUSXOBJS) $(IMPLIB) + $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSX) $(IRTEUSXOBJS) $(IMPLIB) $(LIBIRTEUSIMG): $(INSTALLLIBDIR)/jpegmemcd.$(LSFX) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(LIBNR) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSIMG) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(IMPLIB) $(IMPLIBIMG) + $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSIMG) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(IMPLIB) $(IMPLIBIMG) $(LIBIRTEUSGL): $(IRTEUSGLOBJS) $(IRTGLCOBJECTS) $(LIBNR) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSGL) $(IRTEUSGLOBJS) $(IRTGLCOBJECTS) $(IMPLIB) + $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSGL) $(IRTEUSGLOBJS) $(IRTGLCOBJECTS) $(IMPLIB) $(filter-out $(INSTALLOBJDIR)/pgsql.o $(INSTALLOBJDIR)/time.o,$(IRTEUSOBJS)): $(INSTALLOBJDIR)/%.o: %.l compile_irt.l @[ compile_irt.l -nt $< ] && (set -x; rm -f $(IRTEUSOBJS)) || echo "if compile_irt.l is older then target, so do not remove existing target object" @@ -223,7 +223,7 @@ PQP/$(ARCHDIR)/libPQP-static.a: make -C PQP $(LIBNR): $(NROBJECTS) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBNR) $(NROBJECTS) + $(CC) $(SOFLAGS) $(OUTOPT)$(LIBNR) $(NROBJECTS) $(INSTALLBINDIR)/irteusg$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSIMG) make-link install-irtext.l (cd $(INSTALLBINDIR); ln -sf eusg$(ESFX) irteusg$(ESFX)) diff --git a/irteus/Makefile.Cygwin b/irteus/Makefile.Cygwin index d53033b2..24c864d0 100644 --- a/irteus/Makefile.Cygwin +++ b/irteus/Makefile.Cygwin @@ -41,9 +41,8 @@ ### ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### -CC=gcc -CXX=g++ -LD=g++ -shared +CC ?= gcc +CXX ?= g++ OBJOPT=-o OUTOPT=-o OSFX=o @@ -52,7 +51,7 @@ LPFX=lib ARCH=Cygwin ESFX=.exe #SOFLAGS=-g -falign-functions=4 -Wl,--export-all-symbols -Wl,--unresolved-symbols=ignore-all -Wl,--stack,5000000 -SOFLAGS=-g -falign-functions=4 -Wl,--export-all-symbols +SOFLAGS=-shared -g -falign-functions=4 -Wl,--export-all-symbols IMPLIB=$(EUSDIR)/$(ARCH)/bin/eusgl.a $(EUSDIR)/$(ARCH)/lib/libnr.$(LSFX) IMPLIBGL=$(EUSDIR)/$(ARCH)/bin/eusgl.a -L/usr/X11R6/lib -lGLU -lGL -lXext IMPLIBIMG=-ljpeg -lpng diff --git a/irteus/Makefile.Darwin b/irteus/Makefile.Darwin index 88500026..8360b419 100644 --- a/irteus/Makefile.Darwin +++ b/irteus/Makefile.Darwin @@ -41,16 +41,15 @@ ### ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### -CC=gcc -CXX=gcc -LD=g++ -dynamiclib -flat_namespace -undefined suppress +CC ?= gcc +CXX ?= g++ OBJOPT=-o OUTOPT=-o OSFX=o LSFX=so LPFX=lib ESFX= -SOFLAGS=-g -falign-functions=8 +SOFLAGS=-dynamiclib -flat_namespace -undefined suppress -g -falign-functions=8 IMPLIB=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext IMPLIBIMG=-L/opt/local/lib/jpeg6b/lib -ljpeg -L/opt/local/lib -lpng diff --git a/irteus/Makefile.Linux b/irteus/Makefile.Linux index ff236acc..b5544295 100644 --- a/irteus/Makefile.Linux +++ b/irteus/Makefile.Linux @@ -41,9 +41,8 @@ ### ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### -CC=gcc -CXX=g++ -LD=g++ -shared +CC ?= gcc +CXX ?= g++ OBJOPT=-o OUTOPT=-o OSFX=o @@ -52,7 +51,7 @@ LPFX=lib ARCH=Linux ESFX= #SOFLAGS=-g -falign-functions=4 -Xlinker --export-all-symbols --unresolved-symbols=ignore-all -SOFLAGS=-g -falign-functions=4 -Xlinker --unresolved-symbols=ignore-all +SOFLAGS=-shared -g -falign-functions=4 -Xlinker --unresolved-symbols=ignore-all IMPLIB=-L$(EUSDIR)/$(ARCH)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCH)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext IMPLIBIMG=-ljpeg -lpng @@ -75,5 +74,4 @@ CXXFLAGS+=-g -falign-functions=4 ifeq ($(shell /bin/uname -m), x86_64) CC += -m32 CXX += -m32 -LD += -m32 endif diff --git a/irteus/Makefile.Linux64 b/irteus/Makefile.Linux64 index 7d68934f..c4f1b0df 100644 --- a/irteus/Makefile.Linux64 +++ b/irteus/Makefile.Linux64 @@ -41,16 +41,15 @@ ### ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### -CC=gcc -CXX=g++ -LD=g++ -shared +CC ?= gcc +CXX ?= g++ OBJOPT=-o OUTOPT=-o OSFX=o LSFX=so LPFX=lib ESFX= -SOFLAGS=-g -falign-functions=8 -Xlinker --unresolved-symbols=ignore-all +SOFLAGS=-shared -g -falign-functions=8 -Xlinker --unresolved-symbols=ignore-all IMPLIB=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext IMPLIBIMG=-ljpeg -lpng diff --git a/irteus/Makefile.LinuxARM b/irteus/Makefile.LinuxARM index 8b04f2f4..c3ca4139 100644 --- a/irteus/Makefile.LinuxARM +++ b/irteus/Makefile.LinuxARM @@ -41,9 +41,8 @@ ### ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### -CC=gcc -CXX=g++ -LD=g++ -shared +CC ?= gcc +CXX ?= g++ OBJOPT=-o OUTOPT=-o OSFX=o @@ -52,7 +51,7 @@ LPFX=lib ARCH=LinuxARM ESFX= #SOFLAGS=-g -falign-functions=4 -Xlinker --export-all-symbols --unresolved-symbols=ignore-all -SOFLAGS=-g -falign-functions=4 -Xlinker --unresolved-symbols=ignore-all +SOFLAGS=-shared -g -falign-functions=4 -Xlinker --unresolved-symbols=ignore-all IMPLIB=-L$(EUSDIR)/$(ARCH)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCH)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext IMPLIBIMG=-ljpeg -lpng From ec22631e2a3a0731ff42269ad7e95aaf00b08180 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 1 May 2022 16:39:45 +0900 Subject: [PATCH 12/18] irteus/PQP: cleanup Makfile, use CXX for cross compile --- irteus/PQP/Makefile | 8 ++++---- irteus/PQP/Makefile.Cygwin | 7 +++---- irteus/PQP/Makefile.Darwin | 5 ++--- irteus/PQP/Makefile.Linux | 5 ++--- irteus/PQP/Makefile.Linux64 | 5 ++--- irteus/PQP/Makefile.LinuxARM | 5 ++--- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/irteus/PQP/Makefile b/irteus/PQP/Makefile index 46064a3d..7ab150e5 100644 --- a/irteus/PQP/Makefile +++ b/irteus/PQP/Makefile @@ -2,8 +2,8 @@ include Makefile.$(ARCHDIR) PQPDIR = src -CFLAGS = -I. -I.. -D$(ARCHDIR) -LDFLAGS = -L. -L.. +CFLAGS += -I. -I.. -D$(ARCHDIR) +LDFLAGS += -L. -L.. .SUFFIXES: .cpp @@ -29,13 +29,13 @@ library: $(ARCHDIR)/$(LPFX)PQP.$(LSFX) \ $(ARCHDIR)/$(LPFX)PQP-static.a $(ARCHDIR)/$(LPFX)PQP.$(LSFX): $(OBJECTS) - $(LD) $(SOFLAGS) $(OUTOPT)$(ARCHDIR)/$(LPFX)PQP.$(LSFX) $(OBJECTS) + $(CXX) $(SOFLAGS) $(OUTOPT)$(ARCHDIR)/$(LPFX)PQP.$(LSFX) $(OBJECTS) $(ARCHDIR)/$(LPFX)PQP-static.a: $(OBJECTS) $(AR) $(ARFLAGS) $@ $(OBJECTS) $(OBJECTS): - $(CC) $(CFLAGS) -DCOMPILE_LIB -c $(PQPDIR)/$(*F).cpp $(OBJOPT)$@ + $(CXX) $(CFLAGS) -DCOMPILE_LIB -c $(PQPDIR)/$(*F).cpp $(OBJOPT)$@ clean: rm -f $(CLEAN) diff --git a/irteus/PQP/Makefile.Cygwin b/irteus/PQP/Makefile.Cygwin index 95ca8a1c..cf237b40 100755 --- a/irteus/PQP/Makefile.Cygwin +++ b/irteus/PQP/Makefile.Cygwin @@ -1,9 +1,8 @@ -CC = c++ -O2 -falign-functions=4 +CXX ?= c++ +CFLAGS = -O2 -falign-functions=4 OBJOPT = -o OUTOPT = -o -LD = c++ -shared -falign-functions=4 -EXELD = c++ -falign-functions=4 -SOFLAGS = +SOFLAGS = -shared -falign-functions=4 EXESFX = .exe LSFX = dll LPFX = lib diff --git a/irteus/PQP/Makefile.Darwin b/irteus/PQP/Makefile.Darwin index 153873ee..756cf288 100644 --- a/irteus/PQP/Makefile.Darwin +++ b/irteus/PQP/Makefile.Darwin @@ -1,9 +1,8 @@ -CC = c++ -O2 -falign-functions=8 -fPIC +CXX ?= c++ +CFLAGS = -O2 -falign-functions=8 -fPIC OBJOPT = -o OUTOPT = -o -LD = c++ SOFLAGS = -dynamiclib -flat_namespace -undefined suppress -EXELD = c++ EXESFX = LSFX = so LPFX = lib diff --git a/irteus/PQP/Makefile.Linux b/irteus/PQP/Makefile.Linux index 3c1efcc8..0e98f080 100644 --- a/irteus/PQP/Makefile.Linux +++ b/irteus/PQP/Makefile.Linux @@ -1,9 +1,8 @@ -CC = c++ -O2 +CXX ?= c++ +CFLAGS = -O2 OBJOPT = -o OUTOPT = -o -LD = c++ SOFLAGS = -shared -EXELD = c++ EXESFX = LSFX = so LPFX = lib diff --git a/irteus/PQP/Makefile.Linux64 b/irteus/PQP/Makefile.Linux64 index 6f1b6827..89f0d936 100644 --- a/irteus/PQP/Makefile.Linux64 +++ b/irteus/PQP/Makefile.Linux64 @@ -1,9 +1,8 @@ -CC = c++ -O2 -falign-functions=8 -fPIC +CXX ?= c++ +CFLAGS = -O2 -falign-functions=8 -fPIC OBJOPT = -o OUTOPT = -o -LD = c++ SOFLAGS = -shared -EXELD = c++ EXESFX = LSFX = so LPFX = lib diff --git a/irteus/PQP/Makefile.LinuxARM b/irteus/PQP/Makefile.LinuxARM index 85efe19a..8213759c 100644 --- a/irteus/PQP/Makefile.LinuxARM +++ b/irteus/PQP/Makefile.LinuxARM @@ -1,9 +1,8 @@ -CC = c++ -O2 -fPIC +CXX ?= c++ +CFLAGS = -O2 -fPIC OBJOPT = -o OUTOPT = -o -LD = c++ SOFLAGS = -shared -EXELD = c++ EXESFX = LSFX = so LPFX = lib From 4c310e884affb4ba714d9a59d56d9cbed8f0b4f2 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 1 May 2022 16:40:33 +0900 Subject: [PATCH 13/18] irteus: cleanup Makefile, check if JPEG/PQP installed --- irteus/Makefile | 25 ++++++++++++++++++++----- irteus/Makefile.Cygwin | 7 ++++++- irteus/Makefile.Darwin | 7 ++++++- irteus/Makefile.Linux | 7 ++++++- irteus/Makefile.Linux64 | 7 ++++++- irteus/Makefile.LinuxARM | 7 ++++++- 6 files changed, 50 insertions(+), 10 deletions(-) diff --git a/irteus/Makefile b/irteus/Makefile index 8c3e4523..29e9fb2e 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -41,8 +41,6 @@ ### ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### -include ./Makefile.$(ARCHDIR) - # directory where this package install object file to IRTEUSDIR=$(EUSDIR) INSTALLBINDIR=$(IRTEUSDIR)/$(ARCHDIR)/bin @@ -69,6 +67,14 @@ else endif $(info "-- HAVE_PQP = ${HAVE_PQP}") + +HAVE_JPEG=$(shell echo "\#include \n\#include \"jpeglib.h\"\n\#include \"jconfig.h\"\n" > test-jpeg.c; $(CC) -c test-jpeg.c > /dev/null 2>&1 && echo 1 || echo 0) +$(info "-- HAVE_JPEG = ${HAVE_JPEG}") +HAVE_PNG=$(shell echo "\#include \nint main(){png_create_read_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);;}\n" > test-png.c; $(CC) test-png.c -lpng > /dev/null 2>&1 && echo 1 || echo 0) +$(info "-- HAVE_PNG = ${HAVE_PNG}") + +include ./Makefile.$(ARCHDIR) + # common WFLAGS= #-Wall @@ -94,7 +100,14 @@ EUSLIB_MODULES.L=$(addprefix $(EUSDIR)/lib/,$(MODULES.L)) IRTEUS=irtmath irtutil irtgraph gnuplotlib pgsql time IRTEUSG=irtgeo pqp bullet irtcollision irtscene irtmodel irtsensor irtdyna irtrobot irtbvh irtcollada irtpointcloud irtstl irtwrl IRTEUSX=irtx -IRTEUSIMG=irtimage eusjpeg png +IRTEUSIMG=irtimage +ifeq ($(HAVE_JPEG), 1) + IRTEUSIMG+=eusjpeg + JPEGMEMCD=$(INSTALLLIBDIR)/jpegmemcd.$(LSFX) +endif +ifeq ($(HAVE_PNG), 1) + IRTEUSIMG+=png +endif IRTEUSGL=irtgl irtglrgb irtviewer NR=nr @@ -149,7 +162,9 @@ IRTEUSGL_L=$(addsuffix .l,$(IRTEUSGL)) IRTCOBJECTS=$(INSTALLOBJDIR)/irtc.$(OSFX) $(INSTALLOBJDIR)/irtgeoc.$(OSFX) IRTGCOBJECTS=$(INSTALLOBJDIR)/CPQP.$(OSFX) $(INSTALLOBJDIR)/euspqp.$(OSFX) $(INSTALLOBJDIR)/CBULLET.$(OSFX) $(INSTALLOBJDIR)/eusbullet.$(OSFX) -IRTIMGCOBJECTS=$(INSTALLOBJDIR)/euspng.$(OSFX) +ifeq ($(HAVE_PNG), 1) + IRTIMGCOBJECTS=$(INSTALLOBJDIR)/euspng.$(OSFX) +endif IRTGLCOBJECTS=$(INSTALLOBJDIR)/irtglc.$(OSFX) NROBJECTS=$(INSTALLOBJDIR)/nr.$(OSFX) @@ -177,7 +192,7 @@ $(LIBIRTEUSG): $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(LIBNR) $(PQPLIBSTATIC) $(LIBIRTEUSX): $(IRTEUSXOBJS) $(LIBNR) $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSX) $(IRTEUSXOBJS) $(IMPLIB) -$(LIBIRTEUSIMG): $(INSTALLLIBDIR)/jpegmemcd.$(LSFX) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(LIBNR) +$(LIBIRTEUSIMG): $(JPEGMEMCD) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(LIBNR) $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSIMG) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(IMPLIB) $(IMPLIBIMG) $(LIBIRTEUSGL): $(IRTEUSGLOBJS) $(IRTGLCOBJECTS) $(LIBNR) diff --git a/irteus/Makefile.Cygwin b/irteus/Makefile.Cygwin index 24c864d0..e302a394 100644 --- a/irteus/Makefile.Cygwin +++ b/irteus/Makefile.Cygwin @@ -54,7 +54,12 @@ ESFX=.exe SOFLAGS=-shared -g -falign-functions=4 -Wl,--export-all-symbols IMPLIB=$(EUSDIR)/$(ARCH)/bin/eusgl.a $(EUSDIR)/$(ARCH)/lib/libnr.$(LSFX) IMPLIBGL=$(EUSDIR)/$(ARCH)/bin/eusgl.a -L/usr/X11R6/lib -lGLU -lGL -lXext -IMPLIBIMG=-ljpeg -lpng +ifeq ($(HAVE_JPEG), 1) + IMPLIBIMG+=-ljpeg +endif +ifeq ($(HAVE_PNG), 1) + IMPLIBIMG+=-lpng +endif EXPLIB= RAPID=-LRAPID/$(ARCHDIR) -lRAPID-static RAPIDLIB=RAPID/$(ARCHDIR)/$(LPFX)RAPID-static.a diff --git a/irteus/Makefile.Darwin b/irteus/Makefile.Darwin index 8360b419..d995ef89 100644 --- a/irteus/Makefile.Darwin +++ b/irteus/Makefile.Darwin @@ -52,7 +52,12 @@ ESFX= SOFLAGS=-dynamiclib -flat_namespace -undefined suppress -g -falign-functions=8 IMPLIB=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext -IMPLIBIMG=-L/opt/local/lib/jpeg6b/lib -ljpeg -L/opt/local/lib -lpng +ifeq ($(HAVE_JPEG), 1) + IMPLIBIMG+=-L/opt/local/lib/jpeg6b/lib -ljpeg +endif +ifeq ($(HAVE_PNG), 1) + IMPLIBIMG+=-L/opt/local/lib -lpng +endif EXPLIB= RAPID=-LRAPID/$(ARCHDIR) -lRAPID-static RAPIDLIB=RAPID/$(ARCHDIR)/$(LPFX)RAPID-static.a diff --git a/irteus/Makefile.Linux b/irteus/Makefile.Linux index b5544295..9a575830 100644 --- a/irteus/Makefile.Linux +++ b/irteus/Makefile.Linux @@ -54,7 +54,12 @@ ESFX= SOFLAGS=-shared -g -falign-functions=4 -Xlinker --unresolved-symbols=ignore-all IMPLIB=-L$(EUSDIR)/$(ARCH)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCH)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext -IMPLIBIMG=-ljpeg -lpng +ifeq ($(HAVE_JPEG), 1) + IMPLIBIMG+=-ljpeg +endif +ifeq ($(HAVE_PNG), 1) + IMPLIBIMG+=-lpng +endif EXPLIB= RAPID=-LRAPID/$(ARCHDIR) -lRAPID-static RAPIDLIB=RAPID/$(ARCHDIR)/$(LPFX)RAPID-static.a diff --git a/irteus/Makefile.Linux64 b/irteus/Makefile.Linux64 index c4f1b0df..f9aacd02 100644 --- a/irteus/Makefile.Linux64 +++ b/irteus/Makefile.Linux64 @@ -52,7 +52,12 @@ ESFX= SOFLAGS=-shared -g -falign-functions=8 -Xlinker --unresolved-symbols=ignore-all IMPLIB=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCHDIR)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext -IMPLIBIMG=-ljpeg -lpng +ifeq ($(HAVE_JPEG), 1) + IMPLIBIMG+=-ljpeg +endif +ifeq ($(HAVE_PNG), 1) + IMPLIBIMG+=-lpng +endif EXPLIB= RAPID=-LRAPID/$(ARCHDIR) -lRAPID-static RAPIDLIB=RAPID/$(ARCHDIR)/$(LPFX)RAPID-static.a diff --git a/irteus/Makefile.LinuxARM b/irteus/Makefile.LinuxARM index c3ca4139..5eb12220 100644 --- a/irteus/Makefile.LinuxARM +++ b/irteus/Makefile.LinuxARM @@ -54,7 +54,12 @@ ESFX= SOFLAGS=-shared -g -falign-functions=4 -Xlinker --unresolved-symbols=ignore-all IMPLIB=-L$(EUSDIR)/$(ARCH)/lib -leusgeo -L$(INSTALLLIBDIR) -lnr IMPLIBGL=-L$(EUSDIR)/$(ARCH)/lib -leusgl -L/usr/X11R6/lib -lGLU -lGL -lXext -IMPLIBIMG=-ljpeg -lpng +ifeq ($(HAVE_JPEG), 1) + IMPLIBIMG+=-ljpeg +endif +ifeq ($(HAVE_PNG), 1) + IMPLIBIMG+=-lpng +endif EXPLIB= RAPID=-LRAPID/$(ARCHDIR) -lRAPID-static RAPIDLIB=RAPID/$(ARCHDIR)/$(LPFX)RAPID-static.a From ecb523650d5ae1fbedab52770e82bdc83e8ecb16 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 1 May 2022 16:48:45 +0900 Subject: [PATCH 14/18] .github/workspace/config.yml: add test to check cross compile --- .github/workflows/config.yml | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 7302079d..06119c7e 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -102,6 +102,71 @@ jobs: source bashrc.eus export EXIT_STATUS=0; for test_l in irteus/test/*.l; do irteusg $test_l; export TMP_EXIT_STATUS=$?; export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`; done; [ $EXIT_STATUS == 0 ] || exit 1 + # test for cross sompile + linux-nox-crosscompile: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Clone Euslisp and Setup environmnet + shell: bash + run: | + set -xe + git clone --branch support_nonx https://github.com/euslisp/EusLisp eus + sudo apt update -y -qq + # remove unused packages + sudo dpkg -r --force-depends nginx || echo "OK" + sudo apt purge -y -qq build-essential gcc-9 gcc-10 || echo "OK" + sudo apt purge -y -qq libldap-* || echo "OK" + sudo apt purge -y -qq libx11* x11* libgl1* libglx* || echo "OK" + sudo apt autoremove -y -qq || echo "OK" + # install deb environment + sudo apt install -y -qq make binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user-static + exit 0 + - name: Check environmnet + shell: bash + run: | + set -xe + dpkg --get-selections | egrep -e '(cc|ld)' || echo "OK" ## show selected X/GL + dpkg --get-selections | egrep -e '(libpq|jpeg|png)' || echo "OK" ## show selected X/GL + dpkg --get-selections | egrep -e '(x11|gl)' || echo "OK" ## show selected X/GL + #dpkg --get-selections | egrep -q -e '(x11|gl)' && exit 1 ## exit 1, when X/GL found + exit 0 + - name: Compile irteusg + shell: bash + run: | + set -xe + export TOPDIR=$(pwd) + export EUSDIR=$(pwd)/eus + export ARCHDIR=LinuxARM + export PATH=$EUSDIR/$ARCHDIR/bin:$EUSDIR/$ARCHDIR/lib:$PATH + export LD_LIBRARY_PATH=$EUSDIR/$ARCHDIR/lib:$EUSDIR/$ARCHDIR/bin:$LD_LIBRARY_PATH + export CC=aarch64-linux-gnu-gcc + export LD=aarch64-linux-gnu-ld + export AR=aarch64-linux-gnu-ar + export CXX=aarch64-linux-gnu-g++ + export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/ + cd $EUSDIR/lisp + ln -sf Makefile.Linux Makefile + CC=$CC LD=$LD make eus0 eus1 eus2 eusg + (cd $EUSDIR//test; CXX=$CXX make) + cd $TOPDIR/irteus + ARCHDIR=$ARCHDIR CC=$CC LD=$LD AR=$AR CXX=$CXX make irteusg + - name: Run test + shell: bash + run: | + sed -i 's/(send x:\*root\* :size)/#f\(1000\)/' eus/models/irt-all-*.l + sed -i '/\(send self :def-gl-vertices\)/ s/^/;/' eus/models/*.l + sed -i '/\(send self :make-collision-model-for-links\)/ s/^/;/' eus/models/*.l + export EUSDIR=$(pwd)/eus + export ARCHDIR=LinuxARM + export PATH=$EUSDIR/$ARCHDIR/bin:$EUSDIR/$ARCHDIR/lib:$PATH + export LD_LIBRARY_PATH=$EUSDIR/$ARCHDIR/lib:$EUSDIR/$ARCHDIR/bin:$LD_LIBRARY_PATH + export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/ + set -xe + export EXIT_STATUS=0; for test_l in irteus/test/*.l; do irteusg $test_l; export TMP_EXIT_STATUS=$?; export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`; done; [ $EXIT_STATUS == 0 ] || exit 1 + # doc: # runs-on: ubuntu-latest # timeout-minutes: 60 From 908a59497ff5b5e297c02263aebf97f2da5ac91e Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 2 May 2022 20:31:37 +0900 Subject: [PATCH 15/18] irteus/Maekfile: update HAVE_BULLET logic, check with compile, for cross compile environment --- irteus/Makefile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/irteus/Makefile b/irteus/Makefile index 29e9fb2e..377699b7 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -48,16 +48,7 @@ INSTALLOBJDIR=$(IRTEUSDIR)/$(ARCHDIR)/obj INSTALLLIBDIR=$(IRTEUSDIR)/$(ARCHDIR)/lib # check bullet version -BULLET_VER_MAJOR:=$(shell pkg-config bullet --modversion --silence-errors | cut -f1 -d.) -BULLET_VER_MINOR:=$(shell pkg-config bullet --modversion --silence-errors | cut -f2 -d.) -ifneq ($(and $(BULLET_VER_MAJOR),$(BULLET_VER_MINOR)),) - BULLET_GE_2_83=$(shell [ $(BULLET_VER_MAJOR) -gt 2 -o \( $(BULLET_VER_MAJOR) -eq 2 -a $(BULLET_VER_MINOR) -ge 83 \) ] && echo true) -endif -ifeq ($(BULLET_GE_2_83), true) - HAVE_BULLET=1 -else - HAVE_BULLET=0 -endif +HAVE_BULLET=$(shell echo "\#include \n\#include \nint main(){}" > test-bullet.c; $(CXX) -I/usr/include/bullet $(pkg-config bullet --cflags) test-bullet.c -lBulletCollision -lLinearMath $(pkg-config bullet --libs) > /dev/null 2>&1 && echo 1 || echo 0) $(info "-- HAVE_BULLET = ${HAVE_BULLET}") ifneq ($(wildcard PQP/*),) From d808a80c53291cb79b929ecb0f341e0cf2457445 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 2 May 2022 20:38:13 +0900 Subject: [PATCH 16/18] irteus/Makefile: check if /usr/lib/$(shell $(CC) -dumpmachine)/libpq.so exists, to compile pgsql.l --- irteus/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/irteus/Makefile b/irteus/Makefile index 377699b7..63840c17 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -88,7 +88,10 @@ endif MODULES.L=irt_modules.l EUSLIB_MODULES.L=$(addprefix $(EUSDIR)/lib/,$(MODULES.L)) -IRTEUS=irtmath irtutil irtgraph gnuplotlib pgsql time +IRTEUS=irtmath irtutil irtgraph gnuplotlib time +ifneq (,$(wildcard /usr/lib/$(shell $(CC) -dumpmachine)/libpq.so)) # if /usr/lib/x86_64-linux-gnu/libpq.so exists, use pgsql +IRTEUS+=pgsql +endif IRTEUSG=irtgeo pqp bullet irtcollision irtscene irtmodel irtsensor irtdyna irtrobot irtbvh irtcollada irtpointcloud irtstl irtwrl IRTEUSX=irtx IRTEUSIMG=irtimage From cf5c59f628d3c2bf283e27ee2ef56d8ec698eacd Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 2 May 2022 21:27:44 +0900 Subject: [PATCH 17/18] .github/workflows/config.yml: linux-nox-crosscompile: skip some tests. --- .github/workflows/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 06119c7e..48b687f5 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -165,7 +165,7 @@ jobs: export LD_LIBRARY_PATH=$EUSDIR/$ARCHDIR/lib:$EUSDIR/$ARCHDIR/bin:$LD_LIBRARY_PATH export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/ set -xe - export EXIT_STATUS=0; for test_l in irteus/test/*.l; do irteusg $test_l; export TMP_EXIT_STATUS=$?; export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`; done; [ $EXIT_STATUS == 0 ] || exit 1 + export EXIT_STATUS=0; for test_l in irteus/test/*.l; do [[ $test_l =~ all-robots-objects.l|irteus-demo.l|matrix.l|rendering.l|test-collision.l|test-irt-motion.l ]] && continue; irteusg $test_l; export TMP_EXIT_STATUS=$?; export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`; done; [ $EXIT_STATUS == 0 ] || exit 1 # doc: # runs-on: ubuntu-latest From 3be26479252f606476b8e4b3234c95bb822a8556 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 22 May 2022 21:32:55 +0900 Subject: [PATCH 18/18] irteus/Makefile: compile irteus{x,gl} only if eus{x,gl} exists. --- irteus/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/irteus/Makefile b/irteus/Makefile index 63840c17..37b33fbc 100644 --- a/irteus/Makefile +++ b/irteus/Makefile @@ -162,7 +162,15 @@ endif IRTGLCOBJECTS=$(INSTALLOBJDIR)/irtglc.$(OSFX) NROBJECTS=$(INSTALLOBJDIR)/nr.$(OSFX) -all: irteusg irteusx irteusgl +ifneq (,$(wildcard $(BINDIR)/eusgl)) + IRTEUS_COMPILE_TARGET=irteusg irteusx irteusgl +else ifneq (,$(wildcard $(BINDIR)/eusx)) + IRTEUS_COMPILE_TARGET=irteusg irteusx +else + IRTEUS_COMPILE_TARGET=irteusg +endif +$(info "Compile irteus with ${IRTEUS_COMPILE_TARGET}") +all: ${IRTEUS_COMPILE_TARGET} irteusg: $(INSTALLBINDIR)/irteusg$(ESFX) irteusx: $(INSTALLBINDIR)/irteusx$(ESFX)