wscript_build (2327B)
1 #! /usr/bin/env python 2 # encoding: utf-8 3 #vim syntax=python 4 5 import os, sys, shutil 6 from waflib import Utils 7 8 bld.add_group() 9 10 funigui = ctx.env.guiname+'.exe' 11 csdll = ctx.env.dllname+'_cs.dll' 12 funi_cs = bld.path.find_or_declare(csdll) 13 14 # obtain the file names to copy 15 from waflib import TaskGen 16 @TaskGen.feature('copy_over') 17 @TaskGen.before_method('process_subst') 18 def get_filenames_to_copy_from_task_generators(self): 19 src = self.bld.get_tgen_by_name(self.from_tg).tasks[-1].outputs[0] 20 self.source = [src] 21 self.target = [src.name] 22 self.is_copy = True 23 24 # just copy the files to this folder 25 bld(features='copy_over subst', from_tg='funi') 26 bld(features='copy_over subst', from_tg='csdll') 27 28 # copy the same file to the build directory 29 bld.src2bld(bld, 'Resources/Icon1.ico') 30 31 bld(rule=bld.stpl,source='AssemblyInfo.cs.stpl',target='AssemblyInfo.cs') 32 33 bld.add_group() 34 35 src = """ 36 program.cs 37 FormFuni.cs 38 AssemblyInfo.cs 39 Resources.resx 40 """.strip().split() 41 42 refs = """ 43 System 44 System.Core 45 System.Windows.Forms 46 System.Xml 47 System.Xml.Linq 48 System.Data 49 System.Data.DataSetExtensions 50 System.Drawing 51 """.strip().split() 52 53 if Utils.is_win32: 54 refs = """ 55 System 56 System.Core 57 System.Windows.Forms 58 System.Linq 59 System.RunTime.InteropServices 60 System.Xml 61 System.Xml.Linq 62 System.Threading.Tasks 63 System.Data 64 System.Data.DataSetExtensions 65 System.Deployment 66 System.Drawing 67 """.strip().split() 68 69 70 CSFLAGS = [] 71 def csflag(x): 72 global CSFLAGS 73 CSFLAGS+=[x] 74 csflag(r'/platform:x64') 75 csflag(r'/errorreport:prompt') 76 if Utils.is_win32: 77 csflag(r'/errorendlocation') 78 csflag(r'/preferreduilang:en-US') 79 csflag(r'/highentropyva-') 80 csflag(r'/debug:pdbonly') 81 csflag(r'/filealign:512') 82 csflag(r'/define:'+ctx.env.guiname[1:]) #EstimPRO or EstimRESEARCH 83 csflag(r'/nologo') 84 csflag(r'/noconfig') 85 csflag(r'/nowarn:1701,1702') 86 csflag(r'/target:winexe') 87 if ctx.options.stubs: 88 csflag('/optimize-') 89 csflag('/define:DEBUG') 90 csflag('/define:TRACE') 91 else: 92 csflag('/optimize+') 93 94 csflag(r'/win32icon:gui/Resources/Icon1.ico') 95 96 97 bld(features='cs',source=src,gen=funigui,csflags=CSFLAGS,use=[r+'.dll' for r in refs]+[funi_cs.abspath()]) 98 99 bld.add_group() 100 101 bld(features='satellite_assembly',source='Resources/resources.fr.txt', gen=funigui) 102