Skip to content

Commit 535ed3c

Browse files
authored
Merge pull request InfiniTimeOrg#70 from InfiniTimeOrg/build_resources_option
Add option BUILD_RESOURCES=ON to build resources for sim
2 parents 945693d + 51f6de6 commit 535ed3c

4 files changed

Lines changed: 31 additions & 1 deletion

File tree

.github/workflows/lv_sim.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ jobs:
3838
run:
3939
npm i -g lv_font_conv@1.5.2
4040

41+
- name: Install lv_img_conv
42+
run: |
43+
npm i -g ts-node@10.9.1 -g
44+
npm i -g @swc/core -g
45+
npm i -g lv_img_conv@0.3.0 -g
46+
4147
#########################################################################################
4248
# Checkout
4349

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,22 @@ if(EXISTS ${InfiniTime_DIR}/src/displayapp/fonts/CMakeLists.txt)
280280
target_link_libraries(infinisim PRIVATE infinitime_fonts)
281281
endif()
282282

283+
option(BUILD_RESOURCES "Generate a resource.zip file to install to spi.raw file" ON)
284+
if(BUILD_RESOURCES)
285+
if(EXISTS ${InfiniTime_DIR}/src/resources/CMakeLists.txt)
286+
# set verison variables as used in resources/CMakeLists.txt
287+
set(pinetime_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
288+
set(pinetime_VERSION_MINOR ${PROJECT_VERSION_MINOR})
289+
set(pinetime_VERSION_PATCH ${PROJECT_VERSION_PATCH})
290+
# available since https://github.com/InfiniTimeOrg/InfiniTime/pull/1097
291+
message(STATUS "add subdirectory ${InfiniTime_DIR}/src/resources for 'GenerateResources' target")
292+
add_subdirectory(${InfiniTime_DIR}/src/resources resources)
293+
add_dependencies(infinisim GenerateResources)
294+
else()
295+
message(FATAL_ERROR "BUILD_RESOURCES is enabled, but InfiniTime subdirectory has no resources/CMakeLists.txt file")
296+
endif()
297+
endif()
298+
283299
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
284300
# Special case for SDL2 dependency, goal is to find a config that exports SDL2::SDL2 target
285301
# libsdl2-dev has a `sdl2-config.cmake` that doesn't export this, but vcpkg does..

InfiniTime

Submodule InfiniTime updated 37 files

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ git submodule update --init --recursive
3030
- Compiler (g++ or clang++)
3131
- [lv_font_conv](https://github.com/lvgl/lv_font_conv#install-the-script) (for `font.c` generation since [InfiniTime#1097](https://github.com/InfiniTimeOrg/InfiniTime/pull/1097))
3232
- Note: requires Node.js v12.0.0 or later
33+
- [lv_img_conv](https://github.com/lvgl/lv_img_conv) (for `resource.zip` generation when `BUILD_RESOURCES=ON`, which is the default)
3334

3435
On Ubuntu/Debian install the following packages:
3536

@@ -55,6 +56,12 @@ Then install the `lv_font_conv` executable to the InfiniSim source directory (wi
5556
npm install lv_font_conv@1.5.2
5657
```
5758

59+
When you want to create a `resource.zip` file then install the `lv_img_conv` executable to the InfiniSim source directory (will be installed at `node_modules/.bin/lv_img_conv`)
60+
61+
```sh
62+
npm install ts-node@10.9.1 @swc/core lv_img_conv@0.3.0
63+
```
64+
5865
## Configure and Build
5966

6067
In the most basic configuration tell cmake to configure the project and build it with the following two commands:
@@ -70,6 +77,7 @@ The following configuration settings can be added to the first `cmake -S . -B bu
7077
Inside that directory the `src/libs/lvgl` submodule must be checked out as well.
7178
The default value points to the InfiniTime submodule in this repository.
7279
- `-DMONITOR_ZOOM=1`: scale simulator window by this factor
80+
- `-DBUILD_RESOURCES=ON`: enable/disable `resource.zip` creation, will be created in the `<build-dir>/resources` folder
7381

7482
## Run Simulator
7583

0 commit comments

Comments
 (0)