Xcode Build Setting 整理(二)

文章目錄

Apple Clang

Apple Clang - Address Sanitizer 清掃


Summary

Check for C++ container overflow when Address Sanitizer is enabled. This check requires the entire application to be built with Address Sanitizer. If not, it may report false positives.

Declaration

CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW

Value Type

Boolean

Apple Clang - Code Generation 產生

Debug Information Level (CLANG_DEBUG_INFORMATION_LEVEL)


Summary

Toggles the amount of debug information emitted when debug symbols are enabled. This can impact the size of the generated debug information, which may matter in some cases for large projects, such as when using LTO.

Declaration

CLANG_DEBUG_INFORMATION_LEVEL

Value Type

Enumeration (String)

Enable Additional Vector Extensions

Summary

Enables the use of extended vector instructions. Only used when targeting Intel architectures.

Declaration

CLANG_X86_VECTOR_INSTRUCTIONS

Value Type

Enumeration (String)

Enable Code Coverage Support


Summary

Enables building with code coverage instrumentation. This is only used when the build has code coverage enabled, which is typically done via the Xcode scheme settings.

Declaration

CLANG_ENABLE_CODE_COVERAGE

Value Type

Boolean

Enforce Strict Aliasing


Summary

Optimize code by making more aggressive assumptions about whether pointers can point to the same objects as other pointers. Programs that use pointers a lot may benefit from this, but programs that don't strictly follow the ISO C rules about the type with which an object may be accessed may behave unexpectedly.

Declaration

GCC_STRICT_ALIASING

Value Type

Boolean

Generate Debug Symbols

是否生成 Debug 符號文件,生成的時候可以設置 DEBUG_INFORMATION_FORMAT


Summary

Enables or disables generation of debug symbols. When debug symbols are enabled, the level of detail can be controlled by the `DEBUG_INFORMATION_FORMAT` setting.

Declaration

GCC_GENERATE_DEBUGGING_SYMBOLS

Value Type

Boolean

Generate Legacy Test Coverage Files


Summary

Activating this setting causes a `notes` file to be produced that the `gcov` code-coverage utility can use to show program coverage.

Declaration

GCC_GENERATE_TEST_COVERAGE_FILES

Value Type

Boolean

Generate Position-Dependent Code


Summary

Faster function calls for applications. Not appropriate for shared libraries, which need to be position-independent.

Declaration

GCC_DYNAMIC_NO_PIC

Value Type

Boolean

Inline Methods Hidden


Summary

When enabled, out-of-line copies of inline methods are declared `private extern`.

Declaration

GCC_INLINES_ARE_PRIVATE_EXTERN

Value Type

Boolean

Instrument Program Flow


Summary

Activating this setting indicates that code should be added so program flow arcs are instrumented.

Declaration

GCC_INSTRUMENT_PROGRAM_FLOW_ARCS

Value Type

Boolean

Kernel Development Mode


Summary

Activating this setting enables kernel development mode.

Declaration

GCC_ENABLE_KERNEL_DEVELOPMENT

Value Type

Boolean

Link-Time Optimization


Summary

Enabling this setting allows optimization across file boundaries during linking. * *No:* Disabled. Do not use link-time optimization. * *Monolithic Link-Time Optimization:* This mode performs monolithic link-time optimization of binaries, combining all executable code into a single unit and running aggressive compiler optimizations. * *Incremental Link-Time Optimization:* This mode performs partitioned link-time optimization of binaries, inlining between compilation units and running aggressive compiler optimizations on each unit in parallel. This enables fast incremental builds and uses less memory than Monolithic LTO.

Declaration

LLVM_LTO

Value Type

Enumeration (String)

Make Strings Read-Only

字符串常量重複使用,也就是在mach-o中字符串常量是在同一個區域內,使用的時候通過指針查找

Summary

Reuse string literals.

Declaration

GCC_REUSE_STRINGS

Value Type

Boolean

No Common Blocks

Summary

In C, allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without `extern`) in two different compilations, you will get an error when you link them.

Declaration

GCC_NO_COMMON_BLOCKS

Value Type

Boolean

例子

GCC_NO_COMMON_BLOCKS=YES

Optimization Level


Summary

