Skip to content

Commit

Permalink
ios-toolchain: take care of IPHONEOS_DEPLOYMENT_TARGET (env)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoechtrager committed Dec 28, 2014
1 parent 23658f2 commit 3d19853
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions usage_examples/ios_toolchain/README
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ arm-apple-darwin11-*

You can then use arm-apple-darwin11-clang / arm apple-darwin11-clang++
to build your applications.

---

IPHONEOS_DEPLOYMENT_TARGET can be used to target older iOS versions.

For example:

export IPHONEOS_DEPLOYMENT_TARGET=5.0

will target iOS 5.0.
9 changes: 8 additions & 1 deletion usage_examples/ios_toolchain/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ int main(int argc, char *argv[])
char execpath[PATH_MAX+1];
char sdkpath[PATH_MAX+1];
char codesign_allocate[64];
char osvermin[64];

char *compiler;
char *target;

char *sdk;
char *cpu;
char *osmin;

target_info(argv, &target, &compiler);
if (!get_executable_path(execpath, sizeof(execpath))) abort();
Expand All @@ -96,6 +98,11 @@ int main(int argc, char *argv[])
env(&sdk, "IOS_SDK_SYSROOT", sdkpath);
env(&cpu, "IOS_TARGET_CPU", TARGET_CPU);

env(&osmin, "IPHONEOS_DEPLOYMENT_TARGET", OS_VER_MIN);
unsetenv("IPHONEOS_DEPLOYMENT_TARGET");

snprintf(osvermin, sizeof(osvermin), "-miphoneos-version-min=%s", osmin);

for (i = 1; i < argc; ++i)
{
if (!strcmp(argv[i], "-arch"))
Expand All @@ -119,7 +126,7 @@ int main(int argc, char *argv[])
args[i++] = cpu;
}

args[i++] = "-miphoneos-version-min=" OS_VER_MIN;
args[i++] = osvermin;
args[i++] = "-mlinker-version=241.9";

for (j = 1; j < argc; ++i, ++j)
Expand Down

0 comments on commit 3d19853

Please sign in to comment.