XCODE4 environment variables, Build settings parameters, workspace and binder settings

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/xiaodao/archive/2012/03/28/2422091.html

I. Environment variables in the XCODE4

$ (Built_products_dir)

After the build succeeds, the final product path--can be set in the Per-configuration build products path key of the build settings parameter

$ (target_name)

Target Project Name

$ (srcroot)

Path to project files (such as nuno.xcodeproj)

$ (current_project_version)

Current Project version number

Other:

When compiling the static library, device selector simulator (IPhone 5.0 Simulator), the default base path is not set for any build settings parameters:

/users/xxx/library/developer/xcode/deriveddata/xxxworkspace-caepeadwrerdcrftijaolkkagbjf

Use $ () instead of the above a long string of Dongdong

$ (symroot) = $ ()/build/products

$ (BUILD_DIR) = $ ()/build/products

$ (build_root) = $ ()/build/products

The $ () in these three variables does not change as the build settings parameter is set

Instead, the following can be changed by setting

$ (CONFIGURATION_BUILD_DIR) = $ ()/build/products/debug-iphonesimulator

$ (BUILT_PRODUCTS_DIR) = $ ()/build/products/debug-iphonesimulator

$ (CONFIGURATION_TEMP_DIR) = $ ()/build/intermediates/utillib.build/debug-iphonesimulator

$ (TARGET_BUILD_DIR) = $ ()/build/products/debug-iphonesimulator

$ (sdk_name) = iphonesimulator5.0

$ (platform_name) = Iphonesimulator

$ (CONFIGURATION) = Debug

$ (target_name) = Utillib

$ (executable_name) = LIBUTILLIB.A executable file name

${iphoneos_deployment_target} 5.0

$ (ACTION) = Build

$ (currentconfig_simulator_dir) Current emulator path

$ (CURRENTCONFIG_DEVICE_DIR) Current device path

