Repository navigation
Split videoio dependencies search - #13422
Conversation
fb365e9 to
caffdf5
Compare
|
Verified some basic dependency installation schemes on Linux (Ubuntu 18): https://github.com/mshabunin/videoio-build-verification |
1db7f15 to
38fa50e
Compare
dbf60a2 to
13da355
Compare
| endmacro() | ||
|
|
||
| macro(add_3p_target name inc link def) | ||
| add_library(ocv.3rdparty.${name} INTERFACE) |
There was a problem hiding this comment.
Please move this macro into common OpenCVUtils.cmake (this logic can be re-used for imgcodecs - if BUILD_xxx=OFF).
Lets change name:
- add
ocv_prefix - it should be used for "external" targets
- something like this:
ocv_add_external_dependency_target()
In BUILD_SHARED_LIBS=ON configuration we should not export extra targets in OpenCVModules.cmake, because they are not used. Lets mark these targets for this configuration as IMPORTED.
There was a problem hiding this comment.
I don't want to extract it to OpenCVUtils.cmake yet because it has very basic interface which will be changed later.
| macro(add_backend backend_id cond_var) | ||
| if(${cond_var}) | ||
| include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake") | ||
| endif() |
There was a problem hiding this comment.
WITH_ is auto-detection via provided CMake scripts.
There should be a way to bypass it (auto-detection may not work properly on some configurations).
In that case we need to manually specify HAVE_ / _INCLUDE_DIRS / _LIBRARIES / etc via CMake command line with WITH_xxx=OFF. Script should get use these provided variables.
There was a problem hiding this comment.
IMO the scheme is slightly different. WITH_ enables the feature, if HAVE_ is not set, autodetection tries to find the package, otherwise uses provided values.
Also this way is used it in cmake options verification: if WITH_ is OFF but HAVE_ is ON - verification error will be raised.
There was a problem hiding this comment.
We should not change existed policy about WITH_ / HAVE_ variables.
There was a problem hiding this comment.
I think the difference is not too big and the proposed policy is less error prone. For example, building two configurations in the same build directory:
- build OpenCV with
WITH_disabled by default andHAVE_enabled via command-line - feature is turned ON - build OpenCV with
WITH_disabled by default and none additional variables set - feature is still turned ON, becauseHAVE_is stored in cache and overridesWITH_option.
In the method which I propose, HAVE_ is internal variable and will not be stored in cache, thus WITH_ will actually disable or enable corresponding feature. If you pass HAVE_ via command line in one build and do not pass it in consecutive builds, the feature will still be disabled because target-creation code will not be executed.
There was a problem hiding this comment.
I mean this:
if(WITH_${cond_var} OR HAVE_${cond_var})
include(...)
endif()
and in detect_xxx.cmake (already done):
if(NOT HAVE_xxx)
... some auto-detection which work in most cases ...
endif()
... next auto detection attempt ...
if(HAVE_xxx)
... register dependencies with support of command-line vars: ...
... INCLUDE_DIRS, LIBRARIES, etc ...
endif()
| add_3p_target(xine "${XINE_INCLUDE_DIRS}" "${XINE_LIBRARIES}" "HAVE_XINE") | ||
| endif() | ||
|
|
||
| set(HAVE_XINE ${HAVE_XINE} PARENT_SCOPE) |
There was a problem hiding this comment.
PARENT_SCOPE
It is better to remove that.
Unnecessary "function" scope should be removed (perhaps it is already done here).
There was a problem hiding this comment.
This is a hack to propagate value to the root CMakelists.txt to print status messages. Otherwise the variable will be visible only in the module scope. Same with _VERSION variables.
If we wlil introduce mechanism for modules to add lines to main status log - we will be able to omit this. Something like ocv_status(<module> <group> <text>).
There was a problem hiding this comment.
It is not about "status" text only.
It is about the similar process for all external dependencies, including zlib (which is used for opencv_core directly, and for libtiff dependency) and imgcodecs dependencies.
71e93a2 to
ed1d2df
Compare
| endforeach() | ||
|
|
||
| export(TARGETS ${OpenCVModules_TARGETS} FILE "${CMAKE_BINARY_DIR}/OpenCVModules.cmake") | ||
| export(TARGETS ${OpenCVModules_TARGETS} APPEND FILE "${CMAKE_BINARY_DIR}/OpenCVModules.cmake") |
There was a problem hiding this comment.
APPEND breaks Android pack build.
Multiple configurations are added to the same file during build_sdk.py.
BTW, "install" OpenCVModules doesn't have "APPEND"
There was a problem hiding this comment.
Looks like we need to remove this file after each platform build. I'll fix the script.
There was a problem hiding this comment.
install(EXPORT ... does not have APPEND parameter, I think it just takes the final file and copies it to the destination. export(TARGETS ... needs APPEND when called from several different places with same filename. Or we can try to use export(EXPORT ... variant which will export all targets added to our named export set - it needs to be called only once and does not need APPEND argument - I'll try this.
* Split videoio dependencies search into pieces, removed obsolete backends
* Split videoio dependencies search into pieces, removed obsolete backends
This pullrequest changes
OpenCVFindLibsVideo.cmakefile into parts:videoio/cmake/detect_<backend>.cmakeocv::3rdparty::<tgt>,VIDEOIO_LIBRARIEShas been removedRemoved backends and leftovers:
Platform specific notes:
add_apple_compiler_optionshas been removedPackage search changes:
ARAVIS_ROOToption or environment variableWITH_CAP_IOSoptionDC1394_ROOToption or environment variableGSTREAMER_DIRcmake option orGSTREAMER_ROOT,GSTREAMER_1_0_ROOT_X86_64,GSTREAMER_ROOT_X86_64,GSTREAMER_1_0_ROOT_X86,GSTREAMER_ROOT_X86environment variablesWITH_MSMF_DXVAoption to control HW acceleration (ported Don't include DirectX when WITH_DIRECTX=OFF is specified #13421)OPENNI2_DIRcmake option andOPENNI2_INCLUDE64,OPENNI2_LIB64,OPENNI2_REDIST64,OPENNI2_INCLUDE,OPENNI2_LIB,OPENNI2_REDISTenvironment variablesPVAPI_ROOToption or environment variableLIBREALSENSE_INCLUDE,LIBREALSENSE_LIBoptons or environment variablesXIMEA_ROOToption or environment variable or in/opt/XIMEAdirectory