root/OpenSceneGraph/trunk/src/osgDB/CMakeLists.txt @ 9922

Revision 9922, 3.0 kB (checked in by robert, 6 years ago)

From Frank Midgley, "I tried running osgconv --formats yesterday on OS X and got no results. Turns out the changes discussed in the "osgDB::listAllAvailablePlugins win32 fix" thread back in Sep '08 broke this. The OSG_PLUGIN_EXTENSION macro is being defined in src/osgDB/CMakeLists.txt from CMAKE_SHARED_LIBRARY_SUFFIX which is "dylib" on OS X. The problem is that all of the plug-ins are setup in OsgMacroUtils?.cmake with:

ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H})

which gives them .so extensions. Since ".so" != ".dylib" osgDB::listAllAvailablePlugins finds no plug-ins. I believe the correct solution is to use CMAKE_SHARED_MODULE_SUFFIX instead. This builds and runs correctly on OS X but I have not tested on other platforms.

Attached is an updated src/osgDB/CMakeLists.txt based on rev 9915. The change is at line 108. To validate: build and then run bin/osgconv --formats. You should get many screenfuls of plug-in features, extensions and options."

  • Property svn:eol-style set to native
Line 
1
2IF   (DYNAMIC_OPENSCENEGRAPH)
3    ADD_DEFINITIONS(-DOSGDB_LIBRARY)
4
5    # Add a default plugin search path component
6    ADD_DEFINITIONS(-DOSG_DEFAULT_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}/${OSG_PLUGINS})
7ELSE (DYNAMIC_OPENSCENEGRAPH)
8    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
9ENDIF(DYNAMIC_OPENSCENEGRAPH)
10
11
12
13SET(LIB_NAME osgDB)
14SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})
15SET(LIB_PUBLIC_HEADERS
16    ${HEADER_PATH}/Archive
17    ${HEADER_PATH}/AuthenticationMap
18    ${HEADER_PATH}/ConvertUTF
19    ${HEADER_PATH}/DatabasePager
20    ${HEADER_PATH}/DotOsgWrapper
21    ${HEADER_PATH}/DynamicLibrary
22    ${HEADER_PATH}/Export
23    ${HEADER_PATH}/Field
24    ${HEADER_PATH}/FieldReader
25    ${HEADER_PATH}/FieldReaderIterator
26    ${HEADER_PATH}/FileCache
27    ${HEADER_PATH}/FileNameUtils
28    ${HEADER_PATH}/FileUtils
29    ${HEADER_PATH}/fstream
30    ${HEADER_PATH}/ImageOptions
31    ${HEADER_PATH}/ImagePager
32    ${HEADER_PATH}/Input
33    ${HEADER_PATH}/Output
34    ${HEADER_PATH}/ParameterOutput
35    ${HEADER_PATH}/PluginQuery
36    ${HEADER_PATH}/ReaderWriter
37    ${HEADER_PATH}/ReadFile
38    ${HEADER_PATH}/Registry
39    ${HEADER_PATH}/Serializer
40    ${HEADER_PATH}/SharedStateManager
41    ${HEADER_PATH}/Version
42    ${HEADER_PATH}/WriteFile
43)
44
45# FIXME: For OS X, need flag for Framework or dylib
46ADD_LIBRARY(${LIB_NAME}
47    ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC}
48    ${LIB_PUBLIC_HEADERS}
49    Archive.cpp
50    AuthenticationMap.cpp
51    ConvertUTF.cpp
52    DatabasePager.cpp
53    DotOsgWrapper.cpp
54    DynamicLibrary.cpp
55    Field.cpp
56    FieldReader.cpp
57    FieldReaderIterator.cpp
58    FileCache.cpp
59    FileNameUtils.cpp
60    FileUtils.cpp
61    fstream.cpp
62    ImageOptions.cpp
63    ImagePager.cpp
64    Input.cpp
65    Output.cpp
66    PluginQuery.cpp
67    ReaderWriter.cpp
68    ReadFile.cpp
69    Registry.cpp
70    SharedStateManager.cpp
71    Version.cpp
72    WriteFile.cpp
73    ${OPENSCENEGRAPH_VERSIONINFO_RC}
74)
75
76IF(APPLE)
77    # Needs CoreFoundation calls and a Carbon function
78    SET(OSGDB_PLATFORM_SPECIFIC_LIBRARIES ${CARBON_LIBRARY})
79 
80    SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "standard image plugin for os x, options are quicktime, imageio")
81
82
83    IF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime")
84        ADD_DEFINITIONS(-DDARWIN_QUICKTIME)
85    ELSE(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime")
86        ADD_DEFINITIONS(-DDARWIN_IMAGEIO)
87    ENDIF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime")
88
89ENDIF(APPLE)
90
91IF(QUICKTIME_FOUND)
92    ADD_DEFINITIONS(-DUSE_QUICKTIME)
93ENDIF(QUICKTIME_FOUND)
94
95IF(XINE_FOUND)
96        ADD_DEFINITIONS(-DUSE_XINE)
97ENDIF(XINE_FOUND)
98
99IF(INVENTOR_FOUND)
100        ADD_DEFINITIONS(-DUSE_INVENTOR)
101ENDIF(INVENTOR_FOUND)
102
103IF(OPENVRML_FOUND)
104        ADD_DEFINITIONS(-DUSE_VRML)
105ENDIF(OPENVRML_FOUND)
106
107
108ADD_DEFINITIONS(-DOSG_PLUGIN_EXTENSION=${CMAKE_SHARED_MODULE_SUFFIX})
109
110LINK_INTERNAL(${LIB_NAME}     
111    osg
112    OpenThreads
113)
114LINK_EXTERNAL(${LIB_NAME}     ${OSGDB_PLATFORM_SPECIFIC_LIBRARIES} )
115LINK_CORELIB_DEFAULT(${LIB_NAME})
116
117INCLUDE(ModuleInstall OPTIONAL)
Note: See TracBrowser for help on using the browser.