diff options
| author | Cody Tapscott <topolarity@tapscott.me> | 2022-07-23 09:02:51 -0700 |
|---|---|---|
| committer | Cody Tapscott <topolarity@tapscott.me> | 2022-07-23 09:03:19 -0700 |
| commit | 5337934bcd174987e813e192cb5ef173c13eff37 (patch) | |
| tree | 3bc5787c229bd477068e82891803d6d187403e48 /build.zig | |
| parent | 4113a790b0da56d7081aca52d0ca4e349d27a6a1 (diff) | |
| download | zig-5337934bcd174987e813e192cb5ef173c13eff37.tar.gz zig-5337934bcd174987e813e192cb5ef173c13eff37.zip | |
CMake: Add ZIG_LLVM_LINK_MODE to config.h
This is currently unused, but it will be needed soon so that we can
avoid linking static libc++ if LLVM/Clang is configured as a shared
library.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -660,6 +660,7 @@ fn addCMakeLibraryList(exe: *std.build.LibExeObjStep, list: []const u8) void { } const CMakeConfig = struct { + llvm_linkage: std.build.LibExeObjStep.Linkage, cmake_binary_dir: []const u8, cmake_prefix_path: []const u8, cxx_compiler: []const u8, @@ -698,6 +699,7 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon }; var ctx: CMakeConfig = .{ + .llvm_linkage = undefined, .cmake_binary_dir = undefined, .cmake_prefix_path = undefined, .cxx_compiler = undefined, @@ -741,6 +743,7 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon .prefix = "#define ZIG_DIA_GUIDS_LIB ", .field = "dia_guids_lib", }, + // .prefix = ZIG_LLVM_LINK_MODE parsed manually below }; var lines_it = mem.tokenize(u8, config_h_text, "\r\n"); @@ -753,6 +756,12 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon @field(ctx, mapping.field) = toNativePathSep(b, quoted); } } + if (mem.startsWith(u8, line, "#define ZIG_LLVM_LINK_MODE ")) { + var it = mem.split(u8, line, "\""); + _ = it.next().?; // skip the stuff before the quote + const quoted = it.next().?; // the stuff inside the quote + ctx.llvm_linkage = if (mem.eql(u8, quoted, "shared")) .dynamic else .static; + } } return ctx; } |
