-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
generalize lv-font creation #1131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Riksu9000
merged 3 commits into
InfiniTimeOrg:develop
from
NeroBurner:auto-generate-fonts-generalized
May 16, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,35 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
|
|
||
| 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) | ||
| 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") | ||
|
NeroBurner marked this conversation as resolved.
|
||
| configure_file(${CMAKE_CURRENT_LIST_DIR}/jetbrains_mono_bold_20.c_zero.patch | ||
| displayapp/fonts/jetbrains_mono_bold_20.c_zero.patch COPYONLY) | ||
| foreach(FONT ${FONTS}) | ||
| set_source_files_properties(displayapp/fonts/${FONT}.c | ||
| PROPERTIES GENERATED TRUE) | ||
| ${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() | ||
|
|
||
| add_custom_command(OUTPUT displayapp/fonts/${FONT}.c | ||
| COMMAND python ${CMAKE_CURRENT_LIST_DIR}/generate.py | ||
| -f ${FONT} ${CMAKE_CURRENT_LIST_DIR}/fonts.json | ||
| DEPENDS ${CMAKE_CURRENT_LIST_DIR}/fonts.json | ||
| WORKING_DIRECTORY displayapp/fonts | ||
| ) | ||
| # 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() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.