Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
720616a
port to vtk7 and qt5
patmarion Apr 7, 2017
a0bd22f
more changes
patmarion Apr 8, 2017
02f7e49
updates
patmarion Apr 9, 2017
7a15756
update
patmarion Apr 9, 2017
1da067a
update
patmarion Apr 9, 2017
a227661
update PythonQt
patmarion Apr 9, 2017
b7ac4d8
update
patmarion Apr 10, 2017
db8cec2
Pass the right Qt options to eigen
sankhesh Apr 18, 2017
97320d2
Fix finding VTK with the right components
sankhesh May 4, 2017
74b0eb2
Switched to using the QVTKOpenGLWidget
sankhesh May 9, 2017
3cb1767
Use QVTKWidget when director is compiled against Qt < v5.4
sankhesh May 10, 2017
28db75c
Allow director to compile against Qt4 or Qt5 via DD_QT_VERSION
sankhesh May 12, 2017
11740ee
Change default Qt version to Qt5
sankhesh May 12, 2017
d89d366
Provide option to choose between Qt4 and Qt5 for superbuild via DD_QT…
sankhesh May 12, 2017
48fe2c3
Fix missing parentheses error
sankhesh May 15, 2017
ae28693
Remove vtkGUISupportQtOpenGL dependency
sankhesh May 15, 2017
2a76d06
Use version of PythonQt that allows both Qt4 and Qt5
sankhesh May 15, 2017
3ef8d46
Updated to use different branches of PythonQt based on Qt version
sankhesh May 16, 2017
231c0ae
Conditionally wrap QVTKWidget or QVTKOpenGLWidget based on Qt version
sankhesh May 16, 2017
edaca9b
Link to QtOpenGL module for Qt4
sankhesh May 16, 2017
2ec4cb9
Add missing semicolon causing compile error with Qt4
sankhesh May 16, 2017
0813f34
QSurfaceFormat is not available in Qt4
sankhesh May 16, 2017
b7fbd8a
Merge branch 'master' into port-vtk7-qt5
sankhesh May 18, 2017
07a84d7
Cleanup and add comments to improve code readability
sankhesh May 23, 2017
6aaacac
Ensure Qt5 API is not used when compiling against Qt4
sankhesh May 23, 2017
b68e5a5
Remove unused VTK classes
sankhesh May 23, 2017
1b281bb
Remove VTK5 related workarounds
sankhesh May 23, 2017
d53b223
Use C++11-esque using construct in lieu of typedef
sankhesh May 23, 2017
1963a32
Fix compilation error when USE_DRAKE is enabled
sankhesh May 31, 2017
ccac8a0
Change all QString::toAscii() calls to QString::toLatin1()
sankhesh May 31, 2017
503c7e1
Fix issue with Qt4 conversion to Qt5
sankhesh May 31, 2017
a27a891
Raise CMake exception only if system VTK version less than 8 found
sankhesh Jun 1, 2017
6a49e05
Fix travis configuration scripts
sankhesh Jun 1, 2017
4666667
Install newer CMake on travis trusty VM
sankhesh Jun 1, 2017
f8c5617
Ensure that docker tests are run with right environment variables
sankhesh Jun 1, 2017
4e38da8
Superbuild can download pre-packaged VTK binaries, if requested
sankhesh Jun 2, 2017
9af1714
Install VTK at the install prefix when downloading binary
sankhesh Jun 2, 2017
f5c68d5
Merge branch 'master' into port-vtk7-qt5
sankhesh Jun 2, 2017
965d214
Bring in master changes
sankhesh Jun 2, 2017
473de79
Updated to use the VTK v8.0.0.rc2
sankhesh Jun 9, 2017
ab0388f
Hints for Qt and VTK paths on mac
sankhesh Jun 9, 2017
2502cb1
Update VTK version requirement
sankhesh Jun 9, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: generic
sudo: required
dist: trusty
osx_image: xcode7.3

