Skip to content

Commit 3929e26

Browse files
committed
spng encoder/decoder added as optional png codec
1 parent 50e8ad2 commit 3929e26

18 files changed

+8707
-12
lines changed

3rdparty/libspng/CMakeLists.txt

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ----------------------------------------------------------------------------
2+
# CMake file for libspng. See root CMakeLists.txt
3+
#
4+
# ----------------------------------------------------------------------------
5+
6+
project(${SPNG_LIBRARY})
7+
8+
set(CURR_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}")
9+
set_property(GLOBAL PROPERTY SPNG_INCLUDE_DIR ${CURR_INCLUDE_DIR})
10+
ocv_include_directories(${ZLIB_INCLUDE_DIRS})
11+
12+
file(GLOB_RECURSE spng_headers RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "*.h")
13+
file(GLOB_RECURSE spng_sources RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "*.c")
14+
15+
message(STATUS "libspng will be used as PNG codec")
16+
17+
# ----------------------------------------------------------------------------------
18+
# Define the library target:
19+
# ----------------------------------------------------------------------------------
20+
21+
if(MSVC)
22+
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
23+
endif(MSVC)
24+
25+
add_library(${SPNG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${spng_headers} ${spng_sources})
26+
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-variable)
27+
target_link_libraries(${SPNG_LIBRARY} ${ZLIB_LIBRARIES})
28+
29+
set_target_properties(${SPNG_LIBRARY}
30+
PROPERTIES OUTPUT_NAME ${SPNG_LIBRARY}
31+
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
32+
COMPILE_PDB_NAME ${SPNG_LIBRARY}
33+
COMPILE_PDB_NAME_DEBUG "${SPNG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
34+
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
35+
)
36+
37+
target_compile_definitions(${SPNG_LIBRARY} PUBLIC SPNG_STATIC)
38+
39+
if(ENABLE_SOLUTION_FOLDERS)
40+
set_target_properties(${SPNG_LIBRARY} PROPERTIES FOLDER "3rdparty")
41+
endif()
42+
43+
if(NOT BUILD_SHARED_LIBS)
44+
ocv_install_target(${SPNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
45+
endif()
46+
47+
ocv_install_3rdparty_licenses(${SPNG_LIBRARY} LICENSE)

3rdparty/libspng/LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2018-2022, Randy <[email protected]>
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)