Skip to content

Commit

Permalink
fix directory structure for catkin/rostest
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada committed Aug 19, 2014
1 parent 10ac231 commit 9e8d0d3
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,35 @@ if(ENABLE_CPACK)
endif(GENERATE_DEBIANPACKAGE)
endif(ENABLE_CPACK)

## rostest
find_package(rostest)
if(rostest_FOUND)
add_rostest(test/test_openhrp3.test)
add_rostest(test/test_modelloader.test)
#if catkin environment
if(CMAKE_PREFIX_PATH)
message("[openhrp3] compile under catkin environment")
## rostest
find_package(rostest)
execute_process(COMMAND cmake -E make_directory share/OpenHRP-3.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND cmake -E create_symlink ../../sample share/OpenHRP-3.1/sample WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND cmake -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/bin bin WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) # rosrun could not find symlink?
if(rostest_FOUND)
add_rostest(test/test_openhrp3.test)
add_rostest(test/test_modelloader.test)
endif()

# install
install(CODE "execute_process(COMMAND cmake -E make_directory \$ENV{DISTDIR}/${CMAKE_INSTALL_PREFIX}/share/openhrp3/share)")
install(CODE "execute_process(COMMAND cmake -E make_directory \$ENV{DISTDIR}/${CMAKE_INSTALL_PREFIX}/share/openhrp3/bin)")
# copy package.xml
install(FILES package.xml DESTINATION $ENV{DISTDIR}/${CMAKE_INSTALL_PREFIX}/share/openhrp3/)
# copy share
install(CODE "execute_process(COMMAND cmake -E create_symlink ../../../share/OpenHRP-3.1 OpenHRP-3.1 WORKING_DIRECTORY \$ENV{DISTDIR}/${CMAKE_INSTALL_PREFIX}/share/openhrp3/share)")
# copy test
install(DIRECTORY test DESTINATION $ENV{DISTDIR}/${CMAKE_INSTALL_PREFIX}/share/openhrp3/ USE_SOURCE_PERMISSIONS)
# copy bin
foreach(file export-collada openhrp-aist-dynamics-simulator openhrp-controller-bridge openhrp-model-loader openhrp-shutdown-servers export-vrml openhrp-collision-detector openhrp-jython-prompt openhrp-path-planner openhrp-ut-dynamics-simulator)
install(CODE "execute_process(COMMAND cmake -E create_symlink ../../../bin/${file} ${file} WORKING_DIRECTORY \$ENV{DISTDIR}/${CMAKE_INSTALL_PREFIX}/share/openhrp3/bin)")
endforeach()
# create dae
install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/export-collada -i ${CMAKE_CURRENT_SOURCE_DIR}/sample/model/sample.wrl -o ${CMAKE_CURRENT_SOURCE_DIR}/sample/model/sample.dae OUTPUT_VARIABLE out RESULT_VARIABLE err)
message(\"\${out}\${err}\")")
install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/export-collada -i ${CMAKE_CURRENT_SOURCE_DIR}/sample/model/PA10/pa10.main.wrl -o ${CMAKE_CURRENT_SOURCE_DIR}/sample/model/PA10/pa10.dae OUTPUT_VARIABLE out RESULT_VARIABLE err)
message(\"\${out}\${err}\")")
endif()

0 comments on commit 9e8d0d3

Please sign in to comment.