summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorMichael R. Fisher <mfisher@bketech.com>2013-07-15 17:27:21 -0500
committerMichael Fisher <mfisher31@gmail.com>2013-07-15 22:57:35 -0500
commitcdef4aa50f64daf784590a8f27f1ba11c03f1884 (patch)
tree1bb0c4197f001348db39b795ce8c670e1a374c01 /wscript
parent066df0d218ee4391eb3e15259deca5ccc190ed84 (diff)
Add c++11 enablement options in wscript
- adds "--cxx11" toggle for ./waf configure - The switch adds appropriate compiler flags and tests the compiler for usability of c++11 - This 'should' be compatible for linux, osx, and windows systems that have gcc and/or clang with support c++11
Diffstat (limited to 'wscript')
-rw-r--r--wscript18
1 files changed, 18 insertions, 0 deletions
diff --git a/wscript b/wscript
index a6106c0aef..48e30ef7ea 100644
--- a/wscript
+++ b/wscript
@@ -110,6 +110,22 @@ def set_compiler_flags (conf,opt):
# waf adds -O0 -g itself. thanks waf!
is_clang = conf.env['CXX'][0].endswith('clang++')
+
+ if conf.options.cxx11:
+ conf.check_cxx(cxxflags=["-std=c++11"])
+ conf.env.append_unique('CXXFLAGS', ['-std=c++11'])
+ if platform == "darwin":
+ conf.env.append_unique('CXXFLAGS', ['-stdlib=libc++'])
+ conf.env.append_unique('LINKFLAGS', ['-lc++'])
+ # Prevents visibility issues in standard headers
+ conf.define("_DARWIN_C_SOURCE", 1)
+
+ if is_clang and platform == "darwin":
+ # Silence warnings about the non-existing osx clang compiler flags
+ # -compatibility_version and -current_version. These are Waf
+ # generated and not needed with clang
+ conf.env.append_unique ("CXXFLAGS", ["-Qunused-arguments"])
+
if opt.gprofile:
debug_flags = [ '-pg' ]
@@ -454,6 +470,8 @@ def options(opt):
help='directory where Wine\'s Windows header files can be found')
opt.add_option('--noconfirm', action='store_true', default=False, dest='noconfirm',
help='Do not ask questions that require confirmation during the build')
+ opt.add_option('--cxx11', action='store_true', default=False, dest='cxx11',
+ help='Turn on c++11 compiler flags (-std=c++11)')
for i in children:
opt.recurse(i)