Skip to content

Commit c021cd3

Browse files
committed
把lvgl pycparser从子模块变为文件夹:
1 parent 2b8533e commit c021cd3

3,954 files changed

Lines changed: 1456565 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 3.12)
2+
project (lv_emscripten)
3+
4+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -s USE_SDL=2")
5+
6+
include_directories(${PROJECT_SOURCE_DIR})
7+
8+
add_subdirectory(lvgl)
9+
file(GLOB MY_SOURCES "./*.c")
10+
set(SOURCES ${MY_SOURCES})
11+
12+
add_executable(index ${SOURCES} ${INCLUDES})
13+
14+
if(NOT LVGL_CHOSEN_DEMO)
15+
set(LVGL_CHOSEN_DEMO lv_demo_widgets)
16+
endif()
17+
set_source_files_properties(main.c PROPERTIES COMPILE_FLAGS -DCHOSEN_DEMO=${LVGL_CHOSEN_DEMO})
18+
19+
set(CMAKE_EXECUTABLE_SUFFIX ".html")
20+
target_link_libraries(index
21+
lvgl
22+
lvgl_examples
23+
lvgl_demos
24+
lvgl_thorvg
25+
SDL2
26+
)
27+
set_target_properties(index PROPERTIES LINK_FLAGS "--shell-file ${PROJECT_SOURCE_DIR}/lvgl/.devcontainer/lvgl_shell.html -s SINGLE_FILE=1")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cd build
2+
emcmake cmake ..
3+
emmake make -j$(nproc)
4+
echo "Built succesfully, opening index.html"
5+
code index.html
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"includePath": [
6+
"${workspaceFolder}/**",
7+
"/usr/local/emsdk/upstream/emscripten/cache/sysroot/include/"
8+
],
9+
"defines": [],
10+
"compilerPath": "/usr/bin/clang",
11+
"cStandard": "c17",
12+
"cppStandard": "c++14",
13+
"intelliSenseMode": "linux-clang-x64"
14+
}
15+
],
16+
"version": 4
17+
}

lvgl/.devcontainer/__main.c__

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
2+
/**
3+
* @file main
4+
*
5+
*/
6+
7+
/*********************
8+
* INCLUDES
9+
*********************/
10+
#include <stdlib.h>
11+
#include <unistd.h>
12+
#define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/
13+
#include <SDL2/SDL.h>
14+
#include <emscripten.h>
15+
#include "lvgl/lvgl.h"
16+
#include "lvgl/demos/lv_demos.h"
17+
#include "lvgl/examples/lv_examples.h"
18+
19+
/*********************
20+
* DEFINES
21+
*********************/
22+
23+
/*On OSX SDL needs different handling*/
24+
#if defined(__APPLE__) && defined(TARGET_OS_MAC)
25+
# if __APPLE__ && TARGET_OS_MAC
26+
#define SDL_APPLE
27+
# endif
28+
#endif
29+
30+
/**********************
31+
* TYPEDEFS
32+
**********************/
33+
34+
/**********************
35+
* STATIC PROTOTYPES
36+
**********************/
37+
static void hal_init(void);
38+
static int tick_thread(void * data);
39+
static void memory_monitor(lv_timer_t * param);
40+
41+
/**********************
42+
* STATIC VARIABLES
43+
**********************/
44+
static lv_display_t * disp1;
45+
46+
int monitor_hor_res, monitor_ver_res;
47+
48+
/**********************
49+
* MACROS
50+
**********************/
51+
52+
/**********************
53+
* GLOBAL FUNCTIONS
54+
**********************/
55+
void do_loop(void *arg);
56+
57+
/* Allows disabling CHOSEN_DEMO */
58+
static void lv_example_noop(void) {
59+
}
60+
61+
int main(int argc, char ** argv)
62+
{
63+
64+
monitor_hor_res = 800;
65+
monitor_ver_res = 480;
66+
printf("Starting with screen resolution of %dx%d px\n", monitor_hor_res, monitor_ver_res);
67+
68+
/*Initialize LittlevGL*/
69+
lv_init();
70+
71+
/*Initialize the HAL (display, input devices, tick) for LittlevGL*/
72+
hal_init();
73+
74+
lv_demo_widgets();
75+
76+
emscripten_set_main_loop_arg(do_loop, NULL, -1, true);
77+
}
78+
79+
void do_loop(void *arg)
80+
{
81+
/* Periodically call the lv_timer handler.
82+
* It could be done in a timer interrupt or an OS task too.*/
83+
lv_timer_handler();
84+
}
85+
86+
/**********************
87+
* STATIC FUNCTIONS
88+
**********************/
89+
90+
91+
/**
92+
* Initialize the Hardware Abstraction Layer (HAL) for the Littlev graphics library
93+
*/
94+
static void hal_init(void)
95+
{
96+
lv_display_t * disp = lv_sdl_window_create(monitor_hor_res, monitor_ver_res);
97+
98+
lv_group_t * g = lv_group_create();
99+
lv_group_set_default(g);
100+
101+
lv_sdl_mouse_create();
102+
lv_indev_t * mousewheel = lv_sdl_mousewheel_create();
103+
lv_indev_set_group(mousewheel, lv_group_get_default());
104+
105+
lv_indev_t * keyboard = lv_sdl_keyboard_create();
106+
lv_indev_set_group(keyboard, lv_group_get_default());
107+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"sdl.h": "c"
4+
}
5+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/universal:2",
3+
"features": {
4+
"ghcr.io/ebaskoro/devcontainer-features/emscripten:1": {}
5+
},
6+
"postCreateCommand": "chmod +x /workspace/lvgl_app/lvgl/.devcontainer/setup.sh; /workspace/lvgl_app/lvgl/.devcontainer/setup.sh",
7+
"postStartCommand": ". /usr/local/emsdk/emsdk_env.sh;",
8+
9+
// Configure tool-specific properties.
10+
"customizations": {
11+
// Configure properties specific to VS Code.
12+
"vscode": {
13+
// Add the IDs of extensions you want installed when the container is created.
14+
"extensions": [
15+
//"searKing.preview-vscode"
16+
"analytic-signal.preview-html"
17+
]
18+
}
19+
},
20+
21+
"hostRequirements": {
22+
"cpus": 4
23+
},
24+
25+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/lvgl_app/lvgl,type=bind",
26+
"workspaceFolder": "/workspace/lvgl_app"
27+
28+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
LV_COLOR_DEPTH 32
2+
LV_MEM_SIZE (1024 * 1024)
3+
LV_DRAW_THREAD_STACK_SIZE (64 * 1024)
4+
LV_USE_MATRIX 1
5+
LV_USE_FLOAT 1
6+
LV_USE_LOTTIE 1
7+
8+
LV_USE_DRAW_SW_COMPLEX_GRADIENTS 1
9+
LV_OBJ_STYLE_CACHE 1
10+
LV_USE_LOG 1
11+
LV_LOG_PRINTF 1
12+
LV_USE_PERF_MONITOR 1
13+
LV_USE_SYSMON 1
14+
15+
LV_USE_ASSERT_MEM_INTEGRITY 1
16+
LV_USE_ASSERT_OBJ 1
17+
LV_USE_ASSERT_STYLE 1
18+
LV_FONT_MONTSERRAT_12 1
19+
LV_FONT_MONTSERRAT_14 1
20+
LV_FONT_MONTSERRAT_16 1
21+
LV_FONT_MONTSERRAT_18 1
22+
LV_FONT_MONTSERRAT_20 1
23+
LV_FONT_MONTSERRAT_22 1
24+
LV_FONT_MONTSERRAT_24 1
25+
LV_FONT_MONTSERRAT_26 1
26+
LV_FONT_MONTSERRAT_28 1
27+
LV_FONT_MONTSERRAT_30 1
28+
LV_FONT_MONTSERRAT_32 1
29+
LV_FONT_MONTSERRAT_34 1
30+
LV_FONT_MONTSERRAT_36 1
31+
LV_FONT_MONTSERRAT_38 1
32+
LV_FONT_MONTSERRAT_40 1
33+
LV_FONT_MONTSERRAT_42 1
34+
LV_FONT_MONTSERRAT_44 1
35+
LV_FONT_MONTSERRAT_46 1
36+
LV_FONT_MONTSERRAT_48 1
37+
LV_FONT_MONTSERRAT_28_COMPRESSED 1
38+
LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1
39+
LV_FONT_SIMSUN_16_CJK 1
40+
LV_FONT_UNSCII_8 1
41+
42+
LV_USE_IMGFONT 1
43+
LV_USE_FS_STDIO 1
44+
LV_FS_STDIO_LETTER 'A'
45+
LV_USE_FS_MEMFS 1
46+
LV_FS_MEMFS_LETTER 'M'
47+
LV_USE_THORVG_INTERNAL 1
48+
LV_USE_LZ4_INTERNAL 1
49+
LV_USE_VECTOR_GRAPHIC 1
50+
LV_USE_TINY_TTF 1
51+
LV_USE_BARCODE 1
52+
LV_USE_QRCODE 1
53+
LV_USE_RLE 1
54+
LV_BIN_DECODER_RAM_LOAD 1
55+
LV_USE_TJPGD 1
56+
LV_USE_BMP 1
57+
LV_USE_LODEPNG 1
58+
LV_USE_SDL 1
59+
60+
LV_USE_DEMO_WIDGETS 1
61+
LV_USE_DEMO_KEYPAD_AND_ENCODER 1
62+
LV_USE_DEMO_BENCHMARK 1
63+
LV_USE_DEMO_RENDER 1
64+
LV_USE_DEMO_STRESS 1
65+
LV_USE_DEMO_MUSIC 1
66+
LV_USE_DEMO_FLEX_LAYOUT 1
67+
LV_USE_DEMO_MULTILANG 1
68+
LV_USE_DEMO_TRANSFORM 1
69+
LV_USE_DEMO_SCROLL 1
70+

lvgl/.devcontainer/lvgl_shell.html

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<html>
2+
<head>
3+
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'/>
4+
<style type="text/css">
5+
html, body {
6+
margin: 0;
7+
8+
width: 100%;
9+
height: 100%;
10+
min-width: 100%;
11+
min-height: 100%;
12+
}
13+
14+
body {
15+
display: flex;
16+
flex-direction: column;
17+
align-items: center;
18+
justify-content: center;
19+
}
20+
21+
.git-commit-info {
22+
font-family: Consolas, 'Courier New', Courier, monospace;
23+
background-color: #f1f1f1;
24+
padding: 2px;
25+
text-align: left;
26+
}
27+
#git-hash {
28+
text-align: center;
29+
}
30+
#output {
31+
margin: 0;
32+
padding: 0;
33+
}
34+
</style>
35+
</head>
36+
<body>
37+
<div id="git-hash"></div>
38+
<p id="output">
39+
<canvas id="canvas"></canvas>
40+
</p>
41+
<script src="gitrev.js"></script>
42+
<script>
43+
var siteURL = new URL(window.location.href);
44+
var w = siteURL.searchParams.get("w") || "800";
45+
var h = siteURL.searchParams.get("h") || "480";
46+
var canvas = document.getElementById('canvas');
47+
canvas.setAttribute("width", w);
48+
canvas.setAttribute("height", h);
49+
console.log("Requested " + w + "x" + h + " px");
50+
var Module = {
51+
print: function(text) {
52+
console.log(text);
53+
},
54+
printErr: function(text) {
55+
console.error(text);
56+
},
57+
canvas: (function() {
58+
return canvas;
59+
})(),
60+
arguments: [ siteURL.searchParams.get("w") || "800", siteURL.searchParams.get("h") || "480", siteURL.searchParams.get("example") ?? "default" ]
61+
};
62+
if(typeof window.git_hash != 'undefined') {
63+
var gitHashDiv = document.querySelector("#git-hash");
64+
var gitLink = document.createElement("div");
65+
var gitHashComponents = window.git_hash.split(" ").filter(component => component.trim().length > 0);
66+
for(var i = 0; i < gitHashComponents.length; i++) {
67+
console.log(gitHashComponents[i], gitHashComponents[i].length);
68+
/* This is an extremely lazy way of checking for a Git hash, but it works */
69+
if(gitHashComponents[i].length == 40) {
70+
gitHashComponents[i] = `<a href="https://github.com/lvgl/${gitHashComponents[i+1]}/commit/${gitHashComponents[i]}">${gitHashComponents[i]}</a>`;
71+
} else {
72+
/* Repository name */
73+
gitHashComponents[i] += "<br/>";
74+
}
75+
}
76+
gitLink.classList.add("git-commit-info");
77+
gitLink.innerHTML = gitHashComponents.join(" ");
78+
gitHashDiv.textContent = "LVGL compiled to Emscripten. Git commit information:";
79+
gitHashDiv.appendChild(gitLink);
80+
}
81+
window.addEventListener("click", () => window.focus());
82+
</script>
83+
{{{ SCRIPT }}}
84+
</body>
85+
</html>

lvgl/.devcontainer/setup.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
echo ". /usr/local/emsdk/emsdk_env.sh" >> /home/codespace/.bashrc
4+
5+
cd /workspace/lvgl_app
6+
sudo chmod 777 .
7+
mkdir build
8+
mkdir vscode
9+
10+
cd lvgl/.devcontainer
11+
cp __CMakeLists.txt__ ../../CMakeLists.txt
12+
cp __main.c__ ../../main.c
13+
cp __build_all.sh__ ../../build_all.sh
14+
cp __c_cpp_properties.json__ ../../.vscode/c_cpp_properties.json
15+
cp __settings.json__ ../../.vscode/settings.json
16+
touch ../../lv_conf.h
17+
../scripts/generate_lv_conf.py --template ../lv_conf_template.h --config ../../lv_conf.h
18+
19+
chmod +x ../../build_all.sh

lvgl/.github/.codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
codecov:
2+
notify:
3+
require_ci_to_pass: true
4+
comment: off
5+
coverage:
6+
status:
7+
patch: off
8+
project: off

0 commit comments

Comments
 (0)