Skip to content

fix: add Windows build support for morselib#7

Open
iot-with-vsr wants to merge 1 commit intoMorseMicro:mainfrom
iot-with-vsr:fix/windows-build-support
Open

fix: add Windows build support for morselib#7
iot-with-vsr wants to merge 1 commit intoMorseMicro:mainfrom
iot-with-vsr:fix/windows-build-support

Conversation

@iot-with-vsr
Copy link
Copy Markdown

@iot-with-vsr iot-with-vsr commented Mar 17, 2026

Summary

Fixes three issues that prevent the ap_mode example (and any example using CONFIG_BUILD_SUPPLICANT_FROM_SOURCE=y) from building on Windows with ESP-IDF v5.2.6.

  • Toolchain path regex: CMAKE_OBJCOPY ends with .exe on Windows, so the regex objcopy$ fails to extract the toolchain base, producing invalid paths like objcopy.exear instead of ar
  • Shell pipe in CMake COMMAND: The cmake -E cat | ar -M pipe doesn't work when Ninja wraps commands in cmd.exe /C. Replaced with a CMake -P script using execute_process(... INPUT_FILE ...) to feed stdin to ar -M
  • Python script execution: .py files are not directly executable as commands via cmd.exe. Invoke librarymangler.py via ${PYTHON} explicitly

All fixes are gated behind if(CMAKE_HOST_WIN32) so Linux/macOS builds are completely unchanged.

Test plan

  • ap_mode example builds successfully on Windows (ESP-IDF v5.2.6, ESP32-S3)
  • Other examples (porting_assistant, scan, sta_connect) continue to build
  • Verify Linux build is unaffected (original code paths preserved in else() branches)

On Windows, the morselib build fails due to three platform-specific issues:

1. CMAKE_OBJCOPY ends with .exe, so the regex to extract the toolchain
   base path fails to match, producing invalid tool paths like
   objcopy.exear instead of ar.

2. Shell pipes in CMake COMMAND don't work when Ninja wraps commands in
   cmd.exe /C. Replace with a CMake script using execute_process with
   INPUT_FILE to feed stdin to ar -M.

3. .py scripts are not directly executable via cmd.exe. Invoke the
   librarymangler via ${PYTHON} explicitly.

All fixes are gated behind if(CMAKE_HOST_WIN32) so Linux/macOS builds
are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant