diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9bfd966..0fe0e73 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,9 @@ +macro(add_example example_name folder) + add_executable(${example_name} ${folder}/${example_name}.cpp) + target_link_libraries(${example_name} PRIVATE sdu_controllers ${ARGN}) +endmacro() + + if(BUILD_EXAMPLES) add_subdirectory(simulation) endif() diff --git a/examples/hardware/franka/CMakeLists.txt b/examples/hardware/franka/CMakeLists.txt index 7f40d86..06c35ec 100644 --- a/examples/hardware/franka/CMakeLists.txt +++ b/examples/hardware/franka/CMakeLists.txt @@ -3,8 +3,6 @@ find_package(Franka 0.9.1 REQUIRED) find_package(Eigen3 REQUIRED) find_package(pinocchio REQUIRED) -add_executable(move_to_joint_position cpp/move_to_joint_position.cpp) -target_link_libraries(move_to_joint_position PRIVATE sdu_controllers Franka::Franka Eigen3::Eigen pinocchio::pinocchio) +add_example(move_to_joint_position cpp Franka::Franka Eigen3::Eigen pinocchio::pinocchio) +add_example(cartesian_control cpp Franka::Franka Eigen3::Eigen pinocchio::pinocchio) -add_executable(cartesian_control cpp/cartesian_control.cpp) -target_link_libraries(cartesian_control PRIVATE sdu_controllers Franka::Franka Eigen3::Eigen pinocchio::pinocchio) diff --git a/examples/hardware/ur/CMakeLists.txt b/examples/hardware/ur/CMakeLists.txt index 7b91065..5c309eb 100644 --- a/examples/hardware/ur/CMakeLists.txt +++ b/examples/hardware/ur/CMakeLists.txt @@ -1,11 +1,6 @@ # example dependencies find_package(ur_rtde REQUIRED) -add_executable(admittance_controller_trajectory cpp/admittance_controller_trajectory.cpp) -target_link_libraries(admittance_controller_trajectory PRIVATE sdu_controllers ur_rtde::rtde) - -add_executable(admittance_controller_kinesthetic_teaching cpp/admittance_controller_kinesthetic_teaching.cpp) -target_link_libraries(admittance_controller_kinesthetic_teaching PRIVATE sdu_controllers ur_rtde::rtde) - -add_executable(ur_joint_motion_controller cpp/joint_motion_controller.cpp) -target_link_libraries(ur_joint_motion_controller PRIVATE sdu_controllers ur_rtde::rtde) +add_example(admittance_controller_trajectory cpp ur_rtde::rtde) +add_example(admittance_controller_kinesthetic_teaching cpp ur_rtde::rtde) +add_example(ur_joint_motion_controller cpp ur_rtde::rtde) diff --git a/examples/simulation/CMakeLists.txt b/examples/simulation/CMakeLists.txt index 54b07e1..66e8be9 100644 --- a/examples/simulation/CMakeLists.txt +++ b/examples/simulation/CMakeLists.txt @@ -1,20 +1,9 @@ -add_executable(admittance_controller general/cpp/admittance_controller.cpp) -target_link_libraries(admittance_controller PRIVATE sdu_controllers) +add_example(admittance_controller general/cpp) -add_executable(joint_motion_controller ur/cpp/joint_motion_controller.cpp) -target_link_libraries(joint_motion_controller PRIVATE sdu_controllers) +add_example(joint_motion_controller ur/cpp) +add_example(cartesian_motion_controller ur/cpp) +add_example(force_control_velocity ur/cpp) -add_executable(cartesian_motion_controller ur/cpp/cartesian_motion_controller.cpp) -target_link_libraries(cartesian_motion_controller PRIVATE sdu_controllers) - -add_executable(force_control_velocity ur/cpp/force_control_velocity.cpp) -target_link_libraries(force_control_velocity PRIVATE sdu_controllers) - -add_executable(eurofusion_joint_motion_controller eurofusion/cpp/eurofusion_joint_motion_controller.cpp) -target_link_libraries(eurofusion_joint_motion_controller PRIVATE sdu_controllers) - -add_executable(eurofusion_robot_rnea eurofusion/cpp/eurofusion_robot_rnea.cpp) -target_link_libraries(eurofusion_robot_rnea PRIVATE sdu_controllers) - -add_executable(eurofusion_force_control eurofusion/cpp/force_control_velocity.cpp) -target_link_libraries(eurofusion_force_control PRIVATE sdu_controllers) +add_example(eurofusion_joint_motion_controller eurofusion/cpp) +add_example(eurofusion_robot_rnea eurofusion/cpp) +add_example(eurofusion_force_control_velocity eurofusion/cpp) diff --git a/examples/simulation/eurofusion/cpp/force_control_velocity.cpp b/examples/simulation/eurofusion/cpp/eurofusion_force_control_velocity.cpp similarity index 100% rename from examples/simulation/eurofusion/cpp/force_control_velocity.cpp rename to examples/simulation/eurofusion/cpp/eurofusion_force_control_velocity.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 783fbca..9df84a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,7 +17,7 @@ set(sdu_controllers_SOURCES ) # Try to find ur_rtde in order to build UR Robot HAL -find_package(ur_rtde) +find_package(ur_rtde QUIET) if(ur_rtde_FOUND) list(APPEND sdu_controllers_SOURCES hal/ur_robot.cpp)