diff --git a/.github/workflows/lv_sim.yml b/.github/workflows/lv_sim.yml index f66a656..5eb8599 100644 --- a/.github/workflows/lv_sim.yml +++ b/.github/workflows/lv_sim.yml @@ -29,10 +29,10 @@ jobs: - name: Install cmake uses: lukka/get-cmake@v3.18.3 - - name: Install SDL2 development package + - name: Install SDL2 and libpng development package run: | 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 run: diff --git a/.gitmodules b/.gitmodules index d49ae25..d98fed9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "lv_drivers"] path = lv_drivers url = ../../lvgl/lv_drivers.git -[submodule "libpng"] - path = libpng - url = ../../glennrp/libpng.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 11797f3..fc54529 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) if(WITH_PNG) + find_package(PNG REQUIRED) target_compile_definitions(infinisim PRIVATE WITH_PNG) - add_subdirectory(libpng EXCLUDE_FROM_ALL) - 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) + target_link_libraries(infinisim PRIVATE PNG::PNG) endif() target_include_directories(infinisim PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/gif-h") diff --git a/README.md b/README.md index 6c47721..0219c07 100644 --- a/README.md +++ b/README.md @@ -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)) - 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) +- optional: `libpng`, see `-WITH_PNG=OFF` cmake setting below for more info On Ubuntu/Debian install the following packages: ```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: ```sh -sudo pacman -S cmake sdl2 gcc npm +sudo pacman -S cmake sdl2 gcc npm libpng ``` On Fedora the following packages are needed: ```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`) @@ -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. - `-DMONITOR_ZOOM=1`: scale simulator window by this factor - `-DBUILD_RESOURCES=ON`: enable/disable `resource.zip` creation, will be created in the `/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 diff --git a/libpng b/libpng deleted file mode 160000 index 0a158f3..0000000 --- a/libpng +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0a158f3506502dfa23edfc42790dfaed82efba17 diff --git a/main.cpp b/main.cpp index 9962fcb..8070db7 100644 --- a/main.cpp +++ b/main.cpp @@ -65,7 +65,7 @@ #include #include // localtime #if defined(WITH_PNG) -#include +#include #endif #include