lib/cocoapods-xcframework/xbuilder.rb in cocoapods-bb-xcframework-0.2.5 vs lib/cocoapods-xcframework/xbuilder.rb in cocoapods-bb-xcframework-0.2.6

- old
+ new

@@ -4,11 +4,11 @@ class XBuilder include XcodeXBuilder include XcodeProjHelper include PodUtil include Config::Mixin - def initialize(installer, source_dir, sandbox_root, spec, configuration, symbols=true, support_maccatalyst=true) + def initialize(installer, source_dir, sandbox_root, spec, configuration, symbols=true, support_maccatalyst=true, support_dynamic=false) # def initialize(platform, installer, source_dir, sandbox_root, spec, config) # @platform = platform @installer = installer @source_dir = source_dir @sandbox_root = sandbox_root @@ -19,26 +19,41 @@ @configuration = configuration @outputs = Hash.new @symbols = symbols @support_maccatalyst = support_maccatalyst + @support_dynamic = support_dynamic end def build UI.puts("Building framework #{@spec} with configuration #{@configuration}") - UI.puts "Work dir is :#{@sandbox_root}" + UI.puts "Work dir is :#{@sandbox_root} isSymbols:#{@symbols} isDynamic:#{@support_dynamic}" # defines = "GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_#{@spec.name}=PodsDummy_PodPackage_#{@spec.name}'" defines = "" if @configuration == 'Debug' - defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=YES ONLY_ACTIVE_ARCH=NO' + if @support_dynamic + defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=YES ONLY_ACTIVE_ARCH=NO MACH_O_TYPE=mh_dylib OTHER_LDFLAGS="-ObjC -framework UIKit"' # OTHER_LDFLAGS 动态库工程不会自动导入系统库 + else + defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=YES ONLY_ACTIVE_ARCH=NO MACH_O_TYPE=staticlib' + end else if @symbols - defines << "GCC_GENERATE_DEBUGGING_SYMBOLS=YES" # Release模式需要符号表应于问题排查(二进制切源码操作) by hm 21/10/13 + if @support_dynamic + defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=YES MACH_O_TYPE=mh_dylib OTHER_LDFLAGS="-ObjC -framework UIKit"' # OTHER_LDFLAGS 动态库工程不会自动导入系统库 + else + defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=YES MACH_O_TYPE=staticlib' + end + # defines << "GCC_GENERATE_DEBUGGING_SYMBOLS=YES" # Release模式需要符号表应于问题排查(二进制切源码操作) by hm 21/10/13 else - defines << "GCC_GENERATE_DEBUGGING_SYMBOLS=NO" # 去除符号表 + if @support_dynamic + defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=NO MACH_O_TYPE=mh_dylib OTHER_LDFLAGS="-ObjC -framework UIKit"' # OTHER_LDFLAGS 动态库工程不会自动导入系统库 + else + defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=NO MACH_O_TYPE=staticlib' + end + # defines << "GCC_GENERATE_DEBUGGING_SYMBOLS=NO" # 去除符号表 end end - + build_all_device defines collect_xc_frameworks collect_bundles