mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
zig build system: remove vcpkg integration
Instead of vcpkg, users are encouraged to use the Zig package manager to fulfill dependencies on Windows.
This commit is contained in:
parent
c20ad51c62
commit
579f572cf2
3 changed files with 0 additions and 113 deletions
|
|
@ -67,7 +67,6 @@ cache_root: Cache.Directory,
|
||||||
global_cache_root: Cache.Directory,
|
global_cache_root: Cache.Directory,
|
||||||
cache: *Cache,
|
cache: *Cache,
|
||||||
zig_lib_dir: ?LazyPath,
|
zig_lib_dir: ?LazyPath,
|
||||||
vcpkg_root: VcpkgRoot = .unattempted,
|
|
||||||
pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,
|
pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,
|
||||||
args: ?[][]const u8 = null,
|
args: ?[][]const u8 = null,
|
||||||
debug_log_scopes: []const []const u8 = &.{},
|
debug_log_scopes: []const []const u8 = &.{},
|
||||||
|
|
@ -841,10 +840,6 @@ pub fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run {
|
||||||
run_step.enableTestRunnerMode();
|
run_step.enableTestRunnerMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exe.vcpkg_bin_path) |path| {
|
|
||||||
run_step.addPathDir(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return run_step;
|
return run_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1978,18 +1973,6 @@ pub fn constructCMacro(allocator: Allocator, name: []const u8, value: ?[]const u
|
||||||
return macro;
|
return macro;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const VcpkgRoot = union(VcpkgRootStatus) {
|
|
||||||
unattempted: void,
|
|
||||||
not_found: void,
|
|
||||||
found: []const u8,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const VcpkgRootStatus = enum {
|
|
||||||
unattempted,
|
|
||||||
not_found,
|
|
||||||
found,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const InstallDir = union(enum) {
|
pub const InstallDir = union(enum) {
|
||||||
prefix: void,
|
prefix: void,
|
||||||
lib: void,
|
lib: void,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ const PkgConfigPkg = std.Build.PkgConfigPkg;
|
||||||
const PkgConfigError = std.Build.PkgConfigError;
|
const PkgConfigError = std.Build.PkgConfigError;
|
||||||
const RunError = std.Build.RunError;
|
const RunError = std.Build.RunError;
|
||||||
const Module = std.Build.Module;
|
const Module = std.Build.Module;
|
||||||
const VcpkgRoot = std.Build.VcpkgRoot;
|
|
||||||
const InstallDir = std.Build.InstallDir;
|
const InstallDir = std.Build.InstallDir;
|
||||||
const GeneratedFile = std.Build.GeneratedFile;
|
const GeneratedFile = std.Build.GeneratedFile;
|
||||||
const Compile = @This();
|
const Compile = @This();
|
||||||
|
|
@ -63,7 +62,6 @@ test_server_mode: bool,
|
||||||
wasi_exec_model: ?std.builtin.WasiExecModel = null,
|
wasi_exec_model: ?std.builtin.WasiExecModel = null,
|
||||||
|
|
||||||
installed_headers: ArrayList(*Step),
|
installed_headers: ArrayList(*Step),
|
||||||
vcpkg_bin_path: ?[]const u8 = null,
|
|
||||||
|
|
||||||
// keep in sync with src/Compilation.zig:RcIncludes
|
// keep in sync with src/Compilation.zig:RcIncludes
|
||||||
/// Behavior of automatic detection of include directories when compiling .rc files.
|
/// Behavior of automatic detection of include directories when compiling .rc files.
|
||||||
|
|
@ -936,44 +934,6 @@ pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {
|
||||||
directory_source.addStepDependencies(&self.step);
|
directory_source.addStepDependencies(&self.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If Vcpkg was found on the system, it will be added to include and lib
|
|
||||||
/// paths for the specified target.
|
|
||||||
pub fn addVcpkgPaths(self: *Compile, linkage: Compile.Linkage) !void {
|
|
||||||
const b = self.step.owner;
|
|
||||||
// Ideally in the Unattempted case we would call the function recursively
|
|
||||||
// after findVcpkgRoot and have only one switch statement, but the compiler
|
|
||||||
// cannot resolve the error set.
|
|
||||||
switch (b.vcpkg_root) {
|
|
||||||
.unattempted => {
|
|
||||||
b.vcpkg_root = if (try findVcpkgRoot(b.allocator)) |root|
|
|
||||||
VcpkgRoot{ .found = root }
|
|
||||||
else
|
|
||||||
.not_found;
|
|
||||||
},
|
|
||||||
.not_found => return error.VcpkgNotFound,
|
|
||||||
.found => {},
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (b.vcpkg_root) {
|
|
||||||
.unattempted => unreachable,
|
|
||||||
.not_found => return error.VcpkgNotFound,
|
|
||||||
.found => |root| {
|
|
||||||
const allocator = b.allocator;
|
|
||||||
const triplet = try self.target.vcpkgTriplet(allocator, if (linkage == .static) .Static else .Dynamic);
|
|
||||||
defer b.allocator.free(triplet);
|
|
||||||
|
|
||||||
const include_path = b.pathJoin(&.{ root, "installed", triplet, "include" });
|
|
||||||
errdefer allocator.free(include_path);
|
|
||||||
try self.include_dirs.append(.{ .path = .{ .path = include_path } });
|
|
||||||
|
|
||||||
const lib_path = b.pathJoin(&.{ root, "installed", triplet, "lib" });
|
|
||||||
try self.lib_paths.append(.{ .path = lib_path });
|
|
||||||
|
|
||||||
self.vcpkg_bin_path = b.pathJoin(&.{ root, "installed", triplet, "bin" });
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void {
|
pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void {
|
||||||
const b = self.step.owner;
|
const b = self.step.owner;
|
||||||
assert(self.kind == .@"test");
|
assert(self.kind == .@"test");
|
||||||
|
|
@ -1814,25 +1774,6 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returned slice must be freed by the caller.
|
|
||||||
fn findVcpkgRoot(allocator: Allocator) !?[]const u8 {
|
|
||||||
const appdata_path = try fs.getAppDataDir(allocator, "vcpkg");
|
|
||||||
defer allocator.free(appdata_path);
|
|
||||||
|
|
||||||
const path_file = try fs.path.join(allocator, &[_][]const u8{ appdata_path, "vcpkg.path.txt" });
|
|
||||||
defer allocator.free(path_file);
|
|
||||||
|
|
||||||
const file = fs.cwd().openFile(path_file, .{}) catch return null;
|
|
||||||
defer file.close();
|
|
||||||
|
|
||||||
const size = @as(usize, @intCast(try file.getEndPos()));
|
|
||||||
const vcpkg_path = try allocator.alloc(u8, size);
|
|
||||||
const size_read = try file.read(vcpkg_path);
|
|
||||||
std.debug.assert(size == size_read);
|
|
||||||
|
|
||||||
return vcpkg_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn doAtomicSymLinks(
|
pub fn doAtomicSymLinks(
|
||||||
step: *Step,
|
step: *Step,
|
||||||
output_path: []const u8,
|
output_path: []const u8,
|
||||||
|
|
|
||||||
|
|
@ -636,43 +636,6 @@ pub fn wantSharedLibSymLinks(self: CrossTarget) bool {
|
||||||
return self.getOsTag() != .windows;
|
return self.getOsTag() != .windows;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const VcpkgLinkage = std.builtin.LinkMode;
|
|
||||||
|
|
||||||
/// Returned slice must be freed by the caller.
|
|
||||||
pub fn vcpkgTriplet(self: CrossTarget, allocator: mem.Allocator, linkage: VcpkgLinkage) ![]u8 {
|
|
||||||
const arch = switch (self.getCpuArch()) {
|
|
||||||
.x86 => "x86",
|
|
||||||
.x86_64 => "x64",
|
|
||||||
|
|
||||||
.arm,
|
|
||||||
.armeb,
|
|
||||||
.thumb,
|
|
||||||
.thumbeb,
|
|
||||||
.aarch64_32,
|
|
||||||
=> "arm",
|
|
||||||
|
|
||||||
.aarch64,
|
|
||||||
.aarch64_be,
|
|
||||||
=> "arm64",
|
|
||||||
|
|
||||||
else => return error.UnsupportedVcpkgArchitecture,
|
|
||||||
};
|
|
||||||
|
|
||||||
const os = switch (self.getOsTag()) {
|
|
||||||
.windows => "windows",
|
|
||||||
.linux => "linux",
|
|
||||||
.macos => "macos",
|
|
||||||
else => return error.UnsupportedVcpkgOperatingSystem,
|
|
||||||
};
|
|
||||||
|
|
||||||
const static_suffix = switch (linkage) {
|
|
||||||
.Static => "-static",
|
|
||||||
.Dynamic => "",
|
|
||||||
};
|
|
||||||
|
|
||||||
return std.fmt.allocPrint(allocator, "{s}-{s}{s}", .{ arch, os, static_suffix });
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn isGnuLibC(self: CrossTarget) bool {
|
pub fn isGnuLibC(self: CrossTarget) bool {
|
||||||
return Target.isGnuLibC_os_tag_abi(self.getOsTag(), self.getAbi());
|
return Target.isGnuLibC_os_tag_abi(self.getOsTag(), self.getAbi());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue