Skip to content

Add support for C/C++ #embed #595

@rascalDan

Description

@rascalDan

Make sure you completed the following tasks

Environment and version details

  • Operating System+version: Gentoo Linux 2.18
  • Compiler+version: GCC 15+, Clang 21+ (maybe earlier)
  • Shell: Bash
  • B2 Version: B2 5.4.2 (OS=LINUX, jobs=8)

Describe your use case

Embedding external assets into C/C++ executables. Currently using it to embed SQL, but other possibilities exist aplenty. (OpenGL shader source, etc)

Describe the solution you'd like

Update src/tools/types/cpp.jam to support #embed as well as #include. I've played locally, and given my understanding of #embed itself and b2's dependency tracking, I think it's as simple as changing the pattern rule to:

    rule pattern ( )
    {
        return "^[ \t]*#[ \t]*include[ \t]*(<[^<]+>|\"[^\"]+\")" , 
                "^[ \t]*#[ \t]*embed[ \t]*(<[^<]+>|\"[^\"]+\")" ; 
    }

Alternatives, if applicable

Given I only have #embed used in a single file right now, manually re-saving that file "works" but its a faff... the above rule change works for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions