Skip to content
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 Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "DynamixelSDK c++"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 4.0.3
PROJECT_NUMBER = 4.0.4

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
5 changes: 5 additions & 0 deletions ReleaseNote.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Dynamixel SDK Release Notes

4.0.4 (2026-03-27)
Comment thread
GyuH13 marked this conversation as resolved.
------------------
* Added CMakeLists.txt for unified build system in c, c++
* Contributors: Hyungyu Kim

4.0.3 (2025-12-17)
------------------
* Dynamixel Easy SDK supports Linux SBC environments, Linux 32-bit platforms, and ROS 2 based build and deployment workflows
Expand Down
183 changes: 183 additions & 0 deletions c++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
cmake_minimum_required(VERSION 3.10)

# Standalone C++ SDK: configure/build from the c++/ directory (paths below are relative to c++/).
project(dynamixel_sdk VERSION 4.0.4 LANGUAGES CXX)

set(_dxl_pkg "dynamixel_sdk")

# --------------------------------------------------------
# 1. Build Environment Configuration
# --------------------------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

option(DYNAMIXEL_SDK_RUN_LDCONFIG
"Run ldconfig after install (usually requires root). Recommended OFF."
OFF
)

# --------------------------------------------------------
# 2. Build C++ Library (common sources + platform-specific, like c/CMakeLists.txt)
# --------------------------------------------------------
set(_dxl_common_sources
src/dynamixel_sdk/group_bulk_read.cpp
src/dynamixel_sdk/group_bulk_write.cpp
src/dynamixel_sdk/group_sync_read.cpp
src/dynamixel_sdk/group_sync_write.cpp
src/dynamixel_sdk/group_fast_bulk_read.cpp
src/dynamixel_sdk/group_fast_sync_read.cpp
src/dynamixel_sdk/group_handler.cpp
src/dynamixel_sdk/packet_handler.cpp
src/dynamixel_sdk/port_handler.cpp
src/dynamixel_sdk/protocol1_packet_handler.cpp
src/dynamixel_sdk/protocol2_packet_handler.cpp
)

if(APPLE)
set(_dxl_platform_sources
src/dynamixel_sdk/port_handler_mac.cpp
)
elseif(WIN32)
set(_dxl_platform_sources
src/dynamixel_sdk/port_handler_windows.cpp
)
else()
set(_dxl_platform_sources
src/dynamixel_sdk/port_handler_linux.cpp
src/dynamixel_easy_sdk/connector.cpp
src/dynamixel_easy_sdk/control_table.cpp
src/dynamixel_easy_sdk/motor.cpp
src/dynamixel_easy_sdk/dynamixel_error.cpp
src/dynamixel_easy_sdk/group_executor.cpp
)
endif()

set(_dxl_sources
${_dxl_common_sources}
${_dxl_platform_sources}
)

add_library(dynamixel_sdk SHARED ${_dxl_sources})

target_include_directories(dynamixel_sdk PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/dynamixel_sdk>
)
target_include_directories(dynamixel_sdk PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include/dynamixel_sdk
${CMAKE_CURRENT_SOURCE_DIR}/include/dynamixel_easy_sdk
)

set_target_properties(dynamixel_sdk PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 2
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
OUTPUT_NAME "dxl_cpp"
)

if(UNIX AND NOT APPLE)
target_link_libraries(dynamixel_sdk PRIVATE rt)
endif()

if(NOT APPLE)
set(_control_table_path "${CMAKE_INSTALL_PREFIX}/share/${_dxl_pkg}/control_table")
target_compile_definitions(dynamixel_sdk
PUBLIC
CONTROL_TABLE_PATH="${_control_table_path}"
)
endif()

# --------------------------------------------------------
# 3. Installation
# --------------------------------------------------------
include(GNUInstallDirs)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamixel_sdk/
DESTINATION include/${_dxl_pkg}
)

if(UNIX AND NOT APPLE)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamixel_easy_sdk/
DESTINATION include/dynamixel_easy_sdk
)
endif()

if(NOT APPLE)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../control_table/
DESTINATION share/${_dxl_pkg}/control_table
)
endif()

set(_dxl_cmake_package_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${_dxl_pkg}")

install(
TARGETS dynamixel_sdk
EXPORT dynamixel_sdkTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION include
)

install(
EXPORT dynamixel_sdkTargets
FILE dynamixel_sdkTargets.cmake
NAMESPACE dynamixel_sdk::
DESTINATION ${_dxl_cmake_package_dir}
)

include(CMakePackageConfigHelpers)

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/dynamixel_sdkConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/dynamixel_sdkConfig.cmake"
INSTALL_DESTINATION ${_dxl_cmake_package_dir}
)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/dynamixel_sdkConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/dynamixel_sdkConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dynamixel_sdkConfigVersion.cmake"
DESTINATION ${_dxl_cmake_package_dir}
)

if(DYNAMIXEL_SDK_RUN_LDCONFIG AND UNIX AND NOT APPLE)
install(CODE "execute_process(COMMAND ldconfig)")
endif()

# --------------------------------------------------------
# 4. Uninstall / Reinstall Targets
# --------------------------------------------------------
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)

if(NOT TARGET uninstall)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
COMMENT "Uninstalling DynamixelSDK (C++)..."
)
endif()

if(NOT TARGET reinstall)
add_custom_target(reinstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR} --target install
COMMENT "Reinstalling DynamixelSDK (C++)..."
)
endif()
Empty file added c++/COLCON_IGNORE
Empty file.
53 changes: 53 additions & 0 deletions c++/cmake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Uninstall files listed in install_manifest.txt (created by cmake --install).
# Configured from cmake_uninstall.cmake.in via configure_file(... IMMEDIATE @ONLY).

if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR
"Cannot find @CMAKE_BINARY_DIR@/install_manifest.txt\n"
"Run: cmake --install <build-dir> (or make install) at least once so the manifest exists."
)
endif()

file(STRINGS "@CMAKE_BINARY_DIR@/install_manifest.txt" _dxl_installed_files)

foreach(_dxl_file IN LISTS _dxl_installed_files)
string(STRIP "${_dxl_file}" _dxl_file)
if(_dxl_file STREQUAL "")
continue()
endif()
message(STATUS "Uninstalling: ${_dxl_file}")
# EXISTS is false for broken symlinks, so also check IS_SYMLINK.
if(EXISTS "${_dxl_file}" OR IS_SYMLINK "${_dxl_file}")
file(REMOVE "${_dxl_file}")
endif()
endforeach()

# Remove installed directories (manifest only removes files).
# Derive prefix from install_manifest.txt paths so --prefix overrides work.
set(_dxl_prefix "")
foreach(_dxl_file IN LISTS _dxl_installed_files)
string(STRIP "${_dxl_file}" _dxl_file_stripped)
if(_dxl_file_stripped STREQUAL "")
continue()
endif()

# Example:
# ${prefix}/include/dynamixel_sdk/dynamixel_sdk.h
if(_dxl_file_stripped MATCHES "^(.*)/@CMAKE_INSTALL_INCLUDEDIR@/dynamixel_sdk/.*$")
set(_dxl_prefix "${CMAKE_MATCH_1}")
break()
endif()
endforeach()

if(NOT _dxl_prefix STREQUAL "")
file(REMOVE_RECURSE "${_dxl_prefix}/@CMAKE_INSTALL_INCLUDEDIR@/dynamixel_sdk")
if(NOT APPLE)
file(REMOVE_RECURSE "${_dxl_prefix}/@CMAKE_INSTALL_INCLUDEDIR@/dynamixel_easy_sdk")
endif()

if(NOT APPLE)
file(REMOVE_RECURSE "${_dxl_prefix}/@CMAKE_INSTALL_DATAROOTDIR@/dynamixel_sdk/control_table")
endif()

file(REMOVE_RECURSE "${_dxl_prefix}/@CMAKE_INSTALL_LIBDIR@/cmake/dynamixel_sdk")
endif()
4 changes: 4 additions & 0 deletions c++/cmake/dynamixel_sdkConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

# Imported target: dynamixel_sdk::dynamixel_sdk
include("${CMAKE_CURRENT_LIST_DIR}/dynamixel_sdkTargets.cmake")
12 changes: 12 additions & 0 deletions c++/example/dxl_monitor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.10)

# Standalone build for C++ DXL Monitor example (uses installed dynamixel_sdk).
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(dynamixel_sdk_cpp_examples_dxl_monitor LANGUAGES CXX)
endif()

find_package(dynamixel_sdk CONFIG REQUIRED)

add_executable(dxl_monitor "${CMAKE_CURRENT_SOURCE_DIR}/dxl_monitor.cpp")
target_link_libraries(dxl_monitor PRIVATE dynamixel_sdk::dynamixel_sdk)

29 changes: 29 additions & 0 deletions c++/example/protocol1.0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.10)

# Standalone build for C++ Protocol 1.0 examples (uses installed dynamixel_sdk).
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(dynamixel_sdk_cpp_examples_protocol1 LANGUAGES CXX)
endif()

find_package(dynamixel_sdk CONFIG REQUIRED)

set(_dxl_protocol1_examples
sync_write
reset
multi_port
read_write
ping
bulk_read
)

foreach(_dxl_example IN LISTS _dxl_protocol1_examples)
set(_dxl_src "${CMAKE_CURRENT_SOURCE_DIR}/${_dxl_example}/${_dxl_example}.cpp")
if(NOT EXISTS "${_dxl_src}")
message(FATAL_ERROR "Missing example source: ${_dxl_src}")
endif()

set(_dxl_target "${_dxl_example}")
add_executable(${_dxl_target} "${_dxl_src}")
target_link_libraries(${_dxl_target} PRIVATE dynamixel_sdk::dynamixel_sdk)
endforeach()

35 changes: 35 additions & 0 deletions c++/example/protocol2.0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.10)

# Standalone build for C++ Protocol 2.0 examples (uses installed dynamixel_sdk).
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(dynamixel_sdk_cpp_examples_protocol2 LANGUAGES CXX)
endif()

find_package(dynamixel_sdk CONFIG REQUIRED)

set(_dxl_protocol2_examples
broadcast_ping
ping
read_write
sync_read_write
reboot
multi_port
clear_multi_turn
factory_reset
indirect_address
fast_sync_read
fast_bulk_read
bulk_read_write
)

foreach(_dxl_example IN LISTS _dxl_protocol2_examples)
set(_dxl_src "${CMAKE_CURRENT_SOURCE_DIR}/${_dxl_example}/${_dxl_example}.cpp")
if(NOT EXISTS "${_dxl_src}")
message(FATAL_ERROR "Missing example source: ${_dxl_src}")
endif()

set(_dxl_target "${_dxl_example}")
add_executable(${_dxl_target} "${_dxl_src}")
target_link_libraries(${_dxl_target} PRIVATE dynamixel_sdk::dynamixel_sdk)
endforeach()

14 changes: 14 additions & 0 deletions c++/example/protocol_combined/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.10)

# Standalone build for C++ Protocol Combined example (uses installed dynamixel_sdk).
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(dynamixel_sdk_cpp_examples_protocol_combined LANGUAGES CXX)
endif()

find_package(dynamixel_sdk CONFIG REQUIRED)

add_executable(protocol_combined
"${CMAKE_CURRENT_SOURCE_DIR}/protocol_combined.cpp"
)
target_link_libraries(protocol_combined PRIVATE dynamixel_sdk::dynamixel_sdk)

2 changes: 1 addition & 1 deletion c++/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=DynamixelSDK
version=4.0.3
version=4.0.4
author=ROBOTIS
maintainer=ROBOTIS
sentence=DynamixelSDK for Arduino
Expand Down
Loading
Loading