opencv_zlib renamed back to zlib; make static libs work on Windows

pull/13383/head
Vadim Pisarevsky 14 years ago
parent 8b4cb1d99c
commit 0de9c9fd3c
  1. 2
      3rdparty/CMakeLists.txt
  2. 6
      3rdparty/zlib/CMakeLists.txt
  3. 45
      CMakeLists.txt
  4. 35
      OpenCVConfig.cmake.in
  5. 2
      OpenCVFindOpenEXR.cmake
  6. 6
      Package.cmake.in
  7. 2
      modules/core/CMakeLists.txt
  8. 37
      modules/highgui/CMakeLists.txt
  9. 5
      samples/CMakeLists.txt
  10. 2
      samples/cpp/camshiftdemo.cpp
  11. 4
      samples/cpp/drawing.cpp
  12. 2
      samples/cpp/ffilldemo.cpp
  13. 3
      tests/CMakeLists.txt

@ -17,6 +17,6 @@ if(WITH_TIFF AND NOT TIFF_FOUND)
add_subdirectory(libtiff)
endif()
if(NOT ANDROID)
if(0)
add_subdirectory(gtest)
endif()

@ -1,11 +1,11 @@
if(ANDROID)
define_3rdparty_module(opencv_zlib)
define_3rdparty_module(zlib)
else()
# ----------------------------------------------------------------------------
# CMake file for zlib. See root CMakeLists.txt
#
# ----------------------------------------------------------------------------
PROJECT(opencv_zlib)
PROJECT(zlib)
# List of C++ files:
@ -18,7 +18,7 @@ file(GLOB lib_srcs *.c)
file(GLOB lib_hdrs *.h)
set(lib_ext_hdrs "../include/zlib.h" "../include/zconf.h")
set(the_target "opencv_zlib")
set(the_target "zlib")
add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})

@ -474,6 +474,24 @@ if(UNIX)
endif()
endif()
if(WITH_PNG AND NOT PNG_FOUND)
set(PNG_LIBRARIES libpng)
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()
message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")
if(WITH_OPENEXR)
include(OpenCVFindOpenEXR.cmake)
endif()
@ -778,6 +796,31 @@ if(IPP_FOUND AND USE_IPP)
${A}ippcore${IPP_ARCH}${L}${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
################## Extra HighGUI libs on Windows ###################
if(WIN32)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} comctl32 gdi32 ole32)
if (MSVC)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32)
endif()
if(MINGW)
if(MINGW64)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} msvfw32 avifil32 avicap32 winmm)
if(HAVE_VIDEOINPUT)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput64 strmiids)
endif()
else()
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32 winmm)
if(HAVE_VIDEOINPUT)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput strmiids)
endif()
endif()
endif()
endif()
################## LATEX ##################
set(BUILD_LATEX_DOCS OFF CACHE BOOL "Build LaTeX OpenCV Documentation")
@ -1192,7 +1235,7 @@ if(BUILD_PACKAGE)
endif()
install(DIRECTORY data samples DESTINATION "." COMPONENT main PATTERN ".svn" EXCLUDE)
install(DIRECTORY 3rdparty android modules tests utils DESTINATION "." COMPONENT src PATTERN ".svn" EXCLUDE)
install(DIRECTORY 3rdparty android modules tests DESTINATION "." COMPONENT src PATTERN ".svn" EXCLUDE)
install(DIRECTORY doc/ DESTINATION doc COMPONENT src FILES_MATCHING PATTERN "*.tex")
install(DIRECTORY doc/pics DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)
install(DIRECTORY doc/latex2sphinx DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)

@ -82,24 +82,25 @@ endif(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL "")
# many more dependencies:
IF (NOT @OPENCV_BUILD_SHARED_LIB@)
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:
if(UNIX)
LINK_DIRECTORIES(@CMAKE_LIB_DIRS_CONFIGCMAKE@/../3rdparty/lib)
else()
LINK_DIRECTORIES(@CMAKE_LIB_DIRS_CONFIGCMAKE@/../3rdparty/lib)
if(WIN32)
LINK_DIRECTORIES(@CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@/3rdparty/lib)
endif()
SET(OpenCV_LIBS
@OPENCV_LINKER_LIBS@
@IPP_LIBS@
@JPEG_LIBRARIES@
@PNG_LIBRARIES@
@TIFF_LIBRARIES@
@JASPER_LIBRARIES@
@HIGHGUI_LIBRARIES@
${OpenCV_LIBS}
opencv_zlib
opencv_lapack) # The standard libs BEFORE (OpenCV_LIBS) since these can have "debug","optimized".
endif()
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS})
set(OPENCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ zlib opencv_lapack)
if (CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 4)
foreach(__EXTRA_LIB ${OPENCV_EXTRA_COMPONENTS})
set(OpenCV_LIBS ${OpenCV_LIBS}
debug ${__EXTRA_LIB}@OPENCV_DEBUG_POSTFIX@
optimized ${__EXTRA_LIB})
endforeach(__EXTRA_LIB)
else(CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 4)
set(OpenCV_LIBS ${OpenCV_LIBS} ${OPENCV_EXTRA_COMPONENTS})
endif(CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 4)
ENDIF(NOT @OPENCV_BUILD_SHARED_LIB@)

