summaryrefslogtreecommitdiff
path: root/src/displayapp/fonts/CMakeLists.txt
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-06-06 18:27:54 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-06-06 23:09:58 (GMT)
commit7c45f185a32c7bcff47c8fda1acdec82d3213717 (patch)
tree53b0419fe2a19e6ec5c89d0be0a11dcd8d4ceb00 /src/displayapp/fonts/CMakeLists.txt
parent94b1b330fc1f6e941a797fedabade4e790e28bc2 (diff)
parent35dcf8c8607483c104711c9398d47d57147f4389 (diff)
Merge remote-tracking branch 'origin/develop' into analog24
Diffstat (limited to 'src/displayapp/fonts/CMakeLists.txt')
-rw-r--r--src/displayapp/fonts/CMakeLists.txt35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/displayapp/fonts/CMakeLists.txt b/src/displayapp/fonts/CMakeLists.txt
new file mode 100644
index 0000000..d00c802
--- /dev/null
+++ b/src/displayapp/fonts/CMakeLists.txt
@@ -0,0 +1,35 @@
+set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
+ jetbrains_mono_extrabold_compressed lv_font_navi_80 lv_font_sys_48
+ open_sans_light)
+find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
+ HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")
+message(STATUS "Using ${LV_FONT_CONV} to generate font files")
+configure_file(${CMAKE_CURRENT_LIST_DIR}/jetbrains_mono_bold_20.c_zero.patch
+ ${CMAKE_CURRENT_BINARY_DIR}/jetbrains_mono_bold_20.c_zero.patch COPYONLY)
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
+ # FindPython3 module introduces with CMake 3.12
+ # https://cmake.org/cmake/help/latest/module/FindPython3.html
+ find_package(Python3 REQUIRED)
+else()
+ set(Python3_EXECUTABLE "python")
+endif()
+
+# create static library building fonts
+add_library(infinitime_fonts STATIC)
+# add include directory to lvgl headers needed to compile the font files on its own
+target_include_directories(infinitime_fonts PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../libs")
+foreach(FONT ${FONTS})
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FONT}.c
+ COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/generate.py
+ --lv-font-conv "${LV_FONT_CONV}"
+ --font ${FONT} ${CMAKE_CURRENT_SOURCE_DIR}/fonts.json
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fonts.json
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ add_custom_target(infinitime_fonts_${FONT}
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FONT}.c
+ )
+ target_sources(infinitime_fonts PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${FONT}.c")
+ add_dependencies(infinitime_fonts infinitime_fonts_${FONT})
+endforeach()