Refactored cmake for 3rdparty libs

This commit is contained in:
Andrey Kamaev 2012-02-24 13:53:22 +00:00
parent 4a299acd48
commit 8141a5026c
11 changed files with 204 additions and 198 deletions

View File

@ -1,15 +1,3 @@
if(WITH_JASPER AND NOT JASPER_FOUND)
add_subdirectory(libjasper)
endif()
if(WITH_JPEG AND NOT JPEG_FOUND)
add_subdirectory(libjpeg)
endif()
if(WITH_PNG AND NOT PNG_FOUND)
add_subdirectory(libpng)
endif()
if(WITH_TIFF AND NOT TIFF_FOUND)
add_subdirectory(libtiff)
endif()
if(WIN32) if(WIN32)
add_subdirectory(ffmpeg) add_subdirectory(ffmpeg)
endif() endif()

View File

@ -2,7 +2,7 @@
# CMake file for libjasper. See root CMakeLists.txt # CMake file for libjasper. See root CMakeLists.txt
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
project(libjasper) project(${JASPER_LIBRARY})
add_definitions(-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT) add_definitions(-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT)
@ -19,9 +19,7 @@ file(GLOB lib_ext_hdrs jasper/*.h)
# Define the library target: # Define the library target:
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
set(the_target "libjasper") add_library(${JASPER_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
if(MSVC) if(MSVC)
string(REPLACE "/W3" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REPLACE "/W3" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
@ -39,20 +37,18 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration -Wno-unused") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration -Wno-unused")
endif() endif()
set_target_properties(${JASPER_LIBRARY}
set_target_properties(${the_target}
PROPERTIES PROPERTIES
OUTPUT_NAME "${the_target}" OUTPUT_NAME ${JASPER_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
) )
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") set_target_properties(${JASPER_LIBRARY} PROPERTIES FOLDER "3rdparty")
endif() endif()
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target} install(TARGETS ${JASPER_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif() endif()

View File

@ -2,7 +2,7 @@
# CMake file for libjpeg. See root CMakeLists.txt # CMake file for libjpeg. See root CMakeLists.txt
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
project(libjpeg) project(${JPEG_LIBRARY})
# List of C++ files: # List of C++ files:
@ -16,9 +16,7 @@ file(GLOB lib_hdrs *.h)
# Define the library target: # Define the library target:
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
set(the_target "libjpeg") add_library(${JPEG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs})
if(MSVC) if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
@ -34,17 +32,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1") set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1")
endif() endif()
set_target_properties(${the_target} set_target_properties(${JPEG_LIBRARY}
PROPERTIES OUTPUT_NAME "${the_target}" PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH} ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}
) )
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") set_target_properties(${JPEG_LIBRARY} PROPERTIES FOLDER "3rdparty")
endif() endif()
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target} install(TARGETS ${JPEG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif() endif()

View File

@ -2,7 +2,7 @@
# CMake file for libpng. See root CMakeLists.txt # CMake file for libpng. See root CMakeLists.txt
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
project(libpng) project(${PNG_LIBRARY})
# List of C++ files: # List of C++ files:
@ -16,9 +16,7 @@ file(GLOB lib_hdrs *.h)
# Define the library target: # Define the library target:
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
set(the_target "libpng") add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs})
if(MSVC) if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
@ -30,17 +28,16 @@ if(UNIX)
endif() endif()
endif() endif()
set_target_properties(${the_target} set_target_properties(${PNG_LIBRARY}
PROPERTIES OUTPUT_NAME "${the_target}" PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
) )
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") set_target_properties(${PNG_LIBRARY} PROPERTIES FOLDER "3rdparty")
endif() endif()
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target} install(TARGETS ${PNG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif() endif()

View File

@ -2,7 +2,7 @@
# CMake file for libtiff. See root CMakeLists.txt # CMake file for libtiff. See root CMakeLists.txt
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
project(libtiff) project(${TIFF_LIBRARY})
# List of C++ files: # List of C++ files:
@ -73,8 +73,6 @@ endif(WIN32)
file(GLOB lib_hdrs *.h*) file(GLOB lib_hdrs *.h*)
set(the_target "libtiff")
if(MSVC) if(MSVC)
string(REPLACE "/W4" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REPLACE "/W4" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "/W4" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REPLACE "/W4" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@ -86,24 +84,23 @@ if(UNIX)
endif() endif()
endif() endif()
add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs}) add_library(${TIFF_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(tif_stream.cxx PROPERTIES COMPILE_FLAGS "-Wno-sign-compare") set_source_files_properties(tif_stream.cxx PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
endif() endif()
set_target_properties(${the_target} set_target_properties(${TIFF_LIBRARY}
PROPERTIES PROPERTIES
OUTPUT_NAME "${the_target}" OUTPUT_NAME "${TIFF_LIBRARY}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
) )
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") set_target_properties(${TIFF_LIBRARY} PROPERTIES FOLDER "3rdparty")
endif() endif()
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target} install(TARGETS ${TIFF_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif() endif()

View File

@ -3,7 +3,7 @@
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
project(zlib C) project(${ZLIB_LIBRARY} C)
include(CheckTypeSize) include(CheckTypeSize)
include(CheckFunctionExists) include(CheckFunctionExists)

View File

@ -149,14 +149,11 @@ OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs"
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC ) OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
# 3rd party libs # 3rd party libs
OCV_OPTION(BUILD_ZLIB "Build zlib from source instead of installed in the system" WIN32 OR IOS ) OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR IOS )
OCV_OPTION(BUILD_TIFF "Build libtiff from source" WIN32 OR IOS OR ANDROID )
if(WIN32 OR ANDROID) OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR IOS OR ANDROID )
set(OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE INTERNAL "Build 3rd party libraries") OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR IOS OR ANDROID )
else() OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR IOS OR ANDROID )
# Build 3rdparty libraries under unix
set(OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries")
endif()
# OpenCV installation options # OpenCV installation options
# =================================================== # ===================================================
@ -424,75 +421,9 @@ if(UNIX)
add_definitions(-DHAVE_ALLOCA -DHAVE_ALLOCA_H -DHAVE_LIBPTHREAD -DHAVE_UNISTD_H) add_definitions(-DHAVE_ALLOCA -DHAVE_ALLOCA_H -DHAVE_LIBPTHREAD -DHAVE_UNISTD_H)
endif() endif()
endif() endif()
if (UNIX OR WIN32)
if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
message(STATUS "NOT OPENCV_BUILD_3RDPARTY_LIBS **************************************************")
if(WITH_PNG)
include(FindPNG)
if(PNG_FOUND)
CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/png.h HAVE_PNG_H)
CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/libpng/png.h HAVE_LIBPNG_PNG_H)
endif()
else()
set(PNG_FOUND FALSE)
endif()
if(WITH_TIFF)
include(FindTIFF)
else()
set(TIFF_FOUND FALSE)
endif()
if(WITH_JASPER)
include(FindJasper)
else()
set(JASPER_FOUND FALSE)
endif()
if(WITH_JPEG)
include(FindJPEG)
else()
set(JPEG_FOUND FALSE)
endif()
endif()
endif()
if(WITH_PNG AND NOT PNG_FOUND) # IO libraries
set(PNG_LIBRARIES libpng) include(cmake/OpenCVIOLibs.cmake REQUIRED)
endif()
if(WITH_JPEG AND NOT JPEG_FOUND)
set(JPEG_LIBRARIES libjpeg)
endif()
if(WITH_TIFF AND NOT TIFF_FOUND)
set(TIFF_LIBRARIES libtiff)
endif()
if(WITH_JASPER AND NOT JASPER_FOUND)
set(JASPER_LIBRARIES libjasper)
endif()
################### 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()
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()
#################### LATEX for dpf documentation ################## #################### LATEX for dpf documentation ##################
if(BUILD_DOCS) if(BUILD_DOCS)
@ -791,13 +722,30 @@ status(" OpenGL support:" HAVE_OPENGL THEN YES ELSE NO)
# media # media
status("") status("")
status(" Media I/O: ") status(" Media I/O: ")
status(" ZLib:" ZLIB_FOUND THEN "${ZLIB_FOUND} - ${ZLIB_LIBRARY}" ELSE build) status(" ZLib:" ZLIB_FOUND THEN "${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)
status(" JPEG 2000:" NOT WITH_JASPER OR JASPER_FOUND THEN ${JASPER_FOUND} ELSE build)
status(" OpenEXR:" WITH_OPENEXR AND OPENEXR_FOUND THEN YES ELSE NO)
if(WITH_JPEG)
status(" JPEG:" JPEG_FOUND THEN "${JPEG_LIBRARY}" ELSE build)
else()
status(" JPEG:" "NO")
endif()
if(WITH_PNG)
status(" PNG:" PNG_FOUND THEN "${PNG_LIBRARY}" ELSE build)
else()
status(" PNG:" "NO")
endif()
if(WITH_TIFF)
status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY}" ELSE build)
else()
status(" TIFF:" "NO")
endif()
if(WITH_JASPER)
status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY}" ELSE build)
else()
status(" JPEG 2000:" "NO")
endif()
status(" OpenEXR:" WITH_OPENEXR AND OPENEXR_FOUND THEN YES ELSE NO)
status(" OpenNI:" HAVE_OPENNI THEN YES ELSE NO) status(" OpenNI:" HAVE_OPENNI THEN YES ELSE NO)
status(" OpenNI PrimeSensor Modules:" status(" OpenNI PrimeSensor Modules:"
HAVE_OPENNI_PRIME_SENSOR_MODULE THEN YES ELSE NO) HAVE_OPENNI_PRIME_SENSOR_MODULE THEN YES ELSE NO)

94
cmake/OpenCVIOLibs.cmake Normal file
View File

@ -0,0 +1,94 @@
################### zlib - required
if(BUILD_ZLIB)
set(ZLIB_FOUND FALSE)
else()
if(ANDROID)
set(ZLIB_FOUND TRUE)
set(ZLIB_LIBRARY z)
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
set(ZLIB_INCLUDE_DIR "")
else()
include(FindZLIB)
endif()
endif()
if(NOT ZLIB_FOUND)
set(ZLIB_LIBRARY zlib)
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/zlib")
set(ZLIB_INCLUDE_DIR "${${ZLIB_LIBRARY}_SOURCE_DIR}" "${${ZLIB_LIBRARY}_BINARY_DIR}")
endif()
################### libtiff - optional
if(WITH_TIFF)
if(BUILD_TIFF)
set(TIFF_FOUND FALSE)
else()
include(FindTIFF)
endif()
endif()
if(WITH_TIFF AND NOT TIFF_FOUND)
set(TIFF_LIBRARY libtiff)
set(TIFF_LIBRARIES ${TIFF_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libtiff")
set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}")
endif()
################### libjpeg - optional
if(WITH_JPEG)
if(BUILD_JPEG)
set(JPEG_FOUND FALSE)
else()
include(FindJPEG)
endif()
endif()
if(WITH_JPEG AND NOT JPEG_FOUND)
set(JPEG_LIBRARY libjpeg)
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
endif()
################### libjasper - optional (should be searched after libjpeg)
if(WITH_JASPER)
if(BUILD_JASPER)
set(JASPER_FOUND FALSE)
else()
include(FindJasper)
endif()
endif()
if(WITH_JASPER AND NOT JASPER_FOUND)
set(JASPER_LIBRARY libjasper)
set(JASPER_LIBRARIES ${JASPER_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjasper")
set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}")
endif()
################### libpng - optional
if(WITH_PNG)
if(BUILD_PNG)
set(PNG_FOUND FALSE)
else()
include(FindPNG)
if(PNG_FOUND)
check_include_file(${PNG_PNG_INCLUDE_DIR}/png.h HAVE_PNG_H)
check_include_file(${PNG_PNG_INCLUDE_DIR}/libpng/png.h HAVE_LIBPNG_PNG_H)
endif()
endif()
endif()
if(WITH_PNG AND NOT PNG_FOUND)
set(PNG_LIBRARY libpng)
set(PNG_LIBRARIES ${PNG_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libpng")
set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}")
set(PNG_DEFINITIONS "")
endif()
################### OpenEXR - optional
if(WITH_OPENEXR)
include(cmake/OpenCVFindOpenEXR.cmake)
endif()

View File

@ -13,3 +13,12 @@ ocv_legacy_option(BUILD_NEW_PYTHON_SUPPORT BUILD_opencv_python)
ocv_legacy_option(BUILD_JAVA_SUPPORT BUILD_opencv_java) ocv_legacy_option(BUILD_JAVA_SUPPORT BUILD_opencv_java)
ocv_legacy_option(WITH_ANDROID_CAMERA BUILD_opencv_androidcamera) ocv_legacy_option(WITH_ANDROID_CAMERA BUILD_opencv_androidcamera)
if(DEFINED OPENCV_BUILD_3RDPARTY_LIBS)
set(BUILD_ZLIB ${OPENCV_BUILD_3RDPARTY_LIBS} CACHE BOOL "Set via depricated OPENCV_BUILD_3RDPARTY_LIBS" FORCE)
set(BUILD_TIFF ${OPENCV_BUILD_3RDPARTY_LIBS} CACHE BOOL "Set via depricated OPENCV_BUILD_3RDPARTY_LIBS" FORCE)
set(BUILD_JASPER ${OPENCV_BUILD_3RDPARTY_LIBS} CACHE BOOL "Set via depricated OPENCV_BUILD_3RDPARTY_LIBS" FORCE)
set(BUILD_JPEG ${OPENCV_BUILD_3RDPARTY_LIBS} CACHE BOOL "Set via depricated OPENCV_BUILD_3RDPARTY_LIBS" FORCE)
set(BUILD_PNG ${OPENCV_BUILD_3RDPARTY_LIBS} CACHE BOOL "Set via depricated OPENCV_BUILD_3RDPARTY_LIBS" FORCE)
unset(OPENCV_BUILD_3RDPARTY_LIBS CACHE)
endif()

View File

@ -1,5 +1,5 @@
set(the_description "The Core Functionality") set(the_description "The Core Functionality")
ocv_add_module(core ${ZLIB_LIBRARY}) ocv_add_module(core ${ZLIB_LIBRARIES})
ocv_module_include_directories(${ZLIB_INCLUDE_DIR}) ocv_module_include_directories(${ZLIB_INCLUDE_DIR})
if(HAVE_CUDA) if(HAVE_CUDA)

View File

@ -11,52 +11,32 @@ set(GRFMT_LIBS "")
if(WITH_PNG OR WITH_TIFF OR WITH_OPENEXR) if(WITH_PNG OR WITH_TIFF OR WITH_OPENEXR)
include_directories(${ZLIB_INCLUDE_DIR}) include_directories(${ZLIB_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${ZLIB_LIBRARY}) set(GRFMT_LIBS ${GRFMT_LIBS} ${ZLIB_LIBRARIES})
endif() endif()
if(WITH_JPEG) if(WITH_JPEG)
add_definitions(-DHAVE_JPEG) add_definitions(-DHAVE_JPEG)
if(JPEG_FOUND)
include_directories(${JPEG_INCLUDE_DIR}) include_directories(${JPEG_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${JPEG_LIBRARIES}) set(GRFMT_LIBS ${GRFMT_LIBS} ${JPEG_LIBRARIES})
else()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/libjpeg")
set(GRFMT_LIBS ${GRFMT_LIBS} libjpeg)
endif()
endif() endif()
if(WITH_PNG) if(WITH_PNG)
add_definitions(-DHAVE_PNG) add_definitions(-DHAVE_PNG)
if(PNG_FOUND)
add_definitions(${PNG_DEFINITIONS}) add_definitions(${PNG_DEFINITIONS})
include_directories(${PNG_INCLUDE_DIR}) include_directories(${PNG_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${PNG_LIBRARIES}) set(GRFMT_LIBS ${GRFMT_LIBS} ${PNG_LIBRARIES})
else()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/libpng")
set(GRFMT_LIBS ${GRFMT_LIBS} libpng)
endif()
endif() endif()
if(WITH_TIFF) if(WITH_TIFF)
add_definitions(-DHAVE_TIFF) add_definitions(-DHAVE_TIFF)
if(TIFF_FOUND)
include_directories(${TIFF_INCLUDE_DIR}) include_directories(${TIFF_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${TIFF_LIBRARIES}) set(GRFMT_LIBS ${GRFMT_LIBS} ${TIFF_LIBRARIES})
else()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/libtiff")
set(GRFMT_LIBS ${GRFMT_LIBS} libtiff)
endif()
endif() endif()
if(WITH_JASPER) if(WITH_JASPER)
add_definitions(-DHAVE_JASPER) add_definitions(-DHAVE_JASPER)
if(JASPER_FOUND)
include_directories(${JASPER_INCLUDE_DIR}) include_directories(${JASPER_INCLUDE_DIR})
set(GRFMT_LIBS ${GRFMT_LIBS} ${JASPER_LIBRARIES}) set(GRFMT_LIBS ${GRFMT_LIBS} ${JASPER_LIBRARIES})
else()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/libjasper")
set(GRFMT_LIBS ${GRFMT_LIBS} libjasper)
endif()
endif() endif()
if(WITH_OPENEXR AND OPENEXR_FOUND) if(WITH_OPENEXR AND OPENEXR_FOUND)