conda-forge / opencv-feedstock

A conda-smithy repository for opencv.
BSD 3-Clause "New" or "Revised" License
64 stars 59 forks source link

Generating pkgconfig files for windows #325

Open hmaarrfk opened 2 years ago

hmaarrfk commented 2 years ago

Comment:

Upstream developers are not thrilled about supporting pkgconfig files on windows.

Admittedly, they have caused us quite some frustration at conda-forge for various packages

When trying to install it with this simple patch:

simple patch ```patch diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 43d6a87e74..9e9d379544 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -1,4 +1,4 @@ -if(MSVC OR IOS) +if(IOS) return() endif() @@ -103,7 +103,7 @@ add_custom_target(gen-pkgconfig ALL SOURCES "${CMAKE_BINARY_DIR}/unix-install/${ add_dependencies(developer_scripts gen-pkgconfig) -if(UNIX AND NOT ANDROID) +if(NOT ANDROID) install(FILES ${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME} DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig COMPONENT dev) endif() ```

We found that it listed the shared library in the linking command instead of the lib.

if somebody wants to install pkgconfig files, they may find the above patch useful as a starting point.

Upstream suggested we adopt Cmake for finding FFMPEG on windows. I think they would likely suggest a similar approach to finding opencv on windows.

hmaarrfk commented 2 years ago

They would likely also have to add the cflag

    -DOPENCV_GENERATE_PKGCONFIG=ON                                                  ^