Skip to content

Make install/compile scripts run on non-Windows#4

Open
tabedzki wants to merge 1 commit into
masterfrom
feature/cross-platform-build
Open

Make install/compile scripts run on non-Windows#4
tabedzki wants to merge 1 commit into
masterfrom
feature/cross-platform-build

Conversation

@tabedzki

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Summary

ViRMEn's install/compile scripts assumed a Windows + MSVC toolchain and the (now-removed) MATLAB Java runtime, so they errored out on macOS/Linux. This PR makes them portable without changing Windows behavior — Windows still takes the exact same code paths it did before.

Changes

  • compile_transformations.m — on macOS, link the optional C++ MEX export symbols with the classic linker (-Wl,-ld_classic). Newer Xcode linkers treat MATLAB's <initial-undefines> (_mexCreateMexFunction, etc.) as hard errors; the classic linker treats them as optional, which is what MATLAB expects.
  • install_virmen.m
    • Only copy git-hooks/ when that directory exists.
    • Write version.txt relative to the repo — the old \$GIT_DIR/../version.txt path is unset when the script is run interactively from MATLAB.
    • Guard the Windows-only winmerge invocation behind ispc.
    • Report compile errors via getReport(err) (the previously-called displayException does not exist in this repo).
  • compile_serialcomm.m — skip on non-Windows; Serial.cpp uses the Win32 COM-port API (windows.h, crtdbg.h, tchar.h) and cannot build elsewhere.
  • calibrateBallMEX.m / calibrateBallMEX_2sensors.m — replace java.lang.Thread.sleep(8) with pause(0.008), which doesn't depend on the removed MATLAB Java runtime.

Testing

On MATLAB R2024a (macOS), install_virmen now runs to completion: transformToroidalParametrizedMex and miniVR_projection_wparameters compile (the latter via the classic-linker path), and the Windows-only serial/NI-DAQ steps are skipped with a clear warning instead of erroring.

Notes

  • Recompiled .mexmaci64 binaries are intentionally not included here — they're build artifacts, and this PR is about the build scripts. Each developer regenerates them by running install_virmen on their platform.
  • Independent of Replace deprecated uisplittool with native uicontextmenu dropdowns #3 (the uisplittool GUI rework); both branch from master.

The install and compile scripts assumed a Windows + MSVC environment and
the Java/Swing MATLAB runtime, so they failed on macOS/Linux. Make them
portable without changing Windows behaviour:

- compile_transformations: on macOS, link the optional C++ MEX export
  symbols with the classic linker (-ld_classic); newer Xcode linkers
  treat MATLAB's <initial-undefines> as hard errors otherwise.
- install_virmen: only copy git-hooks when the directory exists, write
  version.txt relative to the repo (the old $GIT_DIR path is unset when
  run interactively), guard the Windows-only winmerge call behind ispc,
  and report errors via getReport (displayException did not exist).
- compile_serialcomm: skip on non-Windows -- Serial.cpp uses the Win32
  COM-port API and cannot build elsewhere.
- calibrateBallMEX, calibrateBallMEX_2sensors: replace the Java
  java.lang.Thread.sleep(8) with pause(0.008), which does not depend on
  the removed MATLAB Java runtime.

Assisted-by: ClaudeCode:claude-opus-4.8
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