Skip to content

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

Open
huytdps13400 wants to merge 1 commit into
callstackincubator:nextfrom
huytdps13400:fix/99-handle-gyp-cflags
Open

Add cflags support to gyp-to-cmake#454
huytdps13400 wants to merge 1 commit into
callstackincubator:nextfrom
huytdps13400:fix/99-handle-gyp-cflags

Conversation

@huytdps13400

Copy link
Copy Markdown

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

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"

1 participant