Update Raspberry Pi detection in CMakeLists.txt #181
Closed
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.
Update Raspberry Pi detection in CMakeLists.txt
Issue
The current CMakeLists.txt file relies on the
/opt/vc/
directory to detect Raspberry Pi systems. However, in recent Raspberry Pi OS updates, particularly for 64-bit versions, this directory has been removed. This change causes the build process to fail on newer Raspberry Pi systems, as it cannot detect the platform correctly and thus fails to include necessary libraries like pigpio.Proposed Solution
Update the Raspberry Pi detection method in CMakeLists.txt to use a more reliable and future-proof approach that doesn't depend on the
/opt/vc/
directory.Implementation Details
Replace the current detection method:
with a new method that checks the device tree:
Update conditional blocks to use the new
IS_RASPBERRY_PI
variable.Adjust library and include paths to account for the new Raspberry Pi OS structure.
Ensure pigpio libraries are correctly linked when building on Raspberry Pi systems.
Changes to existing code
find_path
command with the new detection method.BCM_HOST_INCLUDE_DIR
to instead useIS_RASPBERRY_PI
./opt/vc/
to use appropriate system paths.Testing
This PR aims to restore functionality for building on Raspberry Pi systems while maintaining compatibility with the latest Raspberry Pi OS versions and existing non-Raspberry Pi builds.
References: