Skip to content

Commit f4b729e

Browse files
committed
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`.
1 parent 3ae396c commit f4b729e

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

.github/workflows/lv_sim.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
- name: Install cmake
3030
uses: lukka/get-cmake@v3.18.3
3131

32-
- name: Install SDL2 development package
32+
- name: Install SDL2 and libpng development package
3333
run: |
3434
sudo apt-get update
35-
sudo apt-get -y install libsdl2-dev
35+
sudo apt-get -y install libsdl2-dev libpng-dev
3636
3737
- name: Install lv_font_conv
3838
run:

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
[submodule "lv_drivers"]
55
path = lv_drivers
66
url = ../../lvgl/lv_drivers.git
7-
[submodule "libpng"]
8-
path = libpng
9-
url = ../../glennrp/libpng.git

CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,9 @@ configure_file("${InfiniTime_DIR}/src/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}
317317

318318
option(WITH_PNG "Compile with libpng support to dump current screen as png" ON)
319319
if(WITH_PNG)
320+
find_package(PNG REQUIRED)
320321
target_compile_definitions(infinisim PRIVATE WITH_PNG)
321-
add_subdirectory(libpng EXCLUDE_FROM_ALL)
322-
target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
323-
target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/libpng")
324-
target_link_libraries(infinisim PRIVATE png_static)
322+
target_link_libraries(infinisim PRIVATE PNG::PNG)
325323
endif()
326324

327325
target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/gif-h")

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,24 @@ git submodule update --init --recursive
3131
- [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))
3232
- Note: requires Node.js v12.0.0 or later
3333
- [lv_img_conv](https://github.com/lvgl/lv_img_conv) (for `resource.zip` generation when `BUILD_RESOURCES=ON`, which is the default)
34+
- optional: `libpng`, see `-DWITH_PNG=ON` cmake setting below for more info
3435

3536
On Ubuntu/Debian install the following packages:
3637

3738
```sh
38-
sudo apt install -y cmake libsdl2-dev g++ npm
39+
sudo apt install -y cmake libsdl2-dev g++ npm libpng-dev
3940
```
4041

4142
On Arch Linux the following packages are needed:
4243

4344
```sh
44-
sudo pacman -S cmake sdl2 gcc npm
45+
sudo pacman -S cmake sdl2 gcc npm libpng
4546
```
4647

4748
On Fedora the following packages are needed:
4849

4950
```sh
50-
sudo dnf install cmake SDL2-devel gcc zlib-devel npm
51+
sudo dnf install cmake SDL2-devel g++ npm patch perl libpng-devel
5152
```
5253

5354
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
7879
The default value points to the InfiniTime submodule in this repository.
7980
- `-DMONITOR_ZOOM=1`: scale simulator window by this factor
8081
- `-DBUILD_RESOURCES=ON`: enable/disable `resource.zip` creation, will be created in the `<build-dir>/resources` folder
82+
- `-DWITH_PNG=ON`: enable/disable the screenshot to `PNG` support.
83+
Per default InfiniSim tries to use `libpng` to create screenshots in PNG format.
84+
This requires `libpng` development libraries as build and runtime dependency.
85+
Can be disabled with cmake config setting `-DWITH_PNG=OFF`.
8186

8287
## Run Simulator
8388

libpng

-1
This file was deleted.

main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#include <chrono>
6666
#include <ctime> // localtime
6767
#if defined(WITH_PNG)
68-
#include <libpng/png.h>
68+
#include <png.h>
6969
#endif
7070
#include <gif.h>
7171

0 commit comments

Comments
 (0)