Merge pull request #660 from mxgrey/modernize_cmake

Create a config-file and export library targets for downstream users
This commit is contained in:
OpenSceneGraph git repository 2018-11-26 09:03:20 +00:00 committed by GitHub
commit 3ea101df66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 708 additions and 278 deletions

View File

@ -880,6 +880,67 @@ IF(NOT DEFINED LIB_POSTFIX)
SET(LIB_POSTFIX "")
ENDIF()
# Set installation variables
SET(INSTALL_INCDIR include)
SET(INSTALL_BINDIR bin)
IF(WIN32)
SET(INSTALL_LIBDIR bin)
SET(INSTALL_ARCHIVEDIR lib)
ELSE()
SET(INSTALL_LIBDIR lib${LIB_POSTFIX})
SET(INSTALL_ARCHIVEDIR lib${LIB_POSTFIX})
ENDIF()
# If the version is equal to or greater than 2.8.8, then we can use the
# CMakePackageConfigHelpers module, which we use for configuring the package
# config file. If we are not producing the package config file, then there is no
# point in exporting the targets.
IF(CMAKE_VERSION VERSION_EQUAL "2.8.8" OR
CMAKE_VERSION VERSION_GREATER "2.8.8")
# Tell the project that we will be exporting targets
SET(OSG_EXPORT_TARGETS TRUE CACHE BOOL "Install a config-file and export targets")
# Set the package namespace for exporting
SET(PKG_NAMESPACE osg${OPENSCENEGRAPH_MAJOR_VERSION})
IF(WIN32)
SET(INSTALL_CONFIGDIR cmake)
ELSE()
SET(INSTALL_CONFIGDIR lib${LIB_POSTFIX}/cmake/OpenSceneGraph)
ENDIF()
INCLUDE(CMakePackageConfigHelpers)
CONFIGURE_PACKAGE_CONFIG_FILE(
${PROJECT_SOURCE_DIR}/packaging/cmake/OpenSceneGraphConfig.cmake.in
configure/OpenSceneGraphConfig.cmake
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
PATH_VARS INSTALL_INCDIR
)
WRITE_BASIC_PACKAGE_VERSION_FILE(
configure/OpenSceneGraphConfigVersion.cmake
VERSION ${OPENSCENEGRAPH_VERSION}
COMPATIBILITY SameMajorVersion
)
INSTALL(
FILES
${PROJECT_BINARY_DIR}/configure/OpenSceneGraphConfig.cmake
${PROJECT_BINARY_DIR}/configure/OpenSceneGraphConfigVersion.cmake
DESTINATION ${INSTALL_CONFIGDIR}
COMPONENT libopenscenegraph-dev
)
ELSE()
# We don't support exporting creating config files or exporting targets without >=2.8.8
SET(OSG_EXPORT_TARGETS FALSE CACHE BOOL "Cannot install config files without CMake >= 2.8.8" FORCE)
ENDIF()
SET(INSTALL_PKGCONFIGDIR lib${LIB_POSTFIX}/pkgconfig)
# Here we apparently do some funky stuff with making the bin/ and lib/
# folders which is probably needed to work around a very old CMake bug?
@ -1237,35 +1298,6 @@ IF(CMAKE_CPACK_COMMAND)
ENDIF()
ENDIF()
# Generate pkg-config configuration files
SET(PKGCONFIG_FILES
openscenegraph
openscenegraph-osg
openscenegraph-osgDB
openscenegraph-osgFX
openscenegraph-osgGA
openscenegraph-osgParticle
openscenegraph-osgSim
openscenegraph-osgText
openscenegraph-osgUtil
openscenegraph-osgTerrain
openscenegraph-osgManipulator
openscenegraph-osgViewer
openscenegraph-osgWidget
openscenegraph-osgShadow
openscenegraph-osgAnimation
openscenegraph-osgVolume
)
FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc
@ONLY
)
INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
ENDFOREACH(PKGCONFIG_FILE)
# Run this as late as possible so users can easier spot the message
IF (NOT DEFINED REQUIRES_LIBPATH_MESSAGE AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")

View File

@ -4,16 +4,6 @@
# ${LIB_NAME}
# ${TARGET_H}
SET(INSTALL_INCDIR include)
SET(INSTALL_BINDIR bin)
IF(WIN32)
SET(INSTALL_LIBDIR bin)
SET(INSTALL_ARCHIVEDIR lib)
ELSE()
SET(INSTALL_LIBDIR lib${LIB_POSTFIX})
SET(INSTALL_ARCHIVEDIR lib${LIB_POSTFIX})
ENDIF()
SET(HEADERS_GROUP "Header Files")
SOURCE_GROUP(
@ -25,12 +15,55 @@ IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
HANDLE_MSVC_DLL()
ENDIF()
INSTALL(
IF(OSG_EXPORT_TARGETS)
INSTALL(
TARGETS ${LIB_NAME}
EXPORT ${LIB_NAME}
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT libopenscenegraph
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
)
INSTALL(
EXPORT ${LIB_NAME}
NAMESPACE ${PKG_NAMESPACE}::
DESTINATION ${INSTALL_CONFIGDIR}
FILE ${LIB_NAME}-targets.cmake
COMPONENT libopenscenegraph-dev
)
SET(COMPONENT_CMAKE_DEPENDENCIES ${TARGET_LIBRARIES})
# These two libraries are special cases because they will always be included
# by the config-file.
LIST(REMOVE_ITEM COMPONENT_CMAKE_DEPENDENCIES OpenThreads)
LIST(REMOVE_ITEM COMPONENT_CMAKE_DEPENDENCIES osg)
SET(TARGET_IMPORT_INPUT_FILE "${PROJECT_SOURCE_DIR}/packaging/cmake/openscenegraph-component-import-targets.cmake")
SET(TARGET_IMPORT_OUTPUT_FILE "${PROJECT_BINARY_DIR}/packaging/cmake/openscenegraph-${LIB_NAME}-import-targets.cmake")
CONFIGURE_FILE(
${TARGET_IMPORT_INPUT_FILE}
${TARGET_IMPORT_OUTPUT_FILE}
@ONLY
)
INSTALL(
FILES ${TARGET_IMPORT_OUTPUT_FILE}
DESTINATION ${INSTALL_CONFIGDIR}
COMPONENT libopenscenegraph-dev
)
ELSE()
INSTALL(
TARGETS ${LIB_NAME}
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT libopenscenegraph
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
)
)
ENDIF()
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
GET_TARGET_PROPERTY(PREFIX ${LIB_NAME} PREFIX)
@ -57,3 +90,26 @@ ELSE()
# MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
ENDIF()
# Install pkgconfig file for this component
SET(COMPONENT_PKGCONFIG_REQUIRES)
FOREACH(component ${TARGET_LIBRARIES})
IF(${component} STREQUAL "OpenThreads")
# Skip OpenThreads because that's handled separately
CONTINUE()
ENDIF()
SET(COMPONENT_PKGCONFIG_REQUIRES "${COMPONENT_PKGCONFIG_REQUIRES} openscenegraph-${component}")
ENDFOREACH()
SET(PKGCONFIG_INPUT_FILE "${PROJECT_SOURCE_DIR}/packaging/pkgconfig/component.pc.in")
SET(PKGCONFIG_OUTPUT_FILE "${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph-${LIB_NAME}.pc")
CONFIGURE_FILE(
${PKGCONFIG_INPUT_FILE}
${PKGCONFIG_OUTPUT_FILE}
@ONLY
)
INSTALL(
FILES ${PKGCONFIG_OUTPUT_FILE}
DESTINATION ${INSTALL_PKGCONFIGDIR}
COMPONENT libopenscenegraph-dev
)

View File

@ -223,6 +223,13 @@ MACRO(SETUP_LIBRARY LIB_NAME)
${TARGET_H_NO_MODULE_INSTALL}
${TARGET_SRC}
)
TARGET_INCLUDE_DIRECTORIES(${LIB_NAME}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INSTALL_INCDIR}>
)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core")
IF(APPLE)
IF(OSG_BUILD_PLATFORM_IPHONE)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 2.8.8)
SET(PROJECT_NAME osgCMakeExampleModern)
PROJECT(${PROJECT_NAME})
FIND_PACKAGE (OpenSceneGraph REQUIRED COMPONENTS osgUtil osgDB osgText osgGA osgFX osgSim osgViewer CONFIG)
SET(SOURCES
main.cpp
)
ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} osg3::osg osg3::osgUtil osg3::osgDB osg3::osgText osg3::osgGA osg3::osgFX osg3::osgSim osg3::osgViewer)

View File

@ -0,0 +1,183 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commercial and non commercial applications,
* as long as this copyright notice is maintained.
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <osgDB/ReadFile>
#include <osgUtil/Optimizer>
#include <osg/CoordinateSystemNode>
#include <osg/Switch>
#include <osg/Types>
#include <osgText/Text>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osgGA/SphericalManipulator>
#include <osgGA/Device>
#include <iostream>
int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the standard OpenSceneGraph example which loads and visualises 3d models.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField");
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Play specified camera path animation file, previously saved with 'z' key.");
arguments.getApplicationUsage()->addCommandLineOption("--speed <factor>","Speed factor for animation playing (1 == normal speed).");
arguments.getApplicationUsage()->addCommandLineOption("--device <device-name>","add named device to the viewer");
osgViewer::Viewer viewer(arguments);
unsigned int helpType = 0;
if ((helpType = arguments.readHelpType()))
{
arguments.getApplicationUsage()->write(std::cout, helpType);
return 1;
}
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
std::string url, username, password;
while(arguments.read("--login",url, username, password))
{
if (!osgDB::Registry::instance()->getAuthenticationMap())
{
osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(
url,
new osgDB::AuthenticationDetails(username, password)
);
}
}
std::string device;
while(arguments.read("--device", device))
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<osgGA::Device>(device);
if (dev.valid())
{
viewer.addDevice(dev);
}
}
// set up the camera manipulators.
{
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
keyswitchManipulator->addMatrixManipulator( '5', "Orbit", new osgGA::OrbitManipulator() );
keyswitchManipulator->addMatrixManipulator( '6', "FirstPerson", new osgGA::FirstPersonManipulator() );
keyswitchManipulator->addMatrixManipulator( '7', "Spherical", new osgGA::SphericalManipulator() );
std::string pathfile;
double animationSpeed = 1.0;
while(arguments.read("--speed",animationSpeed) ) {}
char keyForAnimationPath = '8';
while (arguments.read("-p",pathfile))
{
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
if (apm || !apm->valid())
{
apm->setTimeScale(animationSpeed);
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
keyswitchManipulator->selectMatrixManipulator(num);
++keyForAnimationPath;
}
}
viewer.setCameraManipulator( keyswitchManipulator.get() );
}
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
// add the thread model handler
viewer.addEventHandler(new osgViewer::ThreadingHandler);
// add the window size toggle handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
// add the help handler
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
// add the record camera path handler
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
// add the LOD Scale handler
viewer.addEventHandler(new osgViewer::LODScaleHandler);
// add the screen capture handler
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
}
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
// optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel);
viewer.setSceneData(loadedModel);
viewer.realize();
return viewer.run();
}

View File

@ -0,0 +1,192 @@
# - Config file for the OpenSceneGraph package.
#
# For finding and loading OpenSceneGraph from your project, type:
#
# find_package(OpenSceneGraph [version] [COMPONENTS comp])
#
# This creates the following variables:
#
# OpenSceneGraph_LIBRARIES : All the libraries of all the requested components
# OPENSCENEGRAPH_LIBRARIES
#
# OpenSceneGraph_INCLUDE_DIRS : All the include directories of all the requested components
# OPENSCENEGRAPH_INCLUDE_DIRS
#
# OpenSceneGraph_FOUND : Set to true if all required components can be found
# OPENSCENEGRAPH_FOUND
#
# OpenSceneGraph_<comp>_FOUND : Set to true if this component was found
# OPENSCENEGRAPH_<COMP>_FOUND
#
# OSG_LIBRARY : The library for the core OSG component
# OSG_LIBRARIES
#
# OSG_INCLUDE_DIR : The include directory for the core OSG component
#
# <COMP>_LIBRARY : This is created for each requested component <comp>
# <COMP>_LIBRARIES and refers to the component's library
#
# <COMP>_INCLUDE_DIR : This is created for each requested component <comp>
# and refers to the component's include directory
################################################################################
#
# This config-file will also import the following targets:
#
# @PKG_NAMESPACE@::osg (for the core OSG library)
# @PKG_NAMESPACE@::<comp> (for each requested component library)
#
# Use target_link_libraries(tgt [PUBLIC|PRIVATE] @PKG_NAMESPACE@::<comp>)
# for each component that you want to link to.
#
# For convenience, this will also produce a variable
#
# OpenSceneGraph_TARGETS
#
# which will contain the targets of all the requested components.
#
################################################################################
# =========================== DO NOT MODIFY THIS FILE DIRECTLY ===========================
# This file is auto-generated from OpenSceneGraph/CMakeModules/OpenSceneGraphConfig.cmake
# ========================================================================================
# We depend on 2.8.8 for CMakePackageConfigHelpers. This config file is not
# guaranteed to work with lower versions of cmake.
cmake_minimum_required(VERSION 2.8.8)
# Assume we have succeeded unless a required component is missing
set(OpenSceneGraph_FOUND TRUE)
set(OPENSCENEGRAPH_FOUND TRUE)
# Shortcut if find_package(OpenSceneGraph ...) has been called before
if(OpenSceneGraph_CONFIG_INCLUDED)
# Check that each of the components requested have already been found.
set(OpenSceneGraph_all_components_found TRUE)
foreach(component ${OpenSceneGraph_FIND_COMPONENTS})
if(NOT TARGET @PKG_NAMESPACE@::${component})
set(OpenSceneGraph_all_components_found FALSE)
break()
endif()
endforeach()
# If this config file has been called before, and all the requested
# components are already found, then exit early.
if(OpenSceneGraph_all_components_found)
return()
endif()
endif()
set(OpenSceneGraph_CONFIG_INCLUDED TRUE)
@PACKAGE_INIT@
set(OpenSceneGraph_INCLUDE_DIRS @PACKAGE_INSTALL_INCDIR@)
set(OPENSCENEGRAPH_INCLUDE_DIRS ${OpenSceneGraph_INCLUDE_DIRS})
set(OpenSceneGraph_LIBRARIES)
set(OpenSceneGraph_TARGETS)
foreach(component OpenThreads osg ${OpenSceneGraph_FIND_COMPONENTS})
if(TARGET @PKG_NAMESPACE@::${component})
# This component has already been found, so we'll skip it
continue()
endif()
string(TOUPPER ${component} UC_COMPONENT)
set(osg_component_import_target_file ${CMAKE_CURRENT_LIST_DIR}/openscenegraph-${component}-import-targets.cmake)
if(NOT EXISTS ${osg_component_import_target_file})
if(OpenSceneGraph_FIND_REQUIRED_${component} OR NOT OpenSceneGraph_FIND_QUIETLY)
message("Could not find [${component}] component of OpenSceneGraph")
endif()
set(OpenSceneGraph_${component}_FOUND FALSE)
set(OPENSCENEGRAPH_${UC_COMPONENT}_FOUND FALSE)
continue()
endif()
include(${osg_component_import_target_file})
list(APPEND OpenSceneGraph_TARGETS @PKG_NAMESPACE@::${component})
set(OpenSceneGraph_${component}_FOUND TRUE)
set(OPENSCENEGRAPH_${component}_FOUND TRUE)
if(NOT OpenSceneGraph_FIND_QUIETLY)
message(STATUS "Found [${component}] component of OpenSceneGraph")
endif()
# Components all get installed to the same include directory
set(${UC_COMPONENT}_INCLUDE_DIR ${OpenSceneGraph_INCLUDE_DIRS})
if(WIN32)
# For Windows, we need to provide the consumer with the IMPLIB (.lib) file
set(osg_imported_lib_property IMPORTED_IMPLIB)
else()
# For UNIX, we need to provide the shared object (.so) file
set(osg_imported_lib_property IMPORTED_LOCATION)
endif()
# For each possible configuration, find the relevant file on disk
foreach(osg_configuration "" _DEBUG _RELEASE)
get_property(${UC_COMPONENT}_LIBRARY${osg_configuration}
TARGET @PKG_NAMESPACE@::${component}
PROPERTY ${osg_imported_lib_property}${osg_configuration}
)
set(${UC_COMPONENT}_LIBRARIES${osg_configuration} ${${UC_COMPONENT}_LIBRARY})
endforeach()
# If a default library configuration was not found, create it
if(NOT ${UC_COMPONENT}_LIBRARY)
if(${UC_COMPONENT}_LIBRARY_DEBUG AND ${UC_COMPONENT}_LIBRARY_RELEASE)
# We have a release and a debug library, so let's use both
set(${UC_COMPONENT}_LIBRARY
optimized ${${UC_COMPONENT}_LIBRARY_RELEASE}
debug ${${UC_COMPONENT}_LIBRARY_DEBUG})
elseif(${UC_COMPONENT}_LIBRARY_RELEASE)
# There is only a release library, so let's use that
set(${UC_COMPONENT}_LIBRARY optimized ${${UC_COMPONENT}_LIBRARY_RELEASE})
elseif(${UC_COMPONENT}_LIBRARY_DEBUG)
# There is only a debug library, so let's use that
set(${UC_COMPONENT}_LIBRARY debug ${${UC_COMPONENT}_LIBRARY_DEBUG})
else()
# This should never happen, or else something is severely broken
# with the configuration, so we'll quit early.
message(FATAL_ERROR
"Could not find either an optimized or a debug version of the "
"requested OSG component: [${component}]")
endif()
set(${UC_COMPONENT}_LIBRARIES ${${UC_COMPONENT}_LIBRARY})
endif()
list(APPEND OpenSceneGraph_LIBRARIES ${${UC_COMPONENT}_LIBRARIES})
endforeach()
set(OPENSCENEGRAPH_LIBRARIES ${OpenSceneGraph_LIBRARIES})
check_required_components(OpenSceneGraph)
set(OPENSCENEGRAPH_FOUND ${OpenSceneGraph_FOUND})

View File

@ -0,0 +1,23 @@
# This is a utility file for importing the target (and its dependencies) of
# @LIB_NAME@, a component library of OpenSceneGraph. This is designed to be used
# by OpenSceneGraphConfig.cmake and should not be invoked directly.
# First we import all dependent targets (as well as their dependencies, recursively)
foreach(dependency @COMPONENT_CMAKE_DEPENDENCIES@)
set(osg_component_dependency_target_file ${CMAKE_CURRENT_LIST_DIR}/openscenegraph-${dependency}-import-targets.cmake)
if(NOT EXISTS ${osg_component_dependency_target_file})
# Note: This should never happen, because if this library was installed
# and its target was exported, then its dependencies should have been
# installed with their targets alongside it. If we ever land here, then
# either there is a bug in the build system, or the user has broken
# their installation of OpenSceneGraph.
message(FATAL_ERROR
"Could not find [${dependency}] which is a dependency of [@LIB_NAME@]."
" This may indicate a broken installation of OpenSceneGraph.")
endif()
include(${osg_component_dependency_target_file})
endforeach()
# Then we import our own target file
include(${CMAKE_CURRENT_LIST_DIR}/@LIB_NAME@-targets.cmake)

View File

@ -5,10 +5,10 @@ exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osg
Description: 3D scenegraph
Name: openscenegraph-@LIB_NAME@
Description: @COMPONENT_PKGCONFIG_DESCRIPTION@
Version: @OPENSCENEGRAPH_VERSION@
Requires: openthreads
Requires:@COMPONENT_PKGCONFIG_REQUIRES@ openthreads
Conflicts:
Libs: -L${libdir} -losg@CMAKE_BUILD_POSTFIX@
Libs: -L${libdir} -l@LIB_NAME@@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgAnimation
Description: Skinning and morphing library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osg openscenegraph-osgText openscenegraph-osgGA openscenegraph-osgViewer openthreads
Conflicts:
Libs: -L${libdir} -losgAnimation@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgDB
Description: File format reading library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgDB@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgFX
Description: Special effects library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgDB openscenegraph-osgUtil openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgFX@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgGA
Description: GUI event library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgDB openscenegraph-osgUtil openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgGA@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgManipulator
Description: Manipulator library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgUtil openscenegraph-osgGA openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgManipulator@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgParticle
Description: Particle system library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgDB openscenegraph-osgUtil openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgParticle@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgShadow
Description: Shadow techniques library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgUtil openscenegraph-osgDB openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgShadow@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgSim
Description: Simulator utility library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgText openscenegraph-osgDB openscenegraph-osgUtil openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgSim@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgTerrain
Description: Terrain library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgUtil openscenegraph-osgDB openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgTerrain@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgText
Description: Text rendering library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgDB openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgText@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgUtil
Description: Utility library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgUtil@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgViewer
Description: Windowing system setup, thread scene manager library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgText openscenegraph-osgDB openscenegraph-osgUtil openscenegraph-osgGA openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgViewer@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgVolume
Description: Volume library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgUtil openscenegraph-osgDB openscenegraph-osgGA openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgVolume@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -1,14 +0,0 @@
# pkg-config source file
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_POSTFIX@
includedir=${prefix}/include
Name: openscenegraph-osgWidget
Description: Windowing toolkit library for Openscenegraph
Version: @OPENSCENEGRAPH_VERSION@
Requires: openscenegraph-osgText openscenegraph-osgViewer openscenegraph-osgDB openscenegraph-osgGA openscenegraph-osg openthreads
Conflicts:
Libs: -L${libdir} -losgWidget@CMAKE_BUILD_POSTFIX@
Cflags: -I${includedir}

