Return the environment variables that Xcode would set. See http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153 for a full list. Args: xcode_s
(
xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None
)
| 1702 | |
| 1703 | |
| 1704 | def _GetXcodeEnv( |
| 1705 | xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None |
| 1706 | ): |
| 1707 | """Return the environment variables that Xcode would set. See |
| 1708 | http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153 |
| 1709 | for a full list. |
| 1710 | |
| 1711 | Args: |
| 1712 | xcode_settings: An XcodeSettings object. If this is None, this function |
| 1713 | returns an empty dict. |
| 1714 | built_products_dir: Absolute path to the built products dir. |
| 1715 | srcroot: Absolute path to the source root. |
| 1716 | configuration: The build configuration name. |
| 1717 | additional_settings: An optional dict with more values to add to the |
| 1718 | result. |
| 1719 | """ |
| 1720 | |
| 1721 | if not xcode_settings: |
| 1722 | return {} |
| 1723 | |
| 1724 | # This function is considered a friend of XcodeSettings, so let it reach into |
| 1725 | # its implementation details. |
| 1726 | spec = xcode_settings.spec |
| 1727 | |
| 1728 | # These are filled in on an as-needed basis. |
| 1729 | env = { |
| 1730 | "BUILT_FRAMEWORKS_DIR": built_products_dir, |
| 1731 | "BUILT_PRODUCTS_DIR": built_products_dir, |
| 1732 | "CONFIGURATION": configuration, |
| 1733 | "PRODUCT_NAME": xcode_settings.GetProductName(), |
| 1734 | # For FULL_PRODUCT_NAME see: |
| 1735 | # /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX\ Product\ Types.xcspec # noqa: E501 |
| 1736 | "SRCROOT": srcroot, |
| 1737 | "SOURCE_ROOT": "${SRCROOT}", |
| 1738 | # This is not true for static libraries, but currently the env is only |
| 1739 | # written for bundles: |
| 1740 | "TARGET_BUILD_DIR": built_products_dir, |
| 1741 | "TEMP_DIR": "${TMPDIR}", |
| 1742 | "XCODE_VERSION_ACTUAL": XcodeVersion()[0], |
| 1743 | } |
| 1744 | if xcode_settings.GetPerConfigSetting("SDKROOT", configuration): |
| 1745 | env["SDKROOT"] = xcode_settings._SdkPath(configuration) |
| 1746 | else: |
| 1747 | env["SDKROOT"] = "" |
| 1748 | |
| 1749 | if xcode_settings.mac_toolchain_dir: |
| 1750 | env["DEVELOPER_DIR"] = xcode_settings.mac_toolchain_dir |
| 1751 | |
| 1752 | if spec["type"] in ( |
| 1753 | "executable", |
| 1754 | "static_library", |
| 1755 | "shared_library", |
| 1756 | "loadable_module", |
| 1757 | ): |
| 1758 | env["EXECUTABLE_NAME"] = xcode_settings.GetExecutableName() |
| 1759 | env["EXECUTABLE_PATH"] = xcode_settings.GetExecutablePath() |
| 1760 | env["FULL_PRODUCT_NAME"] = xcode_settings.GetFullProductName() |
| 1761 | mach_o_type = xcode_settings.GetMachOType() |
no test coverage detected