Skip to content

Commit

Permalink
CMake tweaks for QGLviewer under Mac OS
Browse files Browse the repository at this point in the history
  • Loading branch information
Armin Hornung committed Feb 10, 2011
1 parent b8e2e50 commit 6a054e3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ ENDIF()

IF(BUILD_VIEWER)
MESSAGE(STATUS "\n")
MESSAGE(STATUS "viewer octovis will be build")
MESSAGE(STATUS "viewer octovis will be built")
ADD_SUBDIRECTORY( src/octovis )
ELSE()
MESSAGE ( "Unfortunately, the viewer (octovis) can not be build.")
MESSAGE ( "Unfortunately, the viewer (octovis) can not be built because some requirements are missing.")
MESSAGE ( "See README.txt or http://octomap.sf.net for further information.\n")
ENDIF()

Expand Down
1 change: 1 addition & 0 deletions CMakeModules/FindQGLViewer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SET( QGLViewer_HOME / CACHE PATH "Where to find QGLViewer" )
FIND_PATH( QGLViewer_INCLUDE_DIR qglviewer.h
/usr/include/qglviewer-qt4
/usr/include/QGLViewer
/opt/local/include/QGLViewer
${QGLViewer_HOME}
)

Expand Down
16 changes: 16 additions & 0 deletions src/octovis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ set(QT_USE_QTXML TRUE)
# include the files enabled above
include(${QT_USE_FILE})

# Mac OS X seems to require special linker flags:
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework OpenGL")
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework OpenGL")
SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -framework OpenGL")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

# sources for octovis library
set(viewerlib_SRCS
SceneObject.cpp
Expand Down Expand Up @@ -78,6 +85,15 @@ target_link_libraries(octovis
octovis_library
)

# special handling of MacOS X:
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_custom_command(TARGET octovis POST_BUILD
COMMAND install_name_tool -change libQGLViewer.2.dylib /opt/local/lib/libQGLViewer.2.dylib ${BASE_DIR}/bin/octovis
)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")




# #installation:
# # store all header files to install:
Expand Down

0 comments on commit 6a054e3

Please sign in to comment.