@ -44,7 +44,7 @@ FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
SET(OPENEXR_FOUND TRUE)
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR")
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} opencv_zlib CACHE STRING "The libraries needed to use OpenEXR")
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} zlib CACHE STRING "The libraries needed to use OpenEXR")
ENDIF ()
IF(OPENEXR_FOUND)

@ -47,7 +47,9 @@ set(CPACK_SOURCE_IGNORE_FILES
"/build/"
"/lib/"
"/interfaces/"
"/utils/"
"/swig_python/"
"/octave/"
"/gtest/"
"~$"
"\\\\.aux$"
"\\\\.bbl$"
@ -58,6 +60,8 @@ set(CPACK_SOURCE_IGNORE_FILES
"\\\\.log$"
"\\\\.toc$"
"\\\\.out$"
"\\\\.pyc$"
"\\\\.pyo$"
"\\\\.vcproj$"
"/1$"
"${CPACK_SOURCE_IGNORE_FILES}")

@ -1,3 +1,3 @@
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include")
set(deps opencv_lapack opencv_zlib)
set(deps opencv_lapack zlib)
define_opencv_module(core ${deps})

@ -264,53 +264,28 @@ endif(MSVC)
add_dependencies(${the_target} opencv_core opencv_imgproc)
# Add the required libraries for linking:
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES} ${HIGHGUI_LIBRARIES} ${OPENEXR_LIBRARIES})
if(WITH_JASPER AND NOT JASPER_FOUND)
add_dependencies(${the_target} libjasper)
target_link_libraries(${the_target} libjasper)
#target_link_libraries(${the_target} libjasper)
endif()
if(WITH_JPEG AND NOT JPEG_FOUND)
add_dependencies(${the_target} libjpeg)
target_link_libraries(${the_target} libjpeg)
#target_link_libraries(${the_target} libjpeg)
endif()
if(WITH_PNG AND NOT PNG_FOUND)
add_dependencies(${the_target} libpng opencv_zlib)
target_link_libraries(${the_target} libpng opencv_zlib)
add_dependencies(${the_target} libpng zlib)
#target_link_libraries(${the_target} libpng zlib)
endif()
if(WITH_TIFF AND NOT TIFF_FOUND)
add_dependencies(${the_target} libtiff)
target_link_libraries(${the_target} libtiff)
#target_link_libraries(${the_target} libtiff)
endif()
#if(OPENCV_BUILD_3RDPARTY_LIBS)
# add_dependencies(${the_target} libjasper libjpeg libpng libtiff opencv_zlib)
# target_link_libraries(${the_target} libjasper libjpeg libpng libtiff opencv_zlib)
#endif()
if(WIN32)
target_link_libraries(${the_target} comctl32 gdi32 ole32)
if (MSVC)
target_link_libraries(${the_target} vfw32)
endif()
if(MINGW)
if(MINGW64)
target_link_libraries(${the_target} msvfw32 avifil32 avicap32 winmm)
if(HAVE_VIDEOINPUT)
target_link_libraries(${the_target} videoInput64 strmiids)
endif()
else()
target_link_libraries(${the_target} vfw32 winmm)
if(HAVE_VIDEOINPUT)
target_link_libraries(${the_target} videoInput strmiids)
endif()
endif()
endif()
endif()
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc zlib ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES} ${HIGHGUI_LIBRARIES} ${OPENEXR_LIBRARIES})
if(APPLE)
target_link_libraries(${the_target} "-lbz2 -framework Cocoa -framework QuartzCore")

@ -5,6 +5,9 @@
add_subdirectory(c)
add_subdirectory(cpp)
add_subdirectory(gpu)
if(0)
add_subdirectory(swig_python)
add_subdirectory(octave)
add_subdirectory(gpu)
endif()

@ -35,7 +35,7 @@ Point origin;
Rect selection;
int vmin = 10, vmax = 256, smin = 30;
void onMouse( int event, int x, int y, int flags, void* param )
void onMouse( int event, int x, int y, int, void* )
{
if( selectObject )
{

@ -16,7 +16,7 @@ static Scalar randomColor(RNG& rng)
return Scalar(icolor&255, (icolor>>8)&255, (icolor>>16)&255);
}
int main( int argc, char** argv )
int main( int, char** )
{
char wndname[] = "Drawing Demo";
const int NUMBER = 100;
@ -24,7 +24,7 @@ int main( int argc, char** argv )
int lineType = CV_AA; // change it to 8 to see non-antialiased graphics
int i, width = 1000, height = 700;
int x1 = -width/2, x2 = width*3/2, y1 = -height/2, y2 = height*3/2;
RNG rng(-1);
RNG rng(0xFFFFFFFF);
Mat image = Mat::zeros(height, width, CV_8UC3);
imshow(wndname, image);

@ -32,7 +32,7 @@ int isColor = true;
bool useMask = false;
int newMaskVal = 255;
void onMouse( int event, int x, int y, int, void* param )
void onMouse( int event, int x, int y, int, void* )
{
if( event != CV_EVENT_LBUTTONDOWN )
return;

@ -12,6 +12,3 @@ add_subdirectory(cxts)
add_subdirectory(gpu)
# endif()
#endif()

Loading…
Cancel
Save