root/OpenSceneGraph/trunk/src/osgViewer/CMakeLists.txt @ 9671

Revision 9671, 5.9 kB (checked in by robert, 5 years ago)

From Sherman Wilcox, added VS versioning information into libs

  • Property svn:eol-style set to native
RevLine 
[6321]1
2# FIXME: For OS X, need flag for Framework or dylib
3IF   (DYNAMIC_OPENSCENEGRAPH)
[6660]4    ADD_DEFINITIONS(-DOSGVIEWER_LIBRARY)
[6321]5ELSE (DYNAMIC_OPENSCENEGRAPH)
[6660]6    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
[6321]7ENDIF(DYNAMIC_OPENSCENEGRAPH)
8
9SET(LIB_NAME osgViewer)
[9001]10
[6321]11SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})
12SET(LIB_PUBLIC_HEADERS
[6660]13    ${HEADER_PATH}/CompositeViewer
14    ${HEADER_PATH}/Export
15    ${HEADER_PATH}/GraphicsWindow
[7178]16    ${HEADER_PATH}/Renderer
[6660]17    ${HEADER_PATH}/Scene
18    ${HEADER_PATH}/Version
19    ${HEADER_PATH}/View
20    ${HEADER_PATH}/Viewer
[7507]21    ${HEADER_PATH}/ViewerBase
[6663]22    ${HEADER_PATH}/ViewerEventHandlers
[6321]23)
24
25SET(LIB_COMMON_FILES
[6660]26    CompositeViewer.cpp
[7178]27    HelpHandler.cpp
28    Renderer.cpp
[6660]29    Scene.cpp
[8629]30    ScreenCaptureHandler.cpp
[6660]31    StatsHandler.cpp
32    Version.cpp
33    View.cpp
34    Viewer.cpp
[7507]35    ViewerBase.cpp
[6663]36    ViewerEventHandlers.cpp
[9671]37    ${OPENSCENEGRAPH_VERSIONINFO_RC}
[6321]38)
39
[8737]40SET(LIB_EXTRA_LIBS)
[6321]41
42IF(WIN32)
[6735]43
[9001]44    #
45    # Enable workaround for OpenGL driver issues when used in multithreaded/multiscreen with NVidia drivers on Windows XP
46    # For example: osgviewer dumptruck.osg was showing total garbage (screen looked like shattered, splashed hedgehog)
47    # There were also serious issues with render to texture cameras.
48    # Workaround repeats makeCurrentContext call as it was found that this causes the problems to dissapear.
49    #
[9165]50    OPTION(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND "Set to ON if you have NVidia board and drivers earlier than 177.92 ver" OFF)
[9001]51    MARK_AS_ADVANCED(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
52    IF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
53        ADD_DEFINITIONS(-DOSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
54    ENDIF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
55
[7012]56    SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}
57        ${HEADER_PATH}/api/Win32/GraphicsWindowWin32
58        ${HEADER_PATH}/api/Win32/PixelBufferWin32
59    )
60       
61    SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
62        GraphicsWindowWin32.cpp
63        PixelBufferWin32.cpp
64    )
[6735]65
[6321]66ELSE(WIN32)
[7012]67
[6660]68    IF(APPLE)
[8479]69        SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon or X11.")
70    ELSE(APPLE)
71        SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation. options only X11")
72    ENDIF(APPLE)
73   
[6735]74
[8479]75    IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon")
76
[6660]77        # FIXME: OS X needs selection mechanism for Cocoa, Carbon, X11
[7039]78        SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}
79            ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon
80            ${HEADER_PATH}/api/Carbon/PixelBufferCarbon
81        )
82        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
83            GraphicsWindowCarbon.cpp
84            PixelBufferCarbon.cpp
85        )
[6735]86
[8479]87    ELSE(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon")
88
[6660]89        # X11 for everybody else
[7727]90
[9363]91
[9424]92        INCLUDE(FindPkgConfig OPTIONAL)
[9363]93        IF (PKG_CONFIG_FOUND)
94
95            PKG_CHECK_MODULES(XRANDR xrandr)
96           
97            IF (XRANDR_FOUND)
98                OPTION(OSGVIEWER_USE_XRANDR "Set to ON to enable Xrandr support for GraphicsWindowX11." ON)
99            ELSE(XRANDR_FOUND)
100                SET(OSGVIEWER_USE_XRANDR OFF)
101            ENDIF (XRANDR_FOUND)
102        ELSE(PKG_CONFIG_FOUND)
103            SET(OSGVIEWER_USE_XRANDR OFF)
104        ENDIF(PKG_CONFIG_FOUND)
105
106
[7007]107        SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}
108            ${HEADER_PATH}/api/X11/GraphicsWindowX11
109            ${HEADER_PATH}/api/X11/PixelBufferX11
110        )
[9548]111
112
[7007]113        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
114            GraphicsWindowX11.cpp
115            PixelBufferX11.cpp
116        )
[6735]117       
[7727]118        IF(OSGVIEWER_USE_XRANDR)
[9629]119       
[7727]120            ADD_DEFINITIONS(-DOSGVIEWER_USE_XRANDR)
[9548]121            SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XRANDR_INCLUDE_DIRS} )
[9629]122
123            IF  (X11_Xrandr_LIB)
124                SET(LIB_EXTRA_LIBS ${X11_Xrandr_LIB} ${LIB_EXTRA_LIBS})
125            ELSE(X11_Xrandr_LIB)
126                SET(LIB_EXTRA_LIBS ${XRANDR_LIBRARIES} ${LIB_EXTRA_LIBS})
127            ENDIF(X11_Xrandr_LIB)
128           
[7727]129        ENDIF(OSGVIEWER_USE_XRANDR)
130
[8737]131        # X11 on Apple requires X11 library plus OpenGL linking hack on Leopard
132        IF(APPLE)
133            # Find GL/glx.h
134            IF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11/include/GL/glx.h)
135                SET(OPENGL_INCLUDE_DIR /usr/X11/include)
136                SET(OPENGL_LIBRARIES /usr/X11/lib/libGL.dylib)
137            ELSEIF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11R6/include/GL/glx.h)
138                SET(OPENGL_INCLUDE_DIR /usr/X11R6/include)
139                SET(OPENGL_LIBRARIES /usr/X11R6/lib/libGL.dylib)
140            ENDIF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11/include/GL/glx.h)
141            INCLUDE_DIRECTORIES(BEFORE SYSTEM ${OPENGL_INCLUDE_DIR})
142
143            SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${OPENGL_LIBRARIES} ${LIB_EXTRA_LIBS})
144            SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
145        ENDIF(APPLE)
146           
147
[8479]148    ENDIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon")
[7012]149
[6321]150ENDIF(WIN32)
151
152
[6735]153ADD_LIBRARY(${LIB_NAME}
154    ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC}
[8211]155    ${LIB_PUBLIC_HEADERS}
156    ${LIB_PRIVATE_HEADERS}
[6735]157    ${LIB_COMMON_FILES}
158)
159
160
[6660]161LINK_INTERNAL(${LIB_NAME}     
162    osgGA
163    osgText
164    osgDB
165    osgUtil
166    osg
167    OpenThreads
[8737]168    ${LIB_EXTRA_LIBS}
[6321]169)
[6403]170
[6402]171LINK_CORELIB_DEFAULT(${LIB_NAME})
[6321]172
[6403]173IF(MINGW OR CYGWIN)
174    LINK_EXTERNAL(${LIB_NAME} gdi32 )
175ENDIF(MINGW OR CYGWIN)
[6363]176
[6743]177INCLUDE(ModuleInstall OPTIONAL)
[6403]178
[6743]179FOREACH( INCLUDEFILE ${LIB_PUBLIC_HEADERS} )
180   FILE(RELATIVE_PATH REL_INCLUDEFILE ${HEADER_PATH} ${INCLUDEFILE})
181   GET_FILENAME_COMPONENT(REL_INCLUDE_PATH ${REL_INCLUDEFILE} PATH)
182   INSTALL(
183   FILES        ${INCLUDEFILE}
184   DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}/${REL_INCLUDE_PATH}
[9342]185   COMPONENT libopenscenegraph-dev
[6743]186   )
187ENDFOREACH( INCLUDEFILE)
Note: See TracBrowser for help on using the browser.