Xcode 中环境变量含义

2017-01-12  本文已影响141人  piao152

(1) mac基础路径

~=当前账户的HOME目录,例如“/Users/xxx”

(2) Xcode中的路径

build默认路径:BUILD_PATH = ~/Library/Developer/Xcode/DerivedData/xxx-xxx-xxxxxxx/Build
可通过“File->Project Settings”查看Derived Data Location。

环境变量宏(Build Setting Macros)引用格式:${MACRO},同Build Phases Run Script中的语法。

(a) ARCH & PLATFORM & SDK

ARCHS = i386
CURRENT_ARCH = i386
PLATFORM_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
PLATFORM_NAME = macosx
SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
SDK_NAME = macosx10.9

(b) PROJECT & SOURCE

PROJECT = HelloWorld
PROJECT_DIR =~/Projects/Learn Objective-C/HelloWorld
PROJECT_FILE_PATH =${PROJECT_DIR}/HelloWorld.xcodeproj
PROJECT_NAME = HelloWorld
SOURCE_ROOT =${PROJECT_DIR}
SRCROOT =${PROJECT_DIR}

(c) BUILD & CONFIGURATION

BUILD_DIR =${BUILD_PATH}/Products
BUILD_ROOT =${BUILD_PATH}/Products
BUILT_PRODUCTS_DIR ={BUILD_PATH}/Products/Debug
CONFIGURATION = Debug
CONFIGURATION_BUILD_DIR =${BUILD_PATH}/Products/Debug
CONFIGURATION_TEMP_DIR =${BUILD_PATH}/Intermediates/HelloWorld.build/Debug

(d) PRODUCT & TARGET

PRODUCT_NAME = HelloWorld
PRODUCT_TYPE = com.apple.product-type.tool //Project Template: Command Line Tool
TARGET_BUILD_DIR =${BUILD_PATH}/Products/Debug
TARGET_NAME = HelloWorld

(3) 设置环境变量

Product -> Edit Scheme(option+command+R)->Arguments->Environment Variables中可以添加自定义环境变量(Name为名称,Value为值)。

上一篇下一篇

猜你喜欢

热点阅读