-
Notifications
You must be signed in to change notification settings - Fork 124
Add macOS ARM support for Thunderscope #3496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9d55cf0
a27eefc
16fff77
999a3e0
b8f3534
d32fb6d
11fcb39
068f212
4d2b6e9
42a0793
d6b303d
c85da81
49e0b0a
1ee0a58
6642aa2
34b2338
822d644
2e7f579
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ansible-lint==24.12.2 | ||
| pyqtgraph==0.13.7 | ||
| thefuzz==0.19.0 | ||
| iterfzf==0.5.0.20.0 | ||
| python-Levenshtein==0.25.1 | ||
| psutil==5.9.0 | ||
| PyOpenGL==3.1.6 | ||
| ruff==0.5.5 | ||
| pyqt-toast-notification==1.3.2 | ||
| grpcio-tools==1.71.0 | ||
| platformio==6.1.18 | ||
| pyqt6==6.9.1 | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should make sure you're using the same c++ compuler version as Ubuntu (to minimize the number of c++ compatibility changes that are needed) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| #!/bin/bash | ||
| #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# | ||
| # UBC Thunderbots macOS Software Setup | ||
| # | ||
| # This script will install all required libraries and dependencies to build | ||
| # and run the Thunderbots codebase on macOS, including the AI and unit tests. | ||
| #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# | ||
|
|
||
| # Save the parent dir of this script | ||
| CURR_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
| cd "$CURR_DIR" || exit | ||
|
|
||
| source util.sh | ||
|
|
||
| # Since we only support MacOS Arm chips (M series), we can use "Darwin" as the identifier | ||
| # for mac setup procedures and ignore the architecture for now. | ||
| sys=$(uname -s) | ||
|
|
||
| print_status_msg "Installing Utilities and Dependencies" | ||
|
|
||
| # Update Homebrew | ||
| brew update | ||
|
|
||
| # Install required packages | ||
| host_software_packages=( | ||
| cmake@4 | ||
| python@3.12 | ||
| bazelisk | ||
| openjdk@21 | ||
| pyqt@6 | ||
| qt@6 | ||
| node@20 | ||
| go@1.24 | ||
| clang-format@20 | ||
nycrat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
| for pkg in "${host_software_packages[@]}"; do | ||
| if ! brew list "$pkg" &>/dev/null; then | ||
| print_status_msg "Installing $pkg..." | ||
| brew install "$pkg" | ||
| else | ||
| print_status_msg "$pkg already installed, skipping..." | ||
| fi | ||
| done | ||
|
|
||
| # Set up cache | ||
| mkdir /tmp/tbots_download_cache | ||
|
|
||
| # Set up Python | ||
| print_status_msg "Setting Up Python Environment" | ||
|
|
||
| # Create virtual environment | ||
| sudo python3.12 -m venv /opt/tbotspython | ||
| chmod | ||
| source /opt/tbotspython/bin/activate | ||
|
|
||
| # Install Python dependencies | ||
| sudo pip install --upgrade pip | ||
| sudo pip install -r macos_requirements.txt | ||
|
|
||
| print_status_msg "Done Setting Up Python Environment" | ||
|
|
||
| print_status_msg "Fetching game controller" | ||
| install_gamecontroller $sys | ||
|
|
||
| print_status_msg "Setting up TIGERS AutoRef" | ||
| install_autoref $sys | ||
| sudo chmod +x "$CURR_DIR/../src/software/autoref/run_autoref.sh" | ||
| sudo cp "$CURR_DIR/../src/software/autoref/DIV_B.txt" "/opt/tbotspython/autoReferee/config/geometry/DIV_B.txt" | ||
| print_status_msg "Finished setting up AutoRef" | ||
|
|
||
| print_status_msg "Setting up cross compiler for robot software" | ||
| install_cross_compiler $sys | ||
| print_status_msg "Done setting up cross compiler for robot software" | ||
|
|
||
| print_status_msg "Setting Up Python Development Headers" | ||
| install_python_toolchain_headers | ||
| print_status_msg "Done Setting Up Python Development Headers" | ||
|
|
||
| print_status_msg "Granting Permissions to /opt/tbotspython" | ||
| sudo chown -R $(id -u):$(id -g) /opt/tbotspython | ||
| print_status_msg "Done Granting Permissions to /opt/tbotspython" | ||
|
|
||
| print_status_msg "Set up ansible-lint" | ||
| /opt/tbotspython/bin/ansible-galaxy collection install ansible.posix | ||
| print_status_msg "Finished setting up ansible-lint" | ||
|
|
||
Lmh-java marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| print_status_msg "Software Setup Complete" | ||
| print_status_msg "Note: Some changes require a new terminal session to take effect" | ||
|
|
||
nycrat marked this conversation as resolved.
Show resolved
Hide resolved
nycrat marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,20 @@ | ||
| install_autoref() { | ||
| autoref_commit=b30660b78728c3ce159de8ae096181a1ec52e9ba | ||
| wget -N https://github.com/TIGERs-Mannheim/AutoReferee/archive/${autoref_commit}.zip -O /tmp/tbots_download_cache/autoReferee.zip | ||
| unzip -q -o -d /tmp/tbots_download_cache/ /tmp/tbots_download_cache/autoReferee.zip | ||
| if is_darwin $1; then | ||
| autoref_version=1.5.5 | ||
| curl -L https://github.com/TIGERs-Mannheim/AutoReferee/releases/download/${autoref_version}/autoReferee.zip -o /tmp/tbots_download_cache/autoReferee.zip | ||
| unzip -q -o -d /tmp/tbots_download_cache/ /tmp/tbots_download_cache/autoReferee.zip | ||
|
|
||
| /tmp/tbots_download_cache/AutoReferee-${autoref_commit}/./gradlew installDist -p /tmp/tbots_download_cache/AutoReferee-${autoref_commit} -Dorg.gradle.java.home=/opt/tbotspython/bin/jdk | ||
| mv /tmp/tbots_download_cache/AutoReferee-${autoref_commit}/build/install/autoReferee /opt/tbotspython/ | ||
| rm -rf /tmp/tbots_download_cache/autoReferee.zip /tmp/tbots_download_cache/AutoReferee-${autoref_commit} | ||
| sudo mv /tmp/tbots_download_cache/autoReferee /opt/tbotspython/ | ||
| rm -rf /tmp/tbots_download_cache/autoReferee.zip | ||
| else | ||
| autoref_commit=b30660b78728c3ce159de8ae096181a1ec52e9ba | ||
| wget -N https://github.com/TIGERs-Mannheim/AutoReferee/archive/${autoref_commit}.zip -O /tmp/tbots_download_cache/autoReferee.zip | ||
| unzip -q -o -d /tmp/tbots_download_cache/ /tmp/tbots_download_cache/autoReferee.zip | ||
|
|
||
| /tmp/tbots_download_cache/AutoReferee-${autoref_commit}/./gradlew installDist -p /tmp/tbots_download_cache/AutoReferee-${autoref_commit} -Dorg.gradle.java.home=/opt/tbotspython/bin/jdk | ||
| mv /tmp/tbots_download_cache/AutoReferee-${autoref_commit}/build/install/autoReferee /opt/tbotspython/ | ||
| rm -rf /tmp/tbots_download_cache/autoReferee.zip /tmp/tbots_download_cache/AutoReferee-${autoref_commit} | ||
| fi | ||
| } | ||
|
|
||
| install_bazel() { | ||
|
|
@@ -25,25 +34,47 @@ install_clang_format() { | |
|
|
||
| install_cross_compiler() { | ||
| file_name=aarch64-tbots-linux-gnu-for-aarch64 | ||
| if is_x86 $1; then | ||
| file_name=aarch64-tbots-linux-gnu-for-x86 | ||
| if is_darwin $1; then | ||
| full_file_name=$file_name.tar.xz | ||
| curl -L "https://raw.githubusercontent.com/UBC-Thunderbots/Software-External-Dependencies/refs/heads/main/toolchain/$full_file_name" \ | ||
| -o /tmp/tbots_download_cache/$full_file_name | ||
| tar -xf /tmp/tbots_download_cache/$full_file_name -C /tmp/tbots_download_cache/ | ||
| sudo mv /tmp/tbots_download_cache/aarch64-tbots-linux-gnu /opt/tbotspython | ||
| rm /tmp/tbots_download_cache/$full_file_name | ||
| else | ||
| if is_x86 $1; then | ||
| file_name=aarch64-tbots-linux-gnu-for-x86 | ||
| fi | ||
| full_file_name=$file_name.tar.xz | ||
| wget https://raw.githubusercontent.com/UBC-Thunderbots/Software-External-Dependencies/refs/heads/main/toolchain/$full_file_name -O /tmp/tbots_download_cache/$full_file_name | ||
| tar -xf /tmp/tbots_download_cache/$full_file_name -C /tmp/tbots_download_cache/ | ||
| sudo mv /tmp/tbots_download_cache/aarch64-tbots-linux-gnu /opt/tbotspython | ||
| rm /tmp/tbots_download_cache/$full_file_name | ||
| fi | ||
| full_file_name=$file_name.tar.xz | ||
| wget https://raw.githubusercontent.com/UBC-Thunderbots/Software-External-Dependencies/refs/heads/main/toolchain/$full_file_name -O /tmp/tbots_download_cache/$full_file_name | ||
| tar -xf /tmp/tbots_download_cache/$full_file_name -C /tmp/tbots_download_cache/ | ||
| sudo mv /tmp/tbots_download_cache/aarch64-tbots-linux-gnu /opt/tbotspython | ||
| rm /tmp/tbots_download_cache/$full_file_name | ||
| } | ||
|
|
||
| install_gamecontroller () { | ||
| arch=arm64 | ||
| if is_x86 $1; then | ||
| arch=amd64 | ||
| fi | ||
| if is_darwin $1; then | ||
| curl -L https://github.com/RoboCup-SSL/ssl-game-controller/archive/refs/tags/v3.17.0.zip -o /tmp/tbots_download_cache/ssl-game-controller.zip | ||
| unzip -q -o -d /tmp/tbots_download_cache/ /tmp/tbots_download_cache/ssl-game-controller.zip | ||
| cd /tmp/tbots_download_cache/ssl-game-controller-3.17.0 | ||
| make install | ||
| go build cmd/ssl-game-controller/main.go | ||
| sudo mv main /opt/tbotspython/gamecontroller | ||
| sudo chmod +x /opt/tbotspython/gamecontroller | ||
|
|
||
| cd - | ||
| sudo rm -rf /tmp/tbots_download_cache/ssl-game-controller-3.17.0 /tmp/tbots_download_cache/go /tmp/tbots_download_cache/go.tar.gz /tmp/tbots_download_cache/ssl-game-controller.zip | ||
| else | ||
| arch=arm64 | ||
| if is_x86 $1; then | ||
| arch=amd64 | ||
| fi | ||
|
|
||
| wget https://github.com/RoboCup-SSL/ssl-game-controller/releases/download/v3.16.1/ssl-game-controller_v3.16.1_linux_${arch} -O /tmp/tbots_download_cache/gamecontroller | ||
| sudo mv /tmp/tbots_download_cache/gamecontroller /opt/tbotspython/gamecontroller | ||
| sudo chmod +x /opt/tbotspython/gamecontroller | ||
| wget https://github.com/RoboCup-SSL/ssl-game-controller/releases/download/v3.16.1/ssl-game-controller_v3.16.1_linux_${arch} -O /tmp/tbots_download_cache/gamecontroller | ||
| sudo mv /tmp/tbots_download_cache/gamecontroller /opt/tbotspython/gamecontroller | ||
| sudo chmod +x /opt/tbotspython/gamecontroller | ||
| fi | ||
| } | ||
|
|
||
| install_java () { | ||
|
|
@@ -90,6 +121,11 @@ install_python_dev_cross_compile_headers() { | |
| rm -rf /tmp/tbots_download_cache/python-3.12.0.tar.xz | ||
| } | ||
|
|
||
| install_python_toolchain_headers() { | ||
| sudo mkdir -p /opt/tbotspython/py_headers/include/ | ||
| sudo ln -sfn "$(python3.12-config --includes | awk '{for(i=1;i<=NF;++i) if ($i ~ /^-I/) print substr($i, 3)}' | head -n1)" /opt/tbotspython/py_headers/include/ | ||
| } | ||
|
|
||
| is_x86() { | ||
| if [[ $1 == "x86_64" ]]; then | ||
| return 0 | ||
|
|
@@ -98,6 +134,14 @@ is_x86() { | |
| fi | ||
| } | ||
|
|
||
| is_darwin() { | ||
| if [[ $1 == "Darwin" ]]; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very minor nit: add a comment here similar to line 15 in |
||
| return 0 | ||
| else | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| print_status_msg () { | ||
| echo "================================================================" | ||
| echo $1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #pragma once | ||
|
|
||
| #include <chrono> | ||
|
|
||
| #if defined(__APPLE__) | ||
| using Clock = std::chrono::system_clock; | ||
| #else | ||
| using Clock = std::chrono::_V2::system_clock; | ||
| #endif | ||
|
|
||
| #if __cplusplus > 201703L | ||
| #include <filesystem> | ||
| namespace fs = std::filesystem; | ||
| #else | ||
| #include <experimental/filesystem> | ||
| namespace fs = std::experimental::filesystem; | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of these can be removed pending #3542 I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do a merge test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhh I think bazel has no problem with your PR, everything compiles. But PyQt6 conflicts still exist with the current commit
9fce33a1727218c76ee0e1b37ee26bbbd1d0a1e1. I would guess this issue is normal because you have not resolved this PyQt lib conflict in your branch yet?Full Error message: