Show
Ignore:
Timestamp:
04/19/10 15:44:42 (4 years ago)
Author:
robert
Message:

From Stephan Huber and Mathieu Marache, "attached you'll find framework support for os x via cmake. Please credit
Mathieu Marache, he added the last missing piece to this puzzle.

I think it is safe to commit these changes to trunk, as the traditional
way via dylibs should work as before.

Here's some more info how to get frameworks:

With these modifications it is possible to compile frameworks on OS X,
when you set the Cmake-option OSG_COMPILE_FRAMEWORKS to true. If you
want to embed the frameworks in your app-bundle make sure to set
OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR accordingly.

You'll have to build the install-target of the generated xcode-projects
as this sets the install_name_dirs of the frameworks and plugins."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgViewer/CMakeLists.txt

    r10887 r11341  
    1  
    21# FIXME: For OS X, need flag for Framework or dylib 
    32IF(DYNAMIC_OPENSCENEGRAPH) 
     
    7170     
    7271    IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa") 
    73         ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION) 
    74         SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}  
    75             ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa 
    76             ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa 
    77             ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa 
    78         ) 
     72        ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION)     
     73  
     74        IF(OSG_COMPILE_FRAMEWORKS) 
     75           SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}  
     76                 ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa 
     77                 ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa 
     78                 ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa 
     79             ) 
     80            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)  
     81            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) 
     82            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) 
     83        ELSE() 
     84            SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}  
     85                ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa 
     86                ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa 
     87                ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa 
     88            ) 
     89        ENDIF()   
     90   
    7991        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}  
    8092            GraphicsWindowCocoa.mm 
     
    8395            PixelBufferCocoa.mm 
    8496        ) 
    85     SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) 
     97        SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) 
    8698    ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon") 
    87         ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION) 
    88         SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}  
    89             ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon 
    90             ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon 
    91             ${HEADER_PATH}/api/Carbon/PixelBufferCarbon 
    92         ) 
     99        ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION)      
     100  
     101        IF(OSG_COMPILE_FRAMEWORKS) 
     102           SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}  
     103                 ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon 
     104                 ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon 
     105                 ${HEADER_PATH}/api/Carbon/PixelBufferCarbon 
     106             ) 
     107            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)  
     108            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon) 
     109            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/PixelBufferCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon) 
     110        ELSE() 
     111            SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}  
     112                ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon 
     113                ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon 
     114                ${HEADER_PATH}/api/Carbon/PixelBufferCarbon 
     115            ) 
     116        ENDIF()    
     117  
    93118        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}  
    94119            GraphicsWindowCarbon.cpp 
     
    97122            PixelBufferCarbon.cpp 
    98123        ) 
     124         
    99125        SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) 
    100126    ELSE()