mirror of
https://github.com/lvgl/lvgl.git
synced 2026-03-24 07:18:34 +08:00
feat(build): make it work with MSVC build (#4704)
Signed-off-by: YanXiaowei <yanxiaowei@xiaomi.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: bjsylvia <bjsylvia@163.com> Co-authored-by: YanXiaowei <yanxiaowei@xiaomi.com> Co-authored-by: Niklas Fiekas <niklas.fiekas@backscattering.de> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lhdjply <1029652979@qq.com>
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
96ce505651
commit
361663ee5f
@@ -1,5 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.4)
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
if(NOT ESP_PLATFORM)
|
||||
project(lvgl HOMEPAGE_URL https://github.com/lvgl/lvgl)
|
||||
endif()
|
||||
@@ -15,3 +17,11 @@ elseif(MICROPY_DIR)
|
||||
else()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/env_support/cmake/custom.cmake)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(lvgl PUBLIC LV_ATTRIBUTE_EXTERN_DATA=__declspec\(dllimport\))
|
||||
else()
|
||||
target_compile_definitions(lvgl PUBLIC LV_ATTRIBUTE_EXTERN_DATA=__declspec\(dllexport\))
|
||||
endif()
|
||||
endif()
|
||||
@@ -11,11 +11,10 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <io.h>
|
||||
#else
|
||||
#elif __linux__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "lv_demos.h"
|
||||
|
||||
/*********************
|
||||
|
||||
@@ -317,6 +317,9 @@
|
||||
*should also appear on LVGL binding API such as Micropython.*/
|
||||
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
|
||||
|
||||
/*Prefix all global extern data with this*/
|
||||
#define LV_ATTRIBUTE_EXTERN_DATA
|
||||
|
||||
/* Use `float` as `lv_value_precise_t` */
|
||||
#define LV_USE_FLOAT 0
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ enum {
|
||||
/**
|
||||
* Make the base object's class publicly available.
|
||||
*/
|
||||
extern const lv_obj_class_t lv_obj_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_obj_class;
|
||||
|
||||
/**
|
||||
* Special, rarely used attributes.
|
||||
|
||||
@@ -877,6 +877,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Prefix all global extern data with this*/
|
||||
#ifndef LV_ATTRIBUTE_EXTERN_DATA
|
||||
#ifdef CONFIG_LV_ATTRIBUTE_EXTERN_DATA
|
||||
#define LV_ATTRIBUTE_EXTERN_DATA CONFIG_LV_ATTRIBUTE_EXTERN_DATA
|
||||
#else
|
||||
#define LV_ATTRIBUTE_EXTERN_DATA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Use `float` as `lv_value_precise_t` */
|
||||
#ifndef LV_USE_FLOAT
|
||||
#ifdef CONFIG_LV_USE_FLOAT
|
||||
|
||||
@@ -30,7 +30,7 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
extern const lv_obj_class_t lv_animimg_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_animimg_class;
|
||||
|
||||
/*Data of image*/
|
||||
typedef struct {
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct {
|
||||
int16_t knob_offset; /*knob offset from the main arc*/
|
||||
} lv_arc_t;
|
||||
|
||||
extern const lv_obj_class_t lv_arc_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef struct {
|
||||
lv_bar_mode_t mode : 2; /**< Type of bar*/
|
||||
} lv_bar_t;
|
||||
|
||||
extern const lv_obj_class_t lv_bar_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_bar_class;
|
||||
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef struct {
|
||||
lv_obj_t obj;
|
||||
} lv_button_t;
|
||||
|
||||
extern const lv_obj_class_t lv_button_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_button_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -69,7 +69,7 @@ typedef struct {
|
||||
uint32_t one_check : 1; /*Single button toggled at once*/
|
||||
} lv_buttonmatrix_t;
|
||||
|
||||
extern const lv_obj_class_t lv_buttonmatrix_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_buttonmatrix_class;
|
||||
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct {
|
||||
char nums [7 * 6][4];
|
||||
} lv_calendar_t;
|
||||
|
||||
extern const lv_obj_class_t lv_calendar_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -23,7 +23,7 @@ extern "C" {
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
extern const lv_obj_class_t lv_calendar_header_arrow_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_arrow_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -23,7 +23,7 @@ extern "C" {
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
extern const lv_obj_class_t lv_calendar_header_dropdown_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_dropdown_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
extern const lv_obj_class_t lv_canvas_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_canvas_class;
|
||||
|
||||
/*Data of canvas*/
|
||||
typedef struct {
|
||||
|
||||
@@ -120,7 +120,7 @@ typedef struct {
|
||||
lv_chart_update_mode_t update_mode : 1;
|
||||
} lv_chart_t;
|
||||
|
||||
extern const lv_obj_class_t lv_chart_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_chart_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct {
|
||||
uint32_t static_txt : 1;
|
||||
} lv_checkbox_t;
|
||||
|
||||
extern const lv_obj_class_t lv_checkbox_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_checkbox_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -53,7 +53,7 @@ typedef struct {
|
||||
uint8_t obj_size_mode: 2; /*Image size mode when image size and object size is different.*/
|
||||
} lv_image_t;
|
||||
|
||||
extern const lv_obj_class_t lv_image_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_image_class;
|
||||
|
||||
/**
|
||||
* Image size mode, when image size and object size is different
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef struct {
|
||||
lv_imgbtn_src_info_t src_right[_LV_IMGBTN_STATE_NUM]; /*Store right side images to each state*/
|
||||
} lv_imgbtn_t;
|
||||
|
||||
extern const lv_obj_class_t lv_imgbtn_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_imgbtn_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef struct {
|
||||
uint8_t popovers : 1; /*Show button titles in popovers on press*/
|
||||
} lv_keyboard_t;
|
||||
|
||||
extern const lv_obj_class_t lv_keyboard_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_keyboard_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct {
|
||||
uint8_t invalid_size_cache : 1; /*1: Recalculate size and update cache*/
|
||||
} lv_label_t;
|
||||
|
||||
extern const lv_obj_class_t lv_label_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_label_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -41,7 +41,7 @@ typedef struct {
|
||||
uint8_t bright; /**< Current brightness of the LED (0..255)*/
|
||||
} lv_led_t;
|
||||
|
||||
extern const lv_obj_class_t lv_led_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_led_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct {
|
||||
uint32_t y_inv : 1; /**< 1: y == 0 will be on the bottom*/
|
||||
} lv_line_t;
|
||||
|
||||
extern const lv_obj_class_t lv_line_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_line_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -25,9 +25,9 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
extern const lv_obj_class_t lv_list_class;
|
||||
extern const lv_obj_class_t lv_list_text_class;
|
||||
extern const lv_obj_class_t lv_list_button_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_text_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_button_class;
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
@@ -93,15 +93,15 @@ typedef struct {
|
||||
bool static_title;
|
||||
} lv_menu_page_t;
|
||||
|
||||
extern const lv_obj_class_t lv_menu_class;
|
||||
extern const lv_obj_class_t lv_menu_page_class;
|
||||
extern const lv_obj_class_t lv_menu_cont_class;
|
||||
extern const lv_obj_class_t lv_menu_section_class;
|
||||
extern const lv_obj_class_t lv_menu_separator_class;
|
||||
extern const lv_obj_class_t lv_menu_sidebar_cont_class;
|
||||
extern const lv_obj_class_t lv_menu_main_cont_class;
|
||||
extern const lv_obj_class_t lv_menu_sidebar_header_cont_class;
|
||||
extern const lv_obj_class_t lv_menu_main_header_cont_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_page_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_cont_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_section_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_separator_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_cont_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_cont_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_header_cont_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_header_cont_class;
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
@@ -43,9 +43,9 @@ typedef struct {
|
||||
lv_obj_t * buttons;
|
||||
} lv_msgbox_t;
|
||||
|
||||
extern const lv_obj_class_t lv_msgbox_class;
|
||||
extern const lv_obj_class_t lv_msgbox_content_class;
|
||||
extern const lv_obj_class_t lv_msgbox_backdrop_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_content_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_backdrop_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef struct {
|
||||
/*New data for this type*/
|
||||
} lv_templ_t;
|
||||
|
||||
extern const lv_obj_class_t lv_templ_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_templ_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef struct {
|
||||
uint32_t moved : 1;
|
||||
} lv_roller_t;
|
||||
|
||||
extern const lv_obj_class_t lv_roller_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_roller_class;
|
||||
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -90,7 +90,7 @@ typedef struct {
|
||||
int32_t rotation;
|
||||
} lv_scale_t;
|
||||
|
||||
extern const lv_obj_class_t lv_scale_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_scale_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -53,7 +53,7 @@ typedef struct {
|
||||
uint8_t left_knob_focus : 1; /*1: with encoder now the right knob can be adjusted*/
|
||||
} lv_slider_t;
|
||||
|
||||
extern const lv_obj_class_t lv_slider_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_slider_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -73,7 +73,7 @@ typedef struct {
|
||||
uint32_t refresh : 1; /* the spangroup need refresh cache_w and cache_h */
|
||||
} lv_spangroup_t;
|
||||
|
||||
extern const lv_obj_class_t lv_spangroup_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spangroup_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef struct {
|
||||
uint32_t digit_step_dir : 2; /* the direction the digit will step on encoder button press when editing*/
|
||||
} lv_spinbox_t;
|
||||
|
||||
extern const lv_obj_class_t lv_spinbox_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinbox_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
extern const lv_obj_class_t lv_spinner_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinner_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef struct {
|
||||
int32_t anim_state;
|
||||
} lv_switch_t;
|
||||
|
||||
extern const lv_obj_class_t lv_switch_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_switch_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef struct {
|
||||
uint32_t row_act;
|
||||
} lv_table_t;
|
||||
|
||||
extern const lv_obj_class_t lv_table_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_table_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef struct {
|
||||
lv_dir_t tab_pos;
|
||||
} lv_tabview_t;
|
||||
|
||||
extern const lv_obj_class_t lv_tabview_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tabview_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -63,7 +63,7 @@ typedef struct {
|
||||
uint8_t one_line : 1; /*One line mode (ignore line breaks)*/
|
||||
} lv_textarea_t;
|
||||
|
||||
extern const lv_obj_class_t lv_textarea_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_textarea_class;
|
||||
|
||||
enum {
|
||||
LV_PART_TEXTAREA_PLACEHOLDER = LV_PART_CUSTOM_FIRST,
|
||||
|
||||
@@ -34,8 +34,8 @@ typedef struct {
|
||||
lv_dir_t dir;
|
||||
} lv_tileview_tile_t;
|
||||
|
||||
extern const lv_obj_class_t lv_tileview_class;
|
||||
extern const lv_obj_class_t lv_tileview_tile_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_tile_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef struct {
|
||||
lv_obj_t obj;
|
||||
} lv_win_t;
|
||||
|
||||
extern const lv_obj_class_t lv_win_class;
|
||||
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_win_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
Reference in New Issue
Block a user