Specifies the degree to which the generated code is optimized for speed and binary size. * *None:* Do not optimize. [-O0] With this setting, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent—if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code. * *Fast:* Optimizing compilation takes somewhat more time, and a lot more memory for a large function. [-O1] With this setting, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time. In Apple's compiler, strict aliasing, block reordering, and inter-block scheduling are disabled by default when optimizing. * *Faster:* The compiler performs nearly all supported optimizations that do not involve a space-speed tradeoff. [-O2] With this setting, the compiler does not perform loop unrolling or function inlining, or register renaming. As compared to the `Fast` setting, this setting increases both compilation time and the performance of the generated code. * *Fastest:* Turns on all optimizations specified by the `Faster` setting and also turns on function inlining and register renaming options. This setting may result in a larger binary. [-O3] * *Fastest, Smallest:* Optimize for size. This setting enables all `Faster` optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size. [-Os] * *Fastest, Aggressive Optimizations:* This setting enables `Fastest` but also enables aggressive optimizations that may break strict standards compliance but should work well on well-behaved code. [-Ofast] * *Smallest, Aggressive Size Optimizations:* This setting enables additional size savings by isolating repetitive code patterns into a compiler generated function. [-Oz]

Declaration

GCC_OPTIMIZATION_LEVEL

Value Type

Enumeration (String)

例子

GCC_OPTIMIZATION_LEVEL=0

Optimization Profile File


Summary

The path to the file of the profile data to use when `CLANG_USE_OPTIMIZATION_PROFILE` is enabled.

Declaration

CLANG_OPTIMIZATION_PROFILE_FILE

Value Type

Path

例子

Apple Clang - Custom Compiler Flags

Other C Flags

c和oc文件的編譯選項

Summary

Space-separated list of additional flags to pass to the compiler for C and Objective-C files. Be sure to backslash-escape any arguments that contain spaces or special characters, such as path names that may contain spaces. Use this setting if Xcode does not already provide UI for a particular C or Objective-C compiler flag.

Declaration

OTHER_CFLAGS

Value Type

String List

OTHER_CFLAGS=" -isystem "/Users/ocean/Library/Developer/Xcode/DerivedData/StudyBuild-axwoigjrsadwcpbvrzeoljxvxnhp/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/Headers"

Other C++ Flags

c++和oc++文件的編譯選項


Summary

Space-separated list of additional flags to pass to the compiler for C++ and Objective-C++ files. Be sure to backslash-escape any arguments that contain spaces or special characters, such as path names that may contain spaces. Use this setting if Xcode does not already provide UI for a C++ or Objective-C++ compiler flag.

Declaration

OTHER_CPLUSPLUSFLAGS

Value Type

String List

OTHER_CPLUSPLUSFLAGS=" -isystem "/Users/ocean/Library/Developer/Xcode/DerivedData/StudyBuild-axwoigjrsadwcpbvrzeoljxvxnhp/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/Headers"

Other Warnings Flags


Summary

Space-separated list of additional warning flags to pass to the compiler. Use this setting if Xcode does not already provide UI for a particular compiler warning flag.

Declaration

WARNING_CFLAGS

Value Type

String List

Apple Clang - Language

char Type Is Unsigned

  • true: char 類型是 unsigned
  • false: char 類型是 signed

Summary

Enabling this setting causes `char` to be unsigned by default, disabling it causes `char` to be signed by default.

Declaration

GCC_CHAR_IS_UNSIGNED_CHAR

Value Type

Boolean

Allow asm, inline, typeof

asm, inline, 和 typeof 這些是否當前關鍵詞對待,是否可以當作標識符,默認是 true

  • true:是關鍵詞
  • false:不是關鍵詞

Summary

Controls whether `asm`, `inline`, and `typeof` are treated as keywords or whether they can be used as identifiers.

Declaration

GCC_ENABLE_ASM_KEYWORD

Value Type

Boolean

C Language Dialect

c語言的標準,現在是 gnu99


Summary

Choose a standard or non-standard C language dialect. * *ANSI C:* Accept ISO C90 and ISO C++, turning off GNU extensions that are incompatible. [-ansi] Incompatible GNU extensions include the `asm`, `inline`, and `typeof` keywords (but not the equivalent `\_\_asm\_\_`, `\_\_inline\_\_`, and `\_\_typeof\_\_` forms), and the `//` syntax for comments. This setting also enables trigraphs. * *C89:* Accept ISO C90 (1990), but not GNU extensions. [-std=c89] * *GNU89:* Accept ISO C90 and GNU extensions. [-std=gnu89] * *C99:* Accept ISO C99 (1999), but not GNU extensions. [-std=c99] * *GNU99:* Accept ISO C99 and GNU extensions. [-std=gnu99] * *C11:* Accept ISO C11 (2011), but not GNU extensions. [-std=c11] * *GNU11:* Accept ISO C11 and GNU extensions. [-std=gnu11] * *Compiler Default:* Tells the compiler to use its default C language dialect. This is normally the best choice unless you have specific needs. (Currently equivalent to GNU99.)

Declaration

GCC_C_LANGUAGE_STANDARD

Value Type

Enumeration (String)

GCC_C_LANGUAGE_STANDARD=gnu11

Code Warrior/MS-style Inline Assembly


Summary

Enable the CodeWarrior/Microsoft syntax for inline assembly code in addition to the standard GCC syntax.

Declaration

GCC_CW_ASM_SYNTAX

Value Type

Boolean

Compile Sources As

源文件的編譯控制

可以根據文件類型,也可設定爲都是c,oc文件等


Summary

Specifies whether to compile each source file according to its file type, or whether to treat all source files in the target as if they are of a specific language.

Declaration

GCC_INPUT_FILETYPE

Value Type

Enumeration (String)

Enable Linking With Shared Libraries

是否可以鏈接標準庫,默認是 Yes

Summary

Enabling this option allows linking with the shared libraries. This is the default for most product types.

Declaration

GCC_LINK_WITH_DYNAMIC_LIBRARIES

Value Type

Boolean

Enable Trigraphs


Summary

Controls whether or not trigraphs are permitted in the source code.

Declaration

GCC_ENABLE_TRIGRAPHS

Value Type

Boolean

Generate Floating Point Library Calls


Summary

Generate output containing library calls for floating point.

Declaration

GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS

Value Type

Boolean

Increase Sharing of Precompiled Headers

Summary

Enabling this option will enable increased sharing of precompiled headers among targets that share the same prefix header and precompiled header directory. Xcode distinguishes between precompiled header (PCH) files by generating a hash value based on the command-line options to the compiler used to create the PCH. Enabling this option will exclude certain compiler options from that hash. Presently this option will exclude search path options (`-I`, `-iquote`, `-isystem`, `-F`, `-L`) from the hash. Enabling increased sharing of PCH files carries some risk—if two targets use the same prefix header but have different include paths that cause the prefix header to include different files when they are precompiled, then subtle problems may result because one target will use a PCH that was built using files included by the other target. In this case, this option must be turned off in order to enforce correctness.

Declaration

GCC_INCREASE_PRECOMPILED_HEADER_SHARING

Value Type

Boolean

GCC_INCREASE_PRECOMPILED_HEADER_SHARING=NO

Precompile Prefix Header

給pch文件生成與編譯的header,內容經常變化的不要使用,會增加編譯時間

Summary

Generates a precompiled header for the prefix header, which should reduce overall build times. Precompiling the prefix header will be most effective if the contents of the prefix header or any file it includes change rarely. If the contents of the prefix header or any file it includes change frequently, there may be a negative impact to overall build time.

Declaration

GCC_PRECOMPILE_PREFIX_HEADER

Value Type

Boolean

Prefix Header

pch 文件的相對路徑(項目)


Summary

Implicitly include the named header. The path given should either be a project relative path or an absolute path.

Declaration

GCC_PREFIX_HEADER

Value Type

String

GCC_PREFIX_HEADER="/Users/ocean/Desktop/code/iOS/StudyBuild/StudyBuild/Supporting Files/PrefixHeader.pch"

Recognize Builtin Functions


Summary

Controls whether builtin functions that do not begin with `\_\_builtin\_` as prefix are recognized. GCC normally generates special code to handle certain builtin functions more efficiently; for instance, calls to `alloca` may become single instructions that adjust the stack directly, and calls to `memcpy` may become inline copy loops. The resulting code is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint on those calls, nor can you change the behavior of the functions by linking with a different library. In addition, when a function is recognized as a builtin function, GCC may use information about that function to warn about problems with calls to that function, or to generate more efficient code, even if the resulting code still contains calls to that function. For example, warnings are given with `-Wformat` for bad calls to `printf`, when `printf` is built in, and `strlen` is known not to modify global memory.

Declaration

GCC_ENABLE_BUILTIN_FUNCTIONS

Value Type

Boolean

Recognize Pascal Strings


Summary

Recognize and construct Pascal-style string literals. Its use in new code is discouraged. Pascal string literals take the form `"\pstring"` . The special escape sequence `\p` denotes the Pascal length byte for the string, and will be replaced at compile time with the number of characters that follow. The `\p` may only appear at the beginning of a string literal, and may not appear in wide string literals or as an integral constant.

Declaration

GCC_ENABLE_PASCAL_STRINGS

Value Type

Boolean

Short Enumeration Constants

Summary

Make enums only as large as needed for the range of possible values. This setting generates code that may not binary compatible with code generated without this setting or with macOS frameworks.

Declaration

GCC_SHORT_ENUMS

Value Type

Boolean

Use Standard System Header Directory Searching

頭文件的搜索範圍是否包含系統的文件夾

  • Yes:系統頭文件目錄也會被搜索
  • No:-I標記的目錄和當前目錄纔會被搜索

Summary

Controls whether the standard system directories are searched for header files. When disabled, only the directories you have specified with `-I` options (and the directory of the current file, if appropriate) are searched.

Declaration

GCC_USE_STANDARD_INCLUDE_SEARCHING

Value Type

Boolean

Apple Clang - Language C++

C++ Language Dialect


Summary

Choose a standard or non-standard C++ language dialect. Options include: * *C++98:* Accept ISO C++ 1998 with amendments, but not GNU extensions. [-std=c++98] * *GNU++98:* Accept ISO C++ 1998 with amendments and GNU extensions. [-std=gnu++98] * *C++11:* Accept the ISO C++ 2011 standard with amendments, but not GNU extensions. [-std=c++11] * *GNU++11:* Accept the ISO C++ 2011 standard with amendments and GNU extensions. [-std=gnu++11] * *C++14:* Accept the ISO C++ 2014 standard with amendments, but not GNU extensions. [-std=c++14] * *GNU++14:* Accept the ISO C++ 2014 standard with amendments and GNU extensions. [-std=gnu++14] * *C++17:* Accept the ISO C++ 2017 standard with amendments, but not GNU extensions. [-std=c++17] * *GNU++17:* Accept the ISO C++ 2017 standard with amendments and GNU extensions. [-std=gnu++17] * *Compiler Default:* Tells the compiler to use its default C++ language dialect. This is normally the best choice unless you have specific needs. (Currently equivalent to GNU++98.)

Declaration

CLANG_CXX_LANGUAGE_STANDARD

Value Type

Enumeration (String)

C++ Standard Library

c++的標準庫

  • libstdc++: 傳統的,GCC和Clang使用
  • libc++: 現代的,Clang使用

Summary

Choose a version of the C++ standard library to use. * *libstdc++:* A traditional C++ standard library that works with GCC and Clang (default). * *libc++:* A highly optimized C++ standard library that works only with Clang, and is designed to support new C++11 features.

Declaration

CLANG_CXX_LIBRARY

Value Type

Enumeration (String)

Destroy Static Objects

Summary

Controls whether variables with static or thread storage duration should have their exit-time destructors run.

Declaration

CLANG_ENABLE_CPP_STATIC_DESTRUCTORS

Value Type

Boolean

Enable C++ Exceptions

Summary

Enable C++ exception handling. Generates extra code needed to propagate exceptions. For some targets, this implies GCC will generate frame unwind information for all functions, which can produce significant data size overhead, although it does not affect execution. If you do not specify this option, GCC will enable it by default for languages like C++ that normally require exception handling, and disable it for languages like C that do not normally require it. However, you may need to enable this option when compiling C code that needs to interoperate properly with exception handlers written in C++.

Declaration

GCC_ENABLE_CPP_EXCEPTIONS

Value Type

Boolean

Enable C++ Runtime Types

Summary

Enable generation of information about every class with virtual functions for use by the C++ runtime type identification features (`dynamic_cast` and `typeid`). If you don't use those parts of the language, you can save some space by using this flag. Note that exception handling uses the same information, but it will generate it as needed.

Declaration

GCC_ENABLE_CPP_RTTI

Value Type

Boolean

Apple Clang - Language - Modules

Allow Non-modular Includes In Framework Modules

Summary

Enabling this setting allows non-modular includes to be used from within framework modules. This is inherently unsafe, as such headers might cause duplicate definitions when used by any client that imports both the framework and the non-modular includes.

Declaration

CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES

Value Type

Boolean

Disable Private Modules Warnings

Summary

Disable warnings related to the recommended use of private module naming. This only makes sense when support for modules is enabled.

Declaration

CLANG_MODULES_DISABLE_PRIVATE_WARNING

Value Type

Boolean

Enable Clang Module Debugging

Summary

When this setting is enabled, `clang` will use the shared debug info available in `clang` modules and precompiled headers. This results in smaller build artifacts, faster compile times, and more complete debug info. This setting should only be disabled when building static libraries with debug info for distribution.

