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