0

By default, Xcode compiles my project for a number of architectures: arm64, armv7 and armv7s. Now I want to define a preprocessor macro only for the arm64 architecture. How can I do that?

Using the Preprocessor macros field in Xcode won't work because preprocessor macros in that field will be defined for all architectures. But how can I define custom preprocessor macros for certain architectures only?

Andreas
  • 9,245
  • 9
  • 49
  • 97
  • You could use http://stackoverflow.com/questions/21639128/determine-if-the-device-is-arm64 to detect the architecture and set a #define if you are in arm64 ? Or this: http://stackoverflow.com/questions/39076166/xcode-7-set-preprocessor-macros-per-architecture by editing manually the project file. – Larme Dec 01 '16 at 16:47
  • Thanks, but the `arm64` was just an example. I know how to detect 64-bit of course but I generally need to be able to set preprocessor macros for certain architectures, not only for `arm64` so I need a generic solution here. Manually editing the project file seems to do the trick but of course I'd prefer a less intrusive solution if there is one. – Andreas Dec 02 '16 at 15:58

1 Answers1

0

I have similar issue, solved something like this (in *.xcodeproj)

            HEADER_SEARCH_PATHS = (
                "$(PROJECT_DIR)/../../../_result/include",
            );
            "HEADER_SEARCH_PATHS[arch=arm64]" = (
                "$(PROJECT_DIR)/../../../_result/include/iphoneos_arm64",
            );