virtualenv:
system_site_packages: true
Expand All @@ -12,12 +10,16 @@ matrix:
osx_image: xcode7.3
env: USE_LCM=ON USE_LIBBOT=OFF USE_LCMGL=OFF MAKE_PACKAGE=ON
- os: linux
dist: trusty
env: USE_LCM=ON USE_LIBBOT=OFF USE_LCMGL=OFF MAKE_PACKAGE=ON MAKE_DOCS=ON
- os: linux
dist: trusty
env: USE_LCM=OFF USE_LIBBOT=OFF USE_LCMGL=OFF
- os: linux
dist: trusty
env: USE_LCM=ON USE_LIBBOT=ON USE_LCMGL=ON
- os: linux
dist: trusty
services:
- docker
env: USE_DOCKER=ON
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ include(cmake/dd-macros.cmake)
include(cmake/dd-testing.cmake)
include(cmake/dd-version.cmake)

# Setup flags for C++11
use_cpp11()

# Setup options for choosing the version of Qt to compile against
ddqt()

# dependency options
option(USE_PORTMIDI "Build director with portmidi dependency." OFF)
option(USE_LCM "Build director with lcm dependency." OFF)
Expand Down
23 changes: 21 additions & 2 deletions cmake/dd-macros.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
macro(ddqt)
set(DD_QT_VERSION "5" CACHE STRING "Expected Qt version")

set_property(CACHE DD_QT_VERSION PROPERTY STRINGS 4 5)

if(NOT (DD_QT_VERSION VERSION_EQUAL "4" OR DD_QT_VERSION VERSION_EQUAL "5"))
message(FATAL_ERROR "Expected value for DD_QT_VERSION is either '4' or '5'")
endif()
endmacro()

macro(setup_qt4)
find_package(Qt4 REQUIRED QtCore QtGui QtOpenGL QtScript)
include(${QT_USE_FILE})
include (${QT_USE_FILE})
endmacro()


macro(setup_qt5)
if(APPLE)
set(qt_homebrew_dir /usr/local/opt/qt/lib/cmake/)
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL
PATHS ${qt_homebrew_dir})
endmacro()


Expand All @@ -13,7 +32,7 @@ macro(use_cpp11)
elseif(GCC_VERSION VERSION_LESS 4.7)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
Expand Down
34 changes: 25 additions & 9 deletions distro/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,35 @@ RUN apt-get update

# Install packages required to build and test
RUN apt-get install -y \
wget \
git \
build-essential \
cmake \
doxygen \
git \
graphviz \
libglib2.0-dev \
libeigen3-dev \
libqt4-dev \
libvtk5-dev \
libvtk5-qt4-dev \
libvtk-java \
libexpat-dev \
libfreetype6-dev \
libglib2.0-dev \
libjpeg-dev \
libqt5webkit5-dev \
libqt5x11extras5-dev \
libtiff5-dev \
libxml2-dev \
libxt-dev \
python-coverage \
python-dev \
python-lxml \
python-numpy \
python-pip \
python-sphinx \
python-vtk \
python-yaml \
python2.7-dev \
qt5-default \
qtbase5-dev \
qtbase5-private-dev \
qtmultimedia5-dev \
qttools5-dev \
wget \
xvfb

RUN pip install sphinx-rtd-theme
Expand All @@ -55,10 +64,17 @@ COPY . /root/
# Build
RUN mkdir build
WORKDIR /root/build
RUN cmake -DUSE_LCM:BOOL=$USE_LCM ../distro/superbuild
RUN cmake \
-DDD_QT_VERSION:STRING=5 \
-DUSE_SYSTEM_VTK:BOOL=OFF \
-DDOWNLOAD_VTK_PACKAGE:BOOL=ON \
-DUSE_LCM:BOOL=$USE_LCM \
../distro/superbuild
RUN make -j2
WORKDIR /root/build/src/director-build
RUN cmake -DSITE:STRING=travis-docker -DBUILDNAME:STRING=travis-docker_lcm-$USE_LCM .

