Use infinitime_fonts target if fonts/CMakeLists.txt exists

Since https://github.com/InfiniTimeOrg/InfiniTime/pull/1097 the fonts
are generated. Support this new way of using fonts.

When InfiniTime isn't a subdirectory of InfiniSim we need to provide
the binary dir when using `add_subdirectory()`. Use `fonts`.

Update README with instructions to install `lv_font_conv`.
main
Reinhold Gschweicher 2022-05-10 23:56:45 +07:00 committed by NeroBurner
parent d9d729d40f
commit f0c6ef9cd6
2 changed files with 16 additions and 2 deletions

@ -238,6 +238,13 @@ set_target_properties(QCBOR PROPERTIES LINKER_LANGUAGE C)
# )
target_link_libraries(infinisim PRIVATE QCBOR)
if(EXISTS ${InfiniTime_DIR}/src/displayapp/fonts/CMakeLists.txt)
# available since https://github.com/InfiniTimeOrg/InfiniTime/pull/1097
message(STATUS "add subdirectory ${InfiniTime_DIR}/src/displayapp/fonts for 'infinitime_fonts' target")
add_subdirectory(${InfiniTime_DIR}/src/displayapp/fonts fonts)
target_link_libraries(infinisim PRIVATE infinitime_fonts)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Special case for SDL2 dependency, goal is to find a config that exports SDL2::SDL2 target
# libsdl2-dev has a `sdl2-config.cmake` that doesn't export this, but vcpkg does..

@ -14,17 +14,18 @@ For a history on how this simulator started and the challenges on its way visit
- CMake
- SDL2 (provides the simulator window, handles mouse and keyboard input)
- Compiler (g++ or clang++)
- [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))
On Ubuntu/Debian install the following packages:
```sh
sudo apt install -y cmake libsdl2-dev g++
sudo apt install -y cmake libsdl2-dev g++ npm
```
On Arch Linux the following packages are needed:
```sh
sudo pacman -S cmake sdl2 gcc
sudo pacman -S cmake sdl2 gcc npm
```
On Fedora the following packages are needed:
@ -33,6 +34,12 @@ On Fedora the following packages are needed:
sudo dnf install cmake SDL2-devel gcc
```
Then install the `lv_font_conv` executable to the source directory (will be installed at `node_modules/.bin/lv_font_conv`)
```sh
npm install lv_font_conv@1.5.2
```
## Get the Sources
Clone this repository and tell `git` to recursively download the submodules as well