Skip to content

build: replace @cImport with addTranslateC modules - #401

Merged
forketyfork merged 2 commits into
mainfrom
build/add-translate-c-modules
Sep 3, 2026
Merged

build: replace @cImport with addTranslateC modules#401
forketyfork merged 2 commits into
mainfrom
build/add-translate-c-modules

Conversation

@forketyfork

Copy link
Copy Markdown
Owner

Issue

@cImport is deprecated in Zig 0.16.0 in favor of build-system translation with b.addTranslateC(...) and named module imports. See the Zig 0.16.0 release notes: @cImport Moving to Build System. No issue number exists for this maintenance change.

Solution

  • Add one built-in std.Build.addTranslateC module per existing C import site, backed by focused shims under src/c/.
  • Preserve SDL3 and SDL3_ttf include paths from SDL3_INCLUDE_PATH and SDL3_TTF_INCLUDE_PATH, and share the macOS SDK framework path with the SDL translation step.
  • Select the PTY shim by target OS and create the libproc/sysctl modules only for macOS.
  • Keep the stable SDL symbol re-export surface in src/c.zig and update the Zig 0.16 and architecture documentation.

Context

The migration uses only Zig 0.16.0 standard build APIs and introduces no dependencies. The executable remains the only module receiving the C translation imports; the MCP and shared utility modules are unchanged. Linux and macOS builds continue to use their existing SDL, system-library, framework, Nix, and Homebrew path configuration.

Test plan

  • On macOS with a display, launch Architect and verify the SDL window opens.
  • On macOS, verify fonts and keyboard shortcuts behave as before.
  • On the macOS host, enter nix develop and verify zig build succeeds.

@forketyfork
forketyfork merged commit 942cbcf into main Sep 3, 2026
4 checks passed
@forketyfork
forketyfork deleted the build/add-translate-c-modules branch September 3, 2026 18:59
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