View File

@ -125,6 +125,12 @@ ELSE()
${TARGET_SRC}
)
TARGET_INCLUDE_DIRECTORIES(${LIB_NAME}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INSTALL_INCDIR}>
)
IF(OPENTHREADS_SONAMES)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION})
ENDIF()
@ -148,17 +154,56 @@ ELSE()
${CMAKE_CURRENT_BINARY_DIR}
)
IF(OSG_EXPORT_TARGETS)
INSTALL(
TARGETS OpenThreads
TARGETS ${LIB_NAME}
EXPORT ${LIB_NAME}
ARCHIVE DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads-dev
LIBRARY DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads
RUNTIME DESTINATION bin COMPONENT libopenthreads
)
INSTALL(
EXPORT ${LIB_NAME}
NAMESPACE ${PKG_NAMESPACE}::
DESTINATION ${INSTALL_CONFIGDIR}
FILE ${LIB_NAME}-targets.cmake
COMPONENT libopenthreads-dev
)
# Intentionally blank
SET(COMPONENT_CMAKE_DEPENDENCIES)
SET(TARGET_IMPORT_INPUT_FILE "${PROJECT_SOURCE_DIR}/packaging/cmake/openscenegraph-component-import-targets.cmake")
SET(TARGET_IMPORT_OUTPUT_FILE "${PROJECT_BINARY_DIR}/packaging/cmake/openscenegraph-${LIB_NAME}-import-targets.cmake")
CONFIGURE_FILE(
${TARGET_IMPORT_INPUT_FILE}
${TARGET_IMPORT_OUTPUT_FILE}
@ONLY
)
INSTALL(
FILES ${TARGET_IMPORT_OUTPUT_FILE}
DESTINATION ${INSTALL_CONFIGDIR}
COMPONENT libopenscenegraph-dev
)
ELSE()
INSTALL(
TARGETS ${LIB_NAME}
ARCHIVE DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads-dev
LIBRARY DESTINATION lib${LIB_POSTFIX} COMPONENT libopenthreads
RUNTIME DESTINATION bin COMPONENT libopenthreads
)
ENDIF()
IF(NOT OSG_COMPILE_FRAMEWORKS)
INSTALL(
FILES ${OpenThreads_PUBLIC_HEADERS}
DESTINATION include/OpenThreads
DESTINATION ${INSTALL_INCDIR}/OpenThreads
COMPONENT libopenthreads-dev
)

