Add support for interface-only libraries. (#19994)

* Add support for interface-only libraries.

* Fixed code formatting.
This commit is contained in:
rh101 2019-07-30 17:51:58 +10:00 committed by minggo
parent 0be2a1e80a
commit a61a06fb14
1 changed files with 22 additions and 14 deletions

View File

@ -62,17 +62,22 @@ function(search_depend_libs_recursive cocos_target all_depends_out)
set(targets_prepare_search ${cocos_target}) set(targets_prepare_search ${cocos_target})
while(true) while(true)
foreach(tmp_target ${targets_prepare_search}) foreach(tmp_target ${targets_prepare_search})
get_target_property(tmp_depend_libs ${tmp_target} LINK_LIBRARIES) get_target_property(target_type ${tmp_target} TYPE)
list(REMOVE_ITEM targets_prepare_search ${tmp_target}) if(${target_type} STREQUAL "SHARED_LIBRARY" OR ${target_type} STREQUAL "STATIC_LIBRARY" OR ${target_type} STREQUAL "MODULE_LIBRARY" OR ${target_type} STREQUAL "EXECUTABLE")
list(APPEND tmp_depend_libs ${tmp_target}) get_target_property(tmp_depend_libs ${tmp_target} LINK_LIBRARIES)
foreach(depend_lib ${tmp_depend_libs}) list(REMOVE_ITEM targets_prepare_search ${tmp_target})
if(TARGET ${depend_lib}) list(APPEND tmp_depend_libs ${tmp_target})
list(APPEND all_depends_inner ${depend_lib}) foreach(depend_lib ${tmp_depend_libs})
if(NOT (depend_lib STREQUAL tmp_target)) if(TARGET ${depend_lib})
list(APPEND targets_prepare_search ${depend_lib}) list(APPEND all_depends_inner ${depend_lib})
if(NOT (depend_lib STREQUAL tmp_target))
list(APPEND targets_prepare_search ${depend_lib})
endif()
endif() endif()
endif() endforeach()
endforeach() else()
list(REMOVE_ITEM targets_prepare_search ${tmp_target})
endif()
endforeach() endforeach()
list(LENGTH targets_prepare_search targets_prepare_search_size) list(LENGTH targets_prepare_search targets_prepare_search_size)
if(targets_prepare_search_size LESS 1) if(targets_prepare_search_size LESS 1)
@ -90,10 +95,13 @@ function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out)
search_depend_libs_recursive(${cocos_target} depend_libs) search_depend_libs_recursive(${cocos_target} depend_libs)
foreach(depend_lib ${depend_libs}) foreach(depend_lib ${depend_libs})
if(TARGET ${depend_lib}) if(TARGET ${depend_lib})
get_target_property(found_shared_lib ${depend_lib} IMPORTED_IMPLIB) get_target_property(target_type ${depend_lib} TYPE)
if(found_shared_lib) if(${target_type} STREQUAL "SHARED_LIBRARY" OR ${target_type} STREQUAL "STATIC_LIBRARY" OR ${target_type} STREQUAL "MODULE_LIBRARY" OR ${target_type} STREQUAL "EXECUTABLE")
get_target_property(tmp_dlls ${depend_lib} IMPORTED_LOCATION) get_target_property(found_shared_lib ${depend_lib} IMPORTED_IMPLIB)
list(APPEND all_depend_ext_dlls ${tmp_dlls}) if(found_shared_lib)
get_target_property(tmp_dlls ${depend_lib} IMPORTED_LOCATION)
list(APPEND all_depend_ext_dlls ${tmp_dlls})
endif()
endif() endif()
endif() endif()
endforeach() endforeach()