In Xcode, how do you set compiler flags for standalone module (framework)?

123 views Asked by At

I was writing my own standalone module and wanted to use cblas_dasum for efficient calculation of the sum of absolute values of a double array. Though a message pops up saying that I have to

specify ACCELERATE_NEW_LAPACK=1 and ACCELERATE_LAPACK_ILP64=1 as preprocessor macros in Xcode build settings.

Unfortunately the function was deprecated from iOS 16.4+ (which I still need to support) and I don't see any Xcode build settings at all where to set this flag.

How do I solve?

What I see:

XCode screen

1

There are 1 answers

3
MGY On

If deprecated, deprecation can stay supported by the OS for years. But anyway:

Macros

To set macros in Xcode build settings go to -> TARGETS -> Build Settings -> Type: Processors Macros -> Type the macro name you wish. And then set it.

enter image description here

Silent Deprecation Messages

If you want to silent deprecation messages for a specific method in code, use this technique:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- (void)YourDeprecatedMethod {
    //content...
}
#pragma GCC diagnostic pop

Try it as you need.

Important

Apple provides the BLAS and LAPACK libraries under the Accelerate framework to be in line with LAPACK 3.9.1. These new interfaces provide additional functionality, as well as a new ILP64 interface. To use the new interfaces, define ACCELERATE_NEW_LAPACK before including the Accelerate or vecLib headers. For ILP64 interfaces, also define ACCELERATE_LAPACK_ILP64. For Swift projects, specify ACCELERATE_NEW_LAPACK=1 and ACCELERATE_LAPACK_ILP64=1 as preprocessor macros in Xcode build settings.