From d1f650f2599a408b3af2a175df15f0d71d9a143f Mon Sep 17 00:00:00 2001 From: Detailscool <496389006@qq.com> Date: Tue, 3 Jan 2023 14:40:59 +0800 Subject: [PATCH] weak_libraries --- lib/xcodeproj/config.rb | 12 ++++++++++-- lib/xcodeproj/config/other_linker_flags_parser.rb | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/xcodeproj/config.rb b/lib/xcodeproj/config.rb index 35d48d39..3123e4a7 100644 --- a/lib/xcodeproj/config.rb +++ b/lib/xcodeproj/config.rb @@ -59,7 +59,7 @@ def initialize(xcconfig_hash_or_file = {}) @attributes = {} @includes = [] @other_linker_flags = {} - [:simple, :frameworks, :weak_frameworks, :libraries, :arg_files, :force_load].each do |key| + [:simple, :frameworks, :weak_frameworks, :libraries, :weak_libraries, :arg_files, :force_load].each do |key| @other_linker_flags[key] = Set.new end merge!(extract_hash(xcconfig_hash_or_file)) @@ -126,10 +126,11 @@ def to_hash(prefix = nil) :frameworks => '-framework ', :weak_frameworks => '-weak_framework ', :libraries => '-l', + :weak_libraries => '-weak_l', :arg_files => '@', :force_load => '-force_load', } - [:libraries, :frameworks, :weak_frameworks, :arg_files, :force_load].each do |key| + [:libraries, :frameworks, :weak_libraries, :weak_frameworks, :arg_files, :force_load].each do |key| modifier = modifiers[key] sorted = other_linker_flags[key].to_a.sort if key == :force_load @@ -182,6 +183,13 @@ def libraries other_linker_flags[:libraries] end + # @return [Set] The list of the *weak* libraries required by + # this settings file. + # + def weak_libraries + other_linker_flags[:weak_libraries] + end + # @return [Set] The list of the arg files required by this # settings file. # diff --git a/lib/xcodeproj/config/other_linker_flags_parser.rb b/lib/xcodeproj/config/other_linker_flags_parser.rb index 31eccefa..0ba0e59c 100644 --- a/lib/xcodeproj/config/other_linker_flags_parser.rb +++ b/lib/xcodeproj/config/other_linker_flags_parser.rb @@ -16,6 +16,7 @@ def self.parse(flags) :frameworks => [], :weak_frameworks => [], :libraries => [], + :weak_libraries => [], :arg_files => [], :simple => [], :force_load => [], @@ -33,6 +34,8 @@ def self.parse(flags) key = :weak_frameworks when '-l' key = :libraries + when '-weak_l' + key = :weak_libraries when '@' key = :arg_files when '-force_load'