View File

@ -43,12 +43,50 @@ IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
HANDLE_MSVC_DLL(ot ${OPENTHREADS_SOVERSION})
ENDIF()
INSTALL(
IF(OSG_EXPORT_TARGETS)
INSTALL(
TARGETS OpenThreads
EXPORT OpenThreads
ARCHIVE DESTINATION lib COMPONENT libopenthreads-dev
LIBRARY DESTINATION lib COMPONENT libopenthreads
RUNTIME DESTINATION bin COMPONENT libopenthreads
)
INSTALL(
EXPORT OpenThreads
NAMESPACE ${PKG_NAMESPACE}::
DESTINATION ${INSTALL_CONFIGDIR}
FILE OpenThreads-targets.cmake
COMPONENT libopenthreads-dev
)
# Intentionally blank
SET(COMPONENT_CMAKE_DEPENDENCIES)
SET(TARGET_IMPORT_INPUT_FILE "${PROJECT_SOURCE_DIR}/packaging/cmake/openscenegraph-component-import-targets.cmake")
SET(TARGET_IMPORT_OUTPUT_FILE "${PROJECT_BINARY_DIR}/packaging/cmake/openscenegraph-OpenThreads-import-targets.cmake")
CONFIGURE_FILE(
${TARGET_IMPORT_INPUT_FILE}
${TARGET_IMPORT_OUTPUT_FILE}
@ONLY
)
INSTALL(
FILES ${TARGET_IMPORT_OUTPUT_FILE}
DESTINATION ${INSTALL_CONFIGDIR}
COMPONENT libopenscenegraph-dev
)
ELSE()
INSTALL(
TARGETS OpenThreads
ARCHIVE DESTINATION lib COMPONENT libopenthreads-dev
LIBRARY DESTINATION lib COMPONENT libopenthreads
RUNTIME DESTINATION bin COMPONENT libopenthreads
)
)
ENDIF()
INSTALL(
FILES ${OpenThreads_PUBLIC_HEADERS}
DESTINATION include/OpenThreads

View File

@ -460,4 +460,6 @@ SET(TARGET_EXTERNAL_LIBRARIES
#INCLUDE(ModuleInstall OPTIONAL)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "3D scenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -106,5 +106,7 @@ SET(TARGET_LIBRARIES
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Skinning and morphing library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -183,5 +183,7 @@ SET(TARGET_LIBRARIES
SET(TARGET_EXTERNAL_LIBRARIES ${OSGDB_PLATFORM_SPECIFIC_LIBRARIES} ${DL_LIBRARY})
SET(TARGET_LIBRARIES_VARS ${COMPRESSION_LIBRARIES})
SET(COMPONENT_PKGCONFIG_DESCRIPTION "File format reading library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -41,10 +41,12 @@ SET(TARGET_SRC
)
SET(TARGET_LIBRARIES
osgUtil
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Special effects library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -73,5 +73,7 @@ SET(TARGET_LIBRARIES
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "GUI event library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -66,4 +66,6 @@ SET(TARGET_LIBRARIES
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Manipulator library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -89,10 +89,12 @@ SET(TARGET_SRC
)
SET(TARGET_LIBRARIES
osgUtil
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Particle system library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -43,11 +43,13 @@ SET(TARGET_LIBRARIES
osgFX
osgText
osgGA
osgUtil
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "A library for creating slide show presentations with OpenSceneGraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -61,11 +61,13 @@ SET(TARGET_SRC
)
SET(TARGET_LIBRARIES
osgUtil
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Shadow techniques library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -65,12 +65,14 @@ SET(TARGET_SRC
SET(TARGET_LIBRARIES
osgText
osgUtil
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Simulator utility library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -35,11 +35,13 @@ SET(TARGET_SRC
)
SET(TARGET_LIBRARIES
osgUtil
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Terrain library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -42,10 +42,12 @@ SET(TARGET_SRC
SET(TARGET_LIBRARIES
osgDB
osg
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Text rendering library for OpenSceneGraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -46,14 +46,16 @@ SET(TARGET_SRC
)
SET(TARGET_LIBRARIES
osgDB
osgGA
osgUtil
osgText
osgViewer
osgText
osgGA
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Library for creating user interfaces in OpenSceneGraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -101,5 +101,7 @@ SET(TARGET_LIBRARIES
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Utility library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -261,6 +261,8 @@ IF(MINGW OR CYGWIN)
SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} gdi32 )
ENDIF()
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Windowing system setup, thread scene manager library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})
# install these headers manually since setup_library and moduleinstall

View File

@ -42,13 +42,15 @@ SET(TARGET_SRC
SET(TARGET_LIBRARIES
osgUtil
osgDB
osgGA
osgDB
osgUtil
osg
OpenThreads
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Volume library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})

View File

@ -66,13 +66,15 @@ SET(TARGET_SRC
SET(TARGET_LIBRARIES
osgText
osgViewer
osgGA
osgText
osgDB
osg
OpenThreads
osgGA
)
SET(COMPONENT_PKGCONFIG_DESCRIPTION "Windowing toolkit library for Openscenegraph")
SETUP_LIBRARY(${LIB_NAME})