From a3c25a2be90828d85cd5c0e9c45e06c569a3169d Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 4 Apr 2019 11:47:25 +0900 Subject: [PATCH] Squashed '.travis/' changes from 2a03b5b..679949e 679949e Update Eigen 3.3 to 3.3.7 and add ps1 script e3853d4 Setup catkin workspace in common script 083fa2c Do not build dependencies in source dc8b946 Merge pull request #35 from bchretien/fix/osx-build 432f6b1 Fix OSX build (deprecated science repo) bad6dbd Allow to specify pybindgen install prefix 3f214dd Update pybindgen archive url f13ddca Use a common script for Eigen 3.2 and 3.3 0d26976 Add a script for Eigen 3.3 027bca4 Update Eigen 3.2 version to 3.2.10 629f539 ipopt: update to 3.12.6 87f7ee7 eigen: update to 3.2.9 a0c7e47 common.sh: fix OS X environment 811fbd6 Merge pull request #31 from francois-keith/dev4 4c8a74c Hard code the path to git.exe 8c1c5f5 Build in debug. 89d0b39 Add some intermediary checks. c2f4554 [AppVeyor] Add a method to run the unit tests. e59a441 Correct choco install. af4c533 Merge pull request #30 from jcarpent/master 00d90b0 Fix bug in common.sh 9da636c Merge pull request #29 from jcarpent/master dd15db5 Use CI_BRANCH instead of TRAVIS_BRANCH 448cc3f Set DO_*_ON_BRANCH to the current branch if they are not yet defined c5ed776 [Cppcheck] Do ccpcheck only on specified branches 3c52bd1 [Coverage] Do coverage only on specified branches git-subtree-dir: .travis git-subtree-split: 679949e28a91c334edf3588753cf294aec2fc4c7 --- after_success | 5 ++++- before_install | 6 +++--- build | 31 ++++++++++++++++++++----------- common.sh | 17 +++++++++++++++++ dependencies/eigen-3.2 | 23 +++-------------------- dependencies/eigen-3.3 | 8 ++++++++ dependencies/eigen-3.3.ps1 | 26 ++++++++++++++++++++++++++ dependencies/eigen-common.sh | 25 +++++++++++++++++++++++++ dependencies/ipopt | 2 +- dependencies/pybindgen-0.16 | 10 ++++++++-- functions.ps1 | 29 ++++++++++++++++++++++++----- 11 files changed, 139 insertions(+), 43 deletions(-) create mode 100755 dependencies/eigen-3.3 create mode 100644 dependencies/eigen-3.3.ps1 create mode 100755 dependencies/eigen-common.sh diff --git a/after_success b/after_success index f0a154a..90b9454 100755 --- a/after_success +++ b/after_success @@ -113,7 +113,10 @@ elif [[ ${CI_OS_NAME} = linux ]]; then exit 0 fi - generate_coverage_data + if [[ ";${DO_COVERAGE_ON_BRANCH};" == *";${CI_BRANCH};"* ]]; then + generate_coverage_data + fi + # If it's not a fork or a pull request if `test x${CI_REPO_SLUG} = x${GH_REPO} -a ${CI_PULL_REQUEST} = false`; then set_push_uri diff --git a/before_install b/before_install index eaa5c89..a5cec81 100755 --- a/before_install +++ b/before_install @@ -22,8 +22,6 @@ _linux_setup_package_source() _osx_setup_package_source() { - # Add science-related repos - brew tap homebrew/science # Update homebrew brew update } @@ -140,7 +138,9 @@ build_git_dependency() mkdir -p "$git_dep" $git_clone -b $git_dep_branch "$git_dep_uri" "$git_dep" cd "$git_dep" - cmake . -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" \ + mkdir -p build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" \ -DDISABLE_TESTS:BOOL=ON ${CMAKE_ADDITIONAL_OPTIONS} make install || make } diff --git a/build b/build index a451417..5208746 100755 --- a/build +++ b/build @@ -15,23 +15,32 @@ build_package() echo "--> Building package..." cd "$build_dir" - cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \ - -DCMAKE_CXX_FLAGS="--coverage" \ - -DCMAKE_EXE_LINKER_FLAGS="--coverage" \ - -DCMAKE_MODULE_LINKER_FLAGS="--coverage" \ - ${CMAKE_ADDITIONAL_OPTIONS} + + if [[ ";${DO_COVERAGE_ON_BRANCH};" == *";${CI_BRANCH};"* ]]; then + cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \ + -DCMAKE_CXX_FLAGS="--coverage" \ + -DCMAKE_EXE_LINKER_FLAGS="--coverage" \ + -DCMAKE_MODULE_LINKER_FLAGS="--coverage" \ + ${CMAKE_ADDITIONAL_OPTIONS} + else + cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \ + ${CMAKE_ADDITIONAL_OPTIONS} + fi + ${MAKE_PREFIX} make make install ALLOW_TESTSUITE_FAILURE=${ALLOW_TESTSUITE_FAILURE:-false} make test || ${ALLOW_TESTSUITE_FAILURE} - cppcheck --quiet --enable=all \ - -I $root_dir/src -I $root_dir/tests -I $root_dir/include \ - -I $root_dir/tests/shared-tests \ - -I $build_dir/include -I $install_dir/include \ - -i $build_dir/CMakeFiles \ - $root_dir || true + if [[ ";${DO_CPPCHECK_ON_BRANCH};" == *";${CI_BRANCH};"* ]]; then + cppcheck --quiet --enable=all \ + -I $root_dir/src -I $root_dir/tests -I $root_dir/include \ + -I $root_dir/tests/shared-tests \ + -I $build_dir/include -I $install_dir/include \ + -i $build_dir/CMakeFiles \ + $root_dir || true + fi } # debian_build_package diff --git a/common.sh b/common.sh index 746f640..ed4c8bf 100644 --- a/common.sh +++ b/common.sh @@ -148,6 +148,10 @@ _setup_ros() if [ -f /opt/ros/${ROS_DISTRO}/setup.sh ]; then . /opt/ros/${ROS_DISTRO}/setup.sh fi + CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws + if [ -e ${CATKIN_DEP_WORKSPACE}/devel/setup.sh ]; then + . ${CATKIN_DEP_WORKSPACE}/devel/setup.sh + fi } # _setup_env_vars @@ -188,6 +192,10 @@ _setup_osx_env() export CXX=g++-4.8 export CC=gcc-4.8 fi + + export DYLD_LIBRARY_PATH="$install_dir/lib:$DYLD_LIBRARY_PATH" + export LTDL_LIBRARY_PATH="$install_dir/lib:$LTDL_LIBRARY_PATH" + export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$PKG_CONFIG_PATH" } # setup_ci_env @@ -227,6 +235,15 @@ setup_ci_env export CMAKE_VERBOSE_MAKEFILE=1 export CTEST_OUTPUT_ON_FAILURE=1 +# Add default DO_*_ON_BRANCH if needed +if [ -z ${DO_COVERAGE_ON_BRANCH+x} ]; then + export DO_COVERAGE_ON_BRANCH=${CI_BRANCH} +fi + +if [ -z ${DO_CPPCHECK_ON_BRANCH+x} ]; then + export DO_CPPCHECK_ON_BRANCH=${CI_BRANCH} +fi + # Create layout. mkdir -p "$build_dir" mkdir -p "$install_dir" diff --git a/dependencies/eigen-3.2 b/dependencies/eigen-3.2 index 46d4838..101f17b 100755 --- a/dependencies/eigen-3.2 +++ b/dependencies/eigen-3.2 @@ -2,24 +2,7 @@ # # Setup Eigen 3.2 # -. `dirname $0`/../common.sh +EIGEN_VERSION=3.2.10 +EIGEN_HASH=b9cd8366d4e8 -EIGEN_VERSION=3.2.8 -EIGEN_HASH=07105f7124f9 - -# Checkout Eigen -cd "$build_dir" -wget --quiet "http://bitbucket.org/eigen/eigen/get/${EIGEN_VERSION}.tar.gz" -tar xzf ${EIGEN_VERSION}.tar.gz -cd "$build_dir/eigen-eigen-${EIGEN_HASH}/" -mkdir -p "$build_dir/eigen-eigen-${EIGEN_HASH}/_build" -cd "$build_dir/eigen-eigen-${EIGEN_HASH}/_build" - -# Build, make and install Eigen -cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" -make -make install - -# Check install -pkg-config --modversion "eigen3 >= ${EIGEN_VERSION}" -pkg-config --cflags "eigen3 >= ${EIGEN_VERSION}" +. `dirname $0`/eigen-common.sh $EIGEN_VERSION $EIGEN_HASH diff --git a/dependencies/eigen-3.3 b/dependencies/eigen-3.3 new file mode 100755 index 0000000..4358d66 --- /dev/null +++ b/dependencies/eigen-3.3 @@ -0,0 +1,8 @@ +#!/bin/bash +# +# Setup Eigen 3.3 +# +EIGEN_VERSION=3.3.7 +EIGEN_HASH=323c052e1731 + +. `dirname $0`/eigen-common.sh $EIGEN_VERSION $EIGEN_HASH diff --git a/dependencies/eigen-3.3.ps1 b/dependencies/eigen-3.3.ps1 new file mode 100644 index 0000000..f6df541 --- /dev/null +++ b/dependencies/eigen-3.3.ps1 @@ -0,0 +1,26 @@ +$EIGEN_VERSION="3.3.7" +$EIGEN_HASH="323c052e1731" + +cd $Env:SOURCE_FOLDER +appveyor DownloadFile "http://bitbucket.org/eigen/eigen/get/$EIGEN_VERSION.zip" +7z x "${EIGEN_VERSION}.zip" -o"${Env:SOURCE_FOLDER}\eigen" -r +cd "${Env:SOURCE_FOLDER}\eigen\eigen-eigen-$EIGEN_HASH" +md build +cd build + +# Build, make and install Eigen +cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" ../ +msbuild INSTALL.vcxproj + +# Generate eigen3.pc +$EIGEN3_PC_FILE="${Env:PKG_CONFIG_PATH}/eigen3.pc" +echo "Name: Eigen3" | Out-File -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Description: A C++ template library for linear algebra: vectors, matrices, and related algorithms" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Requires:" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Version: $EIGEN_VERSION" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Libs:" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Cflags: -I${Env:CMAKE_INSTALL_PREFIX}/include/eigen3" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE + +# Check install +pkg-config --modversion "eigen3 >= ${EIGEN_VERSION}" +pkg-config --cflags "eigen3 >= ${EIGEN_VERSION}" diff --git a/dependencies/eigen-common.sh b/dependencies/eigen-common.sh new file mode 100755 index 0000000..a31f619 --- /dev/null +++ b/dependencies/eigen-common.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Setup Eigen +# +. `dirname $0`/../common.sh + +EIGEN_VERSION=$1 +EIGEN_HASH=$2 + +# Checkout Eigen +cd "$build_dir" +wget --quiet "http://bitbucket.org/eigen/eigen/get/${EIGEN_VERSION}.tar.gz" +tar xzf ${EIGEN_VERSION}.tar.gz +cd "$build_dir/eigen-eigen-${EIGEN_HASH}/" +mkdir -p "$build_dir/eigen-eigen-${EIGEN_HASH}/_build" +cd "$build_dir/eigen-eigen-${EIGEN_HASH}/_build" + +# Build, make and install Eigen +cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" +make +make install + +# Check install +pkg-config --modversion "eigen3 >= ${EIGEN_VERSION}" +pkg-config --cflags "eigen3 >= ${EIGEN_VERSION}" diff --git a/dependencies/ipopt b/dependencies/ipopt index 81adee4..7f681da 100755 --- a/dependencies/ipopt +++ b/dependencies/ipopt @@ -8,7 +8,7 @@ ${SUDO_CMD} apt-get update -qq ${SUDO_CMD} apt-get install -qq libblas-dev liblapack-dev libmumps-seq-dev gfortran -IPOPT_VERSION=3.12.4 +IPOPT_VERSION=3.12.6 build_dir=`mktemp -d` trap "rm -rf -- '$build_dir'" EXIT diff --git a/dependencies/pybindgen-0.16 b/dependencies/pybindgen-0.16 index ac55774..9cd4891 100755 --- a/dependencies/pybindgen-0.16 +++ b/dependencies/pybindgen-0.16 @@ -4,16 +4,22 @@ . `dirname $0`/../common.sh +if [ $# -ge 1 ]; then + PYBINDGEN_INSTALL_PREFIX=$1 +else + PYBINDGEN_INSTALL_PREFIX=/usr/local +fi + # Install dependencies ${SUDO_CMD} apt-get install -qq gccxml python-pygccxml # Get pybindgen cd "$build_dir" -wget --quiet https://pybindgen.googlecode.com/files/pybindgen-0.16.0.tar.bz2 +wget --quiet https://launchpad.net/pybindgen/trunk/0.16/+download/pybindgen-0.16.0.tar.bz2 tar xjf pybindgen-0.16.0.tar.bz2 cd "$build_dir/pybindgen-0.16.0/" # Configure build and install -./waf configure +./waf --prefix=$PYBINDGEN_INSTALL_PREFIX configure ./waf ${SUDO_CMD} ./waf install diff --git a/functions.ps1 b/functions.ps1 index ab3d88d..30da5c4 100644 --- a/functions.ps1 +++ b/functions.ps1 @@ -62,7 +62,7 @@ function install_choco_dependencies { ForEach($choco_dep in $Env:CHOCO_DEPENDENCIES.split(' ')) { - choco install $choco_dep + choco install $choco_dep -y } } @@ -75,13 +75,17 @@ function install_git_dependencies git clone -b "$git_dep_branch" "$git_dep_uri" "$git_dep" cd $git_dep git submodule update --init + if ($lastexitcode -ne 0){ exit $lastexitcode } md build cd build # For projects that use cmake_add_subfortran directory this removes sh.exe # from the path $Env:Path = $Env:Path -replace "Git","dummy" - cmake ../ -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" -DPYTHON_BINDING=OFF -DMINGW_GFORTRAN="$env:MINGW_GFORTRAN" - msbuild INSTALL.vcxproj + cmake ../ -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" -DPYTHON_BINDING=OFF -DMINGW_GFORTRAN="$env:MINGW_GFORTRAN" -DGIT="C:/Program Files/Git/cmd/git.exe" + + if ($lastexitcode -ne 0){ exit $lastexitcode } + msbuild INSTALL.vcxproj /p:Configuration=Debug + if ($lastexitcode -ne 0){ exit $lastexitcode } # Reverse our dirty work $Env:Path = $Env:Path -replace "dummy","Git" } @@ -97,11 +101,26 @@ function build_project { cd $Env:PROJECT_SOURCE_DIR git submodule update --init + if ($lastexitcode -ne 0){ exit $lastexitcode } md build cd build # See comment in dependencies regarding $Env:Path manipulation $Env:Path = $Env:Path -replace "Git","dummy" - cmake ../ -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" -DPYTHON_BINDING=OFF -DMINGW_GFORTRAN="$env:MINGW_GFORTRAN" - msbuild INSTALL.vcxproj + cmake ../ -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" -DPYTHON_BINDING=OFF -DMINGW_GFORTRAN="$env:MINGW_GFORTRAN" -DGIT="C:/Program Files/Git/cmd/git.exe" + if ($lastexitcode -ne 0){ exit $lastexitcode } + msbuild INSTALL.vcxproj /p:Configuration=Debug + if ($lastexitcode -ne 0){ exit $lastexitcode } $Env:Path = $Env:Path -replace "dummy","Git" } + +function test_project +{ + cd %PROJECT_SOURCE_DIR%/build + ctest -N + ctest --build-config Debug --exclude-regex example + if ($lastexitcode -ne 0) + { + type Testing/Temporary/LastTest.log + exit $lastexitcode + } +}