Merge pull request #1793 from jslee02/fix_build_clang6

Fix build errors with Clang 6 (also resolve #1510)
This commit is contained in:
erwincoumans 2018-07-19 09:20:42 +02:00 committed by GitHub
commit c254768d1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 129 additions and 36 deletions

7
.ci/docker/env.list Normal file
View File

@ -0,0 +1,7 @@
TRAVIS_OS_NAME
TRAVIS_PULL_REQUEST
BUILD_NAME
CC
CXX
SUDO

18
.ci/docker/ubuntu-bionic Normal file
View File

@ -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

17
.ci/docker/ubuntu-xenial Normal file
View File

@ -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

30
.ci/script.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
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
$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

View File

@ -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

View File

@ -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})

View File

@ -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)

View File

@ -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)