Skip to content

Meson integration example #498

Description

@Letme

For some new project I am looking in meson build instead of Ceedling or Makefile (so not sure this Issue belongs here, but it is where I was searching for more details). Anyway, while it seems quite straight forward to begin with (just adding dependency function), I am having real problems getting mocks to be generated (cmock.c and unity.c compile out of the box). I was assuming fairly same workflow as Ceedling has, that by adding mock_ include it will take some standard CMockConfig.yml and create all the mocks, but then I read more about Meson and I assumed that when I define mock_ in sources it will know that it needs to run CMock to generate mocks. None of the above works, and creating a helper external script to create mocks by calling the cmock.rb seems like a bad way to go, so my question is:

  • How do you get CMock to generate mocks via meson.build
  • (depends on first) How do you pass a custom CMock configuration to the generation of mocks
  • (depends on first) What is best practice to add the custom flags to test build (like -DTEST) - I am currently adding this using a check meson.is_unity() to append to c_args_test variable.

Probably author of the Meson support PR could help: @dreamer-coding or maybe @noahknegt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions