@@ -45,25 +45,18 @@ function(cocos_mark_multi_resources res_out)
4545 set (${res_out} ${tmp_file_list} PARENT_SCOPE)
4646endfunction ()
4747
48- # get `cocos_target` depend all dlls, save the result in `all_depend_dlls_out`
49- function (get_target_depends_ext_dlls cocos_target all_depend_dlls_out )
50- set (all_depend_ext_dlls )
48+ # get all linked libraries including transitive ones, recursive
49+ function (search_depend_libs_recursive cocos_target all_depends_out )
50+ set (all_depends_inner )
5151 set (targets_prepare_search ${cocos_target} )
52- # targets_prepare_search, target need find ext libs
53- set (have_searched_targets)
54- set (need_search_targets)
5552 while (true )
5653 foreach (tmp_target ${targets_prepare_search} )
5754 get_target_property (tmp_depend_libs ${tmp_target} LINK_LIBRARIES )
5855 list (REMOVE_ITEM targets_prepare_search ${tmp_target} )
59- # target itself use_cocos_pkg
6056 list (APPEND tmp_depend_libs ${tmp_target} )
6157 foreach (depend_lib ${tmp_depend_libs} )
6258 if (TARGET ${depend_lib} )
63- get_target_property (tmp_dlls ${depend_lib} CC_DEPEND_DLLS)
64- if (tmp_dlls)
65- list (APPEND all_depend_ext_dlls ${tmp_dlls} )
66- endif ()
59+ list (APPEND all_depends_inner ${depend_lib} )
6760 if (NOT (depend_lib STREQUAL tmp_target))
6861 list (APPEND targets_prepare_search ${depend_lib} )
6962 endif ()
@@ -75,6 +68,23 @@ function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out)
7568 break ()
7669 endif ()
7770 endwhile (true )
71+ set (${all_depends_out} ${all_depends_inner} PARENT_SCOPE)
72+ endfunction ()
73+
74+ # get `cocos_target` depend all dlls, save the result in `all_depend_dlls_out`
75+ function (get_target_depends_ext_dlls cocos_target all_depend_dlls_out)
76+
77+ set (depend_libs)
78+ set (all_depend_ext_dlls)
79+ search_depend_libs_recursive(${cocos_target} depend_libs)
80+ foreach (depend_lib ${depend_libs} )
81+ if (TARGET ${depend_lib} )
82+ get_target_property (tmp_dlls ${depend_lib} CC_DEPEND_DLLS)
83+ if (tmp_dlls)
84+ list (APPEND all_depend_ext_dlls ${tmp_dlls} )
85+ endif ()
86+ endif ()
87+ endforeach ()
7888
7989 set (${all_depend_dlls_out} ${all_depend_ext_dlls} PARENT_SCOPE)
8090endfunction ()
@@ -231,26 +241,18 @@ macro(cocos_pak_xcode cocos_target)
231241 set (MACOSX_BUNDLE_LONG_VERSION_STRING ${COCOS_APP_LONG_VERSION_STRING} )
232242 set (MACOSX_BUNDLE_SHORT_VERSION_STRING ${COCOS_APP_SHORT_VERSION_STRING} )
233243
234- message ("cocos package: ${cocos_target} , plist file: ${COCOS_APP_INFO_PLIST} " )
244+ message (STATUS "cocos package: ${cocos_target} , plist file: ${COCOS_APP_INFO_PLIST} " )
235245
236246 cocos_config_app_xcode_property(${cocos_target} )
237247endmacro ()
238248
239249# set Xcode property for application, include all depend target
240250macro (cocos_config_app_xcode_property cocos_app)
241- cocos_config_target_xcode_property(${cocos_app} )
242- # for example, cocos_target: cpp-tests link engine_lib: cocos2d
243- get_target_property (engine_libs ${cocos_app} LINK_LIBRARIES )
244- foreach (engine_lib ${engine_libs} )
245- if (TARGET ${engine_lib} )
246- cocos_config_target_xcode_property(${engine_lib} )
247- # for example, engine_lib: cocos2d link external_lib: flatbuffers
248- get_target_property (external_libs ${engine_lib} LINK_LIBRARIES )
249- foreach (external_lib ${external_libs} )
250- if (TARGET ${external_lib} )
251- cocos_config_target_xcode_property(${external_lib} )
252- endif ()
253- endforeach ()
251+ set (depend_libs)
252+ search_depend_libs_recursive(${cocos_app} depend_libs)
253+ foreach (depend_lib ${depend_libs} )
254+ if (TARGET ${depend_lib} )
255+ cocos_config_target_xcode_property(${depend_lib} )
254256 endif ()
255257 endforeach ()
256258endmacro ()
0 commit comments