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,6 +62,8 @@ 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(target_type ${tmp_target} TYPE)
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_depend_libs ${tmp_target} LINK_LIBRARIES) get_target_property(tmp_depend_libs ${tmp_target} LINK_LIBRARIES)
list(REMOVE_ITEM targets_prepare_search ${tmp_target}) list(REMOVE_ITEM targets_prepare_search ${tmp_target})
list(APPEND tmp_depend_libs ${tmp_target}) list(APPEND tmp_depend_libs ${tmp_target})
@ -73,6 +75,9 @@ function(search_depend_libs_recursive cocos_target all_depends_out)
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,12 +95,15 @@ 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(target_type ${depend_lib} TYPE)
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(found_shared_lib ${depend_lib} IMPORTED_IMPLIB) get_target_property(found_shared_lib ${depend_lib} IMPORTED_IMPLIB)
if(found_shared_lib) if(found_shared_lib)
get_target_property(tmp_dlls ${depend_lib} IMPORTED_LOCATION) get_target_property(tmp_dlls ${depend_lib} IMPORTED_LOCATION)
list(APPEND all_depend_ext_dlls ${tmp_dlls}) list(APPEND all_depend_ext_dlls ${tmp_dlls})
endif() endif()
endif() endif()
endif()
endforeach() endforeach()
set(${all_depend_dlls_out} ${all_depend_ext_dlls} PARENT_SCOPE) set(${all_depend_dlls_out} ${all_depend_ext_dlls} PARENT_SCOPE)