| ... | ... | @@ -16,7 +16,6 @@ const PkgConfigPkg = std.Build.PkgConfigPkg; |
| 16 | 16 | const PkgConfigError = std.Build.PkgConfigError; |
| 17 | 17 | const RunError = std.Build.RunError; |
| 18 | 18 | const Module = std.Build.Module; |
| 19 | | const VcpkgRoot = std.Build.VcpkgRoot; |
| 20 | 19 | const InstallDir = std.Build.InstallDir; |
| 21 | 20 | const GeneratedFile = std.Build.GeneratedFile; |
| 22 | 21 | const Compile = @This(); |
| ... | ... | @@ -63,7 +62,6 @@ test_server_mode: bool, |
| 63 | 62 | wasi_exec_model: ?std.builtin.WasiExecModel = null, |
| 64 | 63 | |
| 65 | 64 | installed_headers: ArrayList(*Step), |
| 66 | | vcpkg_bin_path: ?[]const u8 = null, |
| 67 | 65 | |
| 68 | 66 | // keep in sync with src/Compilation.zig:RcIncludes |
| 69 | 67 | /// Behavior of automatic detection of include directories when compiling .rc files. |
| ... | ... | @@ -936,44 +934,6 @@ pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void { |
| 936 | 934 | directory_source.addStepDependencies(&self.step); |
| 937 | 935 | } |
| 938 | 936 | |
| 939 | | /// If Vcpkg was found on the system, it will be added to include and lib |
| 940 | | /// paths for the specified target. |
| 941 | | pub fn addVcpkgPaths(self: *Compile, linkage: Compile.Linkage) !void { |
| 942 | | const b = self.step.owner; |
| 943 | | // Ideally in the Unattempted case we would call the function recursively |
| 944 | | // after findVcpkgRoot and have only one switch statement, but the compiler |
| 945 | | // cannot resolve the error set. |
| 946 | | switch (b.vcpkg_root) { |
| 947 | | .unattempted => { |
| 948 | | b.vcpkg_root = if (try findVcpkgRoot(b.allocator)) |root| |
| 949 | | VcpkgRoot{ .found = root } |
| 950 | | else |
| 951 | | .not_found; |
| 952 | | }, |
| 953 | | .not_found => return error.VcpkgNotFound, |
| 954 | | .found => {}, |
| 955 | | } |
| 956 | | |
| 957 | | switch (b.vcpkg_root) { |
| 958 | | .unattempted => unreachable, |
| 959 | | .not_found => return error.VcpkgNotFound, |
| 960 | | .found => |root| { |
| 961 | | const allocator = b.allocator; |
| 962 | | const triplet = try self.target.vcpkgTriplet(allocator, if (linkage == .static) .Static else .Dynamic); |
| 963 | | defer b.allocator.free(triplet); |
| 964 | | |
| 965 | | const include_path = b.pathJoin(&.{ root, "installed", triplet, "include" }); |
| 966 | | errdefer allocator.free(include_path); |
| 967 | | try self.include_dirs.append(.{ .path = .{ .path = include_path } }); |
| 968 | | |
| 969 | | const lib_path = b.pathJoin(&.{ root, "installed", triplet, "lib" }); |
| 970 | | try self.lib_paths.append(.{ .path = lib_path }); |
| 971 | | |
| 972 | | self.vcpkg_bin_path = b.pathJoin(&.{ root, "installed", triplet, "bin" }); |
| 973 | | }, |
| 974 | | } |
| 975 | | } |
| 976 | | |
| 977 | 937 | pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void { |
| 978 | 938 | const b = self.step.owner; |
| 979 | 939 | assert(self.kind == .@"test"); |
| ... | ... | @@ -1814,25 +1774,6 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 1814 | 1774 | } |
| 1815 | 1775 | } |
| 1816 | 1776 | |
| 1817 | | /// Returned slice must be freed by the caller. |
| 1818 | | fn findVcpkgRoot(allocator: Allocator) !?[]const u8 { |
| 1819 | | const appdata_path = try fs.getAppDataDir(allocator, "vcpkg"); |
| 1820 | | defer allocator.free(appdata_path); |
| 1821 | | |
| 1822 | | const path_file = try fs.path.join(allocator, &[_][]const u8{ appdata_path, "vcpkg.path.txt" }); |
| 1823 | | defer allocator.free(path_file); |
| 1824 | | |
| 1825 | | const file = fs.cwd().openFile(path_file, .{}) catch return null; |
| 1826 | | defer file.close(); |
| 1827 | | |
| 1828 | | const size = @as(usize, @intCast(try file.getEndPos())); |
| 1829 | | const vcpkg_path = try allocator.alloc(u8, size); |
| 1830 | | const size_read = try file.read(vcpkg_path); |
| 1831 | | std.debug.assert(size == size_read); |
| 1832 | | |
| 1833 | | return vcpkg_path; |
| 1834 | | } |
| 1835 | | |
| 1836 | 1777 | pub fn doAtomicSymLinks( |
| 1837 | 1778 | step: *Step, |
| 1838 | 1779 | output_path: []const u8, |