-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
209 lines (201 loc) · 7.96 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
const std = @import("std");
pub fn build(b: *std.Build) void {
//Build
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const projectname = "BaseLVGL";
const rootfile = "main.zig";
const exe = b.addExecutable(.{
.name = projectname,
.root_source_file = b.path(rootfile),
.target = target,
.optimize = optimize
});
exe.addWin32ResourceFile(.{
.file = b.path(projectname ++ ".rc"),
.flags = &.{"/c65001"}, // UTF-8 codepage
});
exe.addIncludePath( b.path("lib/lvgl"));
exe.addIncludePath( b.path("lib/lvgl/src"));
exe.addIncludePath( b.path("lib/lvgl_drv/"));
exe.linkSystemLibrary("GDI32");
const c_srcs = .{
"lib/lvgl/src/core/lv_group.c",
"lib/lvgl/src/core/lv_obj_class.c",
"lib/lvgl/src/core/lv_obj_draw.c",
"lib/lvgl/src/core/lv_obj_event.c",
"lib/lvgl/src/core/lv_obj_id_builtin.c",
"lib/lvgl/src/core/lv_obj_pos.c",
"lib/lvgl/src/core/lv_obj_property.c",
"lib/lvgl/src/core/lv_obj_scroll.c",
"lib/lvgl/src/core/lv_obj_style.c",
"lib/lvgl/src/core/lv_obj_style_gen.c",
"lib/lvgl/src/core/lv_obj_tree.c",
"lib/lvgl/src/core/lv_obj.c",
"lib/lvgl/src/core/lv_refr.c",
"lib/lvgl/src/indev/lv_indev.c",
"lib/lvgl/src/indev/lv_indev_scroll.c",
"lib/lvgl/src/stdlib/lv_mem.c",
"lib/lvgl/src/stdlib/builtin/lv_mem_core_builtin.c",
"lib/lvgl/src/stdlib/builtin/lv_string_builtin.c",
"lib/lvgl/src/stdlib/builtin/lv_sprintf_builtin.c",
"lib/lvgl/src/stdlib/builtin/lv_tlsf.c",
"lib/lvgl/src/misc/lv_anim.c",
"lib/lvgl/src/misc/lv_anim_timeline.c",
"lib/lvgl/src/misc/lv_area.c",
"lib/lvgl/src/misc/lv_async.c",
"lib/lvgl/src/misc/lv_bidi.c",
"lib/lvgl/src/misc/lv_cache.c",
"lib/lvgl/src/misc/lv_cache_builtin.c",
"lib/lvgl/src/misc/lv_color.c",
"lib/lvgl/src/misc/lv_color_op.c",
"lib/lvgl/src/misc/lv_event.c",
"lib/lvgl/src/misc/lv_fs.c",
"lib/lvgl/src/misc/lv_ll.c",
"lib/lvgl/src/misc/lv_log.c",
"lib/lvgl/src/misc/lv_lru.c",
"lib/lvgl/src/misc/lv_math.c",
"lib/lvgl/src/misc/lv_palette.c",
"lib/lvgl/src/misc/lv_profiler_builtin.c",
"lib/lvgl/src/misc/lv_style.c",
"lib/lvgl/src/misc/lv_style_gen.c",
"lib/lvgl/src/misc/lv_templ.c",
"lib/lvgl/src/misc/lv_text.c",
"lib/lvgl/src/misc/lv_text_ap.c",
"lib/lvgl/src/misc/lv_timer.c",
"lib/lvgl/src/misc/lv_utils.c",
"lib/lvgl/src/libs/fsdrv/lv_fs_win32.c",
"lib/lvgl/src/others/file_explorer/lv_file_explorer.c",
"lib/lvgl/src/others/fragment/lv_fragment.c",
"lib/lvgl/src/others/fragment/lv_fragment_manager.c",
"lib/lvgl/src/others/gridnav/lv_gridnav.c",
"lib/lvgl/src/others/ime/lv_ime_pinyin.c",
"lib/lvgl/src/others/imgfont/lv_imgfont.c",
"lib/lvgl/src/others/monkey/lv_monkey.c",
"lib/lvgl/src/others/observer/lv_observer.c",
"lib/lvgl/src/others/snapshot/lv_snapshot.c",
"lib/lvgl/src/others/sysmon/lv_sysmon.c",
"lib/lvgl/src/layouts/lv_layout.c",
"lib/lvgl/src/layouts/flex/lv_flex.c",
"lib/lvgl/src/layouts/grid/lv_grid.c",
"lib/lvgl/src/tick/lv_tick.c",
"lib/lvgl/src/draw/lv_draw.c",
"lib/lvgl/src/draw/lv_draw_arc.c",
"lib/lvgl/src/draw/lv_draw_buf.c",
"lib/lvgl/src/draw/lv_draw_image.c",
"lib/lvgl/src/draw/lv_draw_label.c",
"lib/lvgl/src/draw/lv_draw_line.c",
"lib/lvgl/src/draw/lv_draw_mask.c",
"lib/lvgl/src/draw/lv_draw_rect.c",
"lib/lvgl/src/draw/lv_draw_triangle.c",
"lib/lvgl/src/draw/lv_image_buf.c",
"lib/lvgl/src/draw/lv_image_decoder.c",
"lib/lvgl/src/draw/sw/lv_draw_sw.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_arc.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_bg_img.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_border.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_box_shadow.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_fill.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_gradient.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_img.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_letter.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_line.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_mask.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_mask_rect.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_transform.c",
"lib/lvgl/src/draw/sw/lv_draw_sw_triangle.c",
"lib/lvgl/src/draw/sw/blend/lv_draw_sw_blend.c",
"lib/lvgl/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c",
"lib/lvgl/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c",
"lib/lvgl/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c",
"lib/lvgl/src/display/lv_display.c",
"lib/lvgl/src/osal/lv_os_none.c",
"lib/lvgl/src/font/lv_font.c",
"lib/lvgl/src/font/lv_font_fmt_txt.c",
"lib/lvgl/src/font/lv_font_montserrat_14.c",
"lib/lvgl/src/themes/lv_theme.c",
"lib/lvgl/src/themes/basic/lv_theme_basic.c",
"lib/lvgl/src/themes/default/lv_theme_default.c",
"lib/lvgl/src/themes/mono/lv_theme_mono.c",
"lib/lvgl/src/widgets/arc/lv_arc.c",
"lib/lvgl/src/widgets/bar/lv_bar.c",
"lib/lvgl/src/widgets/button/lv_button.c",
"lib/lvgl/src/widgets/buttonmatrix/lv_buttonmatrix.c",
"lib/lvgl/src/widgets/calendar/lv_calendar.c",
"lib/lvgl/src/widgets/calendar/lv_calendar_header_arrow.c",
"lib/lvgl/src/widgets/calendar/lv_calendar_header_dropdown.c",
"lib/lvgl/src/widgets/canvas/lv_canvas.c",
"lib/lvgl/src/widgets/chart/lv_chart.c",
"lib/lvgl/src/widgets/checkbox/lv_checkbox.c",
"lib/lvgl/src/widgets/dropdown/lv_dropdown.c",
"lib/lvgl/src/widgets/image/lv_image.c",
"lib/lvgl/src/widgets/imgbtn/lv_imgbtn.c",
"lib/lvgl/src/widgets/keyboard/lv_keyboard.c",
"lib/lvgl/src/widgets/label/lv_label.c",
"lib/lvgl/src/widgets/led/lv_led.c",
"lib/lvgl/src/widgets/line/lv_line.c",
"lib/lvgl/src/widgets/list/lv_list.c",
"lib/lvgl/src/widgets/menu/lv_menu.c",
"lib/lvgl/src/widgets/msgbox/lv_msgbox.c",
"lib/lvgl/src/widgets/objx_templ/lv_objx_templ.c",
"lib/lvgl/src/widgets/roller/lv_roller.c",
"lib/lvgl/src/widgets/scale/lv_scale.c",
"lib/lvgl/src/widgets/slider/lv_slider.c",
"lib/lvgl/src/widgets/span/lv_span.c",
"lib/lvgl/src/widgets/spinbox/lv_spinbox.c",
"lib/lvgl/src/widgets/spinner/lv_spinner.c",
"lib/lvgl/src/widgets/switch/lv_switch.c",
"lib/lvgl/src/widgets/table/lv_table.c",
"lib/lvgl/src/widgets/tabview/lv_tabview.c",
"lib/lvgl/src/widgets/textarea/lv_textarea.c",
"lib/lvgl/src/widgets/tileview/lv_tileview.c",
"lib/lvgl/src/widgets/win/lv_win.c"
};
exe.addCSourceFile(.{
.file = b.path("lib/lvgl/src/lv_init.c"),
.flags = &.{ "-Wno-implicit-function-declaration" }
});
inline for (c_srcs) |c_cpp| {
exe.addCSourceFile(.{
.file = b.path(c_cpp),
.flags = &.{ }
});
}
exe.addCSourceFile(.{
.file = b.path("lib/lvgl_drv/win32drv.c"),
.flags = &.{
"-Wno-macro-redefined",
"-Wno-extern-initializer",
"-Wno-incompatible-pointer-types",
"-Wno-implicit-function-declaration",
"-Wno-int-conversion",
"-Wno-int-to-pointer-cast"
}
});
exe.linkLibC();
switch (optimize) {
.Debug => b.exe_dir = "bin/Debug",
.ReleaseSafe => b.exe_dir = "bin/ReleaseSafe",
.ReleaseFast => b.exe_dir = "bin/ReleaseFast",
.ReleaseSmall => b.exe_dir = "bin/ReleaseSmall"
//else => b.exe_dir = "bin/Else",
}
b.installArtifact(exe);
//Run
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
//Tests
const unit_tests = b.addTest(.{
.root_source_file = b.path(rootfile),
.target = target,
.optimize = optimize,
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}