def exclude_macos_target
  exclude_macos_target = ENV['EXCLUDE_MACOS_TARGET']
  if exclude_macos_target
    return true
  end
  return false
end

target 'OrtExtensionsUsage' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  platform :ios, '13.0'

  # Pods for OrtExtensionsUsage

  # Note: For iOS target, it doesn't require the dev version pod which contains macos support, however,
  # Podfile does not allow the same pod contain different dependencies, so adding the pre-release version
  # objc pod here temporarily.
  pod 'onnxruntime-objc', '1.17.0-dev+20231211010.8f2b5a6'

  # environment variable ORT_EXTENSIONS_LOCAL_POD_PATH can be used to specify a local onnxruntime-extensions-c pod path
  ort_extensions_local_pod_path = ENV['ORT_EXTENSIONS_LOCAL_POD_PATH']
  if ort_extensions_local_pod_path != nil
    print 'Using onnxruntime-extensions-c pod at ', ort_extensions_local_pod_path, "\n"
    pod 'onnxruntime-extensions-c', :path => ort_extensions_local_pod_path
  else
    pod 'onnxruntime-extensions-c'
  end

  target 'OrtExtensionsUsageTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

unless exclude_macos_target
  target 'OrtExtensionsMacOSUsage' do
    # Comment the next line if you don't want to use dynamic frameworks
    use_frameworks!
    
    platform :osx, '11.0'

    # Pods for OrtExtensionsMacOSUsage
    
    # Note: Currently using a pre-release version of ORT OBJC pod to enable support for macOS target.
    # TODO: Update to release version when available
    pod 'onnxruntime-objc', '1.17.0-dev+20231211010.8f2b5a6'

    # environment variable ORT_EXTENSIONS_LOCAL_POD_PATH can be used to specify a local onnxruntime-extensions-c pod path
    ort_extensions_local_pod_path = ENV['ORT_EXTENSIONS_LOCAL_POD_PATH']
    if ort_extensions_local_pod_path != nil
      print 'Using onnxruntime-extensions-c pod at ', ort_extensions_local_pod_path, "\n"
      pod 'onnxruntime-extensions-c', :path => ort_extensions_local_pod_path
    else
      pod 'onnxruntime-extensions-c'
    end

    target 'OrtExtensionsMacOSUsageTests' do
      inherit! :search_paths
      # Pods for testing
    end
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
    end
  end
end
