Fix build issues in C and add CMake support.#677
Merged
Conversation
…r port handling in port_handler.c
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the Dynamixel SDK to version 4.0.4 and introduces a unified CMake build system for the C and C++ libraries, including installation and uninstallation scripts. Feedback identifies a regex error in the C SDK's uninstallation logic and suggests refining the C++ SDK's exported include directories to simplify consumer header inclusion. Additionally, a refactor is recommended for port_handler.c to consolidate global variable definitions and reduce platform-specific code duplication.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a build issue in the C SDK and introduces CMake support.
Changes
1. Fix Windows Build Issue
In
port_handler.h, the following variables were declared asextern:int g_used_port_numuint8_t *g_is_usingHowever, these variables were only defined under the Linux implementation in
port_handler.c, which caused build failures on Windows.This PR adds the missing definitions for Windows to resolve the issue.
2. Introduce CMake Support
CMake support has been added to unify the build system.
find_package()in CMake.3. Deprecation Plan for Legacy Make System
The existing Make-based build system will be kept temporarily for compatibility.
4. Installation Path Changes (C vs C++)
Previously, when installing the C SDK via the Make system, files were installed under:
Since this path is shared between C and C++ SDKs, it can cause ambiguity.
To address this:
The CMake build for the C SDK now uses a distinct prefix and project name:
dynamixel_sdk_cThis ensures clear separation between C and C++ installations and avoids conflicts.
Summary
find_package()Thank you.