Skip to content

Commit 5b17410

Browse files
committed
Added BUILD_LIST feature
1 parent a6c02af commit 5b17410

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

cmake/OpenCVModule.cmake

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,41 @@ function(__ocv_resolve_dependencies)
421421
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will be built in current configuration")
422422
endforeach()
423423

424+
# Whitelist feature
425+
if(BUILD_LIST)
426+
# Prepare the list
427+
string(REGEX REPLACE "[ ,:]+" ";" whitelist "${BUILD_LIST}" )
428+
if(BUILD_opencv_world)
429+
list(APPEND whitelist world)
430+
endif()
431+
ocv_list_add_prefix(whitelist "opencv_")
432+
ocv_list_sort(whitelist)
433+
ocv_list_unique(whitelist)
434+
message(STATUS "Using whitelist: ${whitelist}")
435+
# Expand the list
436+
foreach(depth RANGE 10)
437+
set(new_whitelist ${whitelist})
438+
foreach(m ${whitelist})
439+
list(APPEND new_whitelist ${OPENCV_MODULE_${m}_REQ_DEPS})
440+
list(APPEND new_whitelist ${OPENCV_MODULE_${m}_PRIVATE_REQ_DEPS})
441+
endforeach()
442+
ocv_list_sort(new_whitelist)
443+
ocv_list_unique(new_whitelist)
444+
if("${whitelist}" STREQUAL "${new_whitelist}")
445+
break()
446+
endif()
447+
set(whitelist "${new_whitelist}")
448+
endforeach()
449+
# Disable modules not in whitelist
450+
foreach(m ${OPENCV_MODULES_BUILD})
451+
list(FIND whitelist ${m} idx)
452+
if(idx EQUAL -1)
453+
message(STATUS "Module ${m} disabled by whitelist")
454+
__ocv_module_turn_off(${m})
455+
endif()
456+
endforeach()
457+
endif()
458+
424459
# disable MODULES with unresolved dependencies
425460
set(has_changes ON)
426461
while(has_changes)

0 commit comments

Comments
 (0)