how to pass the user-defined macro to xcodebuild?

后端 未结 2 1729
日久生厌
日久生厌 2021-01-20 01:24

I build my project by xcodebuild in command line. Not in xCode. I want to pass some marc to the project so that it can affect the code. Such as code below:

         


        
2条回答
  •  伪装坚强ぢ
    2021-01-20 01:50

    I know this is an old post, but why not just use:

    xcodebuild GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS API_TYPE=1'
    

    If you want to be able to have it optionally override an existing define in app, just code something like this:

    #define DEFAULT_API_TYPE 1
    
    #ifdef API_TYPE
      #define REAL_API_TYPE API_TYPE
    #else
      #define REAL_API_TYPE DEFAULT_API_TYPE
    #endif
    

提交回复
热议问题