diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 4efe55201..b9584a93a 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -8,49 +8,50 @@ 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" catkin: runs-on: ubuntu-18.04 @@ -121,56 +122,171 @@ jobs: catkin config --install catkin build -v -i --make-args VERBOSE=1 - doc: + # 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: | - 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) - + # 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 - osx: - runs-on: macos-latest + # test for cross sompile + linux-nox-crosscompile: + runs-on: ubuntu-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 + - 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: | - cd .github/workflows/ - brew config + 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: | - 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 + 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 [[ $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 + # 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) + + + # 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 diff --git a/irteus/Makefile b/irteus/Makefile index 51fed4ae7..495fec390 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 @@ -50,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/*),) @@ -69,6 +58,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 @@ -93,10 +90,20 @@ PNG_CFLAGS=`pkg-config libpng --cflags` 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 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 @@ -151,14 +158,27 @@ 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) -all: defun.h $(LIBNR) $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSX) $(LIBIRTEUSIMG) $(LIBIRTEUSGL) make-link install-irtext.l +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} -.PHONY: defun.h -defun.h: +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 echo "// redefine defun for update defun() API () https://github.com/euslisp/EusLisp/pull/116" > defun.h echo "#undef defun" >> defun.h @@ -166,44 +186,55 @@ defun.h: cat defun.h $(LIBIRTEUS): $(IRTEUSOBJS) $(IRTCOBJECTS) $(LIBNR) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUS) $(IRTEUSOBJS) \ + $(CXX) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUS) $(IRTEUSOBJS) \ $(IRTCOBJECTS) $(IMPLIB) -$(LIBIRTEUSG): $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(LIBNR) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBIRTEUSG) $(IRTEUSGOBJS) \ +$(LIBIRTEUSG): $(IRTEUSGOBJS) $(IRTGCOBJECTS) $(LIBNR) $(PQPLIBSTATIC) + $(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) +$(LIBIRTEUSIMG): $(JPEGMEMCD) $(IRTEUSIMGOBJS) $(IRTIMGCOBJECTS) $(LIBNR) + $(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) -$(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) - $(BINDIR)/eusgl$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtg.l > $(INSTALLOBJDIR)/compile_irtg.log +$(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)/eusg$(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) - $(BINDIR)/eusx$(ESFX) "(setq *objdir* \"$(INSTALLOBJDIR)/\")" < ./compile_irtimg.l > $(INSTALLOBJDIR)/compile_irtimg.log +$(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)/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)/eusg$(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) @@ -211,13 +242,18 @@ PQP/$(ARCHDIR)/libPQP-static.a: make -C PQP $(LIBNR): $(NROBJECTS) - $(LD) $(SOFLAGS) $(OUTOPT)$(LIBNR) $(NROBJECTS) + $(CC) $(SOFLAGS) $(OUTOPT)$(LIBNR) $(NROBJECTS) -BINS=$(BINDIR)/irteus$(ESFX) $(BINDIR)/irteusgl$(ESFX) -make-link: $(BINS) $(EUSDIR)/irteus -$(BINS): +$(INSTALLBINDIR)/irteusg$(ESFX): $(LIBIRTEUS) $(LIBIRTEUSG) $(LIBIRTEUSIMG) make-link install-irtext.l + (cd $(INSTALLBINDIR); ln -sf eusg$(ESFX) irteusg$(ESFX)) +$(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) $(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)) + +make-link: $(EUSDIR)/irteus + $(EUSDIR)/irteus: (cd $(IRTEUSDIR); ln -sf ../irteus irteus) @@ -237,45 +273,18 @@ 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 -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 $(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) diff --git a/irteus/Makefile.Cygwin b/irteus/Makefile.Cygwin index d53033b22..e302a3945 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,10 +51,15 @@ 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 +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 885000264..d995ef89d 100644 --- a/irteus/Makefile.Darwin +++ b/irteus/Makefile.Darwin @@ -41,19 +41,23 @@ ### 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 +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 ff236acc7..9a575830a 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,10 +51,15 @@ 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 +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 @@ -75,5 +79,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 7d68934fa..f9aacd026 100644 --- a/irteus/Makefile.Linux64 +++ b/irteus/Makefile.Linux64 @@ -41,19 +41,23 @@ ### 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 +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 8b04f2f4f..5eb122208 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,10 +51,15 @@ 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 +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/PQP/Makefile b/irteus/PQP/Makefile index 46064a3de..7ab150e5d 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 95ca8a1cc..cf237b40c 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 153873eeb..756cf288f 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 3c1efcc81..0e98f0809 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 6f1b6827c..89f0d9363 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 85efe19ae..8213759c1 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 diff --git a/irteus/demo/hanoi.l b/irteus/demo/hanoi.l index f09d02735..feb9aee5f 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 af389067e..e8036238a 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 17df00904..f7a0f35e7 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/irtext.l b/irteus/irtext.l index b21416881..90aba9f3a 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 () diff --git a/irteus/irtgeo.l b/irteus/irtgeo.l index 6cb9a1d88..51019bc12 100644 --- a/irteus/irtgeo.l +++ b/irteus/irtgeo.l @@ -813,6 +813,203 @@ (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)) + )) + ) + +;; 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/irtgl.l b/irteus/irtgl.l index e3e070338..3a6dd22b2 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 diff --git a/irteus/irtviewer.l b/irteus/irtviewer.l index 29f40782e..6d9e43670 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) diff --git a/irteus/test/all-robots-objects.l b/irteus/test/all-robots-objects.l index 9776868ad..49bffa917 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 12e50ebf4..a0337dc99 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 51d23e06a..219490988 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 dfb097c26..77448918b 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 5007ff1aa..c58fc6f34 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 6f062824c..8f4ac224a 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 a819e3cc9..850b85adc 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))