From ff95658d59fef0fe945f9854987e7dd6fcfd1f1e Mon Sep 17 00:00:00 2001 From: Juhani Numminen Date: Tue, 21 Jan 2020 16:13:53 +0200 Subject: [PATCH 1/3] Support QGLViewer-qt5 and enable Qt5 by default Thanks to kazuki0824 and anasarrak. --- CMakeLists.txt | 2 +- octovis/CMakeModules/FindQGLViewer.cmake | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1ec836e..70be6912 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) # enables -fPIC in applicable compilers option(BUILD_OCTOVIS_SUBPROJECT "Build targets from subproject octovis" ON) option(BUILD_DYNAMICETD3D_SUBPROJECT "Build targets from subproject dynamicEDT3D" ON) -option(OCTOVIS_QT5 "Link Octovis against Qt5?" NO) +option(OCTOVIS_QT5 "Link Octovis against Qt5?" ON) if(OCTOVIS_QT5) # Compiling against QT5 requires C++11. diff --git a/octovis/CMakeModules/FindQGLViewer.cmake b/octovis/CMakeModules/FindQGLViewer.cmake index 752002b9..9b64430b 100644 --- a/octovis/CMakeModules/FindQGLViewer.cmake +++ b/octovis/CMakeModules/FindQGLViewer.cmake @@ -1,5 +1,5 @@ # Find QGLViewer library -# Looks for a system-wide version of libQGLViewer (qglviewer-qt4 in Ubuntu). +# Looks for a system-wide version of libQGLViewer (qglviewer-qt4 or 5 in Ubuntu). # If none is found, it builds and uses the local copy in "extern" # # Many thanks to L. Ott for assistance! @@ -23,7 +23,11 @@ FIND_PATH( QGLViewer_INCLUDE_DIR qglviewer.h ${QGLVIEWER_BASE_DIR} ) -FIND_LIBRARY( QGLViewer_LIBRARY_DIR_UBUNTU NAMES qglviewer-qt4 QGLViewer-qt4) +IF( QT4_FOUND ) + FIND_LIBRARY( QGLViewer_LIBRARY_DIR_UBUNTU NAMES qglviewer-qt4 QGLViewer-qt4) +ELSE() + FIND_LIBRARY( QGLViewer_LIBRARY_DIR_UBUNTU NAMES qglviewer-qt5 QGLViewer-qt5) +ENDIF() FIND_LIBRARY( QGLViewer_LIBRARY_DIR_WINDOWS QGLViewer2 ${QGLVIEWER_BASE_DIR}) FIND_LIBRARY( QGLViewer_LIBRARY_DIR_OTHER QGLViewer ${QGLVIEWER_BASE_DIR}) @@ -119,4 +123,4 @@ ENDIF() # You need to use qmake of QT4. You are using QT3 if you get: #CMakeFiles/octovis.dir/ViewerWidget.cpp.o: In function `octomap::ViewerWidget::ViewerWidget(QWidget*)': -#ViewerWidget.cpp:(.text+0x1715): undefined reference to `QGLViewer::QGLViewer(QWidget*, QGLWidget const*, QFlags)' \ No newline at end of file +#ViewerWidget.cpp:(.text+0x1715): undefined reference to `QGLViewer::QGLViewer(QWidget*, QGLWidget const*, QFlags)' From c860efd0f702c5381a81965a6d2bb553d2070b85 Mon Sep 17 00:00:00 2001 From: Juhani Numminen Date: Tue, 21 Jan 2020 16:16:45 +0200 Subject: [PATCH 2/3] Travis: upgrade to Qt5 and Ubuntu 18.04 Bionic --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb4cda90..35a103ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: cpp sudo: required -dist: trusty +dist: bionic compiler: - gcc - clang before_install: - sudo apt-get update -qq - - sudo apt-get install -qq libqt4-dev libqt4-opengl-dev libqglviewer-dev + - sudo apt-get install -qq libqglviewer-dev-qt5 before_script: script: ./scripts/travis_build_jobs.sh $VARIANT env: From ce998c7c1df0e64e5536be5ae20a7a27e6e05667 Mon Sep 17 00:00:00 2001 From: Juhani Numminen Date: Tue, 21 Jan 2020 16:41:50 +0200 Subject: [PATCH 3/3] Add option OCTOVIS_QT5 in octovis/CMakeFiles.txt Copied from root CMakeFiles.txt to make this flag default ON even if building octovis as a module. --- octovis/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/octovis/CMakeLists.txt b/octovis/CMakeLists.txt index 34653c02..d20b7d65 100644 --- a/octovis/CMakeLists.txt +++ b/octovis/CMakeLists.txt @@ -64,6 +64,8 @@ set(INSTALL_TARGETS_DEFAULT_ARGS # libQGLViewer, if dependencies available SET( BUILD_VIEWER 0) +option(OCTOVIS_QT5 "Link Octovis against Qt5?" ON) + # Look for required libraries: FIND_PACKAGE(OpenGL) if(NOT OCTOVIS_QT5)