1# ---------------------------------------------------------------------------- 2# CMake file for libpng. See root CMakeLists.txt 3# 4# ---------------------------------------------------------------------------- 5 6if(NEON) 7 project(${PNG_LIBRARY} ASM) 8else() 9 project(${PNG_LIBRARY}) 10endif() 11 12ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIRS}) 13 14file(GLOB lib_srcs *.c) 15file(GLOB lib_hdrs *.h) 16 17if(NEON AND ARM) 18 list(APPEND lib_srcs arm/filter_neon.S) 19 add_definitions(-DPNG_ARM_NEON) 20endif() 21 22# ---------------------------------------------------------------------------------- 23# Define the library target: 24# ---------------------------------------------------------------------------------- 25 26add_definitions(-DPNG_CONFIGURE_LIBPNG) 27 28if(MSVC) 29 add_definitions(-D_CRT_SECURE_NO_DEPRECATE) 30endif(MSVC) 31 32add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs}) 33target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES}) 34 35if(UNIX) 36 if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) 37 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 38 endif() 39endif() 40 41ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align) 42 43set_target_properties(${PNG_LIBRARY} 44 PROPERTIES OUTPUT_NAME ${PNG_LIBRARY} 45 DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" 46 ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} 47 ) 48 49if(ENABLE_SOLUTION_FOLDERS) 50 set_target_properties(${PNG_LIBRARY} PROPERTIES FOLDER "3rdparty") 51endif() 52 53if(NOT BUILD_SHARED_LIBS) 54 ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev) 55endif() 56