Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand EmbeddedExecutable #72

Open
ikskuh opened this issue Jul 27, 2022 · 3 comments
Open

Expand EmbeddedExecutable #72

ikskuh opened this issue Jul 27, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@ikskuh
Copy link
Contributor

ikskuh commented Jul 27, 2022

Expose common functions like install() and setBuildMode(), also installRaw()

@ikskuh ikskuh added the enhancement New feature or request label Jul 27, 2022
@kuon
Copy link
Contributor

kuon commented Aug 2, 2022

I also use:

addCSourceFile
addIncludeDir
addSystemIncludeDir
want_lto

I currently just use exe.inner I don't know if we need to wrap all of those.

@r4gus
Copy link
Contributor

r4gus commented Sep 14, 2022

Implemented in #77

@kuon
Copy link
Contributor

kuon commented Sep 14, 2022

I just had to do the following:

    var buf: [100]u8 = .{0} ** 100;
    const date = std.fmt.bufPrint(
        &buf,
        "{d}",
        .{std.time.timestamp()},
    ) catch unreachable;
    const options = b.addOptions();
    options.addOption([]const u8, "date", date);
    exe.inner.addOptions("compile_info", options);

    exe.addPackage(.{ .name = "compile_info", .source = options.getSource() });

To be able to do

const date = @import("compile_info").date;

So I think #77 should be extended with addOptions and the code would then look like:

    var buf: [100]u8 = .{0} ** 100;
    const date = std.fmt.bufPrint(
        &buf,
        "{d}",
        .{std.time.timestamp()},
    ) catch unreachable;
    const options = b.addOptions();
    options.addOption([]const u8, "date", date);

    exe.addOptions("compile_info", options); // this should be implemented

    // addPackage should not be needed

ikskuh added a commit that referenced this issue Feb 16, 2024
Co-authored-by: Felix (xq) Queißner <git@random-projects.net>
mattnite added a commit that referenced this issue Feb 26, 2024
mattnite added a commit that referenced this issue Feb 26, 2024
mattnite added a commit that referenced this issue Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants