@@ -45,25 +45,18 @@ function(cocos_mark_multi_resources res_out)
45
45
set (${res_out} ${tmp_file_list} PARENT_SCOPE)
46
46
endfunction ()
47
47
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 )
51
51
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)
55
52
while (true )
56
53
foreach (tmp_target ${targets_prepare_search} )
57
54
get_target_property (tmp_depend_libs ${tmp_target} LINK_LIBRARIES )
58
55
list (REMOVE_ITEM targets_prepare_search ${tmp_target} )
59
- # target itself use_cocos_pkg
60
56
list (APPEND tmp_depend_libs ${tmp_target} )
61
57
foreach (depend_lib ${tmp_depend_libs} )
62
58
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} )
67
60
if (NOT (depend_lib STREQUAL tmp_target))
68
61
list (APPEND targets_prepare_search ${depend_lib} )
69
62
endif ()
@@ -75,6 +68,23 @@ function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out)
75
68
break ()
76
69
endif ()
77
70
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 ()
78
88
79
89
set (${all_depend_dlls_out} ${all_depend_ext_dlls} PARENT_SCOPE)
80
90
endfunction ()
@@ -231,26 +241,18 @@ macro(cocos_pak_xcode cocos_target)
231
241
set (MACOSX_BUNDLE_LONG_VERSION_STRING ${COCOS_APP_LONG_VERSION_STRING} )
232
242
set (MACOSX_BUNDLE_SHORT_VERSION_STRING ${COCOS_APP_SHORT_VERSION_STRING} )
233
243
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} " )
235
245
236
246
cocos_config_app_xcode_property(${cocos_target} )
237
247
endmacro ()
238
248
239
249
# set Xcode property for application, include all depend target
240
250
macro (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} )
254
256
endif ()
255
257
endforeach ()
256
258
endmacro ()
0 commit comments