waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

ldc2.py (1185B)


      1 #!/usr/bin/env python
      2 # encoding: utf-8
      3 # Alex Rønne Petersen, 2012 (alexrp/Zor)
      4 
      5 from waflib.Tools import ar, d
      6 from waflib.Configure import conf
      7 
      8 @conf
      9 def find_ldc2(conf):
     10 	"""
     11 	Finds the program *ldc2* and set the variable *D*
     12 	"""
     13 	conf.find_program(['ldc2'], var='D')
     14 
     15 	out = conf.cmd_and_log(conf.env.D + ['-version'])
     16 	if out.find("based on DMD v2.") == -1:
     17 		conf.fatal("detected compiler is not ldc2")
     18 
     19 @conf
     20 def common_flags_ldc2(conf):
     21 	"""
     22 	Sets the D flags required by *ldc2*
     23 	"""
     24 	v = conf.env
     25 
     26 	v.D_SRC_F           = ['-c']
     27 	v.D_TGT_F           = '-of%s'
     28 
     29 	v.D_LINKER          = v.D
     30 	v.DLNK_SRC_F        = ''
     31 	v.DLNK_TGT_F        = '-of%s'
     32 	v.DINC_ST           = '-I%s'
     33 
     34 	v.DSHLIB_MARKER = v.DSTLIB_MARKER = ''
     35 	v.DSTLIB_ST = v.DSHLIB_ST         = '-L-l%s'
     36 	v.DSTLIBPATH_ST = v.DLIBPATH_ST   = '-L-L%s'
     37 
     38 	v.LINKFLAGS_dshlib  = ['-L-shared']
     39 
     40 	v.DHEADER_ext       = '.di'
     41 	v.DFLAGS_d_with_header = ['-H', '-Hf']
     42 	v.D_HDR_F           = '%s'
     43 
     44 	v.LINKFLAGS     = []
     45 	v.DFLAGS_dshlib = ['-relocation-model=pic']
     46 
     47 def configure(conf):
     48 	"""
     49 	Configuration for *ldc2*
     50 	"""
     51 	conf.find_ldc2()
     52 	conf.load('ar')
     53 	conf.load('d')
     54 	conf.common_flags_ldc2()
     55 	conf.d_platform_flags()
     56