Fix libpng submodule usage

The current usage used the system `png.h` header instead of the intended
submodule header. This may break if the system header isn't at
`libpng16/png.h`.

Fix the include header to get the genreated include files and the
`png.h` from the submodule as described in
https://github.com/glennrp/libpng/issues/342#issuecomment-864589614

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/19
This commit is contained in:
Reinhold Gschweicher 2022-04-03 20:05:33 +02:00 committed by NeroBurner
parent 8507c601fb
commit d4e81ca177
2 changed files with 3 additions and 1 deletions

View File

@ -236,6 +236,8 @@ option(WITH_PNG "Compile with libpng support to dump current screen as png" ON)
if(WITH_PNG)
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)
endif()

View File

@ -61,7 +61,7 @@
#include <date/date.h>
#include <chrono>
#if defined(WITH_PNG)
#include <libpng16/png.h>
#include <libpng/png.h>
#endif
/*********************