blob: b6e3303d5f2237aa359f9cdfb0d43a479eb23366 [file] [log] [blame]
akmhoquefa8ee9b2014-03-14 09:06:24 -05001#! /usr/bin/env python
2# encoding: utf-8
3# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
5import sys
6from waflib.Tools import ar,d
7from waflib.Configure import conf
8@conf
9def find_dmd(conf):
10 conf.find_program(['dmd','dmd2','ldc'],var='D')
11 out=conf.cmd_and_log([conf.env.D,'--help'])
12 if out.find("D Compiler v")==-1:
13 out=conf.cmd_and_log([conf.env.D,'-version'])
14 if out.find("based on DMD v1.")==-1:
15 conf.fatal("detected compiler is not dmd/ldc")
16@conf
17def common_flags_ldc(conf):
18 v=conf.env
19 v['DFLAGS']=['-d-version=Posix']
20 v['LINKFLAGS']=[]
21 v['DFLAGS_dshlib']=['-relocation-model=pic']
22@conf
23def common_flags_dmd(conf):
24 v=conf.env
25 v['D_SRC_F']=['-c']
26 v['D_TGT_F']='-of%s'
27 v['D_LINKER']=v['D']
28 v['DLNK_SRC_F']=''
29 v['DLNK_TGT_F']='-of%s'
30 v['DINC_ST']='-I%s'
31 v['DSHLIB_MARKER']=v['DSTLIB_MARKER']=''
32 v['DSTLIB_ST']=v['DSHLIB_ST']='-L-l%s'
33 v['DSTLIBPATH_ST']=v['DLIBPATH_ST']='-L-L%s'
34 v['LINKFLAGS_dprogram']=['-quiet']
35 v['DFLAGS_dshlib']=['-fPIC']
36 v['LINKFLAGS_dshlib']=['-L-shared']
37 v['DHEADER_ext']='.di'
38 v.DFLAGS_d_with_header=['-H','-Hf']
39 v['D_HDR_F']='%s'
40def configure(conf):
41 conf.find_dmd()
42 if sys.platform=='win32':
43 out=conf.cmd_and_log([conf.env.D,'--help'])
44 if out.find("D Compiler v2.")>-1:
45 conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead')
46 conf.load('ar')
47 conf.load('d')
48 conf.common_flags_dmd()
49 conf.d_platform_flags()
50 if str(conf.env.D).find('ldc')>-1:
51 conf.common_flags_ldc()