summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTsukasa OMOTO <henry0312@gmail.com>2014-07-20 01:45:43 +0900
committerwm4 <wm4@nowhere>2014-07-20 00:08:36 +0200
commitb0ff0527a37d988bfbc12d441c60523a50647f84 (patch)
tree2b83aa8f7bcd51e60ad908da4a273045cefd4907
parent887140b7d4c79f3afd3edc26591f9938a0acae38 (diff)
downloadmpv-b0ff0527a37d988bfbc12d441c60523a50647f84.tar.bz2
mpv-b0ff0527a37d988bfbc12d441c60523a50647f84.tar.xz
build: enable compiler optimization by default
-rw-r--r--waftools/detections/compiler.py3
-rw-r--r--wscript9
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']
diff --git a/wscript b/wscript
index bb55ba411e..080ef7f1cf 100644
--- a/wscript
+++ b/wscript
@@ -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')