Skip to content

Commit

Permalink
Support QGLViewer-qt5 and enable Qt5 by default
Browse files Browse the repository at this point in the history
Thanks to kazuki0824 and anasarrak.
  • Loading branch information
jnumm committed Jan 21, 2020
1 parent bfc4580 commit ff95658
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 7 additions & 3 deletions octovis/CMakeModules/FindQGLViewer.cmake
Original file line number Diff line number Diff line change
@@ -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!
Expand All @@ -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})

Expand Down Expand Up @@ -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<Qt::WindowType>)'
#ViewerWidget.cpp:(.text+0x1715): undefined reference to `QGLViewer::QGLViewer(QWidget*, QGLWidget const*, QFlags<Qt::WindowType>)'

0 comments on commit ff95658

Please sign in to comment.