Fix generating of android.mk

This commit is contained in:
Maksim Shabunin 2015-04-06 16:12:00 +03:00
parent ac22c524fc
commit 979721c979
2 changed files with 39 additions and 49 deletions

View File

@ -43,34 +43,17 @@ if(ANDROID)
endforeach() endforeach()
# build the list of opencv libs and dependencies for all modules # build the list of opencv libs and dependencies for all modules
set(OPENCV_MODULES_CONFIGMAKE "") ocv_get_all_libs(OPENCV_MODULES_CONFIGMAKE OPENCV_EXTRA_COMPONENTS_CONFIGMAKE OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE)
set(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "")
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE "")
foreach(m ${OPENCV_MODULES_PUBLIC})
list(INSERT OPENCV_MODULES_CONFIGMAKE 0 ${${m}_MODULE_DEPS_${ocv_optkind}} ${m})
if(${m}_EXTRA_DEPS_${ocv_optkind})
list(INSERT OPENCV_EXTRA_COMPONENTS_CONFIGMAKE 0 ${${m}_EXTRA_DEPS_${ocv_optkind}})
endif()
endforeach()
# split 3rdparty libs and modules # list -> string
foreach(mod ${OPENCV_MODULES_CONFIGMAKE}) string(REPLACE ";" " " OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
if(NOT mod MATCHES "^opencv_.+$") string(REPLACE ";" " " OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "${OPENCV_EXTRA_COMPONENTS_CONFIGMAKE}")
list(INSERT OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE 0 ${mod}) string(REPLACE ";" " " OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE "${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE}")
endif()
endforeach()
if(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE)
list(REMOVE_ITEM OPENCV_MODULES_CONFIGMAKE ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
endif()
# convert CMake lists to makefile literals # replace 'opencv_<module>' -> '<module>''
foreach(lst OPENCV_MODULES_CONFIGMAKE OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE OPENCV_EXTRA_COMPONENTS_CONFIGMAKE)
ocv_list_unique(${lst})
ocv_list_reverse(${lst})
string(REPLACE ";" " " ${lst} "${${lst}}")
endforeach()
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}") string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
# prepare 3rd-party component list without TBB for armeabi and mips platforms. TBB is useless there. # prepare 3rd-party component list without TBB for armeabi and mips platforms. TBB is useless there.
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE}) set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
foreach(mod ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB}) foreach(mod ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB})

View File

@ -415,31 +415,6 @@ function(status text)
endfunction() endfunction()
# splits cmake libraries list of format "general;item1;debug;item2;release;item3" to two lists
macro(ocv_split_libs_list lst lstdbg lstopt)
set(${lstdbg} "")
set(${lstopt} "")
set(perv_keyword "")
foreach(word ${${lst}})
if(word STREQUAL "debug" OR word STREQUAL "optimized")
set(perv_keyword ${word})
elseif(word STREQUAL "general")
set(perv_keyword "")
elseif(perv_keyword STREQUAL "debug")
list(APPEND ${lstdbg} "${word}")
set(perv_keyword "")
elseif(perv_keyword STREQUAL "optimized")
list(APPEND ${lstopt} "${word}")
set(perv_keyword "")
else()
list(APPEND ${lstdbg} "${word}")
list(APPEND ${lstopt} "${word}")
set(perv_keyword "")
endif()
endforeach()
endmacro()
# remove all matching elements from the list # remove all matching elements from the list
macro(ocv_list_filterout lst regex) macro(ocv_list_filterout lst regex)
foreach(item ${${lst}}) foreach(item ${${lst}})
@ -810,3 +785,35 @@ function(ocv_add_library target)
_ocv_append_target_includes(${target}) _ocv_append_target_includes(${target})
endfunction() endfunction()
# build the list of opencv libs and dependencies for all modules
# _modules - variable to hold list of all modules
# _extra - variable to hold list of extra dependencies
# _3rdparty - variable to hold list of prebuilt 3rdparty libraries
macro(ocv_get_all_libs _modules _extra _3rdparty)
set(${_modules} "")
set(${_extra} "")
set(${_3rdparty} "")
foreach(m ${OPENCV_MODULES_PUBLIC})
get_target_property(deps ${m} INTERFACE_LINK_LIBRARIES)
list(INSERT ${_modules} 0 ${deps} ${m})
foreach (dep ${deps} ${OPENCV_LINKER_LIBS})
if (TARGET ${dep})
list(INSERT ${_3rdparty} 0 ${dep})
else()
list(INSERT ${_extra} 0 ${dep})
endif()
endforeach()
endforeach()
# split 3rdparty libs and modules
ocv_list_filterout(${_3rdparty} "^opencv_.+$")
ocv_list_filterout(${_extra} "^opencv_.+$")
list(REMOVE_ITEM ${_modules} ${${_3rdparty}} ${${_extra}})
# convert CMake lists to makefile literals
foreach(lst ${_modules} ${_3rdparty} ${_extra})
ocv_list_unique(${lst})
ocv_list_reverse(${lst})
endforeach()
endmacro()