Skip to content

Commit d763cd9

Browse files
author
yuwei
committed
feat: 产出 LVGL widgets demo 预编译包
1 parent 926f902 commit d763cd9

27 files changed

Lines changed: 3133 additions & 8 deletions

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ set(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include")
3131
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
3232
set(LV_CONF_PATH "${LVGL_CONFIG_DIR}/lv_conf.h" CACHE STRING "" FORCE)
3333
set(LV_CONF_BUILD_DISABLE_EXAMPLES ON CACHE BOOL "" FORCE)
34-
set(LV_CONF_BUILD_DISABLE_DEMOS ON CACHE BOOL "" FORCE)
34+
set(LV_CONF_BUILD_DISABLE_DEMOS OFF CACHE BOOL "" FORCE)
3535
set(LV_CONF_BUILD_DISABLE_THORVG_INTERNAL ON CACHE BOOL "" FORCE)
3636

3737
add_subdirectory("${LVGL_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/lvgl")
3838

3939
target_include_directories(lvgl PRIVATE "${SDL2_INCLUDE_DIR}")
4040
target_compile_options(lvgl PRIVATE ${SDL2_CFLAGS_LIST})
41+
42+
target_include_directories(lvgl_demos PRIVATE "${SDL2_INCLUDE_DIR}")
43+
target_compile_options(lvgl_demos PRIVATE ${SDL2_CFLAGS_LIST})

config/host_macos/lv_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
#define LV_USE_WIN 1
106106

107107
#define LV_BUILD_EXAMPLES 0
108-
#define LV_USE_DEMO_WIDGETS 0
108+
#define LV_USE_DEMO_WIDGETS 1
109109
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
110110
#define LV_USE_DEMO_BENCHMARK 0
111111
#define LV_USE_DEMO_STRESS 0
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* @file lv_demo_benchmark.h
3+
*
4+
*/
5+
6+
#ifndef LV_DEMO_BENCHMARK_H
7+
#define LV_DEMO_BENCHMARK_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/*********************
14+
* INCLUDES
15+
*********************/
16+
#include "../lv_demos.h"
17+
18+
#if LV_USE_DEMO_BENCHMARK
19+
20+
/*********************
21+
* DEFINES
22+
*********************/
23+
24+
/**********************
25+
* TYPEDEFS
26+
**********************/
27+
28+
/**********************
29+
* GLOBAL PROTOTYPES
30+
**********************/
31+
32+
/**
33+
* Run all benchmark scenes.
34+
*
35+
* On the summary end screen the values shall be interpreted according to the followings:
36+
* - CPU usage:
37+
* - If `LV_SYSMON_GET_IDLE` is not modified it's measured based on the time spent in
38+
* `lv_timer_handler`.
39+
* - If an (RT)OS is used `LV_SYSMON_GET_IDLE` can be changed to a custom function
40+
* which returns the idle percentage of idle task.
41+
*
42+
* - FPS: LVGL attempted to render this many times in a second. It's limited based on `LV_DEF_REFR_PERIOD`
43+
*
44+
* - Render time: LVGL spent this much time with rendering only. It's not aware of task yielding,
45+
* but simply the time difference between the start and end of the rendering is measured
46+
*
47+
* - Flush time: It's the sum of
48+
* - the time spent in the `fluch_cb` and
49+
* - the time spent with waiting for flush ready.
50+
*/
51+
void lv_demo_benchmark(void);
52+
53+
/**********************
54+
* MACROS
55+
**********************/
56+
57+
#endif /*LV_USE_DEMO_BENCHMARK*/
58+
59+
#ifdef __cplusplus
60+
} /* extern "C" */
61+
#endif
62+
63+
#endif /*LV_DEMO_BENCHMARK_H*/
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @file lv_demo_flex_layout.h
3+
*
4+
*/
5+
6+
#ifndef LV_DEMO_FLEX_LAYOUT_H
7+
#define LV_DEMO_FLEX_LAYOUT_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/*********************
14+
* INCLUDES
15+
*********************/
16+
17+
/*********************
18+
* DEFINES
19+
*********************/
20+
21+
/**********************
22+
* TYPEDEFS
23+
**********************/
24+
25+
/**********************
26+
* GLOBAL PROTOTYPES
27+
**********************/
28+
void lv_demo_flex_layout(void);
29+
30+
/**********************
31+
* MACROS
32+
**********************/
33+
34+
#ifdef __cplusplus
35+
} /*extern "C"*/
36+
#endif
37+
38+
#endif /*LV_DEMO_FLEX_LAYOUT_H*/
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/**
2+
* @file lv_demo_flex_layout_main.h
3+
*
4+
*/
5+
6+
#ifndef LV_DEMO_FLEX_LAYOUT_MAIN_H
7+
#define LV_DEMO_FLEX_LAYOUT_MAIN_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/*********************
14+
* INCLUDES
15+
*********************/
16+
17+
#include "../../lvgl.h"
18+
19+
/*********************
20+
* DEFINES
21+
*********************/
22+
23+
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
24+
25+
/**********************
26+
* TYPEDEFS
27+
**********************/
28+
typedef struct {
29+
lv_obj_t * root;
30+
lv_obj_t * obj_cur;
31+
lv_style_t obj_def_style;
32+
lv_style_t obj_checked_style;
33+
34+
struct {
35+
lv_obj_t * cont;
36+
37+
struct {
38+
lv_obj_t * view;
39+
40+
struct {
41+
lv_obj_t * tab;
42+
lv_obj_t * ddlist_flow;
43+
lv_obj_t * checkbox_scrl;
44+
} flex;
45+
46+
struct {
47+
lv_obj_t * tab;
48+
lv_obj_t * ddlist_align_main;
49+
lv_obj_t * ddlist_align_cross;
50+
lv_obj_t * ddlist_align_track;
51+
} align;
52+
53+
struct {
54+
lv_obj_t * tab;
55+
lv_obj_t * group_width_and_height;
56+
lv_obj_t * spinbox_width;
57+
lv_obj_t * spinbox_height;
58+
lv_obj_t * group_width_and_height_min;
59+
lv_obj_t * spinbox_min_width;
60+
lv_obj_t * spinbox_min_height;
61+
lv_obj_t * group_width_and_height_max;
62+
lv_obj_t * spinbox_max_width;
63+
lv_obj_t * spinbox_max_height;
64+
lv_obj_t * spinbox_pad_top;
65+
lv_obj_t * spinbox_pad_bottom;
66+
lv_obj_t * spinbox_pad_left;
67+
lv_obj_t * spinbox_pad_right;
68+
lv_obj_t * spinbox_pad_column;
69+
lv_obj_t * spinbox_pad_row;
70+
lv_obj_t * spinbox_flex_grow;
71+
} layout;
72+
} tab;
73+
74+
struct {
75+
lv_obj_t * cont;
76+
lv_obj_t * add;
77+
lv_obj_t * remove;
78+
} btn;
79+
80+
} ctrl_pad;
81+
} view_t;
82+
83+
/**********************
84+
* GLOBAL PROTOTYPES
85+
**********************/
86+
87+
void view_create(lv_obj_t * par, view_t * ui);
88+
void view_ctrl_pad_create(lv_obj_t * par, view_t * ui);
89+
lv_obj_t * obj_child_node_create(lv_obj_t * par, view_t * ui);
90+
91+
void ctrl_pad_attach(view_t * ui);
92+
void ctrl_pad_obj_update(lv_obj_t * obj, view_t * ui);
93+
void flex_loader_obj_update(lv_obj_t * obj, view_t * ui);
94+
void flex_loader_attach(view_t * ui);
95+
96+
/**********************
97+
* MACROS
98+
**********************/
99+
100+
#ifdef __cplusplus
101+
} /*extern "C"*/
102+
#endif
103+
104+
#endif /*LV_DEMO_FLEX_LAYOUT_MAIN_H*/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* @file lv_demo_keypad_encoder.h
3+
*
4+
*/
5+
6+
#ifndef LV_DEMO_KEYPAD_ENCODER_H
7+
#define LV_DEMO_KEYPAD_ENCODER_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/*********************
14+
* INCLUDES
15+
*********************/
16+
#include "../lv_demos.h"
17+
18+
/*********************
19+
* DEFINES
20+
*********************/
21+
22+
/**********************
23+
* TYPEDEFS
24+
**********************/
25+
26+
/**********************
27+
* GLOBAL PROTOTYPES
28+
**********************/
29+
void lv_demo_keypad_encoder(void);
30+
31+
/**********************
32+
* MACROS
33+
**********************/
34+
35+
#ifdef __cplusplus
36+
} /* extern "C" */
37+
#endif
38+
39+
#endif /*LV_DEMO_KEYPAD_ENCODER_H*/
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/**
2+
* @file lv_demos.h
3+
*
4+
*/
5+
6+
#ifndef LV_DEMOS_H
7+
#define LV_DEMOS_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/*********************
14+
* INCLUDES
15+
*********************/
16+
#include "../lvgl.h"
17+
18+
#if LV_USE_DEMO_BENCHMARK
19+
#include "benchmark/lv_demo_benchmark.h"
20+
#endif
21+
22+
#if LV_USE_DEMO_KEYPAD_AND_ENCODER
23+
#include "keypad_encoder/lv_demo_keypad_encoder.h"
24+
#endif
25+
26+
#if LV_USE_DEMO_MUSIC
27+
#include "music/lv_demo_music.h"
28+
#endif
29+
30+
#if LV_USE_DEMO_STRESS
31+
#include "stress/lv_demo_stress.h"
32+
#endif
33+
34+
#if LV_USE_DEMO_WIDGETS
35+
#include "widgets/lv_demo_widgets.h"
36+
#endif
37+
38+
#if LV_USE_DEMO_FLEX_LAYOUT
39+
#include "flex_layout/lv_demo_flex_layout.h"
40+
#endif
41+
42+
#if LV_USE_DEMO_TRANSFORM
43+
#include "transform/lv_demo_transform.h"
44+
#endif
45+
46+
#if LV_USE_DEMO_SCROLL
47+
#include "scroll/lv_demo_scroll.h"
48+
#endif
49+
50+
#if LV_USE_DEMO_MULTILANG
51+
#include "multilang/lv_demo_multilang.h"
52+
#endif
53+
54+
#if LV_USE_DEMO_VECTOR_GRAPHIC && LV_USE_VECTOR_GRAPHIC
55+
#include "vector_graphic/lv_demo_vector_graphic.h"
56+
#endif
57+
58+
#if LV_USE_DEMO_RENDER
59+
#include "render/lv_demo_render.h"
60+
#endif
61+
62+
/*********************
63+
* DEFINES
64+
*********************/
65+
66+
/**********************
67+
* TYPEDEFS
68+
**********************/
69+
70+
/**********************
71+
* GLOBAL PROTOTYPES
72+
**********************/
73+
74+
/**
75+
* Call lv_demo_xxx.
76+
* @param info the information which contains demo name and parameters
77+
* needs by lv_demo_xxx.
78+
* @size size of information.
79+
*/
80+
bool lv_demos_create(char * info[], int size);
81+
82+
/**
83+
* Show help for lv_demos.
84+
*/
85+
void lv_demos_show_help(void);
86+
87+
/**********************
88+
* MACROS
89+
**********************/
90+
91+
#ifdef __cplusplus
92+
} /* extern "C" */
93+
#endif
94+
95+
#endif /*LV_DEMO_H*/

0 commit comments

Comments
 (0)