Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change namespace and directory of osgKido #588

Merged
merged 10 commits into from
Jan 21, 2016
31 changes: 26 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if(MSVC)
else()
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
option(KIDO_BUILD_OSGKIDO "Build osgKido library" ON)
option(KIDO_BUILD_OSGKIDO "Build osgKido library" ON) # TODO(JS): we probably should remove this option or add another build options for other extensions as well for consistency.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually do think we should have an option flag for each extension, although I don't consider that to be high priority.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, as KIDO 0.1.0 should be released as soon as possible, I'll add them for KIDO 1.0.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. This is only relevant to the build system anyway; it doesn't impact the packaging.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: Packing. The ideal way to package KIDO as a Debian would be to create one kido source package that Build-Depends on the build dependencies all components. The source package would build a separate binary package for each component (e.g. kido-optimizer-nlopt) that Depends only on the runtime dependencies for the headers/library that it contains.

I doubt it is possible to change this structure within one Debian release, since it changes the names (and number) of binary packages built from the source package.

Is this the plan? Or will we stick with a single, monolithic kido package for now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, KIDO 0.1 is already doing exactly what you mentioned, and KIDO 0.1 and KIDO 1.0 will have same package structure.

Edit: You can check that the debian control file.

option(KIDO_BUILD_EXAMPLES "Build examples" ON)
option(KIDO_BUILD_TUTORIALS "Build tutorials" ON)
option(KIDO_BUILD_UNITTESTS "Build unit tests" ON)
Expand Down Expand Up @@ -255,6 +255,31 @@ else()
endif()
endif()

# OpenSceneGraph
find_package(OpenSceneGraph 3.0 QUIET
COMPONENTS osg osgViewer osgManipulator osgGA osgDB)
if(OPENSCENEGRAPH_FOUND)
message(STATUS "Looking for OpenSceneGraph -- ${OPENSCENEGRAPH_VERSION} found")
set(HAVE_OPENSCENEGRAPH TRUE)
else(OPENSCENEGRAPH_FOUND)
# kido-gui-osg requires both OSG and OpenThreads. This section attempts to
# identify which of those are missing from the building machine and offer
# advice to the user for getting osgKido to build.
find_package(OpenThreads QUIET)
if(OPENTHREADS_FOUND)
set(warning_msg "Could NOT find OpenSceneGraph")
else(OPENTHREADS_FOUND)
if(OSG_LIBRARY)
set(warning_msg "Could NOT find OpenThreads")
else(OSG_LIBRARY)
set(warning_msg "Could NOT find OpenSceneGraph nor OpenThreads")
endif(OSG_LIBRARY)
endif(OPENTHREADS_FOUND)
message(WARNING "${warning_msg} -- we will skip kido-gui-osg\n"
"If you believe you do have both OSG and OpenThreads installed, try setting OSG_DIR")
set(HAVE_OPENSCENEGRAPH FALSE)
endif(OPENSCENEGRAPH_FOUND)

# FLANN
find_package(FLANN 1.8.4 QUIET)
if(FLANN_FOUND)
Expand Down Expand Up @@ -567,10 +592,6 @@ install(FILES package.xml DESTINATION share/${PROJECT_NAME})
#===============================================================================
add_subdirectory(kido)

if(KIDO_BUILD_OSGKIDO)
add_subdirectory(osgKido)
endif(KIDO_BUILD_OSGKIDO)

# Unit tests
if(KIDO_BUILD_UNITTESTS)
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion ci/before_install_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ipopt
ros/deps/urdfdom
ros/deps/urdfdom_headers
ros/deps/console_bridge
ros/deps/gtest
open-scene-graph
'

