wscript_build (1369B)
1 #! /usr/bin/env python 2 3 bld.shlib( 4 source = 'test_shlib.c', 5 target = 'my_shared_lib', 6 name = 'xyz', 7 vnum = '1.2.3', 8 defs = 'foo.def') 9 10 11 t = bld.program( 12 #features = 'my_precious', 13 source = 'main.c', 14 target = 'test_shared_link', 15 use = 'xyz', 16 # 1. settings flags directly 17 #linkflags = ['-L/disk/comp/waf/demos/c/build/shlib', '-lmy_shared_lib'] 18 ) 19 # 2. another way of setting flags 20 #t.env.linkflags = ['-L/disk/comp/waf/demos/c/build/shlib', '-lmy_shared_lib'] 21 22 # 3. advanced flag control through 'feature' methods (standard practice when 1. or 2. is not enough) 23 #import sys 24 #from waflib import TaskGen 25 #@TaskGen.feature('my_precious') 26 #@TaskGen.after_method('apply_link', 'propagate_uselib_vars') 27 #def set_flags(self): 28 # if sys.platform == 'linux2': 29 # self.link_task.env.LINKFLAGS = ['-Lshlib', '--whole-archive', '-lmy_shared_lib'] 30 # self.link_task.env.LIB = [] 31 # self.link_task.env.STLIB = [] 32 # self.link_task.env.STLIB_MARKER = [] 33 34 # 4. changing the class - setting flags such as LINKFLAGS_cshlib is usually a much better idea 35 #from waflib.Utils import run_once 36 #from waflib.Tools.c import cprogram 37 #class cprogram(cprogram): 38 # def runnable_status(self): 39 # self.set_flags() 40 # self.set_flags() # just to see 41 # return super(cprogram, self).runnable_status() 42 # @run_once 43 # def set_flags(self): 44 # self.env.append_value('LINKFLAGS', ['-g']) 45