Skip to content

Add cflags support to gyp-to-cmake - #454

Merged
kraenhansen merged 1 commit into
callstackincubator:mainfrom
huytdps13400:fix/99-handle-gyp-cflags
Oct 11, 2026
Merged

kraenhansen merged 1 commit into
callstackincubator:mainfrom
huytdps13400:fix/99-handle-gyp-cflags

Conversation

@huytdps13400

Copy link
Copy Markdown
Contributor

Fixes #99

Summary

  • accept and validate target-level cflags in parsed binding.gyp input
  • generate target_compile_options(<target> PRIVATE ...) for those flags
  • preserve the transformer's existing command-expansion and space-escaping behavior
  • target the resolved CMake name when namespaced targets are enabled
  • add a minor changeset for gyp-to-cmake

This intentionally leaves cflags_cc, ldflags, variables, conditions, and target_defaults to their separate tracked issues.

TDD evidence

Parser tests first failed because valid cflags were rejected as an extra property and malformed values were accepted. After adding the parser boundary, transformer tests failed because no target_compile_options command was emitted. Both stages are now green.

Coverage includes:

  • valid and malformed cflags input
  • non-string array entries
  • multiple flags and escaped spaces
  • command expansion into a flag list
  • namespaced target output

Validation

Node 24.16.0 / pnpm 10.33.0:

  • pnpm --filter gyp-to-cmake test — 38/38 passed
  • pnpm run build — passed
  • pnpm test — 115/115 passed across gyp-to-cmake, host, and cmake-rn
  • pnpm lint — passed
  • pnpm prettier:check — passed
  • pnpm depcheck — passed
  • git diff --check — passed

@kraenhansen
kraenhansen changed the base branch from next to main October 11, 2026 21:05
@kraenhansen
kraenhansen force-pushed the fix/99-handle-gyp-cflags branch from 28eb6f6 to 897e3da Compare October 11, 2026 21:05
@kraenhansen

Copy link
Copy Markdown
Collaborator

Rebased onto main and retargeted it there, since this doesn't depend on the Hermes changes on next — the PR now contains just your commit.

@kraenhansen kraenhansen self-assigned this Oct 11, 2026
@kraenhansen
kraenhansen merged commit fd0bfde into callstackincubator:main Oct 11, 2026
9 checks passed
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.

Improve gyp-to-cmake to handle "cflags"

2 participants