$ (Build_dir)/$ (CONFIGURATION) $ (Effective_platform_name =

$ ()/build/products/debug-iphonesimulator

$ (Project_temp_dir)/$ (CONFIGURATION) $ (effective_platform_name) = $ ()/build/intermediates/utillib.build/ Debug-iphonesimulator

Custom variables

${configuration}-iphoneos says: Debug-iphoneos

${configuration}-iphonesimulator says: Debug-iphonesimulator

$ (currentconfig_device_dir) = ${symroot}/${configuration}-iphoneos

$ (currentconfig_simulator_dir) = ${symroot}/${configuration}-iphonesimulator

Customizing a device-independent path (used to store a variety of architectures arm6/arm7/i386 output products)

$ (creating_universal_dir) = ${symroot}/${configuration}-universal

The value represented by the custom variable

$ (CURRENTCONFIG_DEVICE_DIR) = $ ()/build/products/debug-iphoneos

$ (CURRENTCONFIG_SIMULATOR_DIR) = $ ()/build/products/debug-iphonesimulator

$ (CREATING_UNIVERSAL_DIR) = $ ()/build/products/debug-universal

Compile script under iphoneos5.0:

Xcodebuild-project "Utillib.xcodeproj"-configuration "Debug"-target "Utillib"-sdk "iphoneos5.0"-arch "ARMv6 armv7" bu ILD Run_clang_static_analyzer=no $ (build_dir) = "${build_dir}" build_root= "${build_root}"

Compile script under iphonesimulator5.0:

Xcodebuild-project "Utillib.xcodeproj"-configuration "Debug"-target "Utillib"-sdk "iphonesimulator5.0"-arch "i386" b Uild Run_clang_static_analyzer=no $ (build_dir) = "${build_dir}" build_root= "${build_root}"

Add the following sentence to output to a file:

> "${build_root}.build_output"

Lipo Script Tool: Merge the static class library of iphone simulator and real machine, generate common library

Lipo-create-output "${creating_universal_dir}/${executable_name}" "${currentconfig_device_dir}/${executable_name } "" ${currentconfig_simulator_dir}/${executable_name} "

This means: Merge the. A file under the directory "${currentconfig_device_dir. A", and the. A file under directory ${currentconfig_simulator_dir},

Under the ${creating_universal_dir} directory, generate a static library that is common to two devices,

Example: Lipo-create-output xy.a x.a y.a

Analysis of common parameters of build settings in Xcode4

1.Installation Directory: Installation path

When a static library is compiled, installation directory Settings "$ (built_products_dir)" in Build settings

Skip Install set to Yes

installation directory defaults to/usr/local/lib

Because the build location defaults, the. A file is placed very long (for example:/users/xxx/library/developer/xcode/deriveddata/xxxprogram

Dalrvzehhtesxdfqhxixzafvddwe/build/products/debug-iphoneos), or the path specified by our target

Skip Install if it is no, it may be installed to the default path/usr/local/lib

2.Public Headers Folder Path: public header file path

Set as "include" (The specific header file path is: $ (built_products_dir)/include/xx.h)

Generate an include directory in the final file. A sibling directory

Default:/usr/local/include

Public Headers Folder Path This path is an external header file that relies on a project that uses this lib. After you import this path, you #include/import "Xx.h" to see

3.User Header Search Paths: Dependent external header file searching path

Set to "$ (built_products_dir)/include"

Corresponds to the path in 2

4.per-configuration Build Products Path: Final file path

For example, set as ". /app ", will be in the project file. Xcodeproj in the app directory on the top-level directory, create the final file

Default is $ (build_dir)/$ (CONFIGURATION) $ (effective_platform_name)

equals $ (Built_products_dir)

5.per-configuration Intermediate Build Files Path: temporary intermediate file paths

Default is: $ (project_temp_dir)/$ (CONFIGURATION) $ (effective_platform_name)

6.Code Signing Identity: Certificate selection for true machine debugging

Select a certificate corresponding to bundle identifier

Library Search Paths: Gallery Searching path

Architectures: schema, set to ARMv6 or ARMV7

Valid Architectures: Application framework, can be set to ARMv6, ARMV7, or i386

Product Name: Project file name, default is $ (target_name)

Info.plist file:info file path

Build variants: Default to Normal

Other Linker Flags: Additional link tags

Set as "-OBJC"

When you import a static library that uses a category, it needs to be set to-OBJC

iOS Deployment target: iOS Deployment Object

For example, you can choose a version that is set to, IOS3 to iOS5

Prefix Header: Pre-programmed headers (e.g.: UTILLIB/UTILLIB-PREFIX.PCH)

Precompile Prefix Header: Set to "Yes" to allow precompiled headers to be added

Third, workspace (work area)

Role: Managing multiple Projects (project), multi-project linking

Iv. Workspace Multi-project linking Setup

One

1. Create a new static library project, such as Utillib, and generate UtilLib.h and UTILLIB.M files

2. Select the header file that you want to expose.

Set the target membership in the right column to public

Or, select the copy headers entry for the build phases tag of the project directory target and add the header file to be exposed in public

3.architectures set to: ARMv6 armv7

4.Valid architectures set to: ARMv6 armv7 i386

5.Build products Path is set to: $ (srcroot)/. /build

6.per-configuration Build Products path is set to:

$ (srcroot)/.. /build/$ (CONFIGURATION) $ (effective_platform_name)

7.per-configuration Intermediate Build Files path is set to:

$ (srcroot)/.. /build/$ (target_name). build/$ (CONFIGURATION) $ (effective_platform_name)

8. Set the installation path: Installation directory entry

9. Set the external header file path: Public Headers Folder Path entry

10. Adding dependent shell scripts for a static library

Select the build phases tag of the project directory target and click the Add Build Phase button from the bottom corner.

Select the Add Run script item in the pop-up menu, and a run script item will appear in the page

Fill in the "$SRCROOT/mergearmsymbols.sh" in the black box.

Establish a dependency on this script (run this script after compiling the static library)

If the device selected at compile time is iphone simulator:

This script will be generated in the product catalog Debug-iphoneos for the iphone device, which is useful for device. A static library,

Conversely, if the device is choosing an iphone device:

This script will be generated in the product catalog Debug-iphoneos corresponding to the iphone simulator to simulator useful. A static library

Finally, this script calls the Lipo tool, merges the static library generated by this project with the static library generated by this script, and generates a. A file that is common to both simulator and device.

11. The specific bash shell script is as follows:

mergearmsymbols.sh

Download the image on the right and change the suffix to. SH (in fact, the above script, because the blog park can only upload pictures)

The directory structure after the static library is compiled is as follows:

Two

1. Create a new master project, such as Nuno, to add a dependency on a static library

Click Project, click the plus sign in the Build Phases tab of the link Binary with libraries to add the UTILLIB.A library

Select the red item above and in the right column, select relative to Project and set the value to: /libs/libutillib.a

2. Set the external header file path that the main project relies on: User header Search Paths entry

$ (srcroot)/.. /include

3. Set the header Search paths to: $ (srcroot)/. /include

4. Set the library Search paths to: $ (srcroot)/. /libs

Compile and run to implement the binder

(Note: Select Simulator iphone 5.0 simulator, when compiling the static library, the final file will be in Debug-iphonesimulator, even if it succeeds. A file is still red,

This is a bug that may be xcode and does not automatically switch paths

Because $ (built_products_dir) refers to a location that is Build/debug-iphonesos, not a debug-iphonesimulator that contains the final. a file;

Select iOS Device to compile the final file under Build/debug-iphonesos,. A file becomes non-red

All have to be solved with mergearmsymbols.sh script)

XCODE4 environment variables, Build settings parameters, workspace and binder settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.