1# ----------------------------------------------------------------------------
2#  CMake file for libwebp. See root CMakeLists.txt
3#
4# ----------------------------------------------------------------------------
5project(${WEBP_LIBRARY})
6
7ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
8ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/cpu-features")
9
10file(GLOB lib_srcs dec/*.c dsp/*.c enc/*.c mux/*.c utils/*.c webp/*.c)
11file(GLOB lib_hdrs dec/*.h dsp/*.h enc/*.h mux/*.h utils/*.h webp/*.h)
12
13if(ANDROID AND ARMEABI_V7A AND NOT NEON)
14  foreach(file ${lib_srcs})
15    if("${file}" MATCHES "_neon.c")
16      set_source_files_properties("${file}" COMPILE_FLAGS "-mfpu=neon")
17    endif()
18  endforeach()
19endif()
20
21file(GLOB cpuf_s cpu-features/*.c)
22file(GLOB cpuf_h cpu-features/*.h)
23
24if(ANDROID)
25  set(lib_srcs ${lib_srcs} ${cpuf_s})
26  set(lib_hdrs ${lib_hdrs} ${cpuf_h})
27endif()
28
29# ----------------------------------------------------------------------------------
30#         Define the library target:
31# ----------------------------------------------------------------------------------
32
33add_definitions(-DWEBP_USE_THREAD)
34
35add_library(${WEBP_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
36
37if(UNIX)
38  if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
39    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
40  endif()
41endif()
42
43ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-variable -Wshadow -Wmaybe-uninitialized)
44ocv_warnings_disable(CMAKE_C_FLAGS /wd4244 /wd4267) # vs2005
45
46set_target_properties(${WEBP_LIBRARY}
47  PROPERTIES OUTPUT_NAME ${WEBP_LIBRARY}
48  DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
49  ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
50  )
51
52if(ENABLE_SOLUTION_FOLDERS)
53  set_target_properties(${WEBP_LIBRARY} PROPERTIES FOLDER "3rdparty")
54endif()
55
56if(NOT BUILD_SHARED_LIBS)
57  ocv_install_target(${WEBP_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
58endif()
59
60