3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # Thomas Nagy, 2006-2016 (ita)
8 # Ralf Habacker, 2006 (rh)
15 from waflib.Tools import ccroot, ar
16 from waflib.Configure import conf
21 Finds the program g++, and if present, try to detect its version number
23 cxx = conf.find_program(['g++', 'c++'], var='CXX')
24 conf.get_cc_version(cxx, gcc=True)
25 conf.env.CXX_NAME = 'gcc'
28 def gxx_common_flags(conf):
30 Common flags for g++ on nearly all platforms
35 v.CXX_TGT_F = ['-c', '-o']
41 v.CXXLNK_TGT_F = ['-o']
45 v.LIB_ST = '-l%s' # template for adding libs
46 v.LIBPATH_ST = '-L%s' # template for adding libpaths
48 v.STLIBPATH_ST = '-L%s'
49 v.RPATH_ST = '-Wl,-rpath,%s'
51 v.SONAME_ST = '-Wl,-h,%s'
52 v.SHLIB_MARKER = '-Wl,-Bdynamic'
53 v.STLIB_MARKER = '-Wl,-Bstatic'
55 v.cxxprogram_PATTERN = '%s'
57 v.CXXFLAGS_cxxshlib = ['-fPIC']
58 v.LINKFLAGS_cxxshlib = ['-shared']
59 v.cxxshlib_PATTERN = 'lib%s.so'
61 v.LINKFLAGS_cxxstlib = ['-Wl,-Bstatic']
62 v.cxxstlib_PATTERN = 'lib%s.a'
64 v.LINKFLAGS_MACBUNDLE = ['-bundle', '-undefined', 'dynamic_lookup']
65 v.CXXFLAGS_MACBUNDLE = ['-fPIC']
66 v.macbundle_PATTERN = '%s.bundle'
69 def gxx_modifier_win32(conf):
70 """Configuration flags for executing gcc on Windows"""
72 v.cxxprogram_PATTERN = '%s.exe'
74 v.cxxshlib_PATTERN = '%s.dll'
75 v.implib_PATTERN = 'lib%s.dll.a'
76 v.IMPLIB_ST = '-Wl,--out-implib,%s'
78 v.CXXFLAGS_cxxshlib = []
80 # Auto-import is enabled by default even without this option,
81 # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages
82 # that the linker emits otherwise.
83 v.append_value('LINKFLAGS', ['-Wl,--enable-auto-import'])
86 def gxx_modifier_cygwin(conf):
87 """Configuration flags for executing g++ on Cygwin"""
88 gxx_modifier_win32(conf)
90 v.cxxshlib_PATTERN = 'cyg%s.dll'
91 v.append_value('LINKFLAGS_cxxshlib', ['-Wl,--enable-auto-image-base'])
92 v.CXXFLAGS_cxxshlib = []
95 def gxx_modifier_darwin(conf):
96 """Configuration flags for executing g++ on MacOS"""
98 v.CXXFLAGS_cxxshlib = ['-fPIC']
99 v.LINKFLAGS_cxxshlib = ['-dynamiclib']
100 v.cxxshlib_PATTERN = 'lib%s.dylib'
101 v.FRAMEWORKPATH_ST = '-F%s'
102 v.FRAMEWORK_ST = ['-framework']
103 v.ARCH_ST = ['-arch']
105 v.LINKFLAGS_cxxstlib = []
112 def gxx_modifier_aix(conf):
113 """Configuration flags for executing g++ on AIX"""
115 v.LINKFLAGS_cxxprogram= ['-Wl,-brtl']
117 v.LINKFLAGS_cxxshlib = ['-shared', '-Wl,-brtl,-bexpfull']
121 def gxx_modifier_hpux(conf):
125 v.CFLAGS_cxxshlib = ['-fPIC','-DPIC']
126 v.cxxshlib_PATTERN = 'lib%s.sl'
129 def gxx_modifier_openbsd(conf):
130 conf.env.SONAME_ST = []
133 def gcc_modifier_osf1V(conf):
140 def gxx_modifier_platform(conf):
141 """Execute platform-specific functions based on *gxx_modifier_+NAME*"""
142 # * set configurations specific for a platform.
143 # * the destination platform is detected automatically by looking at the macros the compiler predefines,
144 # and if it's not recognised, it fallbacks to sys.platform.
145 gxx_modifier_func = getattr(conf, 'gxx_modifier_' + conf.env.DEST_OS, None)
146 if gxx_modifier_func:
151 Configuration for g++
155 conf.gxx_common_flags()
156 conf.gxx_modifier_platform()
157 conf.cxx_load_tools()
159 conf.link_add_flags()