CocoaPods podspec with architecture flags

QUICK VERSION: I have a code library for which I create a special Cocoapods file. For this, different architecture-based compiler flags are needed. Is it possible?

Explanatory information: One of the library files contains some embedded ARM NEON code. For armv7 and armv7s flags:

s.compiler_flags = '-mfloat-abi=softfp', '-mfpu=neon', '-mcpu=cortex-a9' 

The last flag causes a (completely reasonable) compilation error on arm64.

Xcode supports flags for each architecture in the Build Options area, so this was great until the podspec shell was needed.

Is there a way to customize the CocoaPods specification with flags for each architecture?

+2
cocoapods
source share
1 answer

One of the solutions I found through Can you set configuration options for the architecture in the .xcconfig file in Xcode 4.3? use xcconfig:

 # Common flags s.compiler_flags = '-mfloat-abi=softfp', '-mfpu=neon' # Per-arch flags s.xcconfig = { 'OTHER_CFLAGS[arch=armv7]' => '$(inherited) -mcpu=cortex-a9' , 'OTHER_CFLAGS[arch=armv7s]' => '$(inherited) -mcpu=cortex-a9'} 

Minor CocoaPods error here, the $ flag (inherited) doubles the parameters in Pods.xcconfig:

 OTHER_CFLAGS[arch=armv7] = $(inherited) -mcpu=cortex-a9 $(inherited) -mcpu=cortex-a9 OTHER_CFLAGS[arch=armv7s] = $(inherited) -mcpu=cortex-a9 $(inherited) -mcpu=cortex-a9 

I wonder if there is a more convenient way to do this using the actual compiler-flags flag?

+1
source share

All Articles