Skip to content

Instantly share code, notes, and snippets.

@Dimon70007
Created December 6, 2019 16:39
Show Gist options
  • Save Dimon70007/ecf9eaf8d0d0ae380512d94cf800c492 to your computer and use it in GitHub Desktop.
Save Dimon70007/ecf9eaf8d0d0ae380512d94cf800c492 to your computer and use it in GitHub Desktop.
cocoapods Debug hook for project with many schemes and configurations
# targets with dependencies
# This is an alternative for manually specifying every configuration as :debug [link](http://guides.cocoapods.org/syntax/podfile.html#project).
# Because of cocoapods by default uses :release type for all configurations but Debug
# we need to change every configuration, named <configuration_name>.Debug
# at the bottom of file
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name.include?('.Debug')
config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
config.build_settings['VALIDATE_PRODUCT'] = 'NO'
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'DWARF'
config.build_settings['ENABLE_TESTABILITY'] = 'YES'
config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0'
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES'
config.build_settings['SWIFT_COMPILATION_MODE'] = 'singlefile'
config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = "$(inherited) DEBUG"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = "$(inherited) DEBUG=1"
end
end
end
end
@rbarbish
Copy link

rbarbish commented Apr 8, 2020

Do you know if these settings are optimal for fast compilations of debug builds?

@Dimon70007
Copy link
Author

Do you know if these settings are optimal for fast compilations of debug builds?

This settings have been copied from Debug configuration. But i don't know if it is optimal for fast compilation. May be you should add another build_settings for optimisation

@philosopherdog
Copy link

philosopherdog commented Apr 6, 2022

Thanx for posting. As soon as I run pod install again I get warnings in Update Project Settings for the flags set!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment