Modified zlib search. Use system zlib on Android by default
This commit is contained in:
parent
b12f18536f
commit
a8f0c93379
3
3rdparty/CMakeLists.txt
vendored
3
3rdparty/CMakeLists.txt
vendored
@ -1,6 +1,3 @@
|
||||
if(NOT ZLIB_FOUND)
|
||||
add_subdirectory(zlib)
|
||||
endif()
|
||||
if(WITH_JASPER AND NOT JASPER_FOUND)
|
||||
add_subdirectory(libjasper)
|
||||
endif()
|
||||
|
7
3rdparty/libpng/CMakeLists.txt
vendored
7
3rdparty/libpng/CMakeLists.txt
vendored
@ -7,12 +7,7 @@ project(libpng)
|
||||
# List of C++ files:
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
else()
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../zlib")
|
||||
endif()
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
|
||||
file(GLOB lib_srcs *.c)
|
||||
file(GLOB lib_hdrs *.h)
|
||||
|
20
3rdparty/zlib/CMakeLists.txt
vendored
20
3rdparty/zlib/CMakeLists.txt
vendored
@ -37,11 +37,11 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein"
|
||||
"${OpenCV_BINARY_DIR}/zconf.h" @ONLY)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/zconf.h" @ONLY)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
set(ZLIB_PUBLIC_HDRS
|
||||
"${OpenCV_BINARY_DIR}/zconf.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/zconf.h"
|
||||
zlib.h
|
||||
)
|
||||
set(ZLIB_PRIVATE_HDRS
|
||||
@ -73,10 +73,8 @@ set(ZLIB_SRCS
|
||||
zutil.c
|
||||
)
|
||||
|
||||
set(the_target "zlib")
|
||||
|
||||
add_library(${the_target} STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
set_target_properties(${the_target} PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
add_library(${ZLIB_LIBRARY} STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
set_target_properties(${ZLIB_LIBRARY} PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
|
||||
if(UNIX)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
||||
@ -88,16 +86,16 @@ if(MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4013")
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
OUTPUT_NAME "${the_target}"
|
||||
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
|
||||
OUTPUT_NAME ${ZLIB_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
|
||||
)
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty")
|
||||
set_target_properties(${ZLIB_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${the_target} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||
install(TARGETS ${ZLIB_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||
endif()
|
||||
|
@ -148,6 +148,9 @@ OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests"
|
||||
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs" ON )
|
||||
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
|
||||
|
||||
# 3rdparty libs
|
||||
OCV_OPTION(BUILD_ZLIB "Build zlib from source instead of installed in the system" WIN32 OR IOS )
|
||||
|
||||
if(WIN32 OR ANDROID)
|
||||
set(OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE INTERNAL "Build 3rd party libraries")
|
||||
else()
|
||||
@ -424,7 +427,6 @@ endif()
|
||||
if (UNIX OR WIN32)
|
||||
if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
|
||||
message(STATUS "NOT OPENCV_BUILD_3RDPARTY_LIBS **************************************************")
|
||||
include(FindZLIB)
|
||||
if(WITH_PNG)
|
||||
include(FindPNG)
|
||||
if(PNG_FOUND)
|
||||
@ -468,12 +470,26 @@ if(WITH_JASPER AND NOT JASPER_FOUND)
|
||||
set(JASPER_LIBRARIES libjasper)
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_FOUND)
|
||||
set(ZLIB_LIBRARY zlib)
|
||||
################### zlib - always required
|
||||
if(NOT BUILD_ZLIB)
|
||||
if(ANDROID)
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_LIBRARY z)
|
||||
set(ZLIB_INCLUDE_DIR "")
|
||||
else()
|
||||
include(FindZLIB)
|
||||
endif()
|
||||
else()
|
||||
set(ZLIB_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
#message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")
|
||||
if(NOT ZLIB_FOUND)
|
||||
set(ZLIB_LIBRARY zlib)
|
||||
add_subdirectory(3rdparty/zlib)
|
||||
set(ZLIB_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/zlib" "${${ZLIB_LIBRARY}_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
################### OpenEXR
|
||||
if(WITH_OPENEXR)
|
||||
include(cmake/OpenCVFindOpenEXR.cmake)
|
||||
endif()
|
||||
@ -775,7 +791,7 @@ status(" OpenGL support:" HAVE_OPENGL THEN YES ELSE NO)
|
||||
# media
|
||||
status("")
|
||||
status(" Media I/O: ")
|
||||
status(" ZLib:" ZLIB_FOUND THEN ${ZLIB_FOUND} ELSE build)
|
||||
status(" ZLib:" ZLIB_FOUND THEN "${ZLIB_FOUND} - ${ZLIB_LIBRARY}" ELSE build)
|
||||
status(" JPEG:" NOT WITH_JPEG OR JPEG_FOUND THEN ${JPEG_FOUND} ELSE build)
|
||||
status(" PNG:" NOT WITH_PNG OR PNG_FOUND THEN ${PNG_FOUND} ELSE build)
|
||||
status(" TIFF:" NOT WITH_TIFF OR TIFF_FOUND THEN ${TIFF_FOUND} ELSE build)
|
||||
|
@ -1,9 +1,5 @@
|
||||
set(the_description "The Core Functionality")
|
||||
ocv_add_module(core ${ZLIB_LIBRARY})
|
||||
|
||||
if(NOT ZLIB_FOUND)
|
||||
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/zlib")
|
||||
endif()
|
||||
ocv_module_include_directories(${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if(HAVE_CUDA)
|
||||
|
@ -10,13 +10,8 @@ ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_androidcamera)
|
||||
set(GRFMT_LIBS "")
|
||||
|
||||
if(WITH_PNG OR WITH_TIFF OR WITH_OPENEXR)
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
set(GRFMT_LIBS ${GRFMT_LIBS} ${ZLIB_LIBRARIES})
|
||||
else()
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/zlib")
|
||||
set(GRFMT_LIBS ${GRFMT_LIBS} zlib)
|
||||
endif()
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
set(GRFMT_LIBS ${GRFMT_LIBS} ${ZLIB_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(WITH_JPEG)
|
||||
|
Loading…
x
Reference in New Issue
Block a user