Skip to content

Commit

Permalink
std.Build: fix regression in Step.ConfigHeader
Browse files Browse the repository at this point in the history
Commit 0b7123f regressed the
`include_path` option of ConfigHeader which is intended to set the path,
including subdirectories, that C code would pass to an include
directive.

For example if it passes

    .include_path = "config/config.h",

Then the C code should be able to have

    #include "config/config.h"

This regressed https://github.com/andrewrk/nasm/ but this commit fixes
it.
  • Loading branch information
andrewrk committed Apr 8, 2024
1 parent 6dcbad7 commit fbb38a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/std/Build/Module.zig
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,9 @@ pub fn appendZigProcessFlags(
}
},
.config_header_step => |config_header| {
try zig_args.appendSlice(&.{ "-I", std.fs.path.dirname(config_header.output_file.getPath()).? });
const full_file_path = config_header.output_file.getPath();
const header_dir_path = full_file_path[0 .. full_file_path.len - config_header.include_path.len];
try zig_args.appendSlice(&.{ "-I", header_dir_path });
},
}
}
Expand Down

0 comments on commit fbb38a7

Please sign in to comment.