Declaration

CLANG_ENABLE_MODULE_DEBUGGING

Value Type

Boolean

Enable Modules(C and Objective-C)

Summary

Enables the use of modules for system APIs. System headers are imported as semantic modules instead of raw headers. This can result in faster builds and project indexing.

Declaration

CLANG_ENABLE_MODULES

Value Type

Boolean

Link Frameworks Automatically

Summary

Automatically link SDK frameworks that are referenced using `#import` or `#include`. This feature requires also enabling support for modules. This build setting only applies to C-family languages.

Declaration

CLANG_MODULES_AUTOLINK

Value Type

Boolean

Apple Clang - Language - Objective-C

Enable Objective-C Exceptions

oc語言可以使用 @try/@catch/@throw 來處理異常

Summary

This setting enables `@try`/`@catch`/`@throw` syntax for handling exceptions in Objective-C code. Only applies to Objective-C.

Declaration

GCC_ENABLE_OBJC_EXCEPTIONS

Value Type

Boolean

Implicitly Link Objective-C Runtime Support

Summary

When linking a target using Objective-C code, implicitly link in Foundation (and if deploying back to an older OS) a backwards compatibility library to allow newer language features to run on an OS where the runtime support is not natively available. Most targets that use Objective-C should use this, although there are rare cases where a target should opt out of this behavior.

Declaration

CLANG_LINK_OBJC_RUNTIME

Value Type

Boolean

Objective-C Automatic Reference Counting

ARC是否開啓

Summary

Compiles reference-counted Objective-C code (when garbage collection is not enabled) to use Automatic Reference Counting. Code compiled using automated reference counting is compatible with other code (such as frameworks) compiled using either manual reference counting (for example, traditional `retain` and `release` messages) or automated reference counting. Using this mode is currently incompatible with compiling code to use Objective-C Garbage Collection.

Declaration

CLANG_ENABLE_OBJC_ARC

Value Type

Boolean

CLANG_ENABLE_OBJC_ARC=YES

Weak References in Manual Retain Release

Summary

Compiles Objective-C code to enable weak references for code compiled with manual retain release (MRR) semantics.

Declaration

CLANG_ENABLE_OBJC_WEAK

Value Type

Boolean

CLANG_ENABLE_OBJC_WEAK=YES

Apple Clang - Preprocessing

Enable Foundation Assetions (ENABLE_NS_ASSERTIONS)

預處理階段斷言的啓用/禁止 ;禁用可以提高代碼性能

  • Debug: YES
  • Release: NO

Summary

Controls whether assertion logic provided by `NSAssert` is included in the preprocessed source code or is elided during preprocessing. Disabling assertions can improve code performance.

Declaration

ENABLE_NS_ASSERTIONS

Value Type

Boolean

Enable Strict Checking of objc_msgSend Calls (ENABLE_STRICT_OBJC_MSGSEND)

檢查 objc_msgSend 的調用,默認是 YES


Summary

Controls whether `objc_msgSend` calls must be cast to the appropriate function pointer type before being called.

Declaration

ENABLE_STRICT_OBJC_MSGSEND

Value Type

Boolean

ENABLE_STRICT_OBJC_MSGSEND=YES

Preprocessor Macros (GCC_PREPROCESSOR_DEFINITIONS)

空格分割的預處理宏定義 COCOAPODS=1


Summary

Space-separated list of preprocessor macros of the form `foo` or `foo=bar`.

Declaration

GCC_PREPROCESSOR_DEFINITIONS

Value Type

String List

GCC_PREPROCESSOR_DEFINITIONS="DEBUG=1  COCOAPODS=1"

Preprocessor Macros Not Used In Precompiled Header (GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS)

在預編譯 .pch 時不需要使用的宏定義

Summary

Space-separated list of preprocessor macros of the form `foo` or `foo=bar`. These macros are not used when precompiling a prefix header file.

Declaration

GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS

Value Type

String List

Apple Clang - Undefined Behavior Sanitizer

Enable Extra Integer Checks

檢查 unsigned integersigned integer 是否溢出

Summary

Check for unsigned integer overflow, in addition to checks for signed integer overflow.

Declaration

CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER

Value Type

Boolean

Enable Nullability Annotation Checks

方法的參數和返回值的空能力的檢查

Summary

Check for violations of nullability annotations in function calls, return statements, and 
assignments.

Declaration

CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY

Value Type

Boolean
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章