# Run the tests and build the package
ENV LD_LIBRARY_PATH /root/lib/:/root/build/install/lib
ENV PYTHONPATH /root/lib/python2.7/site-packages/:/root/build/install/lib/python2.7/site-packages
RUN /root/distro/docker/run_tests_and_package.sh
157 changes: 121 additions & 36 deletions distro/superbuild/cmake/externals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ option(USE_SYSTEM_EIGEN "Use system version of eigen. If off, eigen will be bui
option(USE_SYSTEM_LCM "Use system version of lcm. If off, lcm will be built." OFF)
option(USE_SYSTEM_LIBBOT "Use system version of libbot. If off, libbot will be built." OFF)
option(USE_SYSTEM_PCL "Use system version of pcl. If off, pcl will be built." OFF)
option(USE_SYSTEM_VTK "Use system version of VTK. If off, VTK will be built." ON)

set(DD_QT_VERSION "5" CACHE STRING "Expected Qt version")
set_property(CACHE DD_QT_VERSION PROPERTY STRINGS 4 5)
if(NOT (DD_QT_VERSION VERSION_EQUAL "4" OR DD_QT_VERSION VERSION_EQUAL "5"))
message(FATAL_ERROR "Expected value for DD_QT_VERSION is either '4' or '5'")
endif()

if(USE_DRAKE)
set(DRAKE_SOURCE_DIR CACHE PATH "")
Expand All @@ -37,11 +44,26 @@ set(default_cmake_args
)

# Find required external dependencies
find_package(Qt4 4.8 REQUIRED)
set(qt_args)
if (${DD_QT_VERSION} VERSION_GREATER "4")
if(APPLE)
set(qt_homebrew_dir /usr/local/opt/qt/lib/cmake/)
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL
PATHS ${qt_homebrew_dir})
set(qt_args
-DQt5_DIR:PATH=${Qt5_DIR}
-DQt5Core_DIR:PATH=${Qt5Core_DIR}
-DQt5Gui_DIR:PATH=${Qt5Gui_DIR}
-DQt5Widgets_DIR:PATH=${Qt5Widgets_DIR}
)
else()
find_package(Qt4 4.8 REQUIRED)
set(qt_args
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
)
endif()

set(qt_args
-DQT_QMAKE_EXECUTABLE:PATH=${QT_QMAKE_EXECUTABLE}
)

if(APPLE)
find_program(PYTHON_CONFIG_EXECUTABLE python-config)
Expand Down Expand Up @@ -76,6 +98,7 @@ ExternalProject_Add(
URL_MD5 a0e0a32d62028218b1c1848ad7121476
CMAKE_CACHE_ARGS
${default_cmake_args}
${qt_args}
)

