Updates RobotNode build and deployment process.
Simplifies the RobotNode build process by linking directly to system gpiod libraries instead of including a local copy. This reduces redundancy and ensures compatibility with the system's gpiod installation. Adds a deployment script for easier deployment to the robot, streamlining the update process. Also introduces a script to automatically fix symlinks during cross-compilation, ensuring that links resolve correctly on the target system.
This commit is contained in:
parent
07eb6bea15
commit
e8c3e0f8c2
4 changed files with 54 additions and 4 deletions
|
|
@ -41,13 +41,18 @@ configure_file(Version.h.in "${CMAKE_CURRENT_BINARY_DIR}/Version.h")
|
|||
# Consolidated Include Paths
|
||||
target_include_directories(dixon PRIVATE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" # For generated Version.h
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/include" # For libgpiod headers
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/include" # For libgpiod headers
|
||||
)
|
||||
|
||||
# Link the gpiod libraries
|
||||
#target_link_libraries(dixon PRIVATE
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiodcxx.so.2"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiod.so.3")
|
||||
|
||||
# Link the gpiod libraries
|
||||
target_link_libraries(dixon PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiodcxx.so.2"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiod.so.3")
|
||||
gpiodcxx
|
||||
gpiod)
|
||||
|
||||
# Tell the linker: "Trust me, the Pi has the rest of the C++ and C libraries"
|
||||
target_link_options(dixon PRIVATE "-Wl,--allow-shlib-undefined")
|
||||
|
|
@ -1 +1 @@
|
|||
1.0.27
|
||||
1.0.33
|
||||
22
utils/deploy_dixon
Executable file
22
utils/deploy_dixon
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Configuration
|
||||
LOCAL_BIN="$HOME/dev/Dixon/src/RobotNode/cmake-build-pi5-debug/dixon"
|
||||
REMOTE_TARGET="russellg59@192.168.1.224"
|
||||
REMOTE_DIR="/home/russellg59/dixon"
|
||||
REMOTE_EXE="$REMOTE_DIR/dixon"
|
||||
|
||||
# Check if the monster PC actually finished the build
|
||||
if [ ! -f "$LOCAL_BIN" ]; then
|
||||
echo "Error: Binary not found at $LOCAL_BIN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cleaning remote path and pushing binary..."
|
||||
|
||||
# Remove the target first to prevent the 'directory' bug, then push and fix permissions
|
||||
ssh $REMOTE_TARGET "rm -rf $REMOTE_EXE"
|
||||
scp "$LOCAL_BIN" $REMOTE_TARGET:"$REMOTE_EXE"
|
||||
ssh $REMOTE_TARGET "chmod +x $REMOTE_EXE"
|
||||
|
||||
echo "Deployment complete: $REMOTE_EXE"
|
||||
23
utils/fix_links.py
Normal file
23
utils/fix_links.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
def fix_links(root_dir):
|
||||
root_dir = os.path.abspath(root_dir)
|
||||
for root, dirs, files in os.walk(root_dir):
|
||||
for name in files + dirs:
|
||||
path = os.path.join(root, name)
|
||||
if os.path.islink(path):
|
||||
target = os.readlink(path)
|
||||
if target.startswith('/'):
|
||||
# Calculate the relative path from the current folder back to the sysroot
|
||||
relative_to_sysroot = os.path.relpath(root_dir, root)
|
||||
new_target = os.path.normpath(os.path.join(relative_to_sysroot, target.lstrip('/')))
|
||||
print(f"Fixing: {path} -> {new_target}")
|
||||
os.unlink(path)
|
||||
os.symlink(new_target, path)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python3 fix_links.py <directory>")
|
||||
else:
|
||||
fix_links(sys.argv[1])
|
||||
Loading…
Reference in a new issue