forked from OctoMap/octomap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not build QGLViewer using CMake (OctoMap#225)
- Loading branch information
Showing
3 changed files
with
14 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,21 @@ | ||
# Find QGLViewer library | ||
# 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! | ||
# Looks for a system-wide version of libQGLViewer. | ||
# | ||
# QGLViewer_INCLUDE_DIR where to find the include files | ||
# QGLViewer_LIBRARY_DIR where to find the libraries | ||
# QGLViewer_LIBRARIES list of libraries to link | ||
# QGLViewer_FOUND true if QGLViewer was found | ||
|
||
SET( QGLViewer_FOUND 0 CACHE BOOL "Do we have QGLViewer?" ) | ||
|
||
FIND_PATH( QGLVIEWER_BASE_DIR qglviewer.h | ||
${CMAKE_SOURCE_DIR}/src/extern/QGLViewer | ||
${CMAKE_SOURCE_DIR}/octovis/src/extern/QGLViewer | ||
) | ||
|
||
FIND_PATH( QGLViewer_INCLUDE_DIR qglviewer.h | ||
/usr/include/qglviewer-qt4 | ||
/usr/include/QGLViewer | ||
/opt/local/include/QGLViewer | ||
${QGLVIEWER_BASE_DIR} | ||
) | ||
|
||
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}) | ||
|
||
SET( BUILD_LIB_FROM_SOURCE 0) | ||
|
||
IF( QGLViewer_INCLUDE_DIR ) | ||
|
||
MESSAGE(STATUS "QGLViewer includes found in ${QGLViewer_INCLUDE_DIR}") | ||
IF (QGLViewer_LIBRARY_DIR_UBUNTU) | ||
MESSAGE(STATUS "QGLViewer library found in ${QGLViewer_LIBRARY_DIR_UBUNTU}") | ||
SET( QGLViewer_LIBRARIES ${QGLViewer_LIBRARY_DIR_UBUNTU}) | ||
SET( QGLViewer_FOUND 1 CACHE BOOL "Do we have QGLViewer?" FORCE ) | ||
ELSEIF(QGLViewer_LIBRARY_DIR_WINDOWS) | ||
MESSAGE(STATUS "QGLViewer2 found in ${QGLViewer_LIBRARY_DIR_WINDOWS}") | ||
SET( QGLViewer_LIBRARIES ${QGLViewer_LIBRARY_DIR_WINDOWS}) | ||
SET( QGLViewer_FOUND 1 CACHE BOOL "Do we have QGLViewer?" FORCE ) | ||
ELSEIF(QGLViewer_LIBRARY_DIR_OTHER) | ||
MESSAGE(STATUS "QGLViewer found in ${QGLViewer_LIBRARY_DIR_OTHER}") | ||
SET( QGLViewer_LIBRARIES ${QGLViewer_LIBRARY_DIR_OTHER}) | ||
SET( QGLViewer_FOUND 1 CACHE BOOL "Do we have QGLViewer?" FORCE ) | ||
ELSE() | ||
MESSAGE(STATUS "QGLViewer library not found.") | ||
SET( BUILD_LIB_FROM_SOURCE 1) | ||
SET( QGLViewer_FOUND 0 CACHE BOOL "Do we have QGLViewer?" FORCE ) | ||
ENDIF() | ||
|
||
ELSE() | ||
SET( BUILD_LIB_FROM_SOURCE 1) | ||
ENDIF() | ||
|
||
# build own libQGLViewer | ||
IF(BUILD_LIB_FROM_SOURCE) | ||
|
||
IF (WIN32) | ||
MESSAGE("Cannot generate QGLViewer2 from source automatically.") | ||
MESSAGE("Please build libQGLViewer from source, instructions to do so") | ||
MESSAGE("can be found in octovis/README.txt") | ||
MESSAGE("Please rerun CMAKE when you are ready.") | ||
|
||
ELSE (WIN32) | ||
IF(QGLVIEWER_BASE_DIR) | ||
MESSAGE(STATUS "Trying to build libQGLViewer from source in ${QGLVIEWER_BASE_DIR}") | ||
|
||
FIND_PROGRAM(QMAKE-QT4 qmake-qt4) | ||
IF (QMAKE-QT4) | ||
MESSAGE(STATUS "\t generating Makefile using qmake-qt4") | ||
EXECUTE_PROCESS( | ||
WORKING_DIRECTORY ${QGLVIEWER_BASE_DIR} | ||
COMMAND qmake-qt4 | ||
OUTPUT_QUIET | ||
) | ||
ELSE(QMAKE-QT4) | ||
MESSAGE(STATUS "\t generating Makefile using qmake") | ||
EXECUTE_PROCESS( | ||
WORKING_DIRECTORY ${QGLVIEWER_BASE_DIR} | ||
COMMAND qmake-qt4 | ||
OUTPUT_QUIET | ||
) | ||
ENDIF(QMAKE-QT4) | ||
|
||
MESSAGE(STATUS "\t building library (this may take some time...)") | ||
EXECUTE_PROCESS( | ||
WORKING_DIRECTORY ${QGLVIEWER_BASE_DIR} | ||
COMMAND make | ||
OUTPUT_QUIET | ||
) | ||
ENDIF(QGLVIEWER_BASE_DIR) | ||
ENDIF(WIN32) | ||
|
||
ELSE(BUILD_LIB_FROM_SOURCE) | ||
IF (NOT QGLViewer_FOUND) | ||
MESSAGE(STATUS "QGLViewer sources NOT found. Exiting.") | ||
ENDIF () | ||
ENDIF(BUILD_LIB_FROM_SOURCE) | ||
find_path(QGLViewer_INCLUDE_DIR | ||
NAMES qglviewer.h | ||
PATH_SUFFIXES QGLViewer) | ||
|
||
# verify that QGLViewer lib was build if we didnt find it elsewhere | ||
IF (NOT QGLViewer_FOUND) | ||
#FIND_LIBRARY(QGLViewer_LIBRARY_DIR_OTHER QGLViewer ${QGLVIEWER_BASE_DIR}) | ||
FIND_PATH(QGLLIB libQGLViewer.so ${QGLVIEWER_BASE_DIR}) | ||
IF (NOT QGLLIB) | ||
MESSAGE(WARNING "Could not find libQGLViewer.so, failed to build?") | ||
SET( QGLViewer_FOUND 0 CACHE BOOL "Do we have QGLViewer?" FORCE ) | ||
ELSE() | ||
MESSAGE(STATUS "Successfully built library in:\n${QGLLIB}") | ||
SET( QGLViewer_INCLUDE_DIR ${QGLVIEWER_BASE_DIR} CACHE PATH "QGLViewer Include directory" FORCE) | ||
SET( QGLViewer_LIBRARY_DIR ${QGLVIEWER_BASE_DIR} CACHE PATH "QGLViewer Library directory" FORCE) | ||
# TODO: also include "m pthread QGLViewerGen QGLViewerUtility"? | ||
SET( QGLViewer_LIBRARIES QGLViewer) | ||
SET( QGLViewer_FOUND 1 CACHE BOOL "Do we have QGLViewer?" FORCE ) | ||
ENDIF() | ||
ENDIF() | ||
find_library(QGLViewer_LIBRARIES | ||
NAMES QGLViewer QGLViewer2 QGLViewer-qt5 QGLViewer-qt4) | ||
|
||
# You need to use qmake of QT4. You are using QT3 if you get: | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
QGLViewer | ||
DEFAULT_MSG | ||
QGLViewer_LIBRARIES QGLViewer_INCLUDE_DIR) | ||
|
||
#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>)' | ||
mark_as_advanced(QGLViewer_INCLUDE_DIR QGLViewer_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters