authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2024-03-09 23:15:06-08:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2024-03-11 05:06:17-07:00
log3f92cbef89e13c90e2c9f7051dbf5edef76fa90b
treecf0750beb9059e76d8151fb044cb795f6a763eee
parentc32e0d3000f4ee539c00577b75e18c683e84f2c4

resinator: Fix auto-detected includes only being used during preprocessing

Also need to pass them to the .res compilation step, since files (cursors, icons, etc) can be found in the system include directories.

1 files changed, 21 insertions(+), 16 deletions(-)

lib/compiler/resinator/main.zig+21-16
......@@ -14,6 +14,10 @@ pub fn main() !void {
1414 defer std.debug.assert(gpa.deinit() == .ok);
1515 const allocator = gpa.allocator();
1616
17 var arena_state = std.heap.ArenaAllocator.init(allocator);
18 defer arena_state.deinit();
19 const arena = arena_state.allocator();
20
1721 const stderr = std.io.getStdErr();
1822 const stderr_config = std.io.tty.detectConfig(stderr);
1923
......@@ -101,6 +105,22 @@ pub fn main() !void {
101105 }
102106 const maybe_dependencies_list: ?*std.ArrayList([]const u8) = if (options.depfile_path != null) &dependencies_list else null;
103107
108 const include_paths = getIncludePaths(arena, options.auto_includes, zig_lib_dir) catch |err| switch (err) {
109 error.OutOfMemory => |e| return e,
110 else => |e| {
111 switch (e) {
112 error.MsvcIncludesNotFound => {
113 try error_handler.emitMessage(allocator, .err, "MSVC include paths could not be automatically detected", .{});
114 },
115 error.MingwIncludesNotFound => {
116 try error_handler.emitMessage(allocator, .err, "MinGW include paths could not be automatically detected", .{});
117 },
118 }
119 try error_handler.emitMessage(allocator, .note, "to disable auto includes, use the option /:auto-includes none", .{});
120 std.os.exit(1);
121 },
122 };
123
104124 const full_input = full_input: {
105125 if (options.preprocess != .no) {
106126 var preprocessed_buf = std.ArrayList(u8).init(allocator);
......@@ -112,22 +132,6 @@ pub fn main() !void {
112132 defer aro_arena_state.deinit();
113133 const aro_arena = aro_arena_state.allocator();
114134
115 const include_paths = getIncludePaths(aro_arena, options.auto_includes, zig_lib_dir) catch |err| switch (err) {
116 error.OutOfMemory => |e| return e,
117 else => |e| {
118 switch (e) {
119 error.MsvcIncludesNotFound => {
120 try error_handler.emitMessage(allocator, .err, "MSVC include paths could not be automatically detected", .{});
121 },
122 error.MingwIncludesNotFound => {
123 try error_handler.emitMessage(allocator, .err, "MinGW include paths could not be automatically detected", .{});
124 },
125 }
126 try error_handler.emitMessage(allocator, .note, "to disable auto includes, use the option /:auto-includes none", .{});
127 std.os.exit(1);
128 },
129 };
130
131135 var comp = aro.Compilation.init(aro_arena);
132136 defer comp.deinit();
133137
......@@ -211,6 +215,7 @@ pub fn main() !void {
211215 .dependencies_list = maybe_dependencies_list,
212216 .ignore_include_env_var = options.ignore_include_env_var,
213217 .extra_include_paths = options.extra_include_paths.items,
218 .system_include_paths = include_paths,
214219 .default_language_id = options.default_language_id,
215220 .default_code_page = options.default_code_page orelse .windows1252,
216221 .verbose = options.verbose,