Native MacOS hello world (#10309)
* Native MacOS hello world * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update variants/native/portduino/platformio.ini Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: ensure null-termination in getSerialString() and handle len==0 Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --------- Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
GitHub
Jonathan Bennett
Copilot
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
parent
bfadf0c36a
commit
06a6c3ee20
@@ -2,7 +2,7 @@
|
||||
[portduino_base]
|
||||
platform =
|
||||
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
|
||||
https://github.com/meshtastic/platform-native/archive/135b91e953db0b5f44d278f8ebd5b8d985fc03d8.zip
|
||||
https://github.com/meshtastic/platform-native/archive/4ea5e09ac7d51a593e12ec7c1ebb6cd06745ce53.zip
|
||||
framework = arduino
|
||||
|
||||
build_src_filter =
|
||||
@@ -37,25 +37,35 @@ lib_deps =
|
||||
# renovate: datasource=github-tags depName=Adafruit_BME680 packageName=adafruit/Adafruit_BME680
|
||||
https://github.com/adafruit/Adafruit_BME680/archive/refs/tags/2.0.6.zip
|
||||
|
||||
build_flags =
|
||||
; Cross-platform build flags shared between native (Linux) and native-macos builds.
|
||||
; Anything Linux-only (libbluetooth, libgpiod, libi2c, /sys/class/gpio,
|
||||
; PORTDUINO_LINUX_HARDWARE, glibc-style _FORTIFY_SOURCE) goes in `build_flags`
|
||||
; instead. UDP multicast also lives there because the firmware's
|
||||
; UdpMulticastHandler.h unconditionally `#include <WiFi.h>` on non-NRF52
|
||||
; targets, which requires the framework's bundled WiFi shim that we
|
||||
; lib_ignore on macOS.
|
||||
build_flags_common =
|
||||
${arduino_base.build_flags}
|
||||
-D ARCH_PORTDUINO
|
||||
-fPIC
|
||||
-D_FORTIFY_SOURCE=2
|
||||
-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4
|
||||
-Isrc/platform/portduino
|
||||
-DRADIOLIB_EEPROM_UNSUPPORTED
|
||||
-DPORTDUINO_LINUX_HARDWARE
|
||||
-DHAS_UDP_MULTICAST=1
|
||||
-lpthread
|
||||
-lstdc++fs
|
||||
-lbluetooth
|
||||
-lgpiod
|
||||
-lyaml-cpp
|
||||
-li2c
|
||||
-luv
|
||||
-std=gnu17
|
||||
-std=gnu++17
|
||||
|
||||
build_flags =
|
||||
${portduino_base.build_flags_common}
|
||||
-DHAS_UDP_MULTICAST=1
|
||||
-D_FORTIFY_SOURCE=2
|
||||
-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4
|
||||
-DPORTDUINO_LINUX_HARDWARE
|
||||
-lstdc++fs
|
||||
-lbluetooth
|
||||
-lgpiod
|
||||
-li2c
|
||||
lib_ignore =
|
||||
Adafruit NeoPixel
|
||||
Adafruit ST7735 and ST7789 Library
|
||||
|
||||
@@ -117,3 +117,59 @@ build_flags = -lgcov --coverage -fprofile-abs-path -fsanitize=address ${env:nati
|
||||
test_testing_command =
|
||||
${platformio.build_dir}/${this.__env__}/meshtasticd
|
||||
-s
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Native build for macOS (Darwin / arm64 + x86_64). Headless meshtasticd that
|
||||
; runs in SimRadio mode (`-s`) or against real LoRa hardware via a CH341
|
||||
; USB-SPI bridge. No BlueZ, libgpiod, or Linux I2C — those require Linux.
|
||||
;
|
||||
; Prerequisites (Homebrew):
|
||||
; brew install platformio yaml-cpp libuv openssl@3 libusb argp-standalone pkg-config
|
||||
;
|
||||
; The macOS-side patches now live upstream:
|
||||
; * meshtastic/platform-native — `String.h`-shadow shim, `-Wno-enum-constexpr-conversion`,
|
||||
; empty-variant-dir guard. Pulled via `portduino_base.platform` zip pin.
|
||||
; * meshtastic/framework-portduino — LinuxHardwareI2C macOS stubs, AsyncUDP
|
||||
; SOCK_NONBLOCK fallback, Common.h __APPLE__ guard, WiFiServer.cpp extern-C
|
||||
; fix, package.json URL refresh. Pulled by platform-native at its pinned commit.
|
||||
; This env therefore only carries the firmware-side build flags and src filter.
|
||||
; ---------------------------------------------------------------------------
|
||||
[env:native-macos]
|
||||
extends = native_base
|
||||
; Apple's ld doesn't accept GNU ld's `-Wl,-Map,<file>` syntax (inherited from
|
||||
; the top-level platformio.ini). Strip it; the linker map isn't useful for
|
||||
; the macOS dev loop anyway, and Apple ld's equivalent (`-Wl,-map,<file>`)
|
||||
; uses different argument shape.
|
||||
build_unflags = -Wl,-Map,"${platformio.build_dir}"/output.map
|
||||
build_flags = ${portduino_base.build_flags_common}
|
||||
-I variants/native/portduino
|
||||
-I/opt/homebrew/include
|
||||
-I/opt/homebrew/opt/argp-standalone/include
|
||||
-I/opt/homebrew/opt/yaml-cpp/include
|
||||
-L/opt/homebrew/lib
|
||||
-L/opt/homebrew/opt/argp-standalone/lib
|
||||
-L/opt/homebrew/opt/yaml-cpp/lib
|
||||
-largp
|
||||
-DPORTDUINO_DARWIN
|
||||
; Headless build — variants/native/portduino/variant.h would otherwise
|
||||
; default HAS_SCREEN to 1 and pull in screen-renderer source that uses
|
||||
; VLA-with-initializer (a GNU/GCC extension Apple Clang rejects).
|
||||
; MESHTASTIC_EXCLUDE_SCREEN gates the optional `screen->setHeading(...)`-
|
||||
; style screen-driver hooks scattered through sensor sources.
|
||||
-DHAS_SCREEN=0
|
||||
-DMESHTASTIC_EXCLUDE_SCREEN=1
|
||||
!pkg-config --libs openssl --silence-errors || :
|
||||
; src/input/Linux*.{cpp,h} drive evdev (`<linux/input.h>`) which doesn't exist
|
||||
; on macOS. graphics/Panel_sdl.* and graphics/TFTDisplay.cpp pull LovyanGFX
|
||||
; (which we lib_ignore on macOS for the <malloc.h> issue). Neither is needed
|
||||
; for the headless build.
|
||||
build_src_filter = ${native_base.build_src_filter}
|
||||
-<input/LinuxInput.cpp>
|
||||
-<input/LinuxInputImpl.cpp>
|
||||
-<graphics/Panel_sdl.cpp>
|
||||
-<graphics/TFTDisplay.cpp>
|
||||
; LovyanGFX includes <malloc.h> (Linux-only) and is only needed by TFT
|
||||
; variants — not relevant for the headless macOS build.
|
||||
lib_ignore =
|
||||
${portduino_base.lib_ignore}
|
||||
LovyanGFX
|
||||
|
||||
Reference in New Issue
Block a user