From 687248bbf4fcb45d94411fab4a8a0e545fe7ca18 Mon Sep 17 00:00:00 2001 From: Ariel Manzur Date: Wed, 22 Jun 2016 16:15:05 -0300 Subject: [PATCH] added "arch" parameter, made iphone use it to build isim (cherry picked from commit 10c512e46d57034b2fd6f408e0fec37f17e972e5) --- SConstruct | 5 ++++- platform/iphone/detect.py | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index 0f9b046e2bd..ae2f2ae14ab 100644 --- a/SConstruct +++ b/SConstruct @@ -112,6 +112,7 @@ if profile: opts=Variables(customs, ARGUMENTS) opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug") +opts.Add('arch', 'Platform dependent architecture (arm/arm64/x86/x64/mips/etc)', "") opts.Add('bits', 'Compile Target Bits (default/32/64/fat).', "default") opts.Add('platform','Platform: '+str(platform_list)+'.',"") opts.Add('p','Platform (same as platform=).',"") @@ -267,7 +268,9 @@ if selected_platform in platform_list: else: suffix+=".debug" - if (env["bits"]=="32"): + if env["arch"] != "": + suffix += "."+env["arch"] + elif (env["bits"]=="32"): suffix+=".32" elif (env["bits"]=="64"): suffix+=".64" diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 255525bd900..9cb52d45612 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -55,16 +55,22 @@ def configure(env): env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib' import string - if (env["ios_sim"]=="yes"): # i386, simulator + if (env["ios_sim"]=="yes" or env["arch"] == "x86"): # i386, simulator + env["arch"]="x86" + env["bits"]="32" env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"') - elif (env["bits"]=="64"): # arm64 + elif (env["arch"]=="arm64"): # arm64 + env["bits"] = "64" env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') env.Append(CPPFLAGS=['-DNEED_LONG_INT']) env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON']) else: # armv7 + env["arch"] = "arm" + env["bits"] = "32" env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') - if (env["ios_sim"]=="yes"): + if (env["arch"]=="x86"): + env['IPHONEPLATFORM'] = 'iPhoneSimulator' env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3', '-isysroot', '$IPHONESDK', #'-mmacosx-version-min=10.6', @@ -85,7 +91,7 @@ def configure(env): '-framework', 'SystemConfiguration', '-F$IPHONESDK', ]) - elif (env["bits"]=="64"): + elif (env["arch"]=="arm64"): env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1', '-isysroot', '$IPHONESDK', #'-stdlib=libc++', @@ -161,7 +167,9 @@ def configure(env): if(env["opus"]=="yes"): env.opus_fixed_point="yes" - if(env["bits"]=="64"): + if env["arch"]=="x86": + pass + elif(env["arch"]=="arm64"): env.Append(CFLAGS=["-DOPUS_ARM64_OPT"]) else: env.Append(CFLAGS=["-DOPUS_ARM_OPT"])