Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/3rdparty/libpng/CMakeLists.txt
16337 views
1
# ----------------------------------------------------------------------------
2
# CMake file for libpng. See root CMakeLists.txt
3
#
4
# ----------------------------------------------------------------------------
5
6
if(ENABLE_NEON)
7
project(${PNG_LIBRARY} C ASM)
8
else()
9
project(${PNG_LIBRARY} C)
10
endif()
11
12
if(NOT WIN32)
13
find_library(M_LIBRARY
14
NAMES m
15
PATHS /usr/lib /usr/local/lib
16
)
17
if(NOT M_LIBRARY)
18
message(STATUS "math lib 'libm' not found; floating point support disabled")
19
endif()
20
else()
21
# not needed on windows
22
set(M_LIBRARY "")
23
endif()
24
25
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIRS})
26
27
file(GLOB lib_srcs *.c)
28
file(GLOB lib_hdrs *.h)
29
30
31
if(ARM OR AARCH64)
32
if(ENABLE_NEON AND NOT AARCH64)
33
list(APPEND lib_srcs arm/arm_init.c arm/filter_neon.S arm/filter_neon_intrinsics.c)
34
add_definitions(-DPNG_ARM_NEON_OPT=2)
35
else()
36
add_definitions(-DPNG_ARM_NEON_OPT=0) # NEON assembler is not supported
37
endif()
38
endif()
39
40
if(";${CPU_BASELINE_FINAL};" MATCHES "SSE2"
41
AND (NOT MSVC OR (MSVC_VERSION GREATER 1799))) # MSVS2013+ (issue #7232)
42
list(APPEND lib_srcs intel/intel_init.c intel/filter_sse2_intrinsics.c)
43
add_definitions(-DPNG_INTEL_SSE)
44
endif()
45
46
if(PPC64LE OR PPC64)
47
if(ENABLE_VSX AND NOT PPC64)
48
list(APPEND lib_srcs powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c)
49
add_definitions(-DPNG_POWERPC_VSX_OPT=2)
50
else()
51
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
52
endif()
53
endif()
54
55
# ----------------------------------------------------------------------------------
56
# Define the library target:
57
# ----------------------------------------------------------------------------------
58
59
if(MSVC)
60
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
61
endif(MSVC)
62
63
add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
64
target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES})
65
66
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wimplicit-fallthrough)
67
68
set_target_properties(${PNG_LIBRARY}
69
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
70
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
71
COMPILE_PDB_NAME ${PNG_LIBRARY}
72
COMPILE_PDB_NAME_DEBUG "${PNG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
73
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
74
)
75
76
if(ENABLE_SOLUTION_FOLDERS)
77
set_target_properties(${PNG_LIBRARY} PROPERTIES FOLDER "3rdparty")
78
endif()
79
80
if(NOT BUILD_SHARED_LIBS)
81
ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
82
endif()
83
84
ocv_install_3rdparty_licenses(libpng LICENSE README opencv-libpng.patch)
85
86