Skip to content
Closed
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
29 changes: 28 additions & 1 deletion microros_utils/library_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, sys
import os, sys, platform
import yaml
import shutil

Expand Down Expand Up @@ -224,6 +224,7 @@ def package_mcu_library(self):
shutil.copytree(repeated_path, folder_path, copy_function=shutil.move, dirs_exist_ok=True)
shutil.rmtree(repeated_path)


def resolve_binutils_path(self):
if sys.platform == "darwin":
homebrew_binutils_path = "/opt/homebrew/opt/binutils/bin/"
Expand All @@ -235,3 +236,29 @@ def resolve_binutils_path(self):
sys.exit(1)

return ""

def resolve_binutils_path(self):
homebrew_binutils_path = None

if sys.platform == "darwin":
proc = platform.processor()
if proc == "arm":
# Apple Silicon path
homebrew_binutils_path = "/opt/homebrew/opt/binutils/bin/"
elif proc == "i386":
# Intel Mac path
homebrew_binutils_path = "/usr/local/opt/binutils/bin/"
else:
print(f"ERROR: Unknown processor architecture '{proc}'.")
sys.exit(1)

if os.path.exists(homebrew_binutils_path):
return homebrew_binutils_path

print(
f"ERROR: GNU binutils not found. Tried: {homebrew_binutils_path}. Please install binutils with homebrew: brew install binutils"
)
sys.exit(1)

# Linux - use binutils on default path
return ""
Loading