summaryrefslogtreecommitdiff
path: root/platform/iphone
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-04-24 16:49:12 +0200
committerRémi Verschelde <rverschelde@gmail.com>2019-04-24 16:57:58 +0200
commitc2a669a9f03e249fb4fca96a2adf63256eb8dfa2 (patch)
tree711bd1f6ed3b110ba56af20d6995fe615c3ccf0d /platform/iphone
parente1d16e722ec9742c3f92d20dc433d540339c36e6 (diff)
SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS, CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them in the way they are intended to be. As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html - CCFLAGS: General options that are passed to the C and C++ compilers. - CFLAGS: General options that are passed to the C compiler (C only; not C++). - CXXFLAGS: General options that are passed to the C++ compiler. By default, this includes the value of $CCFLAGS, so that setting $CCFLAGS affects both C and C++ compilation. - CPPFLAGS: User-specified C preprocessor options. These will be included in any command that uses the C preprocessor, including not just compilation of C and C++ source files [...], but also [...] Fortran [...] and [...] assembly language source file[s]. TL;DR: Compiler options go to CCFLAGS, unless they must be restricted to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to CPPFLAGS.
Diffstat (limited to 'platform/iphone')
-rw-r--r--platform/iphone/detect.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 853f24379e..d56e28a4af 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -45,20 +45,21 @@ def configure(env):
if (env["target"].startswith("release")):
env.Append(CPPFLAGS=['-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1'])
if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer'])
+ env.Append(CCFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer'])
env.Append(LINKFLAGS=['-O2'])
else: #optimize for size
- env.Append(CPPFLAGS=['-Os', '-ftree-vectorize'])
+ env.Append(CCFLAGS=['-Os', '-ftree-vectorize'])
env.Append(LINKFLAGS=['-Os'])
if env["target"] == "release_debug":
env.Append(CPPFLAGS=['-DDEBUG_ENABLED'])
elif (env["target"] == "debug"):
- env.Append(CPPFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-O0', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+ env.Append(CCFLAGS=['-gdwarf-2', '-O0'])
+ env.Append(CPPFLAGS=['-D_DEBUG', '-DDEBUG=1', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
if (env["use_lto"]):
- env.Append(CPPFLAGS=['-flto'])
+ env.Append(CCFLAGS=['-flto'])
env.Append(LINKFLAGS=['-flto'])
## Architecture
@@ -104,7 +105,7 @@ def configure(env):
detect_darwin_sdk_path('iphonesimulator', env)
env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
arch_flag = "i386" if env["arch"] == "x86" else env["arch"]
- env.Append(CCFLAGS=('-arch ' + arch_flag + ' -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -isysroot $IPHONESDK -mios-simulator-version-min=10.0 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"').split())
+ env.Append(CCFLAGS=('-arch ' + arch_flag + ' -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -isysroot $IPHONESDK -mios-simulator-version-min=10.0').split())
elif (env["arch"] == "arm"):
detect_darwin_sdk_path('iphone', env)
env.Append(CCFLAGS='-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=10.0 -MMD -MT dependencies'.split())
@@ -115,9 +116,9 @@ def configure(env):
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
if env['ios_exceptions']:
- env.Append(CPPFLAGS=['-fexceptions'])
+ env.Append(CCFLAGS=['-fexceptions'])
else:
- env.Append(CPPFLAGS=['-fno-exceptions'])
+ env.Append(CCFLAGS=['-fno-exceptions'])
## Link flags