From f7ed8ad71dc9fa46f33e2e92b78bcfc5bbf1477e Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Thu, 12 Oct 2017 14:35:22 +0200 Subject: [PATCH] Require PNG++ for building. --- CMakeLists.txt | 5 +++ README.md | 1 + cmake/modules/Findpng++.cmake | 61 +++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 cmake/modules/Findpng++.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 80a3451..012d9a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,3 +37,8 @@ target_link_libraries(fmri ${Caffe_LIBRARIES}) find_package(Glog REQUIRED) include_directories(${GLOG_INCLUDE_DIRS}) target_link_libraries(fmri ${GLOG_LIBRARIES}) + +# Require png++ +find_package(png++ REQUIRED) +include_directories(${png++_INCLUDE_DIRS}) +target_link_libraries(fmri ${png++-LIBRARIES}) diff --git a/README.md b/README.md index 10344c4..a754160 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The following programs/libraries need to be installed on your system: - Google log (glog) - OpenCV - Boost System +- PNG++ Note that most of these are dependencies of Caffe, and thus will probably already be on your system. diff --git a/cmake/modules/Findpng++.cmake b/cmake/modules/Findpng++.cmake new file mode 100644 index 0000000..ac893c9 --- /dev/null +++ b/cmake/modules/Findpng++.cmake @@ -0,0 +1,61 @@ +# - Try to find png++ +# +# The following variables are optionally searched for defaults +# png++_ROOT_DIR: Base directory where all png++ components are found +# +# The following are set after configuration is done: +# png++_FOUND +# png++_INCLUDE_DIRS +# png++_LIBRARIES + +find_package(PNG REQUIRED) + +include(FindPackageHandleStandardArgs) + +set(png++_ROOT_DIR "" CACHE PATH "Folder contains png++") + +find_path(png++_INCLUDE_DIR + NAMES + png++/color.hpp + png++/config.hpp + png++/consumer.hpp + png++/convert_color_space.hpp + png++/end_info.hpp + png++/error.hpp + png++/ga_pixel.hpp + png++/generator.hpp + png++/gray_pixel.hpp + png++/image.hpp + png++/image_info.hpp + png++/index_pixel.hpp + png++/info.hpp + png++/info_base.hpp + png++/io_base.hpp + png++/packed_pixel.hpp + png++/palette.hpp + png++/pixel_buffer.hpp + png++/pixel_traits.hpp + png++/png.hpp + png++/reader.hpp + png++/require_color_space.hpp + png++/rgb_pixel.hpp + png++/rgba_pixel.hpp + png++/streaming_base.hpp + png++/tRNS.hpp + png++/types.hpp + png++/writer.hpp + PATHS + ${png++_ROOT_DIR} + PATH_SUFFIXES + src) + +set(png++_INCLUDE_DIRS ${png++_INCLUDE_DIR} ${PNG_INCLUDE_DIRS}) +set(png++_LIBRARIES ${PNG_LIBRARIES}) + +find_package_handle_standard_args(png++ DEFAULT_MSG + png++_INCLUDE_DIR) + +if(png++_FOUND) + set(png++_INCLUDE_DIRS ${png++_INCLUDE_DIR}) + set(png++_LIBRARIES ${png++_LIBRARY}) +endif()