diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-04-21 02:26:48 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-04-21 02:26:48 -0400 |
| commit | ecb71d1dd34e98fc9813cffa473f83127e6e3d01 (patch) | |
| tree | dba3e086b6655bf75a9efae2e67cfc5aa5c629cd /std/build.zig | |
| parent | fb492d19ebb56466f04a2a88c7d3c0a9833f2e0d (diff) | |
| download | zig-ecb71d1dd34e98fc9813cffa473f83127e6e3d01.tar.gz zig-ecb71d1dd34e98fc9813cffa473f83127e6e3d01.zip | |
add example which exercises addObject in the zig build system
closes #329
Diffstat (limited to 'std/build.zig')
| -rw-r--r-- | std/build.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/std/build.zig b/std/build.zig index 29b3350292..8d24af177f 100644 --- a/std/build.zig +++ b/std/build.zig @@ -128,7 +128,7 @@ pub const Builder = struct { pub fn addObject(self: &Builder, name: []const u8, root_src: []const u8) -> &ObjectStep { const obj_step = %%self.allocator.create(ObjectStep); - *obj_step = ObjectStep.init(self, name, src); + *obj_step = ObjectStep.init(self, name, root_src); return obj_step; } @@ -1567,6 +1567,17 @@ pub const CExecutable = struct { %%self.include_dirs.append(self.builder.out_dir); } + pub fn addObject(self: &CExecutable, obj: &ObjectStep) { + self.step.dependOn(&obj.step); + + // TODO make it so we always know where this will be + %%self.object_files.append(%%os.path.join(self.builder.allocator, self.builder.out_dir, + self.builder.fmt("{}{}", obj.name, obj.target.oFileExt()))); + + // TODO should be some kind of isolated directory that only has this header in it + %%self.include_dirs.append(self.builder.out_dir); + } + pub fn addSourceFile(self: &CExecutable, file: []const u8) { %%self.source_files.append(file); } |
