From 3d1cd749b497e84d04a024067c457a5911989c4b Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 9 Jul 2018 21:57:57 -0700 Subject: [PATCH 1/5] Add Travis CI settings for Xenial and Bionic --- .ci/docker/env.list | 7 ++++ .ci/docker/ubuntu-bionic | 18 +++++++++ .ci/docker/ubuntu-xenial | 17 ++++++++ .ci/script.sh | 29 ++++++++++++++ .travis.yml | 87 +++++++++++++++++++++++++--------------- CMakeLists.txt | 2 +- 6 files changed, 126 insertions(+), 34 deletions(-) create mode 100644 .ci/docker/env.list create mode 100644 .ci/docker/ubuntu-bionic create mode 100644 .ci/docker/ubuntu-xenial create mode 100755 .ci/script.sh diff --git a/.ci/docker/env.list b/.ci/docker/env.list new file mode 100644 index 000000000..77dcd5baa --- /dev/null +++ b/.ci/docker/env.list @@ -0,0 +1,7 @@ +TRAVIS_OS_NAME +TRAVIS_PULL_REQUEST + +BUILD_NAME +CC +CXX +SUDO diff --git a/.ci/docker/ubuntu-bionic b/.ci/docker/ubuntu-bionic new file mode 100644 index 000000000..b7643438e --- /dev/null +++ b/.ci/docker/ubuntu-bionic @@ -0,0 +1,18 @@ +FROM ubuntu:bionic + +RUN apt-get update -qq +RUN apt-get install -y \ + build-essential \ + clang \ + cmake \ + curl \ + git \ + libgl-dev \ + libglu-dev \ + libpython3-dev \ + lsb-release \ + pkg-config \ + python3 \ + python3-distutils \ + software-properties-common \ + sudo diff --git a/.ci/docker/ubuntu-xenial b/.ci/docker/ubuntu-xenial new file mode 100644 index 000000000..693e8a1fd --- /dev/null +++ b/.ci/docker/ubuntu-xenial @@ -0,0 +1,17 @@ +FROM ubuntu:xenial + +RUN apt-get update -qq +RUN apt-get install -y \ + build-essential \ + clang \ + cmake \ + curl \ + git \ + libgl-dev \ + libglu-dev \ + libpython3-dev \ + lsb-release \ + pkg-config \ + python3 \ + software-properties-common \ + sudo diff --git a/.ci/script.sh b/.ci/script.sh new file mode 100755 index 000000000..0e67bf9f2 --- /dev/null +++ b/.ci/script.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -ex + +echo "CXX="$CXX +echo "CC="$CC +if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then + $SUDO apt-get install -y python3 + $SUDO apt-get install -y python3-pip + $SUDO pip3 install -U wheel + $SUDO pip3 install -U setuptools + $SUDO python3 setup.py install + python3 examples/pybullet/unittests/unittests.py --verbose + python3 examples/pybullet/unittests/userDataTest.py --verbose + python3 examples/pybullet/unittests/saveRestoreStateTest.py --verbose +fi +cmake . -DBUILD_PYBULLET=ON -G"Unix Makefiles" #-DCMAKE_CXX_FLAGS=-Werror +make -j8 +ctest -j8 --output-on-failure + +# Build again with double precision +cmake . -G "Unix Makefiles" -DUSE_DOUBLE_PRECISION=ON #-DCMAKE_CXX_FLAGS=-Werror +make -j8 +ctest -j8 --output-on-failure + +# Build again with shared libraries +cmake . -G "Unix Makefiles" -DBUILD_SHARED_LIBS=ON +make -j8 +ctest -j8 --output-on-failure +$SUDO make install diff --git a/.travis.yml b/.travis.yml index c93c1d2ce..fbaf6d90f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,56 @@ language: cpp -os: - - linux - - osx -compiler: - - gcc - - clang -addons: - apt: - packages: - - python3 - - +matrix: + include: + - os: linux + compiler: gcc + env: + - BUILD_NAME=TRUSTY_GCC + - SUDO=sudo + - os: linux + compiler: clang + env: + - BUILD_NAME=TRUSTY_CLANG + - SUDO=sudo + - os: linux + compiler: gcc + env: + - BUILD_NAME=XENIAL_GCC + - DOCKER_FILE="ubuntu-xenial" + services: docker + - os: linux + compiler: clang + env: + - BUILD_NAME=XENIAL_CLANG + - DOCKER_FILE="ubuntu-xenial" + services: docker + - os: linux + compiler: gcc + env: + - BUILD_NAME=BIONIC_GCC + - DOCKER_FILE="ubuntu-bionic" + services: docker + - os: linux + compiler: clang + env: + - BUILD_NAME=BIONIC_CLANG + - DOCKER_FILE="ubuntu-bionic" + services: docker + - os: osx + compiler: gcc + env: + - BUILD_NAME=OSX_GCC + - os: osx + compiler: clang + env: + - BUILD_NAME=OSX_CLANG +before_install: + - if [ -n "$DOCKER_FILE" ]; then + docker build -t "$DOCKER_FILE" -f ".ci/docker/$DOCKER_FILE" .; + docker run -itd -v $TRAVIS_BUILD_DIR:$TRAVIS_BUILD_DIR --env-file .ci/docker/env.list --name bullet-docker "$DOCKER_FILE"; + fi script: - - echo "CXX="$CXX - - echo "CC="$CC - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then sudo apt-get install python3-pip; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then sudo pip3 install -U pip wheel; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then sudo pip3 install setuptools; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then sudo python3 setup.py install; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then python3 examples/pybullet/unittests/unittests.py --verbose; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then python3 examples/pybullet/unittests/userDataTest.py --verbose; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then python3 examples/pybullet/unittests/saveRestoreStateTest.py --verbose; fi - - cmake . -DBUILD_PYBULLET=ON -G"Unix Makefiles" #-DCMAKE_CXX_FLAGS=-Werror - - make -j8 - - ctest -j8 --output-on-failure - # Build again with double precision - - cmake . -G "Unix Makefiles" -DUSE_DOUBLE_PRECISION=ON #-DCMAKE_CXX_FLAGS=-Werror - - make -j8 - - ctest -j8 --output-on-failure - # Build again with shared libraries - - cmake . -G "Unix Makefiles" -DBUILD_SHARED_LIBS=ON - - make -j8 - - ctest -j8 --output-on-failure - - sudo make install + - if [ -n "$DOCKER_FILE" ]; then + docker exec bullet-docker /bin/sh -c "cd $TRAVIS_BUILD_DIR && ./.ci/script.sh"; + else + '.ci/script.sh'; + fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a951d25a..728ac7608 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,7 +316,7 @@ IF(BUILD_PYBULLET) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build3/cmake ${CMAKE_MODULE_PATH}) OPTION(EXACT_PYTHON_VERSION "Require Python and match PYTHON_VERSION_PYBULLET exactly, e.g. 2.7.12" OFF) IF(EXACT_PYTHON_VERSION) - set(EXACT_PYTHON_VERSION_FLAG EXACT REQUIRED) + set(EXACT_PYTHON_VERSION_FLAG EXACT REQUIRED) ENDIF(EXACT_PYTHON_VERSION) # first find the python interpreter FIND_PACKAGE(PythonInterp ${PYTHON_VERSION_PYBULLET} ${EXACT_PYTHON_VERSION_FLAG}) From 6323309f892a64ddbb220bdceeb6345702210bf6 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 10 Jul 2018 09:20:00 -0700 Subject: [PATCH 2/5] Fix c++11-narrowing errors in multibody examples --- examples/MultiBody/InvertedPendulumPDControl.cpp | 2 +- examples/MultiBody/MultiBodyConstraintFeedback.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/MultiBody/InvertedPendulumPDControl.cpp b/examples/MultiBody/InvertedPendulumPDControl.cpp index d380929c4..f6277739b 100644 --- a/examples/MultiBody/InvertedPendulumPDControl.cpp +++ b/examples/MultiBody/InvertedPendulumPDControl.cpp @@ -268,7 +268,7 @@ btMultiBody* createInvertedPendulumMultiBody(btMultiBodyDynamicsWorld* world, GU btVector3 posr = local_origin[i+1]; // float pos[4]={posr.x(),posr.y(),posr.z(),1}; - float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; + const btScalar quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; btCollisionShape* shape =0; if (i==0) diff --git a/examples/MultiBody/MultiBodyConstraintFeedback.cpp b/examples/MultiBody/MultiBodyConstraintFeedback.cpp index c08d98f72..f4d959358 100644 --- a/examples/MultiBody/MultiBodyConstraintFeedback.cpp +++ b/examples/MultiBody/MultiBodyConstraintFeedback.cpp @@ -320,7 +320,7 @@ void MultiBodyConstraintFeedbackSetup::initPhysics() btVector3 posr = local_origin[i+1]; // float pos[4]={posr.x(),posr.y(),posr.z(),1}; - float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; + const btScalar quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; btCollisionShape* shape =0; if (i==0) From b3d863900496a8c5dc150adfa8ab21c48bbdd97c Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 10 Jul 2018 11:26:00 -0700 Subject: [PATCH 3/5] Run apt-get update before installing python3-pip --- .ci/script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/script.sh b/.ci/script.sh index 0e67bf9f2..7fff323bf 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -4,6 +4,7 @@ set -ex echo "CXX="$CXX echo "CC="$CC if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then + $SUDO apt-get update $SUDO apt-get install -y python3 $SUDO apt-get install -y python3-pip $SUDO pip3 install -U wheel From 8857638dedce4c10b68baf72909dd99fd9dc9821 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 18 Jul 2018 11:57:34 -0700 Subject: [PATCH 4/5] Revert C++ code changes to make the PR small --- examples/MultiBody/InvertedPendulumPDControl.cpp | 2 +- examples/MultiBody/MultiBodyConstraintFeedback.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/MultiBody/InvertedPendulumPDControl.cpp b/examples/MultiBody/InvertedPendulumPDControl.cpp index f6277739b..d380929c4 100644 --- a/examples/MultiBody/InvertedPendulumPDControl.cpp +++ b/examples/MultiBody/InvertedPendulumPDControl.cpp @@ -268,7 +268,7 @@ btMultiBody* createInvertedPendulumMultiBody(btMultiBodyDynamicsWorld* world, GU btVector3 posr = local_origin[i+1]; // float pos[4]={posr.x(),posr.y(),posr.z(),1}; - const btScalar quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; + float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; btCollisionShape* shape =0; if (i==0) diff --git a/examples/MultiBody/MultiBodyConstraintFeedback.cpp b/examples/MultiBody/MultiBodyConstraintFeedback.cpp index f4d959358..c08d98f72 100644 --- a/examples/MultiBody/MultiBodyConstraintFeedback.cpp +++ b/examples/MultiBody/MultiBodyConstraintFeedback.cpp @@ -320,7 +320,7 @@ void MultiBodyConstraintFeedbackSetup::initPhysics() btVector3 posr = local_origin[i+1]; // float pos[4]={posr.x(),posr.y(),posr.z(),1}; - const btScalar quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; + float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; btCollisionShape* shape =0; if (i==0) From 8b26945f8f4f098d86984c36d6cf71adfce86a1b Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 18 Jul 2018 12:02:36 -0700 Subject: [PATCH 5/5] Fix build errors with Clang 6 (also addresses #1510) --- examples/MultiBody/InvertedPendulumPDControl.cpp | 2 +- examples/MultiBody/MultiBodyConstraintFeedback.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/MultiBody/InvertedPendulumPDControl.cpp b/examples/MultiBody/InvertedPendulumPDControl.cpp index d380929c4..f6277739b 100644 --- a/examples/MultiBody/InvertedPendulumPDControl.cpp +++ b/examples/MultiBody/InvertedPendulumPDControl.cpp @@ -268,7 +268,7 @@ btMultiBody* createInvertedPendulumMultiBody(btMultiBodyDynamicsWorld* world, GU btVector3 posr = local_origin[i+1]; // float pos[4]={posr.x(),posr.y(),posr.z(),1}; - float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; + const btScalar quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; btCollisionShape* shape =0; if (i==0) diff --git a/examples/MultiBody/MultiBodyConstraintFeedback.cpp b/examples/MultiBody/MultiBodyConstraintFeedback.cpp index c08d98f72..f4d959358 100644 --- a/examples/MultiBody/MultiBodyConstraintFeedback.cpp +++ b/examples/MultiBody/MultiBodyConstraintFeedback.cpp @@ -320,7 +320,7 @@ void MultiBodyConstraintFeedbackSetup::initPhysics() btVector3 posr = local_origin[i+1]; // float pos[4]={posr.x(),posr.y(),posr.z(),1}; - float quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; + const btScalar quat[4]={-world_to_local[i+1].x(),-world_to_local[i+1].y(),-world_to_local[i+1].z(),world_to_local[i+1].w()}; btCollisionShape* shape =0; if (i==0)