ExternalProject_Add_Step(eigen make_pkgconfig_dir
Expand Down Expand Up @@ -224,9 +247,18 @@ endif()

###############################################################################
# PythonQt
set(PythonQt_REPO)
set(PythonQt_TAG)
if(${DD_QT_VERSION} VERSION_GREATER "4")
set(PythonQt_REPO https://github.com/patmarion/PythonQt.git)
set(PythonQt_TAG fix-compile-error-on-qt5.8)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmarion Mind creating a PR on PythonQt for branch fix-compile-error-on-qt5.8 and mention this PR (#508)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmarion ping!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, eventually we will get this in. upstream PythonQt is actually a svn repo. The CommonToolkit group manages some unofficial patched branches on Github. I think this is already fixed upstream in svn but I'm not sure if CTK's branches are up to date or not. I will try to look into it. In the meantime, I have no problem referencing this branch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh... commontk/PythonQt#50 (apparently I can create a PR of Pat's branch).

@sankhesh, does patched-7 still work with Qt4?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think patched-7 has removed qt4 support. the src dir generated_cpp_47 was removed in that branch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay... but at least commontk/PythonQt#50 would let us use the same repository in either case, and just a different branch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @patmarion @mwoehlke-kitware

I'm not sure why pythonqt decided to drop the generated sources for Qt4 because the CMake code still seems to support both Qt4 and Qt5. Compilation fails when it can't find the generated sources with Qt4.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can definitively be re-added. It would be nice to work with Florian (from mevislab) and push the patches upstream. I do not have the bandwidth currently ...

else()
set(PythonQt_REPO https://github.com/commontk/PythonQt.git)
set(PythonQt_TAG patched-6)
endif()
ExternalProject_Add(PythonQt
GIT_REPOSITORY https://github.com/commontk/PythonQt.git
GIT_TAG patched-6
GIT_REPOSITORY ${PythonQt_REPO}
GIT_TAG ${PythonQt_TAG}
CMAKE_CACHE_ARGS
${default_cmake_args}
${qt_args}
Expand All @@ -238,9 +270,18 @@ ExternalProject_Add(PythonQt

###############################################################################
# ctkPythonConsole
set(ctkPythonConsole_REPO)
set(ctkPythonConsole_TAG)
if(${DD_QT_VERSION} VERSION_GREATER "4")
set(ctkPythonConsole_REPO https://github.com/mwoehlke-kitware/ctkPythonConsole)
set(ctkPythonConsole_TAG qt5)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwoehlke-kitware Mind creating a PR for branch qt5 on ctkPythonConsole and mention this PR (#508) ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed; I think we should be able to use a single repo/tag here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On closer inspection, it seems this would need tweaking to work with either Qt4 or Qt5. I don't know that I'll be able to do that; @sankhesh, can you do it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwoehlke-kitware I'll look into it.

else()
set(ctkPythonConsole_REPO https://github.com/patmarion/ctkPythonConsole)
set(ctkPythonConsole_TAG 15988c5)
endif()
ExternalProject_Add(ctkPythonConsole
GIT_REPOSITORY https://github.com/patmarion/ctkPythonConsole
GIT_TAG 15988c5
GIT_REPOSITORY ${ctkPythonConsole_REPO}
GIT_TAG ${ctkPythonConsole_TAG}
CMAKE_CACHE_ARGS
${default_cmake_args}
${qt_args}
Expand All @@ -251,52 +292,95 @@ ExternalProject_Add(ctkPythonConsole

###############################################################################
# QtPropertyBrowser
set(QtPropertyBrowser_REPO)
set(QtPropertyBrowser_TAG)
if(${DD_QT_VERSION} VERSION_GREATER "4")
set(QtPropertyBrowser_REPO https://github.com/intbots/QtPropertyBrowser)
set(QtPropertyBrowser_TAG master)
else()
set(QtPropertyBrowser_REPO https://github.com/patmarion/QtPropertyBrowser)
set(QtPropertyBrowser_TAG baf10af)
endif()
ExternalProject_Add(QtPropertyBrowser
GIT_REPOSITORY https://github.com/patmarion/QtPropertyBrowser
GIT_TAG baf10af
GIT_REPOSITORY ${QtPropertyBrowser_REPO}
GIT_TAG ${QtPropertyBrowser_TAG}
CMAKE_CACHE_ARGS
${default_cmake_args}
${qt_args}
-DCMAKE_MACOSX_RPATH:BOOL=ON
)


###############################################################################
# vtk
set(use_system_vtk_default ON)
option(USE_SYSTEM_VTK "Use system version of VTK. If off, VTK will be built." ${use_system_vtk_default})

if(NOT USE_SYSTEM_VTK)
ExternalProject_Add(vtk
GIT_REPOSITORY git://vtk.org/VTK.git
GIT_TAG v5.10.1
CMAKE_CACHE_ARGS
${default_cmake_args}
${python_args}
${qt_args}
-DBUILD_SHARED_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DVTK_USE_GUISUPPORT:BOOL=ON
-DVTK_USE_QT:BOOL=ON
-DVTK_WRAP_PYTHON:BOOL=ON
-DVTK_WRAP_TCL:BOOL=OFF
-DVTK_USE_TK:BOOL=OFF
-DCMAKE_CXX_FLAGS:STRING=-DGLX_GLXEXT_LEGACY # fixes compile error on ubuntu 16.04
)

set(vtk_args -DVTK_DIR:PATH=${install_prefix}/lib/vtk-5.10)
set(BUILD_VTK TRUE)
if(UNIX AND NOT APPLE)
option(DOWNLOAD_VTK_PACKAGE
"Download and install pre-built VTK package. If off, VTK will be built."
ON)

if(DOWNLOAD_VTK_PACKAGE)
set(vtk_package_url "https://d2mbb5ninhlpdu.cloudfront.net/vtk")
if(${DD_QT_VERSION} VERSION_GREATER "4")
set(vtk_package_url
"${vtk_package_url}/vtk-v8.0.0.rc2-qt-5.5.1-xenial-x86_64.tar.gz"
)
set(vtk_package_md5 3dd13a3001fead90ead6547c8277a674)
else()
set(vtk_package_url
"${vtk_package_url}/vtk-v8.0.0.rc2-qt-4.8.6-trusty-x86_64.tar.gz"
)
set(vtk_package_md5 250e5b49f42db7a30b4269294be9223f)
endif()
set(BUILD_VTK FALSE)
ExternalProject_Add(vtk
URL ${vtk_package_url}
URL_MD5 ${vtk_package_md5}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_BINARY_DIR}/src/vtk ${install_prefix}
)
endif()
endif()
if(BUILD_VTK)
ExternalProject_Add(vtk
GIT_REPOSITORY git://vtk.org/VTK.git
GIT_TAG 28deb5620e56f535fc92ff8c73ef00f54923839b
CMAKE_CACHE_ARGS
${default_cmake_args}
${python_args}
${qt_args}
-DBUILD_SHARED_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DVTK_RENDERING_BACKEND:STRING=OpenGL2
-DVTK_QT_VERSION:STRING=${DD_QT_VERSION}
-DModule_vtkGUISupportQt:BOOL=ON
-DCMAKE_MACOSX_RPATH:BOOL=ON
-DVTK_WRAP_PYTHON:BOOL=ON
)
endif()

set(vtk_args -DVTK_DIR:PATH=${install_prefix}/lib/cmake/vtk-7.1)
set(vtk_depends vtk)
else()
set(vtk_homebrew_dir /usr/local/opt/vtk5/lib/vtk-5.10)
if (APPLE AND IS_DIRECTORY ${vtk_homebrew_dir})
set(vtk_args -DVTK_DIR:PATH=${vtk_homebrew_dir})

if(APPLE)
set(vtk_homebrew_dir /usr/local/opt/vtk@8.0/lib/cmake/vtk)
endif()

# Verifies that the system has VTK5.
find_package(VTK REQUIRED HINTS ${vtk_homebrew_dir})
if (NOT ${VTK_VERSION_MAJOR} EQUAL 5)
message(FATAL_ERROR "System does not have VTK5. It has version ${VTK_VERSION}.")
find_package(VTK REQUIRED PATHS ${vtk_homebrew_dir})
if (${VTK_VERSION} VERSION_LESS "8.0")
message(FATAL_ERROR "Director requires a VTK minimum version of v8.0."
" System has VTK version ${VTK_VERSION}")
endif()

set(vtk_args -DVTK_DIR:PATH=${VTK_DIR})
endif()


Expand Down Expand Up @@ -475,6 +559,7 @@ ExternalProject_Add(director
-DUSE_COLLECTIONS:BOOL=${USE_COLLECTIONS}
-DUSE_LIBBOT:BOOL=${USE_LIBBOT}
-DUSE_DRAKE:BOOL=${USE_DRAKE}
-DDD_QT_VERSION:STRING=${DD_QT_VERSION}

${default_cmake_args}
${eigen_args}
Expand Down
Loading