diff --git a/CMakeModules/ModuleInstall.cmake b/CMakeModules/ModuleInstall.cmake index 19cdd53d1..55ccf2d7d 100644 --- a/CMakeModules/ModuleInstall.cmake +++ b/CMakeModules/ModuleInstall.cmake @@ -2,7 +2,7 @@ # Required Vars: # ${LIB_NAME} -# ${LIB_PUBLIC_HEADERS} +# ${TARGET_H} SET(INSTALL_INCDIR include) SET(INSTALL_BINDIR bin) @@ -18,7 +18,7 @@ SET(HEADERS_GROUP "Header Files") SOURCE_GROUP( ${HEADERS_GROUP} - FILES ${LIB_PUBLIC_HEADERS} + FILES ${TARGET_H} ) IF(MSVC AND OSG_MSVC_VERSIONED_DLL) @@ -34,7 +34,7 @@ INSTALL( IF(NOT OSG_COMPILE_FRAMEWORKS) INSTALL ( - FILES ${LIB_PUBLIC_HEADERS} + FILES ${TARGET_H} DESTINATION ${INSTALL_INCDIR}/${LIB_NAME} COMPONENT libopenscenegraph-dev ) @@ -45,7 +45,7 @@ ELSE() SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FRAMEWORK TRUE FRAMEWORK_VERSION ${OPENSCENEGRAPH_SOVERSION} - PUBLIC_HEADER "${LIB_PUBLIC_HEADERS}" + PUBLIC_HEADER "${TARGET_H}" INSTALL_NAME_DIR "${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}" ) # MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}") diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake index ea63146be..f99158997 100644 --- a/CMakeModules/OsgMacroUtils.cmake +++ b/CMakeModules/OsgMacroUtils.cmake @@ -197,6 +197,48 @@ MACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR) ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR) + +####################################################################################################### +# macro for common setup of libraries it expect some variables to be set: +# either within the local CMakeLists or higher in hierarchy +# LIB_NAME is the name of the target library +# TARGET_SRC are the sources of the target +# TARGET_H are the eventual headers of the target +# TARGET_LIBRARIES are the libraries to link to that are internal to the project and have d suffix for debug +# TARGET_EXTERNAL_LIBRARIES are external libraries and are not differentiated with d suffix +# TARGET_LABEL is the label IDE should show up for targets +########################################################################################################## + +MACRO(SETUP_LIBRARY LIB_NAME) + + SET(TARGET_NAME ${LIB_NAME} ) + SET(TARGET_TARGETNAME ${LIB_NAME} ) + + ADD_LIBRARY(${LIB_NAME} + ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} + ${TARGET_H} + ${TARGET_SRC} + ) + + IF(TARGET_LABEL) + SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}") + ENDIF(TARGET_LABEL) + + IF(TARGET_LIBRARIES) + LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES}) + ENDIF() + IF(TARGET_EXTERNAL_LIBRARIES) + LINK_EXTERNAL(${LIB_NAME} ${TARGET_EXTERNAL_LIBRARIES}) + ENDIF() + IF(TARGET_LIBRARIES_VARS) + LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS}) + ENDIF(TARGET_LIBRARIES_VARS) + LINK_CORELIB_DEFAULT(${LIB_NAME}) + + INCLUDE(ModuleInstall OPTIONAL) + +ENDMACRO(SETUP_LIBRARY LIB_NAME) + MACRO(SETUP_PLUGIN PLUGIN_NAME) SET(TARGET_NAME ${PLUGIN_NAME} ) diff --git a/src/osg/CMakeLists.txt b/src/osg/CMakeLists.txt index 0c6ecd80a..f6e1a71fc 100644 --- a/src/osg/CMakeLists.txt +++ b/src/osg/CMakeLists.txt @@ -8,7 +8,6 @@ ENDIF() SET(LIB_NAME osg) - # # Enable workaround for OpenGL driver crash with occlusion query # @@ -19,7 +18,7 @@ ENDIF() SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/AlphaFunc ${HEADER_PATH}/AnimationPath ${HEADER_PATH}/ApplicationUsage @@ -196,9 +195,10 @@ SET(LIB_PUBLIC_HEADERS ${OPENSCENEGRAPH_CONFIG_HEADER} ) -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +#ADD_LIBRARY(${LIB_NAME} +# ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} +# ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC AlphaFunc.cpp AnimationPath.cpp ApplicationUsage.cpp @@ -373,11 +373,22 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) +SET(TARGET_LIBRARIES OpenThreads) -LINK_INTERNAL(${LIB_NAME} - OpenThreads +SET(TARGET_EXTERNAL_LIBRARIES + ${CMAKE_THREAD_LIBS_INIT} + ${MATH_LIBRARY} + ${RT_LIBRARY} + ${DL_LIBRARY} ) -LINK_EXTERNAL(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ${RT_LIBRARY} ${DL_LIBRARY}) -LINK_CORELIB_DEFAULT(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ${RT_LIBRARY} ) -INCLUDE(ModuleInstall OPTIONAL) +#LINK_INTERNAL(${LIB_NAME} +# OpenThreads +#) +#LINK_EXTERNAL(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ${RT_LIBRARY} ${DL_LIBRARY}) +#LINK_CORELIB_DEFAULT(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ${RT_LIBRARY} ) + +#INCLUDE(ModuleInstall OPTIONAL) + +SETUP_LIBRARY(${LIB_NAME}) + diff --git a/src/osgAnimation/CMakeLists.txt b/src/osgAnimation/CMakeLists.txt index d6315bd70..ef7373d5b 100644 --- a/src/osgAnimation/CMakeLists.txt +++ b/src/osgAnimation/CMakeLists.txt @@ -1,4 +1,3 @@ - IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGANIMATION_LIBRARY) ELSE() @@ -7,9 +6,8 @@ ENDIF() SET(LIB_NAME osgAnimation) - SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Action ${HEADER_PATH}/ActionAnimation ${HEADER_PATH}/ActionBlendIn @@ -57,10 +55,7 @@ SET(LIB_PUBLIC_HEADERS ${HEADER_PATH}/VertexInfluence ) - -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC Action.cpp ActionAnimation.cpp ActionBlendIn.cpp @@ -98,7 +93,7 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osg osgText osgGA @@ -106,5 +101,5 @@ LINK_INTERNAL(${LIB_NAME} OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) + diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt index 6080c1005..df8d6441e 100644 --- a/src/osgDB/CMakeLists.txt +++ b/src/osgDB/CMakeLists.txt @@ -44,7 +44,7 @@ ENDIF() SET(LIB_NAME osgDB) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/DataTypes ${HEADER_PATH}/StreamOperator ${HEADER_PATH}/Serializer @@ -81,10 +81,7 @@ SET(LIB_PUBLIC_HEADERS ${HEADER_PATH}/XmlParser ) -# FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC ObjectWrapper.cpp InputStream.cpp OutputStream.cpp @@ -160,17 +157,13 @@ ENDIF() ADD_DEFINITIONS(-DOSG_PLUGIN_EXTENSION=${CMAKE_SHARED_MODULE_SUFFIX}) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osg osgUtil OpenThreads ) -LINK_EXTERNAL(${LIB_NAME} ${OSGDB_PLATFORM_SPECIFIC_LIBRARIES} ${DL_LIBRARY}) -LINK_WITH_VARIABLES(${LIB_NAME} ${COMPRESSION_LIBRARIES}) -LINK_CORELIB_DEFAULT(${LIB_NAME}) +SET(TARGET_EXTERNAL_LIBRARIES ${OSGDB_PLATFORM_SPECIFIC_LIBRARIES} ${DL_LIBRARY}) +SET(TARGET_LIBRARIES_VARS ${COMPRESSION_LIBRARIES}) -IF( ZLIB_FOUND ) - SET( TARGET_LIBRARIES_VARS ZLIB_LIBRARY ) -ENDIF( ZLIB_FOUND ) +SETUP_LIBRARY(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) diff --git a/src/osgFX/CMakeLists.txt b/src/osgFX/CMakeLists.txt index 19fc9fcee..026ea57f0 100644 --- a/src/osgFX/CMakeLists.txt +++ b/src/osgFX/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgFX) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/AnisotropicLighting ${HEADER_PATH}/BumpMapping ${HEADER_PATH}/Cartoon @@ -24,9 +24,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC AnisotropicLighting.cpp BumpMapping.cpp Cartoon.cpp @@ -42,12 +40,11 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgUtil osgDB osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) diff --git a/src/osgGA/CMakeLists.txt b/src/osgGA/CMakeLists.txt index 78c06c07d..e5d2e9763 100644 --- a/src/osgGA/CMakeLists.txt +++ b/src/osgGA/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF(DYNAMIC_OPENSCENEGRAPH) SET(LIB_NAME osgGA) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/AnimationPathManipulator ${HEADER_PATH}/DriveManipulator ${HEADER_PATH}/EventQueue @@ -33,10 +33,7 @@ SET(LIB_PUBLIC_HEADERS ${HEADER_PATH}/CameraViewSwitchManipulator ) -# FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC AnimationPathManipulator.cpp DriveManipulator.cpp EventQueue.cpp @@ -61,13 +58,12 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgDB osgUtil osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) +SETUP_LIBRARY(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) diff --git a/src/osgManipulator/CMakeLists.txt b/src/osgManipulator/CMakeLists.txt index 2cfce0b71..356b80df8 100644 --- a/src/osgManipulator/CMakeLists.txt +++ b/src/osgManipulator/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgManipulator) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/AntiSquish ${HEADER_PATH}/Command ${HEADER_PATH}/CommandManager @@ -34,9 +34,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC AntiSquish.cpp Command.cpp Constraint.cpp @@ -60,13 +58,12 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgViewer osgGA osgUtil osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) diff --git a/src/osgParticle/CMakeLists.txt b/src/osgParticle/CMakeLists.txt index 328cb9466..30d5a7037 100644 --- a/src/osgParticle/CMakeLists.txt +++ b/src/osgParticle/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgParticle) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/AccelOperator ${HEADER_PATH}/AngularAccelOperator ${HEADER_PATH}/BoxPlacer @@ -60,9 +60,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC ConnectedParticleSystem.cpp Emitter.cpp ExplosionDebrisEffect.cpp @@ -90,12 +88,11 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgUtil osgDB osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) diff --git a/src/osgPresentation/CMakeLists.txt b/src/osgPresentation/CMakeLists.txt index 989d48142..2ba472b36 100644 --- a/src/osgPresentation/CMakeLists.txt +++ b/src/osgPresentation/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgPresentation) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Export ${HEADER_PATH}/AnimationMaterial ${HEADER_PATH}/CompileSlideCallback @@ -17,9 +17,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC AnimationMaterial.cpp CompileSlideCallback.cpp PickEventHandler.cpp @@ -28,7 +26,7 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgViewer osgManipulator osgVolume @@ -40,6 +38,6 @@ LINK_INTERNAL(${LIB_NAME} osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) + diff --git a/src/osgQt/CMakeLists.txt b/src/osgQt/CMakeLists.txt index 40bb9eede..e62964c57 100644 --- a/src/osgQt/CMakeLists.txt +++ b/src/osgQt/CMakeLists.txt @@ -14,8 +14,7 @@ SET(SOURCES_H QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" ) - -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Export ${HEADER_PATH}/GraphicsWindowQt ${HEADER_PATH}/QFontImplementation @@ -26,9 +25,7 @@ SET(LIB_PUBLIC_HEADERS # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC GraphicsWindowQt.cpp QFontImplementation.cpp QGraphicsViewAdapter.cpp @@ -37,7 +34,7 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgWidget osgDB osgUtil @@ -50,9 +47,12 @@ IF(CMAKE_COMPILER_IS_GNUCXX) STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ENDIF() -TARGET_LINK_LIBRARIES(${LIB_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY}) +SET(TARGET_LIBRARIES_VARS + QT_QTCORE_LIBRARY + QT_QTGUI_LIBRARY + QT_QTOPENGL_LIBRARY +) INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) -LINK_CORELIB_DEFAULT(${LIB_NAME}) +SETUP_LIBRARY(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) diff --git a/src/osgShadow/CMakeLists.txt b/src/osgShadow/CMakeLists.txt index f5ee19224..a6458e181 100644 --- a/src/osgShadow/CMakeLists.txt +++ b/src/osgShadow/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgShadow) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Export ${HEADER_PATH}/OccluderGeometry ${HEADER_PATH}/ShadowMap @@ -30,9 +30,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC OccluderGeometry.cpp ShadowMap.cpp ShadowTechnique.cpp @@ -53,12 +51,12 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgUtil osgDB osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) + diff --git a/src/osgSim/CMakeLists.txt b/src/osgSim/CMakeLists.txt index fe960b6e8..a866c2d17 100644 --- a/src/osgSim/CMakeLists.txt +++ b/src/osgSim/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgSim) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/BlinkSequence ${HEADER_PATH}/ColorRange ${HEADER_PATH}/DOFTransform @@ -35,9 +35,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC BlinkSequence.cpp ColorRange.cpp DOFTransform.cpp @@ -65,13 +63,14 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgText osgUtil osgDB osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) + + diff --git a/src/osgTerrain/CMakeLists.txt b/src/osgTerrain/CMakeLists.txt index 5ea0b5e5a..561071917 100644 --- a/src/osgTerrain/CMakeLists.txt +++ b/src/osgTerrain/CMakeLists.txt @@ -6,7 +6,7 @@ ENDIF() SET(LIB_NAME osgTerrain) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Export ${HEADER_PATH}/Locator ${HEADER_PATH}/Layer @@ -19,9 +19,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC Layer.cpp Locator.cpp TerrainTile.cpp @@ -32,14 +30,12 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgUtil osgDB osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) - -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) diff --git a/src/osgText/CMakeLists.txt b/src/osgText/CMakeLists.txt index 8ff75f23c..a0f309733 100644 --- a/src/osgText/CMakeLists.txt +++ b/src/osgText/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgText) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Export ${HEADER_PATH}/Font ${HEADER_PATH}/Font3D @@ -23,9 +23,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC DefaultFont.cpp DefaultFont.h GlyphGeometry.h @@ -42,12 +40,12 @@ ADD_LIBRARY(${LIB_NAME} ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgDB osg osgUtil OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) + diff --git a/src/osgUtil/CMakeLists.txt b/src/osgUtil/CMakeLists.txt index bb07e35ce..eb43daa18 100644 --- a/src/osgUtil/CMakeLists.txt +++ b/src/osgUtil/CMakeLists.txt @@ -8,7 +8,7 @@ ENDIF() SET(LIB_NAME osgUtil) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/ConvertVec ${HEADER_PATH}/CubeMapGenerator ${HEADER_PATH}/CullVisitor @@ -52,9 +52,7 @@ SET(LIB_PUBLIC_HEADERS ${HEADER_PATH}/Version ) -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC CubeMapGenerator.cpp CullVisitor.cpp DelaunayTriangulator.cpp @@ -110,10 +108,10 @@ ADD_LIBRARY(${LIB_NAME} INCLUDE_DIRECTORIES("tristripper/include") -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) + diff --git a/src/osgViewer/CMakeLists.txt b/src/osgViewer/CMakeLists.txt index 1647ee88e..bbb9b03bd 100644 --- a/src/osgViewer/CMakeLists.txt +++ b/src/osgViewer/CMakeLists.txt @@ -8,7 +8,7 @@ ENDIF() SET(LIB_NAME osgViewer) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/CompositeViewer ${HEADER_PATH}/Export ${HEADER_PATH}/GraphicsWindow @@ -51,7 +51,7 @@ IF(WIN32) ADD_DEFINITIONS(-DOSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) ENDIF() - SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} + SET(TARGET_H ${TARGET_H} ${HEADER_PATH}/api/Win32/GraphicsHandleWin32 ${HEADER_PATH}/api/Win32/GraphicsWindowWin32 ${HEADER_PATH}/api/Win32/PixelBufferWin32 @@ -87,7 +87,7 @@ ELSE() SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) ELSE() - SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} + SET(TARGET_H ${TARGET_H} ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa @@ -115,7 +115,7 @@ ELSE() SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon) SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/PixelBufferCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon) ELSE() - SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} + SET(TARGET_H ${TARGET_H} ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon ${HEADER_PATH}/api/Carbon/PixelBufferCarbon @@ -142,7 +142,7 @@ ELSE() SET_PROPERTY(SOURCE ${HEADER_PATH}/api/IOS/GraphicsWindowIOS PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/IOS) ELSE() - SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} + SET(TARGET_H ${TARGET_H} ${HEADER_PATH}/api/IOS/GraphicsWindowIOS #${HEADER_PATH}/api/IOS/PixelBufferIOS ) @@ -170,7 +170,7 @@ ELSE() SET(OSGVIEWER_USE_XRANDR OFF) ENDIF() - SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} + SET(TARGET_H ${TARGET_H} ${HEADER_PATH}/api/X11/GraphicsHandleX11 ${HEADER_PATH}/api/X11/GraphicsWindowX11 ${HEADER_PATH}/api/X11/PixelBufferX11 @@ -221,15 +221,13 @@ ELSE() ENDIF() -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC ${LIB_PRIVATE_HEADERS} ${LIB_COMMON_FILES} ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgGA osgText osgDB @@ -238,17 +236,15 @@ LINK_INTERNAL(${LIB_NAME} OpenThreads ) -LINK_EXTERNAL(${LIB_NAME} ${LIB_EXTRA_LIBS}) - -LINK_CORELIB_DEFAULT(${LIB_NAME}) +SET(TARGET_EXTERNAL_LIBRARIES ${LIB_EXTRA_LIBS}) IF(MINGW OR CYGWIN) - LINK_EXTERNAL(${LIB_NAME} gdi32 ) + SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARY} gdi32 ) ENDIF() -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) -FOREACH(INCLUDEFILE ${LIB_PUBLIC_HEADERS} ) +FOREACH(INCLUDEFILE ${TARGET_H} ) FILE(RELATIVE_PATH REL_INCLUDEFILE ${HEADER_PATH} ${INCLUDEFILE}) GET_FILENAME_COMPONENT(REL_INCLUDE_PATH ${REL_INCLUDEFILE} PATH) INSTALL( diff --git a/src/osgVolume/CMakeLists.txt b/src/osgVolume/CMakeLists.txt index ef98496d9..d0148393f 100644 --- a/src/osgVolume/CMakeLists.txt +++ b/src/osgVolume/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() SET(LIB_NAME osgVolume) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Export ${HEADER_PATH}/FixedFunctionTechnique ${HEADER_PATH}/Layer @@ -21,9 +21,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC FixedFunctionTechnique.cpp Layer.cpp Locator.cpp @@ -38,13 +36,14 @@ ADD_LIBRARY(${LIB_NAME} SET(TARGET_LIBRARIES_VARS FREETYPE_LIBRARY ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgUtil osgDB osgGA osg OpenThreads ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) + + diff --git a/src/osgWidget/CMakeLists.txt b/src/osgWidget/CMakeLists.txt index d1c501bee..09aca25fc 100644 --- a/src/osgWidget/CMakeLists.txt +++ b/src/osgWidget/CMakeLists.txt @@ -6,7 +6,7 @@ ENDIF() SET(LIB_NAME osgWidget) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) -SET(LIB_PUBLIC_HEADERS +SET(TARGET_H ${HEADER_PATH}/Export ${HEADER_PATH}/Box ${HEADER_PATH}/Browser @@ -34,9 +34,7 @@ SET(LIB_PUBLIC_HEADERS ) # FIXME: For OS X, need flag for Framework or dylib -ADD_LIBRARY(${LIB_NAME} - ${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC} - ${LIB_PUBLIC_HEADERS} +SET(TARGET_SRC Box.cpp Browser.cpp PdfReader.cpp @@ -61,7 +59,7 @@ ADD_LIBRARY(${LIB_NAME} SET(TARGET_LIBRARIES_VARS FREETYPE_LIBRARY ) -LINK_INTERNAL(${LIB_NAME} +SET(TARGET_LIBRARIES osgText osgViewer osgDB @@ -69,6 +67,6 @@ LINK_INTERNAL(${LIB_NAME} OpenThreads osgGA ) -LINK_CORELIB_DEFAULT(${LIB_NAME}) -INCLUDE(ModuleInstall OPTIONAL) +SETUP_LIBRARY(${LIB_NAME}) +