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

Update examples directory to make dart::gui::osg more accessible #1305

Merged
merged 8 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fi
$SUDO make -j$num_threads install

# Build an example using installed DART
cd $BUILD_DIR/examples/rigidCubes
cd $BUILD_DIR/examples/hello_world
mkdir build && cd build
cmake ..
make -j$num_threads
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
* Improved voxel grid and point cloud rendering performance: [#1294](https://github.com/dartsim/dart/pull/1294)
* Fixed incorrect alpha value update of InteractiveFrame: [#1297](https://github.com/dartsim/dart/pull/1297)

* Examples and Tutorials

* Updated examples directory to make dart::gui::osg more accessible: [#1305](https://github.com/dartsim/dart/pull/1305)

### [DART 6.8.4 (2019-05-03)](https://github.com/dartsim/dart/milestone/56?closed=1)

#### Changes
Expand Down
76 changes: 76 additions & 0 deletions cmake/DARTMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,79 @@ function(dart_format_add)
endif()
endforeach()
endfunction()

#===============================================================================
# dart_build_target_in_source(target
# [LINK_LIBRARIES library1 ...])
# [COMPILE_FEATURES feature1 ...]
# [COMPILE_OPTIONS option1 ...]
# )
function(dart_build_target_in_source target)
set(prefix example)
set(options )
set(oneValueArgs )
set(multiValueArgs LINK_LIBRARIES COMPILE_FEATURES COMPILE_OPTIONS)
cmake_parse_arguments("${prefix}" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(example_LINK_LIBRARIES)
foreach(dep_target ${example_LINK_LIBRARIES})
if(NOT TARGET ${dep_target})
if(DART_VERBOSE)
message(WARNING "Skipping ${target} because required target '${dep_target}' not found")
endif()
return()
endif()
endforeach()
endif()

file(GLOB srcs "*.cpp" "*.hpp")

add_executable(${target} ${srcs})

if(example_LINK_LIBRARIES)
foreach(dep_target ${example_LINK_LIBRARIES})
target_link_libraries(${target} ${dep_target})
endforeach()
endif()

if(example_COMPILE_FEATURES)
foreach(comple_feature ${example_COMPILE_FEATURES})
target_compile_features(${target} PUBLIC ${comple_feature})
endforeach()
endif()

if(example_COMPILE_OPTIONS)
foreach(comple_option ${example_COMPILE_OPTIONS})
target_compile_options(${target} PUBLIC ${comple_option})
endforeach()
endif()

set_target_properties(${target}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)

dart_format_add(${srcs})
endfunction()

#===============================================================================
# dart_build_example_in_source(target
# [LINK_LIBRARIES library1 ...])
# [COMPILE_FEATURES feature1 ...]
# [COMPILE_OPTIONS option1 ...]
# )
function(dart_build_example_in_source target)
dart_build_target_in_source(${target} ${ARGN})
dart_add_example(${target})
endfunction()

#===============================================================================
# dart_build_tutorial_in_source(target
# [LINK_LIBRARIES library1 ...])
# [COMPILE_FEATURES feature1 ...]
# [COMPILE_OPTIONS option1 ...]
# )
function(dart_build_tutorial_in_source target)
dart_build_target_in_source(${target} ${ARGN})
dart_add_tutorial(${target})
endfunction()
40 changes: 22 additions & 18 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ cmake_minimum_required(VERSION 3.5.1)

project(dart-examples)

add_subdirectory(addDeleteSkels)
add_subdirectory(atlasSimbicon)
add_subdirectory(bipedStand)
add_subdirectory(hardcodedDesign)
add_subdirectory(hybridDynamics)
add_subdirectory(jointConstraints)
add_subdirectory(mixedChain)
add_subdirectory(operationalSpaceControl)
add_subdirectory(rigidChain)
add_subdirectory(rigidCubes)
add_subdirectory(rigidLoop)
add_subdirectory(rigidShapes)
add_subdirectory(simpleFrames)
add_subdirectory(softBodies)
add_subdirectory(speedTest)
add_subdirectory(vehicle)
add_subdirectory(humanJointLimits)
# None GUI examples
add_subdirectory(hello_world)
add_subdirectory(speed_test)

add_subdirectory(osgExamples)
# OSG renderer examples
add_subdirectory(atlas_puppet)
add_subdirectory(atlas_simbicon)
add_subdirectory(box_stacking)
add_subdirectory(drag_and_drop)
add_subdirectory(empty)
add_subdirectory(heightmap)
add_subdirectory(hubo_puppet)
add_subdirectory(imgui)
add_subdirectory(operational_space_control)
if(HAVE_OCTOMAP)
add_subdirectory(point_cloud)
endif()
add_subdirectory(soft_bodies)
add_subdirectory(tinkertoy)
add_subdirectory(wam_ikfast)

# Deprecated examples
add_subdirectory(deprecated_examples)
8 changes: 3 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## Build Each Example

Copy the subdirectory to your workspace and follow the instruction of README.md
Copy the subdirectory to your workspace and follow the instruction of README.md
in the subdirectory.

## Build Examples as One Project

### Build Instructions

This project is dependent on DART. Please make sure a proper version of DART is
This project is dependent on DART. Please make sure a proper version of DART is
installed before building this project.

Copy this directory to your workspace (e.g., in Linux):
Expand All @@ -28,8 +28,6 @@ From the workspace directory:

Launch the each executable from the build directory above (e.g.,):

$ ./rigidCubes/rigidCubes
$ ./hello_world

Follow the instructions detailed in the console.


14 changes: 0 additions & 14 deletions examples/addDeleteSkels/CMakeLists.txt

This file was deleted.

16 changes: 0 additions & 16 deletions examples/addDeleteSkels/InSourceBuild.cmake

This file was deleted.

14 changes: 0 additions & 14 deletions examples/atlasSimbicon/CMakeLists.txt

This file was deleted.

16 changes: 0 additions & 16 deletions examples/atlasSimbicon/InSourceBuild.cmake

This file was deleted.

19 changes: 19 additions & 0 deletions examples/atlas_puppet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.5.1)

get_filename_component(example_name ${CMAKE_CURRENT_LIST_DIR} NAME)

project(${example_name})

set(required_components utils-urdf gui-osg)
set(required_libraries dart dart-utils-urdf dart-gui-osg)

if(DART_IN_SOURCE_BUILD)
dart_build_example_in_source(${example_name} LINK_LIBRARIES ${required_libraries})
return()
endif()

find_package(DART 6.6.0 REQUIRED COMPONENTS ${required_components} CONFIG)

file(GLOB srcs "*.cpp" "*.hpp")
add_executable(${example_name} ${srcs})
target_link_libraries(${example_name} PUBLIC ${required_libraries})
File renamed without changes.
Loading