| ... | @@ -660,6 +660,7 @@ fn addCMakeLibraryList(exe: *std.build.LibExeObjStep, list: []const u8) void { | ... | @@ -660,6 +660,7 @@ fn addCMakeLibraryList(exe: *std.build.LibExeObjStep, list: []const u8) void { |
| 660 | } | 660 | } |
| 661 | | 661 | |
| 662 | const CMakeConfig = struct { | 662 | const CMakeConfig = struct { |
| | 663 | llvm_linkage: std.build.LibExeObjStep.Linkage, |
| 663 | cmake_binary_dir: []const u8, | 664 | cmake_binary_dir: []const u8, |
| 664 | cmake_prefix_path: []const u8, | 665 | cmake_prefix_path: []const u8, |
| 665 | cxx_compiler: []const u8, | 666 | cxx_compiler: []const u8, |
| ... | @@ -698,6 +699,7 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon | ... | @@ -698,6 +699,7 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon |
| 698 | }; | 699 | }; |
| 699 | | 700 | |
| 700 | var ctx: CMakeConfig = .{ | 701 | var ctx: CMakeConfig = .{ |
| | 702 | .llvm_linkage = undefined, |
| 701 | .cmake_binary_dir = undefined, | 703 | .cmake_binary_dir = undefined, |
| 702 | .cmake_prefix_path = undefined, | 704 | .cmake_prefix_path = undefined, |
| 703 | .cxx_compiler = undefined, | 705 | .cxx_compiler = undefined, |
| ... | @@ -741,6 +743,7 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon | ... | @@ -741,6 +743,7 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon |
| 741 | .prefix = "#define ZIG_DIA_GUIDS_LIB ", | 743 | .prefix = "#define ZIG_DIA_GUIDS_LIB ", |
| 742 | .field = "dia_guids_lib", | 744 | .field = "dia_guids_lib", |
| 743 | }, | 745 | }, |
| | 746 | // .prefix = ZIG_LLVM_LINK_MODE parsed manually below |
| 744 | }; | 747 | }; |
| 745 | | 748 | |
| 746 | var lines_it = mem.tokenize(u8, config_h_text, "\r\n"); | 749 | 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 | ... | @@ -753,6 +756,12 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon |
| 753 | @field(ctx, mapping.field) = toNativePathSep(b, quoted); | 756 | @field(ctx, mapping.field) = toNativePathSep(b, quoted); |
| 754 | } | 757 | } |
| 755 | } | 758 | } |
| | 759 | if (mem.startsWith(u8, line, "#define ZIG_LLVM_LINK_MODE ")) { |
| | 760 | var it = mem.split(u8, line, "\""); |
| | 761 | _ = it.next().?; // skip the stuff before the quote |
| | 762 | const quoted = it.next().?; // the stuff inside the quote |
| | 763 | ctx.llvm_linkage = if (mem.eql(u8, quoted, "shared")) .dynamic else .static; |
| | 764 | } |
| 756 | } | 765 | } |
| 757 | return ctx; | 766 | return ctx; |
| 758 | } | 767 | } |