brew install $PACKAGES | grep -v '%$'
4 changes: 2 additions & 2 deletions debian/libosgKido0-dev.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
usr/include/osgKido/*
usr/lib/libosgKido.so
usr/include/kido/gui/osg/*
usr/lib/libkido-gui-osg.so
2 changes: 1 addition & 1 deletion debian/libosgKido0.1.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
usr/lib/libosgKido.so.*
usr/lib/libkido-gui-osg.so.*
1 change: 1 addition & 0 deletions kido/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#cmakedefine HAVE_IPOPT 1
#cmakedefine HAVE_SNOPT 1
#cmakedefine HAVE_BULLET_COLLISION 1
#cmakedefine HAVE_OPENSCENEGRAPH 1

#define KIDO_ROOT_PATH "@CMAKE_SOURCE_DIR@/"
#define KIDO_DATA_PATH "@CMAKE_SOURCE_DIR@/data/"
Expand Down
6 changes: 6 additions & 0 deletions kido/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ file(GLOB hdrs "*.hpp")

include_directories(SYSTEM ${GLUT_INCLUDE_DIR})

# Add subdirectories
if(HAVE_OPENSCENEGRAPH)
add_subdirectory(osg)
endif(HAVE_OPENSCENEGRAPH)

# Library
kido_add_library(kido-gui ${srcs} ${hdrs})
target_link_libraries(kido-gui kido kido-utils ${GLUT_LIBRARY})

# Generate header for this namespace
kido_get_filename_components(header_names "gui headers" ${hdrs})
list(APPEND header_names "osg/osg.hpp")
kido_generate_include_header_list(
gui_headers
"kido/gui/"
Expand Down
40 changes: 40 additions & 0 deletions kido/gui/osg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
include_directories(SYSTEM ${OPENSCENEGRAPH_INCLUDE_DIRS})

# Search all header and source files
file(GLOB srcs "*.cpp")
file(GLOB hdrs "*.hpp")

set(kido_gui_osg_srcs ${srcs})
set(kido_gui_osg_hdrs ${hdrs})

add_subdirectory(render)

# Library
kido_add_library(kido-gui-osg ${kido_gui_osg_srcs} ${kido_gui_osg_hdrs})
target_link_libraries(kido-gui-osg kido kido-utils ${OPENSCENEGRAPH_LIBRARIES})

# Generate header for this namespace
kido_get_filename_components(header_names "gui osg headers" ${hdrs})
list(APPEND header_names "render/render.hpp")
kido_generate_include_header_list(
gui_osg_headers
"kido/gui/osg/"
"gui osg headers"
${header_names}
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/osg.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/osg.hpp
)

if(${KIDO_BUILD_EXAMPLES})
add_subdirectory(examples)
endif(${KIDO_BUILD_EXAMPLES})

# Install
install(
FILES ${hdrs} ${CMAKE_CURRENT_BINARY_DIR}/osg.hpp
DESTINATION include/kido/gui/osg
COMPONENT headers
)
install(TARGETS kido-gui-osg EXPORT KIDOTargets DESTINATION lib)
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@

#include <osgGA/GUIEventAdapter>

#include "osgKido/DefaultEventHandler.hpp"
#include "osgKido/MouseEventHandler.hpp"
#include "osgKido/Viewer.hpp"
#include "osgKido/render/ShapeNode.hpp"
#include "osgKido/EntityNode.hpp"
#include "osgKido/Utils.hpp"
#include "kido/gui/osg/DefaultEventHandler.hpp"
#include "kido/gui/osg/MouseEventHandler.hpp"
#include "kido/gui/osg/Viewer.hpp"
#include "kido/gui/osg/render/ShapeNode.hpp"
#include "kido/gui/osg/EntityNode.hpp"
#include "kido/gui/osg/Utils.hpp"

#include "kido/dynamics/Entity.hpp"


#include <iostream>

namespace osgKido
{
namespace kido {
namespace gui {

DefaultEventHandler::DefaultEventHandler(Viewer* _viewer)
: mViewer(_viewer),
Expand Down Expand Up @@ -442,4 +442,5 @@ void DefaultEventHandler::handleDestructionNotification(
mMouseEventHandlers.erase(it);
}

} // namespace osgKido
} // namespace gui
} // namespace kido
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
#include "kido/common/Observer.hpp"

namespace kido {

namespace dynamics {
class Entity;
class Shape;
} // dynamics
} // kido

namespace osgKido
namespace gui
{

struct PickInfo
Expand Down Expand Up @@ -198,7 +198,7 @@ class DefaultEventHandler : public osgGA::GUIEventHandler,
virtual void handleDestructionNotification(
const kido::common::Subject* _subject) override;

/// osgKido::Viewer that this event handler is tied to
/// kido::gui::Viewer that this event handler is tied to
Viewer* mViewer;

/// Set of MouseEventHandlers that are tied to this DefaultEventHandler
Expand Down Expand Up @@ -231,6 +231,7 @@ class DefaultEventHandler : public osgGA::GUIEventHandler,

};

} // namespace osgKido
} // namespace gui
} // namespace kido

#endif // OSGKIDO_DEFAULTEVENTHANDLER_HPP
41 changes: 21 additions & 20 deletions osgKido/DragAndDrop.cpp → kido/gui/osg/DragAndDrop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "osgKido/DragAndDrop.hpp"
#include "osgKido/DefaultEventHandler.hpp"
#include "osgKido/Viewer.hpp"
#include "osgKido/InteractiveFrame.hpp"
#include "osgKido/MouseEventHandler.hpp"
#include "kido/gui/osg/DragAndDrop.hpp"
#include "kido/gui/osg/DefaultEventHandler.hpp"
#include "kido/gui/osg/Viewer.hpp"
#include "kido/gui/osg/InteractiveFrame.hpp"
#include "kido/gui/osg/MouseEventHandler.hpp"

#include "kido/dynamics/SimpleFrame.hpp"
#include "kido/dynamics/MeshShape.hpp"
Expand All @@ -49,7 +49,8 @@

#include "kido/math/Helpers.hpp"

namespace osgKido {
namespace kido {
namespace gui {

DragAndDrop::DragAndDrop(Viewer* viewer, kido::dynamics::Entity* entity)
: mViewer(viewer),
Expand Down Expand Up @@ -83,12 +84,12 @@ void DragAndDrop::update()
if(nullptr == mEntity)
return;

osgKido::MouseButtonEvent event =
kido::gui::MouseButtonEvent event =
mViewer->getDefaultEventHandler()->getButtonEvent(LEFT_MOUSE);

if(mAmMoving)
{
if(osgKido::BUTTON_RELEASE == event)
if(kido::gui::BUTTON_RELEASE == event)
{
mAmMoving = false;
release();
Expand All @@ -98,13 +99,13 @@ void DragAndDrop::update()
}
else // not moving
{
if(osgKido::BUTTON_PUSH == event)
if(kido::gui::BUTTON_PUSH == event)
{
const std::vector<osgKido::PickInfo>& picks =
const std::vector<kido::gui::PickInfo>& picks =
mViewer->getDefaultEventHandler()->getButtonPicks(
osgKido::LEFT_MOUSE, osgKido::BUTTON_PUSH);
kido::gui::LEFT_MOUSE, kido::gui::BUTTON_PUSH);

for(const osgKido::PickInfo& pick : picks)
for(const kido::gui::PickInfo& pick : picks)
{
if(pick.entity == mEntity)
{
Expand Down Expand Up @@ -332,25 +333,25 @@ void SimpleFrameShapeDnD::update()
if(nullptr == mEntity || nullptr == mShape)
return;

osgKido::MouseButtonEvent event =
kido::gui::MouseButtonEvent event =
mViewer->getDefaultEventHandler()->getButtonEvent(LEFT_MOUSE);

if(mAmMoving)
{
if(osgKido::BUTTON_RELEASE == event)
if(kido::gui::BUTTON_RELEASE == event)
mAmMoving = false;

move();
}
else
{
if(osgKido::BUTTON_PUSH == event)
if(kido::gui::BUTTON_PUSH == event)
{
const std::vector<osgKido::PickInfo>& picks =
const std::vector<kido::gui::PickInfo>& picks =
mViewer->getDefaultEventHandler()->getButtonPicks(
osgKido::LEFT_MOUSE, osgKido::BUTTON_PUSH);
kido::gui::LEFT_MOUSE, kido::gui::BUTTON_PUSH);

for(const osgKido::PickInfo& pick : picks)
for(const kido::gui::PickInfo& pick : picks)
{
if(pick.entity == mEntity && pick.shape.get() == mShape)
{
Expand Down Expand Up @@ -801,5 +802,5 @@ osgGA::GUIEventAdapter::ModKeyMask BodyNodeDnD::getJointRestrictionModKey() cons
return mJointRestrictionModKey;
}


} // namespace osgKido
} // namespace gui
} // namespace kido
13 changes: 6 additions & 7 deletions osgKido/DragAndDrop.hpp → kido/gui/osg/DragAndDrop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,18 @@
#include "DefaultEventHandler.hpp"

namespace kido {

namespace dynamics {
class SimpleFrame;
} // namespace dynamics
} // namespace kido

namespace osgKido
{
namespace gui {

class Viewer;
class InteractiveFrame;

/// DragAndDrop is a class that facilitates enabling various kinds of kido
/// Entities to be dragged and dropped in an osgKido environment
/// Entities to be dragged and dropped in an kido-gui-osg environment
class DragAndDrop : public kido::common::Subject,
public kido::common::Observer
{
Expand Down Expand Up @@ -245,7 +244,7 @@ class InteractiveFrameDnD : public DragAndDrop
public:

/// Constructor
InteractiveFrameDnD(Viewer* viewer, osgKido::InteractiveFrame* frame);
InteractiveFrameDnD(Viewer* viewer, kido::gui::InteractiveFrame* frame);

/// Virtual destructor
virtual ~InteractiveFrameDnD() = default;
Expand Down Expand Up @@ -357,7 +356,7 @@ class BodyNodeDnD : public DragAndDrop
size_t mAdditionalBodyNodes;
};

} // namespace osgKido

} // namespace gui
} // namespace kido

#endif // OSGKIDO_DRAGANDDROP_HPP
Loading