From b2b7e09718aafeeeb370c2cb9aa0445688c85161 Mon Sep 17 00:00:00 2001 From: notinaboat <73502641+notinaboat@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:02:40 +1100 Subject: [PATCH 1/4] New: LVGL - Light and Versatile Graphics Library build_tarballs.jl LVGL - Light and Versatile Graphics Library https://github.com/lvgl/lvgl --- L/LVGL_SDL/build_tarballs.jl | 106 +++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 L/LVGL_SDL/build_tarballs.jl diff --git a/L/LVGL_SDL/build_tarballs.jl b/L/LVGL_SDL/build_tarballs.jl new file mode 100644 index 00000000000..e95888dbc23 --- /dev/null +++ b/L/LVGL_SDL/build_tarballs.jl @@ -0,0 +1,106 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message. +using BinaryBuilder, Pkg + +name = "LVGL_SDL" +version = v"9.2.0" + +# Collection of sources required to complete build +sources = [ + GitSource("https://github.com/lvgl/lv_port_pc_eclipse.git", "ba45efb68b125aa93237e7c75c51d4cd65fc10cf") +] + +# Bash recipe for building across all platforms +script = raw""" +cd $WORKSPACE/srcdir +cd lv_port_pc_eclipse/ +git submodule update --init --recursive +cd lvgl/ +patch -p1 << "EOF" +diff --git a/env_support/cmake/custom.cmake b/env_support/cmake/custom.cmake +index e4cd36376..0e1d4b9d0 100644 +--- a/env_support/cmake/custom.cmake ++++ b/env_support/cmake/custom.cmake +@@ -26,6 +26,7 @@ file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp ${LVGL_R + # Build LVGL library + add_library(lvgl ${SOURCES}) + add_library(lvgl::lvgl ALIAS lvgl) ++target_link_libraries(lvgl lvgl_thorvg ${SDL2_LIBRARIES}) + + target_compile_definitions( + lvgl PUBLIC $<$:LV_LVGL_H_INCLUDE_SIMPLE> +@@ -49,7 +50,7 @@ if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL) + add_library(lvgl_thorvg ${THORVG_SOURCES}) + add_library(lvgl::thorvg ALIAS lvgl_thorvg) + target_include_directories(lvgl_thorvg SYSTEM PUBLIC ${LVGL_ROOT_DIR}/src/libs/thorvg) +- target_link_libraries(lvgl_thorvg PUBLIC lvgl) ++ # target_link_libraries(lvgl_thorvg PUBLIC lvgl) + endif() + + if(NOT (CMAKE_C_COMPILER_ID STREQUAL "MSVC")) +EOF + +patch -p1 << "EOF" +diff --git a/src/drivers/sdl/lv_sdl_window.c b/src/drivers/sdl/lv_sdl_window.c +index df8a28e4e..40c5c0bcd 100644 +--- a/src/drivers/sdl/lv_sdl_window.c ++++ b/src/drivers/sdl/lv_sdl_window.c +@@ -438,7 +438,12 @@ static void * sdl_draw_buf_realloc_aligned(void * ptr, size_t new_size) + /* Size must be multiple of align, See: https://en.cppreference.com/w/c/memory/aligned_alloc */ + + #define BUF_ALIGN (LV_DRAW_BUF_ALIGN < sizeof(void *) ? sizeof(void *) : LV_DRAW_BUF_ALIGN) +- return aligned_alloc(BUF_ALIGN, LV_ALIGN_UP(new_size, BUF_ALIGN)); ++ void* result; ++ if (posix_memalign(&result, BUF_ALIGN, LV_ALIGN_UP(new_size, BUF_ALIGN)) == 0) ++ { ++ return result; ++ } ++ return NULL; + #else + return _aligned_malloc(LV_ALIGN_UP(new_size, LV_DRAW_BUF_ALIGN), LV_DRAW_BUF_ALIGN); + #endif /* _WIN32 */ +EOF + +cd .. +patch -p1 << "EOF" +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 78eaf02..1753f9f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,8 @@ + cmake_minimum_required(VERSION 3.10) + project(lvgl) + ++option(BUILD_SHARED_LIBS "Build shared libraries" ON) ++ + option(LV_USE_DRAW_SDL "Use SDL draw unit" OFF) + option(LV_USE_LIBPNG "Use libpng to decode PNG" OFF) + option(LV_USE_LIBJPEG_TURBO "Use libjpeg turbo to decode JPEG" OFF) +EOF + +cmake -B build -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release +cmake --build build --parallel ${nproc} +cmake --install build +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = [ + Platform("x86_64", "macos"; ), + Platform("aarch64", "linux"; libc="glibc") +] + + +# The products that we will ensure are always built +products = [ + LibraryProduct("liblvgl", :liblvgl), + LibraryProduct("liblvgl_thorvg", :liblvgl_thorvg) +] + +# Dependencies that must be installed before this package can be built +dependencies = [ + Dependency(PackageSpec(name="SDL2_jll", uuid="ab825dc5-c88e-5901-9575-1e5e20358fcf")) +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"13.2.0") From 18a0518f5b1e1de1a78f522992bbfc3c4d4b313a Mon Sep 17 00:00:00 2001 From: notinaboat <73502641+notinaboat@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:43:18 +1100 Subject: [PATCH 2/4] Create alloc_aligned.patch --- .../x86_64-apple-darwin14/alloc_aligned.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 L/LVGL_SDL/bundled/patches/x86_64-apple-darwin14/alloc_aligned.patch diff --git a/L/LVGL_SDL/bundled/patches/x86_64-apple-darwin14/alloc_aligned.patch b/L/LVGL_SDL/bundled/patches/x86_64-apple-darwin14/alloc_aligned.patch new file mode 100644 index 00000000000..4101e08d9d3 --- /dev/null +++ b/L/LVGL_SDL/bundled/patches/x86_64-apple-darwin14/alloc_aligned.patch @@ -0,0 +1,17 @@ +diff --git a/src/drivers/sdl/lv_sdl_window.c b/src/drivers/sdl/lv_sdl_window.c +index 9a89271c5..4fdf52760 100644 +--- a/src/drivers/sdl/lv_sdl_window.c ++++ b/src/drivers/sdl/lv_sdl_window.c +@@ -410,7 +410,11 @@ static void * sdl_draw_buf_realloc_aligned(void * ptr, size_t new_size) + /* Size must be multiple of align, See: https://en.cppreference.com/w/c/memory/aligned_alloc */ + + #define BUF_ALIGN (LV_DRAW_BUF_ALIGN < sizeof(void *) ? sizeof(void *) : LV_DRAW_BUF_ALIGN) +- return aligned_alloc(BUF_ALIGN, LV_ALIGN_UP(new_size, BUF_ALIGN)); ++ // MacOS SDK version 14 does not support aligned_malloc() ++ ptr = NULL; ++ posix_memalign(&ptr, BUF_ALIGN, LV_ALIGN_UP(new_size, BUF_ALIGN)); ++ return ptr; ++ + #else + return _aligned_malloc(LV_ALIGN_UP(new_size, LV_DRAW_BUF_ALIGN), LV_DRAW_BUF_ALIGN); + #endif /* _WIN32 */ From 06aab01bd15fdc85124af4354e9561c66d2427b2 Mon Sep 17 00:00:00 2001 From: notinaboat <73502641+notinaboat@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:43:55 +1100 Subject: [PATCH 3/4] lvgl_sdl.patch --- L/LVGL_SDL/bundled/patches/lvgl_sdl.patch | 327 ++++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 L/LVGL_SDL/bundled/patches/lvgl_sdl.patch diff --git a/L/LVGL_SDL/bundled/patches/lvgl_sdl.patch b/L/LVGL_SDL/bundled/patches/lvgl_sdl.patch new file mode 100644 index 00000000000..234c76801d8 --- /dev/null +++ b/L/LVGL_SDL/bundled/patches/lvgl_sdl.patch @@ -0,0 +1,327 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8751ddc07..51337276a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,10 @@ + cmake_minimum_required(VERSION 3.12.4) + ++set(CMAKE_C_STANDARD 99) ++set(CMAKE_CXX_STANDARD 17) ++set(CMAKE_CXX_STANDARD_REQUIRED ON) ++ ++ + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + + if(NOT ESP_PLATFORM) +@@ -22,6 +27,10 @@ else() + include(${CMAKE_CURRENT_LIST_DIR}/env_support/cmake/custom.cmake) + endif() + ++find_package(SDL2 REQUIRED SDL2) ++target_include_directories(lvgl PUBLIC ${SDL2_INCLUDE_DIRS}) ++target_link_libraries(lvgl lvgl::thorvg ${SDL2_LIBRARIES}) ++ + #[[ + unfortunately CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS does not work for global data. + for global data we still need decl specs. +@@ -37,4 +46,4 @@ if (MSVC) + INTERFACE LV_ATTRIBUTE_EXTERN_DATA=__declspec\(dllimport\) + PRIVATE LV_ATTRIBUTE_EXTERN_DATA=__declspec\(dllexport\) + ) +-endif() +\ No newline at end of file ++endif() +diff --git a/env_support/cmake/custom.cmake b/env_support/cmake/custom.cmake +index e4cd36376..eaf808d93 100644 +--- a/env_support/cmake/custom.cmake ++++ b/env_support/cmake/custom.cmake +@@ -49,7 +49,7 @@ if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL) + add_library(lvgl_thorvg ${THORVG_SOURCES}) + add_library(lvgl::thorvg ALIAS lvgl_thorvg) + target_include_directories(lvgl_thorvg SYSTEM PUBLIC ${LVGL_ROOT_DIR}/src/libs/thorvg) +- target_link_libraries(lvgl_thorvg PUBLIC lvgl) ++ # Circular dependency! target_link_libraries(lvgl_thorvg PUBLIC lvgl) + endif() + + if(NOT (CMAKE_C_COMPILER_ID STREQUAL "MSVC")) +diff --git a/lv_conf_template.h b/lv_conf_template.h +index 1ff84cb75..ed4209ee1 100644 +--- a/lv_conf_template.h ++++ b/lv_conf_template.h +@@ -12,7 +12,7 @@ + */ + + /* clang-format off */ +-#if 0 /* Set this to "1" to enable content */ ++#if 1 /* Set this to "1" to enable content */ + + #ifndef LV_CONF_H + #define LV_CONF_H +@@ -27,7 +27,7 @@ + *====================*/ + + /** Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888) */ +-#define LV_COLOR_DEPTH 16 ++#define LV_COLOR_DEPTH 32 + + /*========================= + STDLIB WRAPPER SETTINGS +@@ -69,7 +69,7 @@ + + #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN + /** Size of memory available for `lv_malloc()` in bytes (>= 2kB) */ +- #define LV_MEM_SIZE (64 * 1024U) /**< [bytes] */ ++ #define LV_MEM_SIZE (1204 * 1024U) /**< [bytes] */ + + /** Size of the memory expand for `lv_malloc()` in bytes */ + #define LV_MEM_POOL_EXPAND_SIZE 0 +@@ -379,7 +379,7 @@ + #define LV_COLOR_MIX_ROUND_OFS 0 + + /** Add 2 x 32-bit variables to each `lv_obj_t` to speed up getting style properties */ +-#define LV_OBJ_STYLE_CACHE 0 ++#define LV_OBJ_STYLE_CACHE 1 + + /** Add `id` field to `lv_obj_t` */ + #define LV_USE_OBJ_ID 0 +@@ -466,11 +466,11 @@ + #define LV_ATTRIBUTE_EXTERN_DATA + + /** Use `float` as `lv_value_precise_t` */ +-#define LV_USE_FLOAT 0 ++#define LV_USE_FLOAT 1 + + /** Enable matrix support + * - Requires `LV_USE_FLOAT = 1` */ +-#define LV_USE_MATRIX 0 ++#define LV_USE_MATRIX 1 + + /** Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default */ + #define LV_USE_PRIVATE_API 0 +@@ -485,14 +485,14 @@ + #define LV_FONT_MONTSERRAT_10 0 + #define LV_FONT_MONTSERRAT_12 0 + #define LV_FONT_MONTSERRAT_14 1 +-#define LV_FONT_MONTSERRAT_16 0 +-#define LV_FONT_MONTSERRAT_18 0 +-#define LV_FONT_MONTSERRAT_20 0 +-#define LV_FONT_MONTSERRAT_22 0 +-#define LV_FONT_MONTSERRAT_24 0 +-#define LV_FONT_MONTSERRAT_26 0 +-#define LV_FONT_MONTSERRAT_28 0 +-#define LV_FONT_MONTSERRAT_30 0 ++#define LV_FONT_MONTSERRAT_16 1 ++#define LV_FONT_MONTSERRAT_18 1 ++#define LV_FONT_MONTSERRAT_20 1 ++#define LV_FONT_MONTSERRAT_22 1 ++#define LV_FONT_MONTSERRAT_24 1 ++#define LV_FONT_MONTSERRAT_26 1 ++#define LV_FONT_MONTSERRAT_28 1 ++#define LV_FONT_MONTSERRAT_30 1 + #define LV_FONT_MONTSERRAT_32 0 + #define LV_FONT_MONTSERRAT_34 0 + #define LV_FONT_MONTSERRAT_36 0 +@@ -510,8 +510,8 @@ + #define LV_FONT_SIMSUN_16_CJK 0 /**< 1000 most common CJK radicals */ + + /** Pixel perfect monospaced fonts */ +-#define LV_FONT_UNSCII_8 0 +-#define LV_FONT_UNSCII_16 0 ++#define LV_FONT_UNSCII_8 1 ++#define LV_FONT_UNSCII_16 1 + + /** Optionally declare custom fonts here. + * +@@ -730,9 +730,9 @@ + #define LV_FS_DEFAULT_DRIVE_LETTER '\0' + + /** API for fopen, fread, etc. */ +-#define LV_USE_FS_STDIO 0 ++#define LV_USE_FS_STDIO 1 + #if LV_USE_FS_STDIO +- #define LV_FS_STDIO_LETTER '\0' /**< Set an upper cased letter on which the drive will accessible (e.g. 'A') */ ++ #define LV_FS_STDIO_LETTER 'A' /**< Set an upper cased letter on which the drive will accessible (e.g. 'A') */ + #define LV_FS_STDIO_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #define LV_FS_STDIO_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ + #endif +@@ -785,7 +785,7 @@ + #endif + + /** LODEPNG decoder library */ +-#define LV_USE_LODEPNG 0 ++#define LV_USE_LODEPNG 1 + + /** PNG decoder(libpng) library */ + #define LV_USE_LIBPNG 0 +@@ -816,7 +816,7 @@ + #define LV_USE_RLE 0 + + /** QR code library */ +-#define LV_USE_QRCODE 0 ++#define LV_USE_QRCODE 1 + + /** Barcode code library */ + #define LV_USE_BARCODE 0 +@@ -833,10 +833,10 @@ + #endif + + /** Built-in TTF decoder */ +-#define LV_USE_TINY_TTF 0 ++#define LV_USE_TINY_TTF 1 + #if LV_USE_TINY_TTF + /* Enable loading TTF data from files */ +- #define LV_TINY_TTF_FILE_SUPPORT 0 ++ #define LV_TINY_TTF_FILE_SUPPORT 1 + #define LV_TINY_TTF_CACHE_GLYPH_CNT 256 + #endif + +@@ -845,16 +845,16 @@ + + /** Enable Vector Graphic APIs + * - Requires `LV_USE_MATRIX = 1` */ +-#define LV_USE_VECTOR_GRAPHIC 0 ++#define LV_USE_VECTOR_GRAPHIC 1 + + /** Enable ThorVG (vector graphics library) from the src/libs folder */ +-#define LV_USE_THORVG_INTERNAL 0 ++#define LV_USE_THORVG_INTERNAL 1 + + /** Enable ThorVG by assuming that its installed and linked to the project */ + #define LV_USE_THORVG_EXTERNAL 0 + + /** Use lvgl built-in LZ4 lib */ +-#define LV_USE_LZ4_INTERNAL 0 ++#define LV_USE_LZ4_INTERNAL 1 + + /** Use external LZ4 library */ + #define LV_USE_LZ4_EXTERNAL 0 +@@ -936,7 +936,7 @@ + #define LV_USE_FRAGMENT 0 + + /** 1: Support using images as font in label or span widgets */ +-#define LV_USE_IMGFONT 0 ++#define LV_USE_IMGFONT 1 + + /** 1: Enable an observer pattern implementation */ + #define LV_USE_OBSERVER 1 +@@ -985,7 +985,7 @@ + *==================*/ + + /** Use SDL to open window on PC and handle mouse and keyboard. */ +-#define LV_USE_SDL 0 ++#define LV_USE_SDL 1 + #if LV_USE_SDL + #define LV_SDL_INCLUDE_PATH + #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */ +diff --git a/src/font/lv_font.c b/src/font/lv_font.c +index 35ae352e3..eb4887ece 100644 +--- a/src/font/lv_font.c ++++ b/src/font/lv_font.c +@@ -144,6 +144,94 @@ const lv_font_t * lv_font_default(void) + return LV_FONT_DEFAULT; + } + ++const lv_font_t * lv_font(uint8_t size) ++{ ++#if LV_FONT_MONTSERRAT_8 ++ if (size == 8) return &lv_font_montserrat_8; ++#endif ++ ++#if LV_FONT_MONTSERRAT_10 ++ if (size == 10) return &lv_font_montserrat_10; ++#endif ++ ++#if LV_FONT_MONTSERRAT_12 ++ if (size == 12) return &lv_font_montserrat_12; ++#endif ++ ++#if LV_FONT_MONTSERRAT_14 ++ if (size == 14) return &lv_font_montserrat_14; ++#endif ++ ++#if LV_FONT_MONTSERRAT_16 ++ if (size == 16) return &lv_font_montserrat_16; ++#endif ++ ++#if LV_FONT_MONTSERRAT_18 ++ if (size == 18) return &lv_font_montserrat_18; ++#endif ++ ++#if LV_FONT_MONTSERRAT_20 ++ if (size == 20) return &lv_font_montserrat_20; ++#endif ++ ++#if LV_FONT_MONTSERRAT_22 ++ if (size == 22) return &lv_font_montserrat_22; ++#endif ++ ++#if LV_FONT_MONTSERRAT_24 ++ if (size == 24) return &lv_font_montserrat_24; ++#endif ++ ++#if LV_FONT_MONTSERRAT_26 ++ if (size == 26) return &lv_font_montserrat_26; ++#endif ++ ++#if LV_FONT_MONTSERRAT_28 ++ if (size == 28) return &lv_font_montserrat_28; ++#endif ++ ++#if LV_FONT_MONTSERRAT_30 ++ if (size == 30) return &lv_font_montserrat_30; ++#endif ++ ++#if LV_FONT_MONTSERRAT_32 ++ if (size == 32) return &lv_font_montserrat_32; ++#endif ++ ++#if LV_FONT_MONTSERRAT_34 ++ if (size == 34) return &lv_font_montserrat_34; ++#endif ++ ++#if LV_FONT_MONTSERRAT_36 ++ if (size == 36) return &lv_font_montserrat_36; ++#endif ++ ++#if LV_FONT_MONTSERRAT_38 ++ if (size == 38) return &lv_font_montserrat_38; ++#endif ++ ++#if LV_FONT_MONTSERRAT_40 ++ if (size == 40) return &lv_font_montserrat_40; ++#endif ++ ++#if LV_FONT_MONTSERRAT_42 ++ if (size == 42) return &lv_font_montserrat_42; ++#endif ++ ++#if LV_FONT_MONTSERRAT_44 ++ if (size == 44) return &lv_font_montserrat_44; ++#endif ++ ++#if LV_FONT_MONTSERRAT_46 ++ if (size == 46) return &lv_font_montserrat_46; ++#endif ++ ++#if LV_FONT_MONTSERRAT_48 ++ if (size == 48) return &lv_font_montserrat_48; ++#endif ++ return LV_FONT_DEFAULT; ++} ++ + /********************** + * STATIC FUNCTIONS + **********************/ +diff --git a/src/font/lv_font.h b/src/font/lv_font.h +index 2f172b9f8..b2ec1d914 100644 +--- a/src/font/lv_font.h ++++ b/src/font/lv_font.h +@@ -289,6 +289,8 @@ LV_FONT_CUSTOM_DECLARE + */ + const lv_font_t * lv_font_default(void); + ++const lv_font_t * lv_font(uint8_t size); ++ + #ifdef __cplusplus + } /*extern "C"*/ + #endif From 0fecbbc5eb8d3ff93f2fe61cd86bc8105f10ef3a Mon Sep 17 00:00:00 2001 From: notinaboat <73502641+notinaboat@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:44:57 +1100 Subject: [PATCH 4/4] Update build_tarballs.jl --- L/LVGL_SDL/build_tarballs.jl | 90 +++++++++--------------------------- 1 file changed, 21 insertions(+), 69 deletions(-) diff --git a/L/LVGL_SDL/build_tarballs.jl b/L/LVGL_SDL/build_tarballs.jl index e95888dbc23..555dbd420e7 100644 --- a/L/LVGL_SDL/build_tarballs.jl +++ b/L/LVGL_SDL/build_tarballs.jl @@ -3,82 +3,34 @@ using BinaryBuilder, Pkg name = "LVGL_SDL" -version = v"9.2.0" +version = v"9.3.0" # Collection of sources required to complete build sources = [ - GitSource("https://github.com/lvgl/lv_port_pc_eclipse.git", "ba45efb68b125aa93237e7c75c51d4cd65fc10cf") + GitSource("https://github.com/lvgl/lvgl.git", "4f086111a107718b719a45e2cc422f5b756d7edd"), + DirectorySource("./bundled"), ] # Bash recipe for building across all platforms script = raw""" -cd $WORKSPACE/srcdir -cd lv_port_pc_eclipse/ -git submodule update --init --recursive -cd lvgl/ -patch -p1 << "EOF" -diff --git a/env_support/cmake/custom.cmake b/env_support/cmake/custom.cmake -index e4cd36376..0e1d4b9d0 100644 ---- a/env_support/cmake/custom.cmake -+++ b/env_support/cmake/custom.cmake -@@ -26,6 +26,7 @@ file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp ${LVGL_R - # Build LVGL library - add_library(lvgl ${SOURCES}) - add_library(lvgl::lvgl ALIAS lvgl) -+target_link_libraries(lvgl lvgl_thorvg ${SDL2_LIBRARIES}) - - target_compile_definitions( - lvgl PUBLIC $<$:LV_LVGL_H_INCLUDE_SIMPLE> -@@ -49,7 +50,7 @@ if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL) - add_library(lvgl_thorvg ${THORVG_SOURCES}) - add_library(lvgl::thorvg ALIAS lvgl_thorvg) - target_include_directories(lvgl_thorvg SYSTEM PUBLIC ${LVGL_ROOT_DIR}/src/libs/thorvg) -- target_link_libraries(lvgl_thorvg PUBLIC lvgl) -+ # target_link_libraries(lvgl_thorvg PUBLIC lvgl) - endif() - - if(NOT (CMAKE_C_COMPILER_ID STREQUAL "MSVC")) -EOF - -patch -p1 << "EOF" -diff --git a/src/drivers/sdl/lv_sdl_window.c b/src/drivers/sdl/lv_sdl_window.c -index df8a28e4e..40c5c0bcd 100644 ---- a/src/drivers/sdl/lv_sdl_window.c -+++ b/src/drivers/sdl/lv_sdl_window.c -@@ -438,7 +438,12 @@ static void * sdl_draw_buf_realloc_aligned(void * ptr, size_t new_size) - /* Size must be multiple of align, See: https://en.cppreference.com/w/c/memory/aligned_alloc */ - - #define BUF_ALIGN (LV_DRAW_BUF_ALIGN < sizeof(void *) ? sizeof(void *) : LV_DRAW_BUF_ALIGN) -- return aligned_alloc(BUF_ALIGN, LV_ALIGN_UP(new_size, BUF_ALIGN)); -+ void* result; -+ if (posix_memalign(&result, BUF_ALIGN, LV_ALIGN_UP(new_size, BUF_ALIGN)) == 0) -+ { -+ return result; -+ } -+ return NULL; - #else - return _aligned_malloc(LV_ALIGN_UP(new_size, LV_DRAW_BUF_ALIGN), LV_DRAW_BUF_ALIGN); - #endif /* _WIN32 */ -EOF - -cd .. -patch -p1 << "EOF" -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 78eaf02..1753f9f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,8 @@ - cmake_minimum_required(VERSION 3.10) - project(lvgl) - -+option(BUILD_SHARED_LIBS "Build shared libraries" ON) -+ - option(LV_USE_DRAW_SDL "Use SDL draw unit" OFF) - option(LV_USE_LIBPNG "Use libpng to decode PNG" OFF) - option(LV_USE_LIBJPEG_TURBO "Use libjpeg turbo to decode JPEG" OFF) -EOF - -cmake -B build -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release +cd $WORKSPACE/srcdir/lvgl +atomic_patch -p1 ${WORKSPACE}/srcdir/patches/*.patch +if [[ "${target}" == "x86_64-apple-darwin14" ]] +then + atomic_patch -p1 ${WORKSPACE}/srcdir/patches/x86_64-apple-darwin14/*.patch +fi +cp lv_conf_template.h lv_conf.h +cp lv_conf.h .. + +cmake -B build \ + -DBUILD_SHARED_LIBS=ON \ + -DLIB_INSTALL_DIR=${prefix}/lib \ + -DLV_CONF_BUILD_DISABLE_DEMOS=1 \ + -DLV_CONF_BUILD_DISABLE_EXAMPLES=1 \ + -DLV_CONF_INCLUDE_SIMPLE=OFF \ + -DCMAKE_INSTALL_PREFIX=${prefix} \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel ${nproc} cmake --install build """