mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-10 12:47:51 +08:00
build: restructure cmake (#8210)
Co-authored-by: Erik Tagirov <erik.tagirov@edgemtech.ch>
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ elseif(ZEPHYR_BASE)
|
||||
elseif(MICROPY_DIR)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/env_support/cmake/micropython.cmake)
|
||||
else()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/env_support/cmake/custom.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/env_support/cmake/os_desktop.cmake)
|
||||
endif()
|
||||
|
||||
#[[
|
||||
@@ -38,4 +38,4 @@ if (MSVC)
|
||||
INTERFACE LV_ATTRIBUTE_EXTERN_DATA=__declspec\(dllimport\)
|
||||
PRIVATE LV_ATTRIBUTE_EXTERN_DATA=__declspec\(dllexport\)
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+2
-3
@@ -5,7 +5,6 @@
|
||||
"name": "_base",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"LV_CONF_SKIP": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -71,7 +70,7 @@
|
||||
},
|
||||
"cacheVariables": {
|
||||
"BUILD_SHARED_LIBS": "ON",
|
||||
"LV_USE_KCONFIG": "ON"
|
||||
"BUILD_LV_USE_KCONFIG": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -84,7 +83,7 @@
|
||||
"CMAKE_C_COMPILER": "cl.exe",
|
||||
"CMAKE_CXX_COMPILER": "cl.exe",
|
||||
"BUILD_SHARED_LIBS": "ON",
|
||||
"LV_USE_KCONFIG": "ON"
|
||||
"LV_BUILD_USE_KCONFIG": "ON"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
|
||||
@@ -2084,79 +2084,85 @@ menu "LVGL configuration"
|
||||
endmenu
|
||||
|
||||
menu "Demos"
|
||||
config LV_USE_DEMO_WIDGETS
|
||||
bool "Show some widget"
|
||||
default n
|
||||
config LV_BUILD_DEMOS
|
||||
bool "Build demos"
|
||||
default y if !LV_CONF_MINIMAL
|
||||
|
||||
config LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
bool "Demonstrate the usage of encoder and keyboard"
|
||||
default n
|
||||
if LV_BUILD_DEMOS
|
||||
config LV_USE_DEMO_WIDGETS
|
||||
bool "Show some widget"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_BENCHMARK
|
||||
bool "Benchmark your system"
|
||||
default n
|
||||
select LV_FONT_MONTSERRAT_14
|
||||
select LV_FONT_MONTSERRAT_20
|
||||
select LV_FONT_MONTSERRAT_24
|
||||
select LV_FONT_MONTSERRAT_26
|
||||
select LV_USE_DEMO_WIDGETS
|
||||
config LV_USE_DEMO_RENDER
|
||||
bool "Render test for each primitives. Requires at least 480x272 display"
|
||||
default n
|
||||
config LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
bool "Demonstrate the usage of encoder and keyboard"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_SCROLL
|
||||
bool "Scroll settings test for LVGL"
|
||||
default n
|
||||
config LV_USE_DEMO_BENCHMARK
|
||||
bool "Benchmark your system"
|
||||
default n
|
||||
select LV_FONT_MONTSERRAT_14
|
||||
select LV_FONT_MONTSERRAT_20
|
||||
select LV_FONT_MONTSERRAT_24
|
||||
select LV_FONT_MONTSERRAT_26
|
||||
select LV_USE_DEMO_WIDGETS
|
||||
config LV_USE_DEMO_RENDER
|
||||
bool "Render test for each primitives. Requires at least 480x272 display"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_STRESS
|
||||
bool "Stress test for LVGL"
|
||||
default n
|
||||
config LV_USE_DEMO_SCROLL
|
||||
bool "Scroll settings test for LVGL"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_TRANSFORM
|
||||
bool "Transform test for LVGL"
|
||||
default n
|
||||
depends on LV_FONT_MONTSERRAT_18
|
||||
config LV_USE_DEMO_STRESS
|
||||
bool "Stress test for LVGL"
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_MUSIC
|
||||
bool "Music player demo"
|
||||
default n
|
||||
config LV_DEMO_MUSIC_SQUARE
|
||||
bool "Enable Square"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_LANDSCAPE
|
||||
bool "Enable Landscape"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_ROUND
|
||||
bool "Enable Round"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_LARGE
|
||||
bool "Enable Large"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_AUTO_PLAY
|
||||
bool "Enable Auto play"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_USE_DEMO_TRANSFORM
|
||||
bool "Transform test for LVGL"
|
||||
default n
|
||||
depends on LV_FONT_MONTSERRAT_18
|
||||
|
||||
config LV_USE_DEMO_FLEX_LAYOUT
|
||||
bool "Flex layout previewer"
|
||||
default n
|
||||
config LV_USE_DEMO_MULTILANG
|
||||
bool "multi-language demo"
|
||||
default n
|
||||
config LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
bool "vector graphic demo"
|
||||
default n
|
||||
depends on LV_USE_VECTOR_GRAPHIC
|
||||
config LV_USE_DEMO_SMARTWATCH
|
||||
bool "Smartwatch demo"
|
||||
config LV_USE_DEMO_EBIKE
|
||||
bool "Ebike demo"
|
||||
config LV_USE_DEMO_HIGH_RES
|
||||
config LV_USE_DEMO_MUSIC
|
||||
bool "Music player demo"
|
||||
default n
|
||||
config LV_DEMO_MUSIC_SQUARE
|
||||
bool "Enable Square"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_LANDSCAPE
|
||||
bool "Enable Landscape"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_ROUND
|
||||
bool "Enable Round"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_LARGE
|
||||
bool "Enable Large"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
config LV_DEMO_MUSIC_AUTO_PLAY
|
||||
bool "Enable Auto play"
|
||||
depends on LV_USE_DEMO_MUSIC
|
||||
default n
|
||||
|
||||
config LV_USE_DEMO_FLEX_LAYOUT
|
||||
bool "Flex layout previewer"
|
||||
default n
|
||||
config LV_USE_DEMO_MULTILANG
|
||||
bool "multi-language demo"
|
||||
default n
|
||||
config LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
bool "vector graphic demo"
|
||||
default n
|
||||
depends on LV_USE_VECTOR_GRAPHIC
|
||||
config LV_USE_DEMO_SMARTWATCH
|
||||
bool "Smartwatch demo"
|
||||
config LV_USE_DEMO_EBIKE
|
||||
bool "Ebike demo"
|
||||
config LV_USE_DEMO_HIGH_RES
|
||||
bool "High resolution demo"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
# A default defconfig doesn't need to store anything as it'll just take the default parameters when expanded into an actual config
|
||||
@@ -1 +0,0 @@
|
||||
CONFIG_LV_CONF_MINIMAL=y
|
||||
@@ -8,11 +8,10 @@ CMake
|
||||
Overview
|
||||
********
|
||||
CMake is a cross-platform build system generator. It is used to easily integrate a project/library into another project.
|
||||
It also offer the possibility to configure the build with different options, to enable or disable components, or to
|
||||
It also offers the possibility to configure the build with different options, to enable or disable components, or to
|
||||
integrate custom scripts executions during the configuration/build phase.
|
||||
|
||||
LVGL includes CMake natively, which means that one can use it to configure and build LVGL directly or integrate it into an higher
|
||||
level cmake build.
|
||||
LVGL includes CMake natively, which means that one can use it to configure and build LVGL directly or integrate it into an higher level cmake build.
|
||||
|
||||
This project uses CMakePresets to ensure an easy build.
|
||||
Find out more on Cmake Presets here: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
|
||||
@@ -23,8 +22,7 @@ Prerequisites
|
||||
|
||||
You need to install
|
||||
|
||||
- CMake
|
||||
- Ninja (for Linux builds). Be sure to Add ninja to your PATH!
|
||||
- CMake with GNU make or Ninja (for Linux builds). Be sure to add ninja/make to your PATH!
|
||||
- The prerequisites listed in ``scripts/install-prerequisites.sh/bat``
|
||||
- A python3 interpreter if you wish to use KConfig.
|
||||
|
||||
@@ -132,58 +130,101 @@ This snippet adds LVGL and needs an ``lv_conf.h`` file present next to the lvgl
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(LV_CONF_INCLUDE_SIMPLE OFF)
|
||||
add_subdirectory(lvgl)
|
||||
|
||||
|
||||
This snippet adds LVGL and needs an ``lv_conf.h`` file present in lvgl/src folder:
|
||||
This snippet sets up LVGL and tells it which ``lv_conf.h`` file to use:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(LV_BUILD_CONF_PATH path/to/my_lv_conf.h)
|
||||
add_subdirectory(lvgl)
|
||||
|
||||
|
||||
This snippet adds LVGL and specify a ``lv_conf.h`` to use:
|
||||
This snippet sets up LVGL and points to the folder where ``lv_conf.h`` is located:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(LV_CONF_PATH path/to/my_lv_conf.h)
|
||||
set(LV_BUILD_CONF_DIR path/to/directory)
|
||||
add_subdirectory(lvgl)
|
||||
|
||||
|
||||
This snippet adds LVGL and specify to use Kconfig as the configuration system:
|
||||
This snippet adds LVGL and specifies to use Kconfig as the configuration system:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(LV_USE_KCONFIG ON)
|
||||
set(LV_BUILD_USE_KCONFIG ON)
|
||||
add_subdirectory(lvgl)
|
||||
|
||||
This snippet adds LVGL and specify to use Kconfig as the configuration system and to use a specific defconfig:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(LV_USE_KCONFIG ON)
|
||||
set(LV_DEFCONFIG_PATH path/to/my_defconfig)
|
||||
set(LV_BUILD_USE_KCONFIG ON)
|
||||
set(LV_BUILD_DEFCONFIG_PATH path/to/my_defconfig)
|
||||
add_subdirectory(lvgl)
|
||||
|
||||
|
||||
To disable the demo/example set these options:
|
||||
To enable the demos and examples set these options:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(LV_CONF_BUILD_DISABLE_EXAMPLES ON)
|
||||
set(LV_CONF_BUILD_DISABLE_DEMOS ON)
|
||||
set(CONFIG_LV_BUILD_EXAMPLES ON)
|
||||
set(CONFIG_LV_BUILD_DEMOS ON)
|
||||
add_subdirectory(lvgl)
|
||||
|
||||
Below is a list of the available options/variables
|
||||
|
||||
These cmake options are available to configure LVGL:
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 30 70
|
||||
|
||||
* - Variable/Option
|
||||
- Type
|
||||
- Description
|
||||
* - LV_BUILD_CONF_PATH
|
||||
- PATH
|
||||
- Allows to set a custom path for ``lv_conf.h``
|
||||
* - LV_BUILD_CONF_DIR
|
||||
- PATH
|
||||
- Allows to set a directory containing ``lv_conf.h``
|
||||
* - LV_BUILD_USE_KCONFIG
|
||||
- BOOLEAN
|
||||
- When set KConfig is used as the configuration source. This option is disabled by default.
|
||||
* - LV_BUILD_DEFCONFIG_PATH
|
||||
- PATH
|
||||
- Specify to use a .defconfig file instead of the current .config in a Kconfig setup.
|
||||
* - LV_BUILD_LVGL_H_SYSTEM_INCLUDE
|
||||
- BOOLEAN
|
||||
- Enable if LVGL will be installed to the system or your build system uses a sysroot.
|
||||
Turning this option on implies that the resources generated by the image generation script
|
||||
will include ``lvgl.h`` as a system include. i.e: ``#include <lvgl.h>``.
|
||||
This option is disabled by default.
|
||||
* - LV_BUILD_LVGL_H_SIMPLE_INCLUDE
|
||||
- BOOLEAN
|
||||
- When enabled the resources will include ``lvgl.h`` as a simple include, this option
|
||||
is enabled by default.
|
||||
* - LV_BUILD_SET_CONFIG_OPTS
|
||||
- BOOLEAN
|
||||
- When enabled, this option runs a script that processes the ``lv_conf.h``/Kconfig
|
||||
configuration using ``pcpp`` to generate corresponding ``CONFIG_LV_*`` and
|
||||
``CONFIG_LV_BUILD_*`` CMake variables based on the contents of ``lv_conf_internal.h``.
|
||||
This requires python3 with ``venv`` and ``pip`` or access to a working ``pcpp``.
|
||||
If KConfig is used, this is enabled automatically.
|
||||
* - CONFIG_LV_BUILD_DEMOS
|
||||
- BOOLEAN
|
||||
- When enabled builds the demos
|
||||
* - CONFIG_LV_BUILD_EXAMPLES
|
||||
- BOOLEAN
|
||||
- When enabled builds the examples
|
||||
* - CONFIG_LV_USE_THORVG_INTERNAL
|
||||
- BOOLEAN
|
||||
- When enabled the in-tree LVGL version of ThorVG is compiled
|
||||
* - CONFIG_LV_USE_PRIVATE_API
|
||||
- BOOLEAN
|
||||
- When enabled the private headers ``*_private.h`` are installed on the system
|
||||
|
||||
.. note::
|
||||
|
||||
When ``LV_BUILD_SET_CONFIG_OPTS`` or ``LV_BUILD_USE_KCONFIG`` are enabled,
|
||||
the options/variables beginning with the prefix ``CONFIG_*`` are automatically
|
||||
set to the values found in ``lv_conf.h``
|
||||
|
||||
- ``LV_CONF_PATH`` (STRING): Specify a custom path for ``lv_conf.h``.
|
||||
- ``LV_CONF_INCLUDE_SIMPLE`` (BOOLEAN): Use ``#include "lv_conf.h"`` instead of ``#include "../../lv_conf.h"``
|
||||
- ``LV_USE_KCONFIG`` (BOOLEAN): Use Kconfig as the configuration source.
|
||||
- ``LV_DEFCONFIG_PATH`` (STRING): Specify to use a defconfig file instead of the current .config in a Kconfig setup.
|
||||
- ``LV_CONF_BUILD_DISABLE_EXAMPLES`` (BOOLEAN): Disable building the examples if set.
|
||||
- ``LV_CONF_BUILD_DISABLE_DEMOS`` (BOOLEAN): Disable building the demos if set.
|
||||
- ``LV_CONF_BUILD_DISABLE_THORVG_INTERNAL``: Disable the internal compilation of ThorVG.
|
||||
- ``LV_CMAKE_CREATE_CONF_VARS`` (BOOLEAN) : Disable the creation of variables from ``lv_conf_internal.h`` this feature is disabled by default.
|
||||
It is enabled automatically if ``LV_USE_KCONFIG`` is enabled. This feature requires a python3 interpreter with support for the *pip* and *venv* modules
|
||||
|
||||
@@ -1,300 +0,0 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/version.cmake")
|
||||
|
||||
# Option to define LV_LVGL_H_INCLUDE_SIMPLE, default: ON
|
||||
option(LV_LVGL_H_INCLUDE_SIMPLE
|
||||
"Use #include \"lvgl.h\" instead of #include \"../../lvgl.h\"" ON)
|
||||
|
||||
# Option to define LV_CONF_INCLUDE_SIMPLE, default: ON
|
||||
option(LV_CONF_INCLUDE_SIMPLE
|
||||
"Use #include \"lv_conf.h\" instead of #include \"../../lv_conf.h\"" ON)
|
||||
|
||||
set(LV_KCONFIG_IGNORE "Don't use Kconfig. Kconfig is not used by default." ON)
|
||||
|
||||
find_package(Python REQUIRED)
|
||||
|
||||
option(LV_CONF_SKIP "Skip including lv_conf.h during configuration" OFF)
|
||||
option(LV_USE_KCONFIG "Use Kconfig to configure LVGL" OFF)
|
||||
option(LV_CMAKE_CREATE_CONF_VARS "Create variables from the options defined in lv_conf_internal.h - required for KConfig" OFF)
|
||||
|
||||
# Option LV_CONF_PATH, which should be the path for lv_conf.h
|
||||
# If set parent path LV_CONF_DIR is added to includes
|
||||
if( LV_CONF_PATH )
|
||||
get_filename_component(LV_CONF_DIR ${LV_CONF_PATH} DIRECTORY)
|
||||
endif( LV_CONF_PATH )
|
||||
|
||||
# Option to build shared libraries (as opposed to static), default: OFF
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
|
||||
# Set sources used for LVGL components
|
||||
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c ${LVGL_ROOT_DIR}/src/*.S)
|
||||
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
|
||||
file(GLOB_RECURSE DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c)
|
||||
file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp ${LVGL_ROOT_DIR}/src/others/vg_lite_tvg/*.cpp)
|
||||
|
||||
# Build LVGL library
|
||||
add_library(lvgl ${SOURCES})
|
||||
add_library(lvgl::lvgl ALIAS lvgl)
|
||||
|
||||
set(PCPP_DEFINITIONS_LIST "")
|
||||
|
||||
if ( LV_USE_KCONFIG )
|
||||
# kconfig.cmake will generate the .config
|
||||
# and autoconf.h, which will be used by lv_conf_kconfig.h
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/kconfig.cmake)
|
||||
|
||||
# If KConfig is used - creating CMAKE variables from lv_conf_internal.h is required,
|
||||
# so PCPP is used to pre-process lv_conf_internal.h
|
||||
set(LV_CMAKE_CREATE_CONF_VARS TRUE)
|
||||
|
||||
# Set the flag to specify we are using kconfig, needed for the
|
||||
# generate_cmake_variables.py script
|
||||
set(LV_KCONFIG_IGNORE OFF)
|
||||
set(KCONFIG_FLAG --kconfig)
|
||||
|
||||
# If using Kconfig, we need to define additional definitions
|
||||
list(APPEND PCPP_DEFINITIONS_LIST "LV_CONF_SKIP" "LV_CONF_KCONFIG_EXTERNAL_INCLUDE=\"${LV_CONF_KCONFIG_EXTERNAL_INCLUDE}\"")
|
||||
else()
|
||||
if (LV_CONF_PATH)
|
||||
list(APPEND PCPP_DEFINITIONS_LIST "LV_CONF_PATH=\"${LV_CONF_PATH}\"")
|
||||
endif()
|
||||
|
||||
if (LV_LVGL_H_INCLUDE_SIMPLE)
|
||||
list(APPEND PCPP_DEFINITIONS_LIST "LV_LVGL_H_INCLUDE_SIMPLE")
|
||||
endif()
|
||||
|
||||
if (LV_CONF_INCLUDE_SIMPLE)
|
||||
list(APPEND PCPP_DEFINITIONS_LIST "LV_CONF_INCLUDE_SIMPLE")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PCPP_DEFINITIONS_LIST)
|
||||
set(PCPP_ADDITIONAL_DEFS "--defs" ${PCPP_DEFINITIONS_LIST})
|
||||
else()
|
||||
set(PCPP_ADDITIONAL_DEFS "")
|
||||
endif()
|
||||
|
||||
|
||||
target_compile_definitions(
|
||||
lvgl PUBLIC $<$<BOOL:${LV_LVGL_H_INCLUDE_SIMPLE}>:LV_LVGL_H_INCLUDE_SIMPLE>
|
||||
$<$<BOOL:${LV_CONF_INCLUDE_SIMPLE}>:LV_CONF_INCLUDE_SIMPLE>
|
||||
$<$<BOOL:${LV_KCONFIG_IGNORE}>:LV_KCONFIG_IGNORE>
|
||||
$<$<BOOL:${LV_CONF_SKIP}>:LV_CONF_SKIP>
|
||||
)
|
||||
|
||||
if ( LV_CMAKE_CREATE_CONF_VARS )
|
||||
# Use the portable pcpp to preprocess lv_conf_internal.h
|
||||
execute_process(
|
||||
COMMAND ${Python_EXECUTABLE} ${LVGL_ROOT_DIR}/scripts/preprocess_lv_conf_internal.py
|
||||
--input ${LVGL_ROOT_DIR}/src/lv_conf_internal.h
|
||||
--tmp_file ${CMAKE_CURRENT_BINARY_DIR}/tmp.h
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h
|
||||
--workfolder ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PCPP_ADDITIONAL_DEFS}
|
||||
--include ${LVGL_ROOT_DIR} ${LVGL_ROOT_DIR}/.. ${LVGL_ROOT_DIR}/src ${LV_CONF_DIR}
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
if(NOT "${ret}" STREQUAL "0")
|
||||
message(FATAL_ERROR "preprocess_lv_conf_internal.py failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
# Convert the expanded lv_conf_expanded.h to cmake variables
|
||||
execute_process(
|
||||
COMMAND ${Python_EXECUTABLE}
|
||||
${LVGL_ROOT_DIR}/scripts/generate_cmake_variables.py
|
||||
--input ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/lv_conf.cmake
|
||||
--parentscope
|
||||
${KCONFIG_FLAG}
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
if(NOT "${ret}" STREQUAL "0")
|
||||
message(FATAL_ERROR "generate_cmake_variables.py command failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
# This will set all CONFIG_LV_USE_* variables in cmake
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/lv_conf.cmake)
|
||||
endif()
|
||||
|
||||
# Add definition of LV_CONF_PATH only if needed
|
||||
# Do not redefine it if already defined in tests/CMakeLists.txt
|
||||
if(LV_CONF_PATH AND NOT LV_BUILD_TEST)
|
||||
target_compile_definitions(lvgl PUBLIC LV_CONF_PATH="${LV_CONF_PATH}")
|
||||
endif()
|
||||
|
||||
# Add definition of LV_CONF_SKIP only if needed
|
||||
if(LV_CONF_SKIP)
|
||||
target_compile_definitions(lvgl PUBLIC LV_CONF_SKIP=1)
|
||||
endif()
|
||||
|
||||
# Include root and optional parent path of LV_CONF_PATH
|
||||
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LV_CONF_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
|
||||
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)
|
||||
endif()
|
||||
|
||||
if(NOT (CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
|
||||
set_source_files_properties(${LVGL_ROOT_DIR}/src/others/vg_lite_tvg/vg_lite_tvg.cpp PROPERTIES COMPILE_FLAGS -Wunused-parameter)
|
||||
endif()
|
||||
|
||||
# Build LVGL example library
|
||||
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
|
||||
add_library(lvgl_examples ${EXAMPLE_SOURCES})
|
||||
add_library(lvgl::examples ALIAS lvgl_examples)
|
||||
|
||||
target_include_directories(lvgl_examples SYSTEM PUBLIC ${LVGL_ROOT_DIR}/examples)
|
||||
target_link_libraries(lvgl_examples PUBLIC lvgl)
|
||||
endif()
|
||||
|
||||
# Build LVGL demos library
|
||||
if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
|
||||
add_library(lvgl_demos ${DEMO_SOURCES})
|
||||
add_library(lvgl::demos ALIAS lvgl_demos)
|
||||
|
||||
target_include_directories(lvgl_demos SYSTEM PUBLIC ${LVGL_ROOT_DIR}/demos)
|
||||
target_link_libraries(lvgl_demos PUBLIC lvgl)
|
||||
endif()
|
||||
|
||||
# Library and headers can be installed to system using make install
|
||||
file(GLOB LVGL_PUBLIC_HEADERS
|
||||
"${LVGL_ROOT_DIR}/lvgl.h"
|
||||
"${LVGL_ROOT_DIR}/lv_version.h")
|
||||
|
||||
if(NOT LV_CONF_SKIP)
|
||||
if (LV_CONF_PATH)
|
||||
string(REPLACE "\"" "" UNQUOTED_LV_CONF_PATH ${LV_CONF_PATH})
|
||||
list(APPEND LVGL_PUBLIC_HEADERS ${UNQUOTED_LV_CONF_PATH})
|
||||
else()
|
||||
list(APPEND LVGL_PUBLIC_HEADERS
|
||||
"${CMAKE_SOURCE_DIR}/lv_conf.h")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("${LIB_INSTALL_DIR}" STREQUAL "")
|
||||
set(LIB_INSTALL_DIR "lib")
|
||||
endif()
|
||||
if("${RUNTIME_INSTALL_DIR}" STREQUAL "")
|
||||
set(RUNTIME_INSTALL_DIR "bin")
|
||||
endif()
|
||||
if("${INC_INSTALL_DIR}" STREQUAL "")
|
||||
set(INC_INSTALL_DIR "include/lvgl")
|
||||
endif()
|
||||
|
||||
|
||||
#Install headers
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
DESTINATION "${INC_INSTALL_DIR}"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
|
||||
# Install headers from the LVGL_PUBLIC_HEADERS variable
|
||||
install(
|
||||
FILES ${LVGL_PUBLIC_HEADERS}
|
||||
DESTINATION "${INC_INSTALL_DIR}/"
|
||||
)
|
||||
|
||||
# install example headers
|
||||
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples"
|
||||
DESTINATION "${INC_INSTALL_DIR}"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
endif()
|
||||
|
||||
# install demo headers
|
||||
if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demos"
|
||||
DESTINATION "${INC_INSTALL_DIR}"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
endif()
|
||||
|
||||
|
||||
configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc @ONLY)
|
||||
configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" ${CMAKE_CURRENT_BINARY_DIR}/lv_version.h @ONLY)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc"
|
||||
DESTINATION "share/pkgconfig/")
|
||||
|
||||
# Install library
|
||||
set_target_properties(
|
||||
lvgl
|
||||
PROPERTIES OUTPUT_NAME lvgl
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
|
||||
|
||||
# Install library thorvg
|
||||
if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL)
|
||||
set_target_properties(
|
||||
lvgl_thorvg
|
||||
PROPERTIES OUTPUT_NAME lvgl_thorvg
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl_thorvg
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
# Install library demos
|
||||
if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
|
||||
set_target_properties(
|
||||
lvgl_demos
|
||||
PROPERTIES OUTPUT_NAME lvgl_demos
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl_demos
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
#install library examples
|
||||
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
|
||||
set_target_properties(
|
||||
lvgl_examples
|
||||
PROPERTIES OUTPUT_NAME lvgl_examples
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl_examples
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
endif()
|
||||
@@ -5,38 +5,53 @@ set(OUTPUT_DOTCONFIG ${CMAKE_CURRENT_SOURCE_DIR}/.config)
|
||||
set(KCONFIG_LIST_OUT ${CMAKE_CURRENT_BINARY_DIR}/kconfig_list)
|
||||
set(AUTO_CONF_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Check if the user want to use a defconfig, using the -DLV_DEFCONFIG_PATH option
|
||||
if(LV_DEFCONFIG_PATH)
|
||||
set(DOTCONFIG ${LV_DEFCONFIG_PATH})
|
||||
# Check if the user wants to use a defconfig, using the -DLV_BUILD_DEFCONFIG_PATH option
|
||||
if(LV_BUILD_DEFCONFIG_PATH)
|
||||
# The supplied path can be relative - normalize it to absolute
|
||||
message(STATUS "Using defconfig: ${LV_BUILD_DEFCONFIG_PATH}")
|
||||
|
||||
if (NOT IS_ABSOLUTE ${CONF_PATH})
|
||||
file(REAL_PATH ${LV_BUILD_DEFCONFIG_PATH}
|
||||
DOTCONFIG BASE_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
message(STATUS "Converted to absolute path: ${DOTCONFIG}")
|
||||
|
||||
else()
|
||||
set(DOTCONFIG ${LV_BUILD_DEFCONFIG_PATH})
|
||||
endif()
|
||||
|
||||
else()
|
||||
set(DOTCONFIG ${CMAKE_CURRENT_SOURCE_DIR}/.config)
|
||||
# Fallback - This will attempt to use a .config file inside of the LVGL directory
|
||||
set(DOTCONFIG ${CMAKE_CURRENT_SOURCE_DIR}/.config)
|
||||
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${DOTCONFIG})
|
||||
message(FATAL_ERROR "defconfig: ${DOTCONFIG} - does not exist")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python_EXECUTABLE}
|
||||
${LVGL_ROOT_DIR}/scripts/kconfig.py
|
||||
${LVGL_ROOT_DIR}/Kconfig
|
||||
${OUTPUT_DOTCONFIG}
|
||||
${AUTOCONF_H}
|
||||
${KCONFIG_LIST_OUT}
|
||||
${DOTCONFIG}
|
||||
WORKING_DIRECTORY ${LVGL_ROOT_DIR}
|
||||
# The working directory is set to the app dir such that the user
|
||||
# can use relative paths in CONF_FILE, e.g. CONF_FILE=nrf5.conf
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
COMMAND ${Python_EXECUTABLE}
|
||||
${LVGL_ROOT_DIR}/scripts/kconfig.py
|
||||
${LVGL_ROOT_DIR}/Kconfig
|
||||
${OUTPUT_DOTCONFIG}
|
||||
${AUTOCONF_H}
|
||||
${KCONFIG_LIST_OUT}
|
||||
${DOTCONFIG}
|
||||
WORKING_DIRECTORY ${LVGL_ROOT_DIR}
|
||||
# The working directory is set to the app dir such that the user
|
||||
# can use relative paths in CONF_FILE, e.g. CONF_FILE=nrf5.conf
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
if(NOT "${ret}" STREQUAL "0")
|
||||
message(FATAL_ERROR "command failed with return code: ${ret}")
|
||||
message(FATAL_ERROR "command failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
# Re-configure (Re-execute all CMakeLists.txt code) when autoconf.h changes
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H})
|
||||
set_target_properties(lvgl PROPERTIES CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H})
|
||||
|
||||
# Set compile definitions for lvgl build
|
||||
add_compile_definitions(LV_CONF_KCONFIG_EXTERNAL_INCLUDE="${AUTOCONF_H}")
|
||||
# Set the variable that can be used by the CMakeLists.txt including this file
|
||||
set(LV_CONF_KCONFIG_EXTERNAL_INCLUDE "${AUTOCONF_H}")
|
||||
set(KCONFIG_EXTERNAL_INCLUDE ${AUTOCONF_H})
|
||||
|
||||
# Ensure LV_DEFCONFIG_PATH is not set in the path, to be able to call it without
|
||||
# the -DLV_DEFCONFIG_PATH after the first configuration, and to work with the .config
|
||||
unset(LV_DEFCONFIG_PATH CACHE)
|
||||
# Ensure LV_BUILD_DEFCONFIG_PATH is not set in the path, to be able to call it without
|
||||
# the -DLV_BUILD_DEFCONFIG_PATH after the first configuration, and to work with the .config
|
||||
unset(LV_BUILD_DEFCONFIG_PATH CACHE)
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/version.cmake")
|
||||
|
||||
############################## OPTIONS ######################################
|
||||
|
||||
set(LV_BUILD_CONF_PATH "" CACHE PATH
|
||||
"Use this to specify the location of and/or filename of lv_conf.h")
|
||||
|
||||
set(LV_BUILD_CONF_DIR "" CACHE PATH
|
||||
"Can be used to specify the include dir containing lv_conf.h, to be used in conjuction with LV_CONF_INCLUDE_SIMPLE")
|
||||
|
||||
option(LV_BUILD_USE_KCONFIG "Use Kconfig" OFF)
|
||||
set(LV_BUILD_DEFCONFIG_PATH "" CACHE PATH
|
||||
"Supply the default Kconfig configuration - used with Kconfig")
|
||||
|
||||
option(LV_BUILD_SET_CONFIG_OPTS
|
||||
"Create variables from the definitions in lv_conf_internal.h" OFF)
|
||||
|
||||
option(LV_BUILD_LVGL_H_SIMPLE_INCLUDE
|
||||
"Disable if the lvgl directory is located at the top-level of your project" ON)
|
||||
|
||||
option(LV_BUILD_LVGL_H_SYSTEM_INCLUDE
|
||||
"Enable if LVGL will be installed on the system or the build system of your application uses a sysroot" OFF)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
|
||||
### LVGL configuration options always use the prefix CONFIG_
|
||||
### They can be set using the -D argument or cmake-gui(1) and are kept in cache
|
||||
### The option names are the same as the defines in lv_conf.h - so check it for a description
|
||||
|
||||
### INFO: When LV_BUILD_SET_CONFIG_OPTS is enabled - these options are set automatically
|
||||
### based on lv_conf.h or Kconfig
|
||||
|
||||
option(CONFIG_LV_BUILD_DEMOS "Build demos" ON)
|
||||
option(CONFIG_LV_BUILD_EXAMPLES "Build examples" ON)
|
||||
option(CONFIG_LV_USE_THORVG_INTERNAL "Use the internal version of ThorVG" ON)
|
||||
option(CONFIG_LV_USE_PRIVATE_API "If set - install the private headers" OFF)
|
||||
|
||||
############################## BUILD ######################################
|
||||
|
||||
if (LV_BUILD_CONF_PATH AND LV_BUILD_CONF_DIR)
|
||||
message(FATAL_ERROR "can not use LV_BUILD_CONF_DIR and LV_BUILD_CONF_PATH at the same time")
|
||||
endif()
|
||||
|
||||
if (LV_BUILD_USE_KCONFIG)
|
||||
# If Kconfig is used then enable PCPP
|
||||
set(LV_BUILD_SET_CONFIG_OPTS ON)
|
||||
endif()
|
||||
|
||||
if (LV_BUILD_SET_CONFIG_OPTS)
|
||||
# Python is required when LV_BUILD_SET_CONFIG_OPTS is enabled
|
||||
# PCPP is used to pre-process lv_conf_internal.h and it avoids setting
|
||||
# CONFIG_LV_USE or CONFIG_LV_BUILD options manually
|
||||
find_package(Python REQUIRED)
|
||||
endif()
|
||||
|
||||
# Determine if LVGL is built from a top-level directory
|
||||
get_directory_property(HAS_PARENT_SCOPE PARENT_DIRECTORY)
|
||||
|
||||
|
||||
# Set sources used for LVGL components
|
||||
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c
|
||||
${LVGL_ROOT_DIR}/src/*.S)
|
||||
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
|
||||
file(GLOB_RECURSE DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c)
|
||||
file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp
|
||||
${LVGL_ROOT_DIR}/src/others/vg_lite_tvg/*.cpp)
|
||||
|
||||
# Build LVGL library
|
||||
add_library(lvgl ${SOURCES})
|
||||
add_library(lvgl::lvgl ALIAS lvgl)
|
||||
|
||||
if (NOT LV_BUILD_USE_KCONFIG)
|
||||
|
||||
# Default - use the lv_conf.h configuration file
|
||||
target_compile_definitions(lvgl PUBLIC LV_KCONFIG_IGNORE)
|
||||
|
||||
message(STATUS ${LV_BUILD_CONF_PATH})
|
||||
|
||||
if (LV_BUILD_CONF_PATH)
|
||||
|
||||
set(CONF_PATH ${LV_BUILD_CONF_PATH})
|
||||
message(STATUS "Using configuration: ${CONF_PATH}")
|
||||
|
||||
if (NOT IS_ABSOLUTE ${CONF_PATH})
|
||||
file(REAL_PATH ${CONF_PATH} CONF_PATH BASE_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
message(STATUS "Converted to absolute path: ${CONF_PATH}")
|
||||
endif()
|
||||
|
||||
get_filename_component(CONF_INC_DIR ${CONF_PATH} DIRECTORY)
|
||||
|
||||
target_compile_definitions(lvgl PUBLIC LV_CONF_PATH="${CONF_PATH}")
|
||||
|
||||
elseif(LV_BUILD_CONF_DIR)
|
||||
|
||||
message(STATUS "Using lv_conf.h from the user-supplied configuration directory: ${LV_BUILD_CONF_DIR}")
|
||||
|
||||
set(CONF_INC_DIR ${LV_BUILD_CONF_DIR})
|
||||
|
||||
list(APPEND LVGL_PUBLIC_HEADERS ${CONF_INC_DIR}/lv_conf.h)
|
||||
|
||||
# Avoid compilation errors due to the relative path of the include directory
|
||||
if (NOT IS_ABSOLUTE ${CONF_INC_DIR})
|
||||
file(REAL_PATH ${CONF_INC_DIR} CONF_INC_DIR BASE_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
message(STATUS "Converted to absolute path: ${CONF_INC_DIR}")
|
||||
endif()
|
||||
|
||||
set(CONF_PATH ${CONF_INC_DIR}/lv_conf.h)
|
||||
|
||||
target_compile_definitions(lvgl PUBLIC LV_CONF_INCLUDE_SIMPLE)
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "Using lv_conf.h from the top-level project directory")
|
||||
|
||||
list(APPEND LVGL_PUBLIC_HEADERS ${CMAKE_SOURCE_DIR}/lv_conf.h)
|
||||
|
||||
set(CONF_INC_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(CONF_PATH ${CONF_INC_DIR}/lv_conf.h)
|
||||
|
||||
target_compile_definitions(lvgl PUBLIC LV_CONF_INCLUDE_SIMPLE)
|
||||
|
||||
endif()
|
||||
|
||||
# Check if lv_conf.h exists at the configured location
|
||||
if (NOT EXISTS ${CONF_PATH})
|
||||
message(FATAL_ERROR "Configuration file: ${CONF_PATH} - not found")
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
# Use kconfig
|
||||
# kconfig.cmake will generate the .config
|
||||
# and autoconf.h, which will be used by lv_conf_kconfig.h
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/kconfig.cmake)
|
||||
|
||||
# Set the flag to specify we are using kconfig, needed for the
|
||||
# generate_cmake_variables.py script.
|
||||
set(GEN_VARS_KCONFIG_MODE_FLAG --kconfig)
|
||||
|
||||
# If using Kconfig, we need to define additional definitions
|
||||
target_compile_definitions(lvgl PUBLIC
|
||||
"LV_CONF_SKIP"
|
||||
"LV_CONF_KCONFIG_EXTERNAL_INCLUDE=\"${KCONFIG_EXTERNAL_INCLUDE}\"")
|
||||
|
||||
endif()
|
||||
|
||||
if (LV_BUILD_LVGL_H_SYSTEM_INCLUDE)
|
||||
target_compile_definitions(lvgl PUBLIC LV_LVGL_H_INCLUDE_SYSTEM)
|
||||
elseif(LV_BUILD_LVGL_H_SIMPLE_INCLUDE)
|
||||
target_compile_definitions(lvgl PUBLIC LV_LVGL_H_INCLUDE_SIMPLE)
|
||||
endif()
|
||||
|
||||
|
||||
if (LV_BUILD_SET_CONFIG_OPTS)
|
||||
# Use the portable pcpp to preprocess lv_conf_internal.h
|
||||
|
||||
get_target_property(CONF_DEFINES lvgl COMPILE_DEFINITIONS)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python_EXECUTABLE} ${LVGL_ROOT_DIR}/scripts/preprocess_lv_conf_internal.py
|
||||
--input ${LVGL_ROOT_DIR}/src/lv_conf_internal.h
|
||||
--tmp_file ${CMAKE_CURRENT_BINARY_DIR}/tmp.h
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h
|
||||
--workfolder ${CMAKE_CURRENT_BINARY_DIR}
|
||||
--defs ${CONF_DEFINES}
|
||||
--include ${LVGL_ROOT_DIR} ${CMAKE_SOURCE_DIR} ${LVGL_ROOT_DIR}/src ${CONF_INC_DIR}
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
if(NOT "${ret}" STREQUAL "0")
|
||||
message(FATAL_ERROR "preprocess_lv_conf_internal.py failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
if(HAS_PARENT_SCOPE)
|
||||
# Also set the CONFIG_LV_USE_* and CONFIG_LV_BUILD_* configuration
|
||||
# on the parent scope
|
||||
set(PARENT_SCOPE_ARG "--parentscope")
|
||||
else()
|
||||
set(PARENT_SCOPE_ARG "")
|
||||
endif()
|
||||
|
||||
# Convert the expanded lv_conf_expanded.h to cmake variables
|
||||
execute_process(
|
||||
COMMAND ${Python_EXECUTABLE}
|
||||
${LVGL_ROOT_DIR}/scripts/generate_cmake_variables.py
|
||||
--input ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/lv_conf.cmake
|
||||
${PARENT_SCOPE_ARG}
|
||||
${GEN_VARS_KCONFIG_MODE_FLAG}
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
|
||||
if(NOT "${ret}" STREQUAL "0")
|
||||
message(FATAL_ERROR "generate_cmake_variables.py command failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
# This will set all CONFIG_LV_USE_* or CONFIG_LV_BUILD_* variables in cmake
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/lv_conf.cmake)
|
||||
endif()
|
||||
|
||||
# Set the configuration inc dir for all targets created in this CMakeLists.txt
|
||||
# CMAKE_CURRENT_SOURCE_DIR is necessary because the assets include lvgl/lvgl.h ...
|
||||
include_directories(${CONF_INC_DIR} ${LVGL_ROOT_DIR})
|
||||
|
||||
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${CONF_INC_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Propagate the compiler definitions set on LVGL to the rest of the targets
|
||||
# mentioned in this file
|
||||
get_target_property(COMP_DEF lvgl COMPILE_DEFINITIONS)
|
||||
|
||||
if(CONFIG_LV_USE_THORVG_INTERNAL)
|
||||
message(STATUS "Enabling the building of ThorVG internal")
|
||||
|
||||
add_library(lvgl_thorvg ${THORVG_SOURCES})
|
||||
add_library(lvgl::thorvg ALIAS lvgl_thorvg)
|
||||
target_include_directories(lvgl_thorvg PRIVATE ${LVGL_ROOT_DIR}/src/libs/thorvg)
|
||||
set_target_properties(lvgl_thorvg PROPERTIES COMPILE_DEFINITIONS "${COMP_DEF}")
|
||||
|
||||
# This tells cmake to link lvgl with lvgl_thorvg
|
||||
# The linker will resolve all dependencies when dynamic linking
|
||||
target_link_libraries(lvgl PRIVATE lvgl_thorvg)
|
||||
# During static linking, we need to create a cyclic dependency as thorvg also needs lvgl
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
target_link_libraries(lvgl_thorvg PRIVATE lvgl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT (CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
|
||||
set_source_files_properties(${LVGL_ROOT_DIR}/src/others/vg_lite_tvg/vg_lite_tvg.cpp
|
||||
PROPERTIES COMPILE_FLAGS -Wunused-parameter)
|
||||
endif()
|
||||
|
||||
# Build LVGL example library
|
||||
if(CONFIG_LV_BUILD_EXAMPLES)
|
||||
|
||||
message(STATUS "Enabling the building of examples")
|
||||
|
||||
add_library(lvgl_examples ${EXAMPLE_SOURCES})
|
||||
add_library(lvgl::examples ALIAS lvgl_examples)
|
||||
target_include_directories(lvgl_examples SYSTEM PUBLIC ${LVGL_ROOT_DIR}/examples)
|
||||
set_target_properties(lvgl_examples PROPERTIES COMPILE_DEFINITIONS "${COMP_DEF}")
|
||||
|
||||
# This tells cmake to link lvgl with lvgl_examples
|
||||
# PUBLIC allows code linking with LVGL to also use the library
|
||||
# The linker will resolve all dependencies when dynamic linking
|
||||
target_link_libraries(lvgl PUBLIC lvgl_examples)
|
||||
|
||||
# During static linking, we need to create a cyclic dependency as the examples also needs lvgl
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
target_link_libraries(lvgl_examples PRIVATE lvgl)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# Build LVGL demos library
|
||||
if(CONFIG_LV_BUILD_DEMOS)
|
||||
|
||||
message(STATUS "Enabling the building of demos")
|
||||
|
||||
add_library(lvgl_demos ${DEMO_SOURCES})
|
||||
add_library(lvgl::demos ALIAS lvgl_demos)
|
||||
target_include_directories(lvgl_demos SYSTEM PUBLIC ${LVGL_ROOT_DIR}/demos)
|
||||
set_target_properties(lvgl_demos PROPERTIES COMPILE_DEFINITIONS "${COMP_DEF}")
|
||||
|
||||
# This tells cmake to link lvgl with lvgl_examples
|
||||
# PUBLIC allows code linking with LVGL to also use the library
|
||||
# The linker will resolve all dependencies when dynamic linking
|
||||
target_link_libraries(lvgl PUBLIC lvgl_demos)
|
||||
|
||||
# During static linking, we need to create a cyclic dependency as the demos also needs lvgl
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
# If static linking - demos depends on fonts defined in lvgl
|
||||
# During dynamic linking, the linker is able to resolve everything
|
||||
target_link_libraries(lvgl_demos PRIVATE lvgl)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
############################## INSTALLATION ######################################
|
||||
|
||||
# Library and headers can be installed to system using make install
|
||||
file(GLOB LVGL_PUBLIC_HEADERS
|
||||
"${LVGL_ROOT_DIR}/lvgl.h"
|
||||
"${CONF_INC_DIR}/*.h"
|
||||
"${LVGL_ROOT_DIR}/lv_version.h")
|
||||
|
||||
if (CONFIG_LV_USE_PRIVATE_API)
|
||||
list(APPEND LVGL_PUBLIC_HEADERS "${LVGL_ROOT_DIR}/lvgl_private.h")
|
||||
endif()
|
||||
|
||||
if("${LIB_INSTALL_DIR}" STREQUAL "")
|
||||
set(LIB_INSTALL_DIR "lib")
|
||||
endif()
|
||||
if("${RUNTIME_INSTALL_DIR}" STREQUAL "")
|
||||
set(RUNTIME_INSTALL_DIR "bin")
|
||||
endif()
|
||||
if("${INC_INSTALL_DIR}" STREQUAL "")
|
||||
set(INC_INSTALL_DIR "include/lvgl")
|
||||
endif()
|
||||
|
||||
#Install public headers
|
||||
install(
|
||||
DIRECTORY "${LVGL_ROOT_DIR}/src"
|
||||
DESTINATION "${INC_INSTALL_DIR}"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
PATTERN "*_private.h" EXCLUDE)
|
||||
|
||||
if (CONFIG_LV_USE_PRIVATE_API)
|
||||
# Install private headers - only if required
|
||||
install(
|
||||
DIRECTORY "${LVGL_ROOT_DIR}/src"
|
||||
DESTINATION "${INC_INSTALL_DIR}"
|
||||
FILES_MATCHING
|
||||
PATTERN "*_private.h")
|
||||
endif()
|
||||
|
||||
|
||||
if (LV_BUILD_USE_KCONFIG)
|
||||
# When KConfig is used, copy the expanded conf header
|
||||
# and rename it to lv_conf.h
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h
|
||||
DESTINATION ${INC_INSTALL_DIR}
|
||||
RENAME lv_conf.h)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES ${LVGL_PUBLIC_HEADERS}
|
||||
DESTINATION "${INC_INSTALL_DIR}/")
|
||||
|
||||
# Install library
|
||||
set_target_properties(
|
||||
lvgl
|
||||
PROPERTIES OUTPUT_NAME lvgl
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
|
||||
# TODO: if LVGL is linked with something else eg Freetype, Pkgconfig file must contain -lfreetype2
|
||||
configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc @ONLY)
|
||||
configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" ${CMAKE_CURRENT_BINARY_DIR}/lv_version.h @ONLY)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc"
|
||||
DESTINATION "share/pkgconfig/")
|
||||
|
||||
# Install library thorvg
|
||||
if(CONFIG_LV_USE_THORVG_INTERNAL)
|
||||
|
||||
set_target_properties(
|
||||
lvgl_thorvg
|
||||
PROPERTIES OUTPUT_NAME lvgl_thorvg
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl_thorvg
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
|
||||
endif()
|
||||
|
||||
if(CONFIG_LV_BUILD_DEMOS)
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demos"
|
||||
DESTINATION "${INC_INSTALL_DIR}"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
|
||||
set_target_properties(
|
||||
lvgl_demos
|
||||
PROPERTIES OUTPUT_NAME lvgl_demos
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl_demos
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
|
||||
endif()
|
||||
|
||||
if(CONFIG_LV_BUILD_EXAMPLES)
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples"
|
||||
DESTINATION "${INC_INSTALL_DIR}"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
|
||||
set_target_properties(
|
||||
lvgl_examples
|
||||
PROPERTIES OUTPUT_NAME lvgl_examples
|
||||
VERSION ${LVGL_VERSION}
|
||||
SOVERSION ${LVGL_SOVERSION}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl_examples
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
|
||||
endif()
|
||||
|
||||
############################## SET GLOBAL VARIABLES ######################################
|
||||
|
||||
if (HAS_PARENT_SCOPE)
|
||||
# Set the configuration include directory on the top-level project
|
||||
# Useful so that it doesn't need to be determined a second time in the project itself
|
||||
set(LVGL_CONF_INC_DIR ${CONF_INC_DIR} PARENT_SCOPE)
|
||||
set(LVGL_CONF_PATH ${CONF_PATH} PARENT_SCOPE)
|
||||
set(LVGL_COMPILER_DEFINES ${COMP_DEF} PARENT_SCOPE)
|
||||
|
||||
else()
|
||||
# The file has been included by tests/CMakeLists.txt -
|
||||
# or somewhere else, set variable containing the normalized path of the include dir
|
||||
# containing the configuration file
|
||||
set(LVGL_CONF_INC_DIR ${CONF_INC_DIR})
|
||||
set(LVGL_CONF_PATH ${CONF_PATH})
|
||||
set(LVGL_COMPILER_DEFINES ${COMP_DEF})
|
||||
endif()
|
||||
+64
-59
@@ -1303,73 +1303,78 @@
|
||||
#define LV_QNX_BUF_COUNT 1 /**< 1 or 2 */
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
*==================*/
|
||||
/*=====================
|
||||
* BUILD OPTIONS
|
||||
*======================*/
|
||||
|
||||
/** Enable examples to be built with the library. */
|
||||
#define LV_BUILD_EXAMPLES 1
|
||||
|
||||
/** Build the demos */
|
||||
#define LV_BUILD_DEMOS 1
|
||||
|
||||
/*===================
|
||||
* DEMO USAGE
|
||||
====================*/
|
||||
|
||||
/** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
|
||||
/** Demonstrate usage of encoder and keyboard. */
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
|
||||
/** Benchmark your system */
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
|
||||
/** Render test for each primitive.
|
||||
* - Requires at least 480x272 display. */
|
||||
#define LV_USE_DEMO_RENDER 0
|
||||
|
||||
/** Stress test for LVGL */
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
|
||||
/** Music player demo */
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
#define LV_DEMO_MUSIC_SQUARE 0
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
#define LV_DEMO_MUSIC_ROUND 0
|
||||
#define LV_DEMO_MUSIC_LARGE 0
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#endif
|
||||
|
||||
/** Vector graphic demo */
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
|
||||
|
||||
/*---------------------------
|
||||
* Demos from lvgl/lv_demos
|
||||
---------------------------*/
|
||||
|
||||
/** Flex layout demo */
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT 0
|
||||
|
||||
/** Smart-phone like multi-language demo */
|
||||
#define LV_USE_DEMO_MULTILANG 0
|
||||
|
||||
/** Widget transformation demo */
|
||||
#define LV_USE_DEMO_TRANSFORM 0
|
||||
|
||||
/** Demonstrate scroll settings */
|
||||
#define LV_USE_DEMO_SCROLL 0
|
||||
|
||||
/*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/
|
||||
#define LV_USE_DEMO_EBIKE 0
|
||||
#if LV_USE_DEMO_EBIKE
|
||||
#define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/
|
||||
#endif
|
||||
|
||||
/** High-resolution demo */
|
||||
#define LV_USE_DEMO_HIGH_RES 0
|
||||
|
||||
/* Smart watch demo */
|
||||
#define LV_USE_DEMO_SMARTWATCH 0
|
||||
#if LV_BUILD_DEMOS
|
||||
/** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
|
||||
/** Demonstrate usage of encoder and keyboard. */
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
|
||||
/** Benchmark your system */
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
|
||||
/** Render test for each primitive.
|
||||
* - Requires at least 480x272 display. */
|
||||
#define LV_USE_DEMO_RENDER 0
|
||||
|
||||
/** Stress test for LVGL */
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
|
||||
/** Music player demo */
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
#define LV_DEMO_MUSIC_SQUARE 0
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
#define LV_DEMO_MUSIC_ROUND 0
|
||||
#define LV_DEMO_MUSIC_LARGE 0
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#endif
|
||||
|
||||
/** Vector graphic demo */
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
|
||||
|
||||
/*---------------------------
|
||||
* Demos from lvgl/lv_demos
|
||||
---------------------------*/
|
||||
|
||||
/** Flex layout demo */
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT 0
|
||||
|
||||
/** Smart-phone like multi-language demo */
|
||||
#define LV_USE_DEMO_MULTILANG 0
|
||||
|
||||
/** Widget transformation demo */
|
||||
#define LV_USE_DEMO_TRANSFORM 0
|
||||
|
||||
/** Demonstrate scroll settings */
|
||||
#define LV_USE_DEMO_SCROLL 0
|
||||
|
||||
/*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/
|
||||
#define LV_USE_DEMO_EBIKE 0
|
||||
#if LV_USE_DEMO_EBIKE
|
||||
#define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/
|
||||
#endif
|
||||
|
||||
/** High-resolution demo */
|
||||
#define LV_USE_DEMO_HIGH_RES 0
|
||||
|
||||
/* Smart watch demo */
|
||||
#define LV_USE_DEMO_SMARTWATCH 0
|
||||
#endif /* LV_BUILD_DEMOS */
|
||||
|
||||
/*--END OF LV_CONF_H--*/
|
||||
|
||||
|
||||
@@ -335,13 +335,14 @@ def write_c_array_file(
|
||||
header = f'''
|
||||
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
|
||||
#include "lvgl.h"
|
||||
#elif defined(LV_LVGL_H_INCLUDE_SYSTEM)
|
||||
#include <lvgl.h>
|
||||
#elif defined(LV_BUILD_TEST)
|
||||
#include "../lvgl.h"
|
||||
#else
|
||||
#include "lvgl/lvgl.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ fi
|
||||
cd ..
|
||||
|
||||
# Generate lv_conf
|
||||
LV_CONF_PATH=lvgl/configs/ci/docs/lv_conf_docs.h
|
||||
LV_CONF_PATH=`pwd`/lvgl/configs/ci/docs/lv_conf_docs.h
|
||||
|
||||
cp lvgl/lv_conf_template.h $LV_CONF_PATH
|
||||
python ./lvgl/scripts/generate_lv_conf.py \
|
||||
@@ -38,7 +38,7 @@ python ./lvgl/scripts/generate_lv_conf.py \
|
||||
|
||||
mkdir cmbuild
|
||||
cd cmbuild
|
||||
emcmake cmake .. -DLV_CONF_PATH=$LV_CONF_PATH -DLVGL_CHOSEN_DEMO=lv_example_noop -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
emcmake cmake .. -DLV_BUILD_CONF_PATH=$LV_CONF_PATH -DLVGL_CHOSEN_DEMO=lv_example_noop -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
emmake make -j$(nproc)
|
||||
rm -rf CMakeFiles
|
||||
cd ../..
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# Generate the cmake variables CONFIG_LV_USE_* from the
|
||||
# Generate the cmake variables CONFIG_LV_USE_* or CONFIG_LV_BUILD_* from the
|
||||
# preprocessed lv_conf_internal.h
|
||||
#
|
||||
# Author: David TRUAN (david.truan@edgemtech.ch)
|
||||
@@ -20,7 +20,7 @@ def fatal(msg):
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=""
|
||||
"Convert the expanded lv_conf_internal.h to cmake variables."
|
||||
"It converts all LV_USE_* configurations."
|
||||
"It converts all LV_USE_*, LV_BUILD_* configurations."
|
||||
)
|
||||
|
||||
parser.add_argument('--input', type=str, required=True, nargs='?',
|
||||
@@ -55,13 +55,14 @@ def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool, d
|
||||
fin = open(path_input)
|
||||
fout = open(path_output, "w", newline='')
|
||||
|
||||
# If we use Kconfig, we must check the CONFIG_LV_USE_* defines
|
||||
# If we use Kconfig, we must check the CONFIG_LV_USE_* and
|
||||
# CONFIG_LV_BUILD_* defines
|
||||
if kconfig:
|
||||
CONFIG_PATTERN="#define CONFIG_LV_USE"
|
||||
CONFIG_PATTERN="^#define +(CONFIG_LV_USE|CONFIG_LV_BUILD)"
|
||||
CONFIG_PREFIX=""
|
||||
# Otherwise check the LV_USE_* defines
|
||||
# Otherwise check the LV_USE_* and LV_BUILD_* defines
|
||||
else:
|
||||
CONFIG_PATTERN="#define LV_USE"
|
||||
CONFIG_PATTERN="^#define +(LV_USE|LV_BUILD)"
|
||||
CONFIG_PREFIX="CONFIG_"
|
||||
|
||||
|
||||
@@ -71,7 +72,7 @@ def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool, d
|
||||
|
||||
# Treat the LV_USE_STDLIB_* configs in a special way, as we need
|
||||
# to convert the define to full config with 1 value when enabled
|
||||
if line.startswith(f'{CONFIG_PATTERN}_STDLIB'):
|
||||
if re.search(f'{CONFIG_PATTERN}_STDLIB', line):
|
||||
|
||||
parts = line.split()
|
||||
if len(parts) < 3:
|
||||
@@ -88,7 +89,7 @@ def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool, d
|
||||
|
||||
# Treat the LV_USE_OS config in a special way, as we need
|
||||
# to convert the define to full config with 1 value when enabled
|
||||
if line.startswith(f'{CONFIG_PATTERN}_OS'):
|
||||
if re.search(f'{CONFIG_PATTERN}_OS', line):
|
||||
|
||||
parts = line.split()
|
||||
if len(parts) < 3:
|
||||
@@ -104,7 +105,8 @@ def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool, d
|
||||
write_set_cmd(fout, f'{CONFIG_PREFIX}{name} 1', is_parent_scope)
|
||||
|
||||
# For the rest of the configs, simply add CONFIG_ and write the name of the define
|
||||
# all LV_USE_* configs where the value is 0 or 1, as these are the one needed in cmake
|
||||
# all LV_USE_* or LV_BUILD_* configs where the value is 0 or 1,
|
||||
# as these are the ones that are needed in cmake
|
||||
# To detect the configuration of LVGL to perform conditional compilation/linking
|
||||
elif re.search(f'{CONFIG_PATTERN}.* +[01] *$', line):
|
||||
|
||||
|
||||
@@ -214,6 +214,22 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
|
||||
#define LV_USE_MEM_MONITOR 0
|
||||
#endif /*LV_USE_SYSMON*/
|
||||
|
||||
#if LV_BUILD_DEMOS == 0
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
#define LV_USE_DEMO_RENDER 0
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT 0
|
||||
#define LV_USE_DEMO_MULTILANG 0
|
||||
#define LV_USE_DEMO_TRANSFORM 0
|
||||
#define LV_USE_DEMO_SCROLL 0
|
||||
#define LV_USE_DEMO_EBIKE 0
|
||||
#define LV_USE_DEMO_HIGH_RES 0
|
||||
#define LV_USE_DEMO_SMARTWATCH 0
|
||||
#endif /* LV_BUILD_DEMOS */
|
||||
|
||||
#ifndef LV_USE_LZ4
|
||||
#if (LV_USE_LZ4_INTERNAL || LV_USE_LZ4_EXTERNAL)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
# generate the cmake variables
|
||||
#
|
||||
# Author: David TRUAN (david.truan@edgemtech.ch)
|
||||
# Author: Erik Tagirov (erik.tagirov@edgemtech.ch)
|
||||
#
|
||||
|
||||
import sys
|
||||
@@ -13,6 +14,8 @@ import subprocess
|
||||
import os
|
||||
import argparse
|
||||
import re
|
||||
import importlib.util
|
||||
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(description="Preprocess a C header file and remove indentation.")
|
||||
@@ -57,13 +60,23 @@ def preprocess_file(pcpp_exe, input_file, tmp_file, output_file, include_dirs, d
|
||||
exit(1)
|
||||
|
||||
|
||||
def remove_indentation(tmp_file, output_file):
|
||||
# Read the temporary files and return an array of lines
|
||||
def read_lines(tmp_file):
|
||||
|
||||
try:
|
||||
with open(tmp_file, "r") as f:
|
||||
lines = f.readlines()
|
||||
except Exception as e:
|
||||
print(f"Failed to pre-process file: {e}")
|
||||
exit(1)
|
||||
|
||||
clean_lines = []
|
||||
return lines
|
||||
|
||||
def remove_indentation(lines):
|
||||
|
||||
clean_lines = []
|
||||
|
||||
try:
|
||||
for line in lines:
|
||||
stripped = line.lstrip()
|
||||
|
||||
@@ -73,39 +86,68 @@ def remove_indentation(tmp_file, output_file):
|
||||
|
||||
clean_lines.append(stripped)
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
f.writelines(clean_lines)
|
||||
|
||||
print(f"Indentation removed. Cleaned output saved to {output_file}")
|
||||
|
||||
os.remove(tmp_file)
|
||||
print(f"Temporary preprocessed file {tmp_file} removed.")
|
||||
except Exception as e:
|
||||
print(f"Error during indentation removal: {e}")
|
||||
exit(1)
|
||||
|
||||
def install_pcpp_in_venv(workfolder:str) -> str:
|
||||
return clean_lines
|
||||
|
||||
# This is required - to avoid include errors when Kconfig is used and
|
||||
# LVGL is installed on the system - i.e when lvgl.h is used as a system include
|
||||
def add_include_guards(lines):
|
||||
|
||||
lines.insert(0, "#define LV_CONF_H\n\n")
|
||||
lines.insert(0, "#ifndef LV_CONF_H\n")
|
||||
lines.append("#endif /* END LV_CONF_H */\n")
|
||||
return lines
|
||||
|
||||
def init_venv(venv_path):
|
||||
"""
|
||||
Creates a virtual env named .venv inside `workfolder`
|
||||
and installs every dependecy inside `dependencies`
|
||||
Returns the path to pcpp
|
||||
Creates a virtual env named .venv in the `workfolder` directory
|
||||
It is usually set to the path of the build directory.
|
||||
If the .venv already exists it enters the venv
|
||||
Returns the path to the venv
|
||||
"""
|
||||
venv_path = os.path.join(workfolder, ".venv")
|
||||
try:
|
||||
if os.path.exists(venv_path) == False:
|
||||
# Create venv
|
||||
subprocess.check_call([sys.executable, "-m", "venv", venv_path])
|
||||
|
||||
# Enter venv
|
||||
venv_path = os.path.join(venv_path, ".venv")
|
||||
subprocess.check_call([sys.executable, "-m", "venv", venv_path])
|
||||
|
||||
if sys.platform == "win32":
|
||||
venv_pip = os.path.join(venv_path, "Scripts", "pip.exe")
|
||||
venv_pcpp = os.path.join(venv_path, "Scripts", "pcpp.exe")
|
||||
else:
|
||||
venv_pip = os.path.join(venv_path, "bin", "pip")
|
||||
venv_pcpp = os.path.join(venv_path, "bin", "pcpp")
|
||||
|
||||
subprocess.check_call([venv_pip, "install", "pcpp"])
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error setting up environnement: {e}")
|
||||
sys.exit(1)
|
||||
print(f"Error during the setup of python venv: {e}")
|
||||
exit(1)
|
||||
|
||||
return venv_path
|
||||
|
||||
def install_pcpp_in_venv(venv_path):
|
||||
"""
|
||||
Install pcpp a python implementation of the C pre-processor
|
||||
On success - Returns the path to pcpp, None on failure
|
||||
"""
|
||||
|
||||
if sys.platform == "win32":
|
||||
venv_pip = os.path.join(venv_path, "Scripts", "pip.exe")
|
||||
venv_pcpp = os.path.join(venv_path, "Scripts", "pcpp.exe")
|
||||
else:
|
||||
venv_pip = os.path.join(venv_path, "bin", "pip")
|
||||
venv_pcpp = os.path.join(venv_path, "bin", "pcpp")
|
||||
|
||||
if os.path.exists(venv_pcpp) == False:
|
||||
# Install pcpp
|
||||
try:
|
||||
subprocess.check_call([venv_pip, "install", "pcpp"])
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Failed to install PCPP: {e}")
|
||||
return None
|
||||
else:
|
||||
print("PCPP is already installed in venv")
|
||||
|
||||
|
||||
return venv_pcpp
|
||||
|
||||
@@ -113,10 +155,38 @@ def main():
|
||||
|
||||
args = get_args()
|
||||
|
||||
pcpp_exe = install_pcpp_in_venv(args.workfolder)
|
||||
# Check if PCPP is already present on the system
|
||||
# if it's not - create a python venv inside the workfolder directory
|
||||
# and install it there
|
||||
res = subprocess.run(["which", "pcpp"], capture_output=True)
|
||||
if res.returncode == 0:
|
||||
pcpp_exe = res.stdout.decode().replace("\n", "")
|
||||
print(f"Found PCPP: {pcpp_exe}")
|
||||
else:
|
||||
print("Failed to locate pcpp - installing it")
|
||||
venv_path = init_venv(args.workfolder)
|
||||
pcpp_exe = install_pcpp_in_venv(venv_path)
|
||||
if pcpp_exe is None:
|
||||
exit(1)
|
||||
|
||||
preprocess_file(pcpp_exe, args.input, args.tmp_file, args.output, args.include, args.defs)
|
||||
|
||||
remove_indentation(args.tmp_file, args.output)
|
||||
lines = read_lines(args.tmp_file)
|
||||
lines = remove_indentation(lines)
|
||||
lines = add_include_guards(lines)
|
||||
|
||||
# Write the resulting output header file with include guards and no indentation
|
||||
try:
|
||||
with open(args.output, "w") as f:
|
||||
f.writelines(lines)
|
||||
except Exception as e:
|
||||
print(f"Writing resulting file failed: {e}")
|
||||
exit(1)
|
||||
|
||||
print(f"Expanded configuration header saved to {args.output}")
|
||||
|
||||
os.remove(args.tmp_file)
|
||||
print(f"Temporary preprocessed file {args.tmp_file} removed.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
+190
-159
@@ -4204,9 +4204,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
*==================*/
|
||||
/*=====================
|
||||
* BUILD OPTIONS
|
||||
*======================*/
|
||||
|
||||
/** Enable examples to be built with the library. */
|
||||
#ifndef LV_BUILD_EXAMPLES
|
||||
@@ -4221,186 +4221,201 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Build the demos */
|
||||
#ifndef LV_BUILD_DEMOS
|
||||
#ifdef LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_BUILD_DEMOS
|
||||
#define LV_BUILD_DEMOS CONFIG_LV_BUILD_DEMOS
|
||||
#else
|
||||
#define LV_BUILD_DEMOS 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_BUILD_DEMOS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*===================
|
||||
* DEMO USAGE
|
||||
====================*/
|
||||
|
||||
/** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */
|
||||
#ifndef LV_USE_DEMO_WIDGETS
|
||||
#ifdef CONFIG_LV_USE_DEMO_WIDGETS
|
||||
#define LV_USE_DEMO_WIDGETS CONFIG_LV_USE_DEMO_WIDGETS
|
||||
#else
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Demonstrate usage of encoder and keyboard. */
|
||||
#ifndef LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
#ifdef CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
#else
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Benchmark your system */
|
||||
#ifndef LV_USE_DEMO_BENCHMARK
|
||||
#ifdef CONFIG_LV_USE_DEMO_BENCHMARK
|
||||
#define LV_USE_DEMO_BENCHMARK CONFIG_LV_USE_DEMO_BENCHMARK
|
||||
#else
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Render test for each primitive.
|
||||
* - Requires at least 480x272 display. */
|
||||
#ifndef LV_USE_DEMO_RENDER
|
||||
#ifdef CONFIG_LV_USE_DEMO_RENDER
|
||||
#define LV_USE_DEMO_RENDER CONFIG_LV_USE_DEMO_RENDER
|
||||
#else
|
||||
#define LV_USE_DEMO_RENDER 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Stress test for LVGL */
|
||||
#ifndef LV_USE_DEMO_STRESS
|
||||
#ifdef CONFIG_LV_USE_DEMO_STRESS
|
||||
#define LV_USE_DEMO_STRESS CONFIG_LV_USE_DEMO_STRESS
|
||||
#else
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Music player demo */
|
||||
#ifndef LV_USE_DEMO_MUSIC
|
||||
#ifdef CONFIG_LV_USE_DEMO_MUSIC
|
||||
#define LV_USE_DEMO_MUSIC CONFIG_LV_USE_DEMO_MUSIC
|
||||
#else
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#endif
|
||||
#endif
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
#ifndef LV_DEMO_MUSIC_SQUARE
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_SQUARE
|
||||
#define LV_DEMO_MUSIC_SQUARE CONFIG_LV_DEMO_MUSIC_SQUARE
|
||||
#if LV_BUILD_DEMOS
|
||||
/** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */
|
||||
#ifndef LV_USE_DEMO_WIDGETS
|
||||
#ifdef CONFIG_LV_USE_DEMO_WIDGETS
|
||||
#define LV_USE_DEMO_WIDGETS CONFIG_LV_USE_DEMO_WIDGETS
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_SQUARE 0
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_LANDSCAPE
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_LANDSCAPE
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE CONFIG_LV_DEMO_MUSIC_LANDSCAPE
|
||||
|
||||
/** Demonstrate usage of encoder and keyboard. */
|
||||
#ifndef LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
#ifdef CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_ROUND
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_ROUND
|
||||
#define LV_DEMO_MUSIC_ROUND CONFIG_LV_DEMO_MUSIC_ROUND
|
||||
|
||||
/** Benchmark your system */
|
||||
#ifndef LV_USE_DEMO_BENCHMARK
|
||||
#ifdef CONFIG_LV_USE_DEMO_BENCHMARK
|
||||
#define LV_USE_DEMO_BENCHMARK CONFIG_LV_USE_DEMO_BENCHMARK
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_ROUND 0
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_LARGE
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_LARGE
|
||||
#define LV_DEMO_MUSIC_LARGE CONFIG_LV_DEMO_MUSIC_LARGE
|
||||
|
||||
/** Render test for each primitive.
|
||||
* - Requires at least 480x272 display. */
|
||||
#ifndef LV_USE_DEMO_RENDER
|
||||
#ifdef CONFIG_LV_USE_DEMO_RENDER
|
||||
#define LV_USE_DEMO_RENDER CONFIG_LV_USE_DEMO_RENDER
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_LARGE 0
|
||||
#define LV_USE_DEMO_RENDER 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_AUTO_PLAY
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_AUTO_PLAY
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY CONFIG_LV_DEMO_MUSIC_AUTO_PLAY
|
||||
|
||||
/** Stress test for LVGL */
|
||||
#ifndef LV_USE_DEMO_STRESS
|
||||
#ifdef CONFIG_LV_USE_DEMO_STRESS
|
||||
#define LV_USE_DEMO_STRESS CONFIG_LV_USE_DEMO_STRESS
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Vector graphic demo */
|
||||
#ifndef LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
#ifdef CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
#else
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*---------------------------
|
||||
* Demos from lvgl/lv_demos
|
||||
---------------------------*/
|
||||
|
||||
/** Flex layout demo */
|
||||
#ifndef LV_USE_DEMO_FLEX_LAYOUT
|
||||
#ifdef CONFIG_LV_USE_DEMO_FLEX_LAYOUT
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT CONFIG_LV_USE_DEMO_FLEX_LAYOUT
|
||||
#else
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Smart-phone like multi-language demo */
|
||||
#ifndef LV_USE_DEMO_MULTILANG
|
||||
#ifdef CONFIG_LV_USE_DEMO_MULTILANG
|
||||
#define LV_USE_DEMO_MULTILANG CONFIG_LV_USE_DEMO_MULTILANG
|
||||
#else
|
||||
#define LV_USE_DEMO_MULTILANG 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Widget transformation demo */
|
||||
#ifndef LV_USE_DEMO_TRANSFORM
|
||||
#ifdef CONFIG_LV_USE_DEMO_TRANSFORM
|
||||
#define LV_USE_DEMO_TRANSFORM CONFIG_LV_USE_DEMO_TRANSFORM
|
||||
#else
|
||||
#define LV_USE_DEMO_TRANSFORM 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Demonstrate scroll settings */
|
||||
#ifndef LV_USE_DEMO_SCROLL
|
||||
#ifdef CONFIG_LV_USE_DEMO_SCROLL
|
||||
#define LV_USE_DEMO_SCROLL CONFIG_LV_USE_DEMO_SCROLL
|
||||
#else
|
||||
#define LV_USE_DEMO_SCROLL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/
|
||||
#ifndef LV_USE_DEMO_EBIKE
|
||||
#ifdef CONFIG_LV_USE_DEMO_EBIKE
|
||||
#define LV_USE_DEMO_EBIKE CONFIG_LV_USE_DEMO_EBIKE
|
||||
#else
|
||||
#define LV_USE_DEMO_EBIKE 0
|
||||
#endif
|
||||
#endif
|
||||
#if LV_USE_DEMO_EBIKE
|
||||
#ifndef LV_DEMO_EBIKE_PORTRAIT
|
||||
#ifdef CONFIG_LV_DEMO_EBIKE_PORTRAIT
|
||||
#define LV_DEMO_EBIKE_PORTRAIT CONFIG_LV_DEMO_EBIKE_PORTRAIT
|
||||
|
||||
/** Music player demo */
|
||||
#ifndef LV_USE_DEMO_MUSIC
|
||||
#ifdef CONFIG_LV_USE_DEMO_MUSIC
|
||||
#define LV_USE_DEMO_MUSIC CONFIG_LV_USE_DEMO_MUSIC
|
||||
#else
|
||||
#define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** High-resolution demo */
|
||||
#ifndef LV_USE_DEMO_HIGH_RES
|
||||
#ifdef CONFIG_LV_USE_DEMO_HIGH_RES
|
||||
#define LV_USE_DEMO_HIGH_RES CONFIG_LV_USE_DEMO_HIGH_RES
|
||||
#else
|
||||
#define LV_USE_DEMO_HIGH_RES 0
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
#ifndef LV_DEMO_MUSIC_SQUARE
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_SQUARE
|
||||
#define LV_DEMO_MUSIC_SQUARE CONFIG_LV_DEMO_MUSIC_SQUARE
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_SQUARE 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_LANDSCAPE
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_LANDSCAPE
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE CONFIG_LV_DEMO_MUSIC_LANDSCAPE
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_ROUND
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_ROUND
|
||||
#define LV_DEMO_MUSIC_ROUND CONFIG_LV_DEMO_MUSIC_ROUND
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_ROUND 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_LARGE
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_LARGE
|
||||
#define LV_DEMO_MUSIC_LARGE CONFIG_LV_DEMO_MUSIC_LARGE
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_LARGE 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DEMO_MUSIC_AUTO_PLAY
|
||||
#ifdef CONFIG_LV_DEMO_MUSIC_AUTO_PLAY
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY CONFIG_LV_DEMO_MUSIC_AUTO_PLAY
|
||||
#else
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Smart watch demo */
|
||||
#ifndef LV_USE_DEMO_SMARTWATCH
|
||||
#ifdef CONFIG_LV_USE_DEMO_SMARTWATCH
|
||||
#define LV_USE_DEMO_SMARTWATCH CONFIG_LV_USE_DEMO_SMARTWATCH
|
||||
#else
|
||||
#define LV_USE_DEMO_SMARTWATCH 0
|
||||
|
||||
/** Vector graphic demo */
|
||||
#ifndef LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
#ifdef CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC CONFIG_LV_USE_DEMO_VECTOR_GRAPHIC
|
||||
#else
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*---------------------------
|
||||
* Demos from lvgl/lv_demos
|
||||
---------------------------*/
|
||||
|
||||
/** Flex layout demo */
|
||||
#ifndef LV_USE_DEMO_FLEX_LAYOUT
|
||||
#ifdef CONFIG_LV_USE_DEMO_FLEX_LAYOUT
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT CONFIG_LV_USE_DEMO_FLEX_LAYOUT
|
||||
#else
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Smart-phone like multi-language demo */
|
||||
#ifndef LV_USE_DEMO_MULTILANG
|
||||
#ifdef CONFIG_LV_USE_DEMO_MULTILANG
|
||||
#define LV_USE_DEMO_MULTILANG CONFIG_LV_USE_DEMO_MULTILANG
|
||||
#else
|
||||
#define LV_USE_DEMO_MULTILANG 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Widget transformation demo */
|
||||
#ifndef LV_USE_DEMO_TRANSFORM
|
||||
#ifdef CONFIG_LV_USE_DEMO_TRANSFORM
|
||||
#define LV_USE_DEMO_TRANSFORM CONFIG_LV_USE_DEMO_TRANSFORM
|
||||
#else
|
||||
#define LV_USE_DEMO_TRANSFORM 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Demonstrate scroll settings */
|
||||
#ifndef LV_USE_DEMO_SCROLL
|
||||
#ifdef CONFIG_LV_USE_DEMO_SCROLL
|
||||
#define LV_USE_DEMO_SCROLL CONFIG_LV_USE_DEMO_SCROLL
|
||||
#else
|
||||
#define LV_USE_DEMO_SCROLL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/
|
||||
#ifndef LV_USE_DEMO_EBIKE
|
||||
#ifdef CONFIG_LV_USE_DEMO_EBIKE
|
||||
#define LV_USE_DEMO_EBIKE CONFIG_LV_USE_DEMO_EBIKE
|
||||
#else
|
||||
#define LV_USE_DEMO_EBIKE 0
|
||||
#endif
|
||||
#endif
|
||||
#if LV_USE_DEMO_EBIKE
|
||||
#ifndef LV_DEMO_EBIKE_PORTRAIT
|
||||
#ifdef CONFIG_LV_DEMO_EBIKE_PORTRAIT
|
||||
#define LV_DEMO_EBIKE_PORTRAIT CONFIG_LV_DEMO_EBIKE_PORTRAIT
|
||||
#else
|
||||
#define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** High-resolution demo */
|
||||
#ifndef LV_USE_DEMO_HIGH_RES
|
||||
#ifdef CONFIG_LV_USE_DEMO_HIGH_RES
|
||||
#define LV_USE_DEMO_HIGH_RES CONFIG_LV_USE_DEMO_HIGH_RES
|
||||
#else
|
||||
#define LV_USE_DEMO_HIGH_RES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Smart watch demo */
|
||||
#ifndef LV_USE_DEMO_SMARTWATCH
|
||||
#ifdef CONFIG_LV_USE_DEMO_SMARTWATCH
|
||||
#define LV_USE_DEMO_SMARTWATCH CONFIG_LV_USE_DEMO_SMARTWATCH
|
||||
#else
|
||||
#define LV_USE_DEMO_SMARTWATCH 0
|
||||
#endif
|
||||
#endif
|
||||
#endif /* LV_BUILD_DEMOS */
|
||||
|
||||
|
||||
|
||||
@@ -4437,6 +4452,22 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
|
||||
#define LV_USE_MEM_MONITOR 0
|
||||
#endif /*LV_USE_SYSMON*/
|
||||
|
||||
#if LV_BUILD_DEMOS == 0
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
#define LV_USE_DEMO_RENDER 0
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
#define LV_USE_DEMO_MUSIC 0
|
||||
#define LV_USE_DEMO_VECTOR_GRAPHIC 0
|
||||
#define LV_USE_DEMO_FLEX_LAYOUT 0
|
||||
#define LV_USE_DEMO_MULTILANG 0
|
||||
#define LV_USE_DEMO_TRANSFORM 0
|
||||
#define LV_USE_DEMO_SCROLL 0
|
||||
#define LV_USE_DEMO_EBIKE 0
|
||||
#define LV_USE_DEMO_HIGH_RES 0
|
||||
#define LV_USE_DEMO_SMARTWATCH 0
|
||||
#endif /* LV_BUILD_DEMOS */
|
||||
|
||||
#ifndef LV_USE_LZ4
|
||||
#if (LV_USE_LZ4_INTERNAL || LV_USE_LZ4_EXTERNAL)
|
||||
|
||||
+31
-15
@@ -123,26 +123,26 @@ elseif (OPTIONS_FULL_32BIT)
|
||||
elseif (OPTIONS_TEST_SYSHEAP)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP})
|
||||
filter_compiler_options (C TEST_LIBS ${SANITIZE_AND_COVERAGE_OPTIONS})
|
||||
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
|
||||
set (CONFIG_LV_BUILD_EXAMPLES OFF CACHE BOOL "disable examples" FORCE)
|
||||
set (ENABLE_TESTS ON)
|
||||
add_definitions(-DREF_IMGS_PATH="ref_imgs/")
|
||||
elseif (OPTIONS_TEST_DEFHEAP)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_DEFHEAP})
|
||||
filter_compiler_options (C TEST_LIBS ${SANITIZE_AND_COVERAGE_OPTIONS})
|
||||
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
|
||||
set (CONFIG_LV_BUILD_EXAMPLES OFF CACHE BOOL "disable examples" FORCE)
|
||||
set (ENABLE_TESTS ON)
|
||||
add_definitions(-DREF_IMGS_PATH="ref_imgs/")
|
||||
elseif (OPTIONS_TEST_MEMORYCHECK)
|
||||
# sanitizer is disabled because valgrind uses LD_PRELOAD and the
|
||||
# sanitizer lib needs to load first
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP})
|
||||
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
|
||||
set (CONFIG_LV_BUILD_EXAMPLES OFF CACHE BOOL "disable examples" FORCE)
|
||||
set (ENABLE_TESTS ON)
|
||||
add_definitions(-DREF_IMGS_PATH="ref_imgs/")
|
||||
elseif (OPTIONS_TEST_VG_LITE)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_VG_LITE} -DLVGL_CI_USING_SYS_HEAP ${SANITIZE_AND_COVERAGE_OPTIONS})
|
||||
filter_compiler_options (C TEST_LIBS ${SANITIZE_AND_COVERAGE_OPTIONS})
|
||||
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
|
||||
set (CONFIG_LV_BUILD_EXAMPLES OFF CACHE BOOL "disable examples" FORCE)
|
||||
set (ENABLE_TESTS ON)
|
||||
add_definitions(-DREF_IMGS_PATH="ref_imgs_vg_lite/")
|
||||
|
||||
@@ -170,14 +170,8 @@ if ($ENV{NON_AMD64_BUILD})
|
||||
set(CMAKE_LIBRARY_PATH "/usr/lib/i386-linux-gnu" CACHE PATH "search 32bit lib path firstly")
|
||||
endif()
|
||||
|
||||
# Set LV_CONF_PATH so custom.cmake knows about it before compiling lvgl
|
||||
# Used to preprocess lv_conf_internal.h with the test config
|
||||
set(LV_CONF_PATH "${LVGL_TEST_DIR}/src/lv_test_conf.h")
|
||||
set(LV_BUILD_TEST ON)
|
||||
# Options lvgl and examples are compiled with.
|
||||
set(COMPILE_OPTIONS
|
||||
-DLV_CONF_PATH="${LVGL_TEST_DIR}/src/lv_test_conf.h"
|
||||
-DLV_BUILD_TEST
|
||||
${BUILD_OPTIONS}
|
||||
${BUILD_TARGET_DEF}
|
||||
)
|
||||
@@ -262,21 +256,41 @@ endif()
|
||||
get_filename_component(LVGL_DIR ${LVGL_TEST_DIR} DIRECTORY)
|
||||
|
||||
# Include lvgl project file.
|
||||
# Set LV_BUILD_CONF_PATH so os_desktop.cmake knows about it before compiling lvgl
|
||||
# Used to preprocess lv_conf_internal.h with the test config
|
||||
set(LV_BUILD_CONF_PATH "${LVGL_TEST_DIR}/src/lv_test_conf.h" CACHE STRING "set test configuration")
|
||||
|
||||
include(${LVGL_DIR}/CMakeLists.txt)
|
||||
target_compile_options(lvgl PUBLIC $<$<COMPILE_LANGUAGE:C>: ${LVGL_C_COMPILE_OPTIONS}>)
|
||||
target_compile_options(lvgl PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${LVGL_CXX_COMPILE_OPTIONS}>)
|
||||
target_compile_definitions(lvgl PUBLIC LV_BUILD_TEST)
|
||||
if(NOT (CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
|
||||
target_compile_options(lvgl PUBLIC $<$<COMPILE_LANGUAGE:ASM>: ${LVGL_C_COMPILE_OPTIONS}>)
|
||||
endif()
|
||||
target_compile_options(lvgl PUBLIC $<$<COMPILE_LANGUAGE:CXX>: ${LVGL_CXX_COMPILE_OPTIONS}>)
|
||||
if (TARGET lvgl_examples)
|
||||
target_compile_options(lvgl_examples PUBLIC ${LVGL_C_COMPILE_OPTIONS})
|
||||
target_compile_options(lvgl PUBLIC $<$<COMPILE_LANGUAGE:ASM>:${LVGL_C_COMPILE_OPTIONS}>)
|
||||
endif()
|
||||
|
||||
if (TARGET lvgl_thorvg)
|
||||
target_compile_options(lvgl_thorvg PUBLIC $<$<COMPILE_LANGUAGE:C>:${LVGL_C_COMPILE_OPTIONS}>)
|
||||
target_compile_options(lvgl_thorvg PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${LVGL_CXX_COMPILE_OPTIONS}>)
|
||||
endif()
|
||||
|
||||
if (TARGET lvgl_examples)
|
||||
target_compile_options(lvgl_examples PUBLIC $<$<COMPILE_LANGUAGE:C>:${LVGL_C_COMPILE_OPTIONS}>)
|
||||
target_compile_options(lvgl_examples PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${LVGL_CXX_COMPILE_OPTIONS}>)
|
||||
endif()
|
||||
|
||||
if (TARGET lvgl_demos)
|
||||
target_compile_options(lvgl_demos PUBLIC $<$<COMPILE_LANGUAGE:C>:${LVGL_C_COMPILE_OPTIONS}>)
|
||||
target_compile_options(lvgl_demos PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${LVGL_CXX_COMPILE_OPTIONS}>)
|
||||
endif()
|
||||
|
||||
|
||||
# LVGL_CONF_DIR and LVGL_CONF_PATH are normalized and set by os_desktop.cmake
|
||||
|
||||
set(TEST_INCLUDE_DIRS
|
||||
$<BUILD_INTERFACE:${LVGL_TEST_DIR}/src>
|
||||
$<BUILD_INTERFACE:${LVGL_TEST_DIR}/unity>
|
||||
$<BUILD_INTERFACE:${LVGL_TEST_DIR}>
|
||||
$<BUILD_INTERFACE:${LVGL_CONF_DIR}>
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE TEST_IMAGES_SRC ${LVGL_TEST_DIR}/test_images/*.c)
|
||||
@@ -322,6 +336,7 @@ add_library(test_common
|
||||
)
|
||||
target_include_directories(test_common PUBLIC ${TEST_INCLUDE_DIRS})
|
||||
target_compile_options(test_common PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})
|
||||
target_compile_definitions(test_common PRIVATE LV_BUILD_TEST ${LVGL_COMPILER_DEFINES})
|
||||
|
||||
# Generate one test executable for each source file pair.
|
||||
# The sources in ${CMAKE_CURRENT_BINARY_DIR} is auto-generated, the
|
||||
@@ -455,6 +470,7 @@ endif()
|
||||
if (TEST_LIBS_FILES)
|
||||
add_library(test_libs STATIC ${TEST_LIBS_FILES})
|
||||
target_include_directories(test_libs PUBLIC ${TEST_INCLUDE_DIRS} "src/test_libs")
|
||||
target_compile_definitions(test_libs PRIVATE LV_BUILD_TEST ${LVGL_COMPILER_DEFINES})
|
||||
target_compile_options(test_libs PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})
|
||||
list(APPEND TEST_LIBS test_libs)
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
#include "../../libs/freetype/lv_freetype_private.h"
|
||||
#include "lvgl.h"
|
||||
#include "src/libs/freetype/lv_freetype_private.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user