From 4383d2b5acfd8935e1147cc081ff33cba04b7972 Mon Sep 17 00:00:00 2001 From: George ElKoura Date: Thu, 29 Jun 2017 21:57:23 -0700 Subject: [PATCH] Several improvements to CI building and testing - Added support for OSX CI builds and tests - Cleaned up build scripts and moved to $ROOT/build_scripts - On Linux: moved to trusty distro - On Linux: enabled OpenMP, TBB and PTex build options - On Linux: install and setup xvfb with newer mesa drivers to run our GL tests - On Linux: enable GL tests --- .gitignore | 2 +- .travis.yml | 67 ++++++++-------- README.md | 6 +- build_scripts/travis_before_script_linux.sh | 86 +++++++++++++++++++++ build_scripts/travis_script_linux.sh | 39 ++++++++++ build_scripts/travis_script_osx.sh | 30 +++++++ examples/common/glUtils.cpp | 4 +- regression/osd_regression/main.cpp | 9 +++ 8 files changed, 206 insertions(+), 37 deletions(-) create mode 100755 build_scripts/travis_before_script_linux.sh create mode 100755 build_scripts/travis_script_linux.sh create mode 100755 build_scripts/travis_script_osx.sh diff --git a/.gitignore b/.gitignore index 1c8516a4..fad22d83 100755 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # ignore build files -/build* +/build/* /inst* *.pyc diff --git a/.travis.yml b/.travis.yml index b96d31ca..74e9a965 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,44 +23,47 @@ # language: cpp +os: + - linux + - osx + +osx_image: xcode9 + +sudo: required +dist: trusty + +compiler: + - gcc + - clang + branches: only: - master - dev +matrix: + + # On Linux build with gcc and on OSX build with clang + exclude: + - os: osx + compiler: gcc + - os: linux + compiler: clang + # build environment before_script: - # as of 4/28/2015, travis worker has pre-installed cmake 2.8.7. - # opensubdiv needs 2.8.8 or later. - # get the latest cmake from PPA - - cmake --version - - sudo add-apt-repository --yes ppa:dcthomp/smtk - - sudo apt-get update -qq - # remove existing cmake - - sudo dpkg -r cmake cmake-data - # install newer version - - sudo apt-get install cmake - - cmake --version - - # install GL related libs from wily - - sudo add-apt-repository 'deb http://us.archive.ubuntu.com/ubuntu/ wily main restricted universe multiverse' - - sudo add-apt-repository 'deb http://us.archive.ubuntu.com/ubuntu/ wily-updates main restricted universe multiverse' - - sudo apt-get update -qq - # install glut and xxf86vm (for GL libs) - - sudo apt-get install freeglut3-dev - - sudo apt-get install libxxf86vm-dev - # install GLEW - - sudo apt-get install libglew-dev - # install GLFW3 - - sudo apt-get install libglfw3-dev - - # hopefully we'd like to test basic imaging tests too, using X virtual framebuffer - # (not working now) - - sudo apt-get install xvfb + - if [ $TRAVIS_OS_NAME == osx ] ; then + echo "before_script on OSX" ; + elif [ $TRAVIS_OS_NAME == linux ] ; then + echo "before_script on Linux" ; + source build_scripts/travis_before_script_linux.sh ; + fi script: - - mkdir build && cd build - - cmake -DNO_TBB=1 -DNO_OMP=1 -DNO_CUDA=1 -DNO_OPENCL=1 -DNO_PTEX=1 -DNO_GLTESTS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. - - make - - make test - + - if [ $TRAVIS_OS_NAME == osx ] ; then + echo "script on OSX" ; + build_scripts/travis_script_osx.sh ; + elif [ $TRAVIS_OS_NAME == linux ] ; then + echo "script on Linux" ; + source build_scripts/travis_script_linux.sh ; + fi diff --git a/README.md b/README.md index 5d0a714c..4e1d6a8f 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ Feel free to use it and let us know what you think. For more details about OpenSubdiv, see [Pixar Graphics Technologies](http://graphics.pixar.com). -| | Linux | Windows | macOS | iOS | -|:------:|:-------:|:---------:|:------:|:---:| -| master | [![Linux Build Status](https://travis-ci.org/PixarAnimationStudios/OpenSubdiv.svg?branch=master)](https://travis-ci.org/PixarAnimationStudios/OpenSubdiv) | [![Windows Build Status](https://ci.appveyor.com/api/projects/status/mcmwg4q9m8kgi9im/branch/master?svg=true)](https://ci.appveyor.com/project/c64kernal/opensubdiv-ddr8q) | +| | Linux and OSX | Windows | +|:------:|:-------:|:---------:| +| master | [![Linux and OSX Build Status](https://travis-ci.org/PixarAnimationStudios/OpenSubdiv.svg?branch=master)](https://travis-ci.org/PixarAnimationStudios/OpenSubdiv) | [![Windows Build Status](https://ci.appveyor.com/api/projects/status/mcmwg4q9m8kgi9im/branch/master?svg=true)](https://ci.appveyor.com/project/c64kernal/opensubdiv-ddr8q) | | dev | [![Linux Build Status](https://travis-ci.org/PixarAnimationStudios/OpenSubdiv.svg?branch=dev)](https://travis-ci.org/PixarAnimationStudios/OpenSubdiv) | [![Windows Build Status](https://ci.appveyor.com/api/projects/status/mcmwg4q9m8kgi9im/branch/dev?svg=true)](https://ci.appveyor.com/project/c64kernal/opensubdiv-ddr8q) | ## Documents diff --git a/build_scripts/travis_before_script_linux.sh b/build_scripts/travis_before_script_linux.sh new file mode 100755 index 00000000..7f351502 --- /dev/null +++ b/build_scripts/travis_before_script_linux.sh @@ -0,0 +1,86 @@ +# +# Copyright 2017 Pixar +# +# Licensed under the Apache License, Version 2.0 (the "Apache License") +# with the following modification; you may not use this file except in +# compliance with the Apache License and the following modification to it: +# Section 6. Trademarks. is deleted and replaced with: +# +# 6. Trademarks. This License does not grant permission to use the trade +# names, trademarks, service marks, or product names of the Licensor +# and its affiliates, except as required to comply with Section 4(c) of +# the License and to reproduce the content of the NOTICE file. +# +# You may obtain a copy of the Apache License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the Apache License with the above modification is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the Apache License for the specific +# language governing permissions and limitations under the Apache License. +# + + +# opensubdiv needs 2.8.8 or later. +cmake --version + +############################################################################### +# Install X11 dev libraries +sudo apt-get install libxrandr-dev +sudo apt-get install libxcursor-dev +sudo apt-get install libxinerama-dev +sudo apt-get install libxi-dev + +sudo apt-get update -qq + +# install glut and xxf86vm (for GL libs) +sudo apt-get install freeglut3 +sudo apt-get install freeglut3-dev +sudo apt-get install libxxf86vm1 +sudo apt-get install libxxf86vm-dev + +# install GLEW +sudo apt-get install libglew1.10 +sudo apt-get install libglew-dev + + +############################################################################### +# Upgrade to get a version of Mesa that supports OGL 4 +sudo add-apt-repository ppa:ubuntu-x-swat/updates -y +sudo apt-get update -qq +sudo apt-get dist-upgrade + + +############################################################################### +# Build and install glfw +mkdir glfw && pushd glfw +git clone https://github.com/glfw/glfw +mkdir build && cd build +cmake ../glfw +make +sudo make install +popd + + + +############################################################################### +# Start an X Virtual Framebuffer so that we can do some basic imaging tests. +export DISPLAY=:99.0 +sh -e /etc/init.d/xvfb start + +############################################################################### +# Install TBB 4.3 update 1 +wget https://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20141023oss_lin.tgz -O /tmp/tbb.tgz +tar -xvzf /tmp/tbb.tgz -C $HOME + +############################################################################### +# Install PTex +wget https://github.com/wdas/ptex/archive/v2.0.30.tar.gz -O /tmp/ptex.tgz +tar -xvzf /tmp/ptex.tgz -C $HOME +pushd $HOME/ptex-2.0.30/src +make +mkdir $HOME/ptex +mv $HOME/ptex-2.0.30/install/* $HOME/ptex +popd diff --git a/build_scripts/travis_script_linux.sh b/build_scripts/travis_script_linux.sh new file mode 100755 index 00000000..443c166d --- /dev/null +++ b/build_scripts/travis_script_linux.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright 2017 Pixar +# +# Licensed under the Apache License, Version 2.0 (the "Apache License") +# with the following modification; you may not use this file except in +# compliance with the Apache License and the following modification to it: +# Section 6. Trademarks. is deleted and replaced with: +# +# 6. Trademarks. This License does not grant permission to use the trade +# names, trademarks, service marks, or product names of the Licensor +# and its affiliates, except as required to comply with Section 4(c) of +# the License and to reproduce the content of the NOTICE file. +# +# You may obtain a copy of the Apache License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the Apache License with the above modification is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the Apache License for the specific +# language governing permissions and limitations under the Apache License. +# + +mkdir build && cd build + +# On gcc, we can turn on OMP +# On Linux, we'll also test TBB and Ptex +cmake \ + -DNO_CUDA=1 \ + -DNO_OPENCL=1 \ + -DPTEX_LOCATION=$HOME/ptex \ + -DTBB_LOCATION=$HOME/tbb43_20141023oss \ + .. || exit $? + +make || exit $? + +ctest --output-on-failure || exit $? diff --git a/build_scripts/travis_script_osx.sh b/build_scripts/travis_script_osx.sh new file mode 100755 index 00000000..729782fd --- /dev/null +++ b/build_scripts/travis_script_osx.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright 2017 Pixar +# +# Licensed under the Apache License, Version 2.0 (the "Apache License") +# with the following modification; you may not use this file except in +# compliance with the Apache License and the following modification to it: +# Section 6. Trademarks. is deleted and replaced with: +# +# 6. Trademarks. This License does not grant permission to use the trade +# names, trademarks, service marks, or product names of the Licensor +# and its affiliates, except as required to comply with Section 4(c) of +# the License and to reproduce the content of the NOTICE file. +# +# You may obtain a copy of the Apache License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the Apache License with the above modification is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the Apache License for the specific +# language governing permissions and limitations under the Apache License. +# + + +mkdir build && cd build +cmake -DNO_TBB=1 -DNO_OMP=1 -DNO_CUDA=1 -DNO_OPENCL=1 -DNO_PTEX=1 -DNO_GLTESTS=1 .. || exit $? +make || exit $? +make test || exit $? diff --git a/examples/common/glUtils.cpp b/examples/common/glUtils.cpp index cdee16be..702391e2 100644 --- a/examples/common/glUtils.cpp +++ b/examples/common/glUtils.cpp @@ -147,12 +147,14 @@ PrintGLVersion() { std::cout << glGetString(GL_RENDERER) << "\n"; std::cout << glGetString(GL_VERSION) << "\n"; - int i; + int i = -1; std::cout << "Init OpenGL "; glGetIntegerv(GL_MAJOR_VERSION, &i); std::cout << i << "."; glGetIntegerv(GL_MINOR_VERSION, &i); std::cout << i << "\n"; + + CheckGLErrors("PrintGLVersion"); } void diff --git a/regression/osd_regression/main.cpp b/regression/osd_regression/main.cpp index cb8393bb..396571ac 100644 --- a/regression/osd_regression/main.cpp +++ b/regression/osd_regression/main.cpp @@ -623,6 +623,12 @@ parseArgs(int argc, char ** argv) { } } +void _glfw_error_callback(int error, const char *description) +{ + printf("GLFW reported error %d: %s\n", + error, description); +} + //------------------------------------------------------------------------------ int main(int argc, char ** argv) { @@ -632,8 +638,11 @@ main(int argc, char ** argv) { // "-backend " tests one backend. parseArgs(argc, argv); + glfwSetErrorCallback(_glfw_error_callback); + // Make sure we have an OpenGL context : create dummy GLFW window if (! glfwInit()) { + printf("DISPLAY set to '%s'\n", getenv("DISPLAY")); printf("Failed to initialize GLFW\n"); return 1; }