Small improvement in generate-fonts.py following code review.

Add lv_img_conf in Docker image to build resources at build time.
This commit is contained in:
Jean-François Milants 2022-09-11 12:43:30 +02:00 committed by JF
parent cbe2f08cf7
commit e2a3d9f0c7
6 changed files with 39 additions and 3 deletions

View File

@ -54,6 +54,10 @@ if(BUILD_DFU)
set(BUILD_DFU true)
endif()
if(BUILD_RESOURCES)
set(BUILD_RESOURCES true)
endif()
set(TARGET_DEVICE "PINETIME" CACHE STRING "Target device")
set_property(CACHE TARGET_DEVICE PROPERTY STRINGS PINETIME MOY-TFK5 MOY-TIN5 MOY-TON5 MOY-UNK)
@ -98,6 +102,11 @@ if(BUILD_DFU)
else()
message(" * Build DFU (using adafruit-nrfutil) : Disabled")
endif()
if(BUILD_RESOURCES)
message(" * Build resources : Enabled")
else()
message(" * Build resources : Disabled")
endif()
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/Version.h)

View File

@ -22,6 +22,12 @@ RUN apt-get update -qq \
python3-dev \
git \
apt-utils \
pkg-config \
libpixman-1-dev \
libcairo2-dev \
libpango-1.0-0 \
ibpango1.0-dev \
libpangocairo-1.0-0 \
&& curl -sL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
@ -33,6 +39,10 @@ RUN pip3 install -Iv cryptography==3.3
RUN pip3 install cbor
RUN npm i lv_font_conv@1.5.2 -g
RUN npm i ts-node@10.9.1 -g
RUN npm i @swc/core -g
RUN npm i lv_img_conv@0.3.0 -g
# build.sh knows how to compile
COPY build.sh /opt/

View File

@ -11,6 +11,10 @@ export SOURCES_DIR="${SOURCES_DIR:=/sources}"
export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}"
export OUTPUT_DIR="${OUTPUT_DIR:=$SOURCES_DIR/build/output}"
# Specify a folder with read/write access to NPM
export NPM_DIR="$BUILD_DIR/npm"
export npm_config_cache="${NPM_DIR}"
export BUILD_TYPE=${BUILD_TYPE:=Release}
export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"}
export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
@ -62,7 +66,8 @@ CmakeGenerate() {
-DUSE_OPENOCD=1 \
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_PATH" \
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
-DBUILD_DFU=1
-DBUILD_DFU=1 \
-DBUILD_RESOURCES=1
}
CmakeBuild() {

View File

@ -15,6 +15,8 @@ cp "$BUILD_DIR/src/pinetime-mcuboot-app-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/p
cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin"
cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip"
cp "$BUILD_DIR/src/resources/infinitime-resources-$PROJECT_VERSION.zip" "$OUTPUT_DIR/infinitime-resources-$PROJECT_VERSION.zip"
mkdir -p "$OUTPUT_DIR/src"
cp $BUILD_DIR/src/*.bin "$OUTPUT_DIR/src/"
cp $BUILD_DIR/src/*.hex "$OUTPUT_DIR/src/"

View File

@ -940,6 +940,10 @@ add_custom_command(TARGET ${EXECUTABLE_NAME}
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_FILE_NAME}.out "${EXECUTABLE_FILE_NAME}.hex"
COMMENT "post build steps for ${EXECUTABLE_FILE_NAME}")
if(BUILD_RESOURCES)
add_dependencies(${EXECUTABLE_NAME} GenerateResources)
endif()
# Build binary intended to be used by bootloader
set(EXECUTABLE_MCUBOOT_NAME "pinetime-mcuboot-app")
set(EXECUTABLE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
@ -973,6 +977,10 @@ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME}
COMMENT "post build steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}"
)
if(BUILD_RESOURCES)
add_dependencies(${EXECUTABLE_MCUBOOT_NAME} GenerateResources)
endif()
if(BUILD_DFU)
add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME}
POST_BUILD
@ -1127,7 +1135,9 @@ if(BUILD_DFU)
)
endif()
add_subdirectory(resources)
if(BUILD_RESOURCES)
add_subdirectory(resources)
endif()
# FLASH

View File

@ -20,7 +20,7 @@ class Source(object):
def gen_lvconv_line(lv_font_conv: str, dest: str, size: int, bpp: int, format: str, sources: typing.List[Source], compress:bool=False):
if format != "lvgl" and format != "bin":
format = "lvgl"
format = "bin" if dest.lower().endswith(".bin") else "lvgl"
args = [lv_font_conv, '--size', str(size), '--output', dest, '--bpp', str(bpp), '--format', format]
if not compress: