@@ -103,7 +103,6 @@ link_objects: ArrayList(LinkObject),
103
103
include_dirs : ArrayList (IncludeDir ),
104
104
c_macros : ArrayList ([]const u8 ),
105
105
installed_headers : ArrayList (* Step ),
106
- output_dir : ? []const u8 ,
107
106
is_linking_libc : bool = false ,
108
107
is_linking_libcpp : bool = false ,
109
108
vcpkg_bin_path : ? []const u8 = null ,
@@ -387,7 +386,6 @@ pub fn create(owner: *std.Build, options: Options) *CompileStep {
387
386
.disable_sanitize_c = false ,
388
387
.sanitize_thread = false ,
389
388
.rdynamic = false ,
390
- .output_dir = null ,
391
389
.override_dest_dir = null ,
392
390
.installed_path = null ,
393
391
.install_step = null ,
@@ -452,19 +450,9 @@ fn computeOutFileNames(self: *CompileStep) void {
452
450
self .out_lib_filename = self .out_filename ;
453
451
}
454
452
}
455
- if (self .output_dir != null ) {
456
- self .output_lib_path_source .path = b .pathJoin (
457
- &.{ self .output_dir .? , self .out_lib_filename },
458
- );
459
- }
460
453
}
461
454
}
462
455
463
- pub fn setOutputDir (self : * CompileStep , dir : []const u8 ) void {
464
- const b = self .step .owner ;
465
- self .output_dir = b .dupePath (dir );
466
- }
467
-
468
456
pub fn install (self : * CompileStep ) void {
469
457
const b = self .step .owner ;
470
458
b .installArtifact (self );
@@ -1937,54 +1925,31 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
1937
1925
},
1938
1926
else = > | e | return e ,
1939
1927
};
1940
- const build_output_dir = fs .path .dirname (output_bin_path ).? ;
1941
-
1942
- if (self .output_dir ) | output_dir | {
1943
- var src_dir = try fs .cwd ().openIterableDir (build_output_dir , .{});
1944
- defer src_dir .close ();
1945
-
1946
- // Create the output directory if it doesn't exist.
1947
- try fs .cwd ().makePath (output_dir );
1948
-
1949
- var dest_dir = try fs .cwd ().openDir (output_dir , .{});
1950
- defer dest_dir .close ();
1951
-
1952
- var it = src_dir .iterate ();
1953
- while (try it .next ()) | entry | {
1954
- // The compiler can put these files into the same directory, but we don't
1955
- // want to copy them over.
1956
- if (mem .eql (u8 , entry .name , "llvm-ar.id" ) or
1957
- mem .eql (u8 , entry .name , "libs.txt" ) or
1958
- mem .eql (u8 , entry .name , "builtin.zig" ) or
1959
- mem .eql (u8 , entry .name , "zld.id" ) or
1960
- mem .eql (u8 , entry .name , "lld.id" )) continue ;
1961
-
1962
- _ = try src_dir .dir .updateFile (entry .name , dest_dir , entry .name , .{});
1963
- }
1964
- } else {
1965
- self .output_dir = build_output_dir ;
1966
- }
1967
-
1968
- // This will ensure all output filenames will now have the output_dir available!
1969
- self .computeOutFileNames ();
1928
+ const output_dir = fs .path .dirname (output_bin_path ).? ;
1970
1929
1971
1930
// Update generated files
1972
- if ( self . output_dir != null ) {
1973
- self .output_dirname_source .path = self . output_dir .? ;
1931
+ {
1932
+ self .output_dirname_source .path = output_dir ;
1974
1933
1975
1934
self .output_path_source .path = b .pathJoin (
1976
- &.{ self . output_dir .? , self .out_filename },
1935
+ &.{ output_dir , self .out_filename },
1977
1936
);
1978
1937
1938
+ if (self .kind == .lib ) {
1939
+ self .output_lib_path_source .path = b .pathJoin (
1940
+ &.{ output_dir , self .out_lib_filename },
1941
+ );
1942
+ }
1943
+
1979
1944
if (self .emit_h ) {
1980
1945
self .output_h_path_source .path = b .pathJoin (
1981
- &.{ self . output_dir .? , self .out_h_filename },
1946
+ &.{ output_dir , self .out_h_filename },
1982
1947
);
1983
1948
}
1984
1949
1985
1950
if (self .target .isWindows () or self .target .isUefi ()) {
1986
1951
self .output_pdb_path_source .path = b .pathJoin (
1987
- &.{ self . output_dir .? , self .out_pdb_filename },
1952
+ &.{ output_dir , self .out_pdb_filename },
1988
1953
);
1989
1954
}
1990
1955
}
0 commit comments