Skip to content

Commit 876cbce

Browse files
authored
Merge pull request #64 from arduino-libraries/precompiled-lib
Precompiling `lvgl` drastically reduces library compile time.
2 parents b5a7a07 + 83fecc2 commit 876cbce

File tree

154 files changed

+26466
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+26466
-4
lines changed

.github/workflows/compile-examples.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
libraries: |
5151
# Install the library from the local path.
5252
- source-path: ./
53-
- name: lvgl
5453
# Additional library dependencies can be listed here.
5554
# See: https://github.com/arduino/compile-sketches#libraries
5655
sketch-paths: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extras/build

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ This library allows you to control and interact with the 6 DOF Braccio++ robot a
1515
* [Help Center](https://support.arduino.cc/)
1616
* [Forum](https://forum.arduino.cc)
1717

18+
### How-to-update precompiled `liblvgl`
19+
```bash
20+
git clone https://github.com/lvgl/lvgl
21+
git clone https://github.com/arduino-libraries/Arduino_Braccio_plusplus
22+
cd Arduino_Braccio_plusplus/extras
23+
mkdir build && cd build
24+
cmake -DCMAKE_BUILD_TYPE=Release ..
25+
make -j8
26+
```
27+
1828
## :bug: Bugs & Issues
1929

2030
If you want to report an issue with this library, you can submit it to the [issue tracker](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/issues) of this repository. Remember to include as much detail as you can about your hardware set-up, code and steps for reproducing the issue. Make sure you're using an original Arduino board.

extras/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
##########################################################################
2+
cmake_minimum_required(VERSION 3.16)
3+
##########################################################################
4+
project(lvgl)
5+
##########################################################################
6+
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
7+
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
8+
##########################################################################
9+
add_library(${PROJECT_NAME} STATIC "")
10+
##########################################################################
11+
set(LVGL_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../lvgl)
12+
set(LV_CONF_DIR ${CMAKE_SOURCE_DIR}/../src)
13+
##########################################################################
14+
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LV_CONF_DIR})
15+
##########################################################################
16+
file(GLOB_RECURSE LVGL_SOURCES ${LVGL_ROOT_DIR}/src/*.c)
17+
target_sources(${PROJECT_NAME} PUBLIC ${LVGL_SOURCES})
18+
##########################################################################
19+
target_compile_options(${PROJECT_NAME} PRIVATE -mcpu=cortex-m0plus -fPIC)
20+
##########################################################################
21+
file(WRITE ${CMAKE_BINARY_DIR}/cp-lvgl-hdr.cmake
22+
"file(COPY ${LVGL_ROOT_DIR}/src DESTINATION ../../src/lib/lvgl FILES_MATCHING PATTERN *.h)\n"
23+
)
24+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND cp ${CMAKE_BINARY_DIR}/liblvgl.a ../../src/cortex-m0plus/liblvgl.a COMMENT "Copying libvgl.a")
25+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND cp ${LVGL_ROOT_DIR}/lvgl.h ../../src/lib/lvgl COMMENT "Copying lvgl.h")
26+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cp-lvgl-hdr.cmake COMMENT "Copying lvgl/src/*.h")
27+
##########################################################################

library.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ paragraph=This library allows you to control the Arduino Braccio++ 6-DOF 2nd gen
77
category=Communication
88
url=https://github.com/arduino-libraries/Arduino_Braccio_plusplus
99
architectures=mbed,mbed_nano
10+
precompiled=true
11+
ldflags=-llvgl
1012
includes=Braccio++.h
11-
depends=lvgl

src/Braccio++.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "drivers/Ticker.h"
3434

3535
#include "lib/TFT_eSPI/TFT_eSPI.h" // Hardware-specific library
36-
#include <lvgl.h>
36+
#include "lib/lvgl/lvgl.h"
3737

3838
#include <chrono>
3939
using namespace std::chrono;

src/cortex-m0plus/liblvgl.a

831 KB
Binary file not shown.

src/gif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* USA.
1919
*/
2020

21-
#include <lvgl.h>
21+
#include "lib/lvgl/lvgl.h"
2222

2323
#ifndef LV_ATTRIBUTE_MEM_ALIGN
2424
#define LV_ATTRIBUTE_MEM_ALIGN

src/lib/lvgl/lvgl.h

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/**
2+
* @file lvgl.h
3+
* Include all LVGL related headers
4+
*/
5+
6+
#ifndef LVGL_H
7+
#define LVGL_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/***************************
14+
* CURRENT VERSION OF LVGL
15+
***************************/
16+
#define LVGL_VERSION_MAJOR 8
17+
#define LVGL_VERSION_MINOR 3
18+
#define LVGL_VERSION_PATCH 0
19+
#define LVGL_VERSION_INFO "dev"
20+
21+
/*********************
22+
* INCLUDES
23+
*********************/
24+
25+
#include "src/misc/lv_log.h"
26+
#include "src/misc/lv_timer.h"
27+
#include "src/misc/lv_math.h"
28+
#include "src/misc/lv_mem.h"
29+
#include "src/misc/lv_async.h"
30+
#include "src/misc/lv_anim_timeline.h"
31+
#include "src/misc/lv_printf.h"
32+
33+
#include "src/hal/lv_hal.h"
34+
35+
#include "src/core/lv_obj.h"
36+
#include "src/core/lv_group.h"
37+
#include "src/core/lv_indev.h"
38+
#include "src/core/lv_refr.h"
39+
#include "src/core/lv_disp.h"
40+
#include "src/core/lv_theme.h"
41+
42+
#include "src/font/lv_font.h"
43+
#include "src/font/lv_font_loader.h"
44+
#include "src/font/lv_font_fmt_txt.h"
45+
46+
#include "src/widgets/lv_arc.h"
47+
#include "src/widgets/lv_btn.h"
48+
#include "src/widgets/lv_img.h"
49+
#include "src/widgets/lv_label.h"
50+
#include "src/widgets/lv_line.h"
51+
#include "src/widgets/lv_table.h"
52+
#include "src/widgets/lv_checkbox.h"
53+
#include "src/widgets/lv_bar.h"
54+
#include "src/widgets/lv_slider.h"
55+
#include "src/widgets/lv_btnmatrix.h"
56+
#include "src/widgets/lv_dropdown.h"
57+
#include "src/widgets/lv_roller.h"
58+
#include "src/widgets/lv_textarea.h"
59+
#include "src/widgets/lv_canvas.h"
60+
#include "src/widgets/lv_switch.h"
61+
62+
#include "src/draw/lv_draw.h"
63+
64+
#include "src/lv_api_map.h"
65+
66+
/*-----------------
67+
* EXTRAS
68+
*----------------*/
69+
#include "src/extra/lv_extra.h"
70+
71+
/*********************
72+
* DEFINES
73+
*********************/
74+
75+
/**********************
76+
* TYPEDEFS
77+
**********************/
78+
79+
/**********************
80+
* GLOBAL PROTOTYPES
81+
**********************/
82+
83+
/**********************
84+
* MACROS
85+
**********************/
86+
87+
/** Gives 1 if the x.y.z version is supported in the current version
88+
* Usage:
89+
*
90+
* - Require v6
91+
* #if LV_VERSION_CHECK(6,0,0)
92+
* new_func_in_v6();
93+
* #endif
94+
*
95+
*
96+
* - Require at least v5.3
97+
* #if LV_VERSION_CHECK(5,3,0)
98+
* new_feature_from_v5_3();
99+
* #endif
100+
*
101+
*
102+
* - Require v5.3.2 bugfixes
103+
* #if LV_VERSION_CHECK(5,3,2)
104+
* bugfix_in_v5_3_2();
105+
* #endif
106+
*
107+
*/
108+
#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH)))
109+
110+
/**
111+
* Wrapper functions for VERSION macros
112+
*/
113+
114+
static inline int lv_version_major(void)
115+
{
116+
return LVGL_VERSION_MAJOR;
117+
}
118+
119+
static inline int lv_version_minor(void)
120+
{
121+
return LVGL_VERSION_MINOR;
122+
}
123+
124+
static inline int lv_version_patch(void)
125+
{
126+
return LVGL_VERSION_PATCH;
127+
}
128+
129+
static inline const char *lv_version_info(void)
130+
{
131+
return LVGL_VERSION_INFO;
132+
}
133+
134+
#ifdef __cplusplus
135+
} /*extern "C"*/
136+
#endif
137+
138+
#endif /*LVGL_H*/

0 commit comments

Comments
 (0)