Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the ${PROJECT_DIR} for an Xcode project

Tags:

xcode

How do I figure out what my absolute ${PROJECT_DIR} path is for my Xcode project? Is there a way to print this in Terminal? How?

like image 510
adit Avatar asked Jan 17 '12 01:01

adit


People also ask

What is ${ Project_dir?

PROJECT_DIR. Identifies the directory containing the project ( .xcodeproj ) $(PROJECT_DIR)/build is used as the create the default value for: Intermediate Build Files Path OBJROOT.

Where is the products folder in Xcode?

It should by located in: ~/Library/Developer/Xcode/DerivedData . Show activity on this post. You can configure the output directory using the CONFIGURATION_BUILD_DIR environment variable.

Where is Srcroot in Xcode?

Open your project or workspace in Xcode and navigate to the Project navigator. Control-click the ci_scripts group you created earlier and choose New File. Choose the Shell Script template.


2 Answers

Build Settings -> Preprocess Macros

PROJECT_DIR=@\""$PROJECT_DIR"\"  BUILD_ROOT=@\""$(BUILD_ROOT)"\" 

Then you can log it directly

NSLog(@"project dir=%@, BUILD_ROOT_=%@", PROJECT_DIR, BUILD_ROOT); 
like image 120
vk.edward.li Avatar answered Sep 19 '22 13:09

vk.edward.li


Run this from Terminal

For a project:

xcodebuild -project yourProject.xcodeproj -target yourTarget -showBuildSettings | grep PROJECT_DIR 

For a workspace:

xcodebuild -workspace yourWorkspace.xcworkspace -scheme yourScheme -showBuildSettings | grep PROJECT_DIR 

As you can see, you can retrieve any other build settings value

like image 40
Xavi Gil Avatar answered Sep 21 '22 13:09

Xavi Gil