diff options
-rw-r--r-- | waftools/detections/compiler.py | 3 | ||||
-rw-r--r-- | wscript | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/waftools/detections/compiler.py b/waftools/detections/compiler.py index 2d6f8c6d23..b98218856f 100644 --- a/waftools/detections/compiler.py +++ b/waftools/detections/compiler.py @@ -22,6 +22,9 @@ def __add_generic_flags__(ctx): "-D_LARGEFILE64_SOURCE", "-std=c99", "-Wall"] + if ctx.is_optimization(): + ctx.env.CFLAGS += ['-O2'] + if ctx.is_debug_build(): ctx.env.CFLAGS += ['-g'] @@ -36,6 +36,11 @@ build_options = [ 'default': 'enable', 'func': check_true }, { + 'name': '--optimize', + 'desc': 'whether to optimize', + 'default': 'enable', + 'func': check_true + }, { 'name': '--debug-build', 'desc': 'whether to compile-in debugging information', 'default': 'enable', @@ -788,6 +793,10 @@ def options(opt): help = "select Lua package which should be autodetected. Choices: 51 51deb 51fbsd 52 52deb 52fbsd luajit") @conf +def is_optimization(ctx): + return getattr(ctx.options, 'enable_optimize') + +@conf def is_debug_build(ctx): return getattr(ctx.options, 'enable_debug-build') |