1
0
Fork 0

Remove libpng submodule and require system lib

On rolling distros the usage of `libpng` submodule makes problems as the
`zlib` system dependency of said module gets updated. Then the submodule
regularly is too old to handle the updates `zlib` dependency.

Fix this maintenance churn by requiring `libpng` as system library as
well. Then the distros package manager keeps those versions in sync.

This unfortunately requires users to install a new runtime/build
dependency, but it still can be disabled with `-DWITH_PNG=OFF`.
This commit is contained in:
Reinhold Gschweicher 2023-09-05 22:52:09 +02:00
parent 3ae396c0a6
commit f4b729e00b
6 changed files with 13 additions and 14 deletions

View file

@ -29,10 +29,10 @@ jobs:
- name: Install cmake - name: Install cmake
uses: lukka/get-cmake@v3.18.3 uses: lukka/get-cmake@v3.18.3
- name: Install SDL2 development package - name: Install SDL2 and libpng development package
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get -y install libsdl2-dev sudo apt-get -y install libsdl2-dev libpng-dev
- name: Install lv_font_conv - name: Install lv_font_conv
run: run:

3
.gitmodules vendored
View file

@ -4,6 +4,3 @@
[submodule "lv_drivers"] [submodule "lv_drivers"]
path = lv_drivers path = lv_drivers
url = ../../lvgl/lv_drivers.git url = ../../lvgl/lv_drivers.git
[submodule "libpng"]
path = libpng
url = ../../glennrp/libpng.git

View file

@ -317,11 +317,9 @@ configure_file("${InfiniTime_DIR}/src/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}
option(WITH_PNG "Compile with libpng support to dump current screen as png" ON) option(WITH_PNG "Compile with libpng support to dump current screen as png" ON)
if(WITH_PNG) if(WITH_PNG)
find_package(PNG REQUIRED)
target_compile_definitions(infinisim PRIVATE WITH_PNG) target_compile_definitions(infinisim PRIVATE WITH_PNG)
add_subdirectory(libpng EXCLUDE_FROM_ALL) target_link_libraries(infinisim PRIVATE PNG::PNG)
target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/libpng")
target_link_libraries(infinisim PRIVATE png_static)
endif() endif()
target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/gif-h") target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/gif-h")

View file

@ -31,23 +31,24 @@ git submodule update --init --recursive
- [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)) - [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))
- Note: requires Node.js v12.0.0 or later - Note: requires Node.js v12.0.0 or later
- [lv_img_conv](https://github.com/lvgl/lv_img_conv) (for `resource.zip` generation when `BUILD_RESOURCES=ON`, which is the default) - [lv_img_conv](https://github.com/lvgl/lv_img_conv) (for `resource.zip` generation when `BUILD_RESOURCES=ON`, which is the default)
- optional: `libpng`, see `-DWITH_PNG=ON` cmake setting below for more info
On Ubuntu/Debian install the following packages: On Ubuntu/Debian install the following packages:
```sh ```sh
sudo apt install -y cmake libsdl2-dev g++ npm sudo apt install -y cmake libsdl2-dev g++ npm libpng-dev
``` ```
On Arch Linux the following packages are needed: On Arch Linux the following packages are needed:
```sh ```sh
sudo pacman -S cmake sdl2 gcc npm sudo pacman -S cmake sdl2 gcc npm libpng
``` ```
On Fedora the following packages are needed: On Fedora the following packages are needed:
```sh ```sh
sudo dnf install cmake SDL2-devel gcc zlib-devel npm sudo dnf install cmake SDL2-devel g++ npm patch perl libpng-devel
``` ```
Then install the `lv_font_conv` executable to the InfiniSim source directory (will be installed at `node_modules/.bin/lv_font_conv`) Then install the `lv_font_conv` executable to the InfiniSim source directory (will be installed at `node_modules/.bin/lv_font_conv`)
@ -78,6 +79,10 @@ The following configuration settings can be added to the first `cmake -S . -B bu
The default value points to the InfiniTime submodule in this repository. The default value points to the InfiniTime submodule in this repository.
- `-DMONITOR_ZOOM=1`: scale simulator window by this factor - `-DMONITOR_ZOOM=1`: scale simulator window by this factor
- `-DBUILD_RESOURCES=ON`: enable/disable `resource.zip` creation, will be created in the `<build-dir>/resources` folder - `-DBUILD_RESOURCES=ON`: enable/disable `resource.zip` creation, will be created in the `<build-dir>/resources` folder
- `-DWITH_PNG=ON`: enable/disable the screenshot to `PNG` support.
Per default InfiniSim tries to use `libpng` to create screenshots in PNG format.
This requires `libpng` development libraries as build and runtime dependency.
Can be disabled with cmake config setting `-DWITH_PNG=OFF`.
## Run Simulator ## Run Simulator

1
libpng

@ -1 +0,0 @@
Subproject commit 0a158f3506502dfa23edfc42790dfaed82efba17

View file

@ -65,7 +65,7 @@
#include <chrono> #include <chrono>
#include <ctime> // localtime #include <ctime> // localtime
#if defined(WITH_PNG) #if defined(WITH_PNG)
#include <libpng/png.h> #include <png.h>
#endif #endif
#include <gif.h> #include <gif.h>