# Sconstruct file for P4OFC
import string, os, re, glob
def filename(p): # Return filename bit
return os.path.split(p)[1]
MSDEV = '""C:\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\devenv.exe""'
VB6 = '"C:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.exe"'
INNOSETUP = '"C:\Program Files (x86)\Inno Setup 5\iscc.exe"'
#---------------------------------
# Scan MSDEV DSP file for dependencies like:
# SOURCE=.\safearray.H
dsp_re = re.compile(r'^SOURCE=(\S+)$', re.M)
def dsp_scan(node, env, target, arg):
contents = node.get_contents()
includes = dsp_re.findall(contents)
return includes
dspscan = Scanner(name = 'dsp',
function = dsp_scan,
argument = None,
skeys = ['.dsp'])
#---------------------------------
# Scan MSDEV SLN file for dependencies like:
# SOURCE=.\safearray.H
vcproj_re = re.compile(r'<File\s+RelativePath="([^"]*)', re.M)
vcproj_re_exclude = re.compile(r'.*_i\..*')
def vcproj_scan(node, env, target, arg):
# print "Node: " + node.name + ': ' + node.get_abspath()
contents = node.get_contents()
includes = vcproj_re.findall(contents)
# print "Includes: " + ' '.join(includes)
# Remove files generated by MIDL compiler (e.g. *_i.c or similar)
includes = filter(lambda x:not vcproj_re_exclude.match(x), includes)
# print "Filtered Includes: " + ' '.join(includes)
return includes
vcprojscan = Scanner(name = 'vcproj',
function = vcproj_scan,
argument = None,
skeys = ['.vcproj'])
#---------------------------------
# Also VB scanner for dependencies like:
# Module=Register; Register.bas
# Form=TimerForm.frm
# Form=p4vbTestForm.frm
# Class=WinHelp; WinHelp.cls
vbp_module_re = re.compile(r'^Module=\S+; (\S+)\s*$', re.M)
vbp_form_re = re.compile(r'^Form=(\S+)\s*$', re.M)
vbp_class_re = re.compile(r'^Class=\S+; (\S+)\s*$', re.M)
def vbp_scan(node, env, target, arg):
contents = node.get_contents()
includes = vbp_module_re.findall(contents)
includes += vbp_form_re.findall(contents)
includes += vbp_class_re.findall(contents)
# print "Node: " + node.name
# print "Includes: " + string.join(includes, ' ')
# print "Change no: " + p4_change_no(1)
return includes
vbpscan = Scanner(name = 'vbp',
function = vbp_scan,
argument = None,
skeys = ['.vbp'])
scanners = Environment().Dictionary('SCANNERS')
#---------------------------------
# Builder for Setup compiler
mkinstall = Builder(action = INNOSETUP + ' $SOURCES')
msdev_mindep = Builder(action = [[MSDEV,
'$SOURCES', '/build', 'Release MinDependency', '/out', 'log.txt']])
msdev_rel = Builder(action = [[MSDEV,
'$SOURCES', '/build', 'Release']])
msvb = Builder(action = VB6 + ' /makedll $SOURCES')
def build_typelibs_cmd(target, source, env):
# Code to build "target" from "source"
os.system('p4comaddin\\powervb\\buildtypelibs.bat')
return None
build_typelibs = Builder(action = build_typelibs_cmd)
files_dir = 'install/files'
setup = 'install/Output/P4OFC.exe'
p4com = 'p4com/src/ReleaseMinDependency/p4com.dll'
libeay32 = 'openssl-lib/libeay32.dll'
ssleay32 = 'openssl-lib/ssleay32.dll'
p4comaddin = 'p4comaddin/p4comaddin.dll'
libp4gt = 'libp4gt/release/libp4gt.lib'
p4dialogs = 'p4dialogs/release/p4dialogs.dll'
vboosttypes6 = 'references/VBoostTypes6.olb'
threadapi = 'references/ThreadAPI.olb'
# Files to remove when appropriate
clean_files = glob.glob('p4com/src/ReleaseMinDependency/*')
clean_files.extend(glob.glob('libp4gt/release/*'))
clean_files.extend(glob.glob('p4dialogs/release/*'))
#print "Clean: " + ' '.join(clean_files)
Clean(p4com, clean_files)
# Default target to build
Default(setup)
env = Environment(BUILDERS = {'mkinstall' : mkinstall,
'msdev_mindep' : msdev_mindep,
'msdev_rel' : msdev_rel,
'msvb' : msvb,
'build_typelibs' : build_typelibs},
SCANNERS = scanners + [dspscan, vcprojscan, vbpscan])
FILES = ['help/p4ofc.chm']
env.Install(dir = files_dir, source = FILES)
for f in FILES:
env.Depends(setup, files_dir + '/' + filename(f))
env.msdev_mindep(target = p4com, source = 'p4com/src/p4com.vcxproj')
#env.msdev_rel(target = libp4gt, source = 'libp4gt/libp4gt.vcxproj')
env.msdev_rel(target = p4dialogs, source = 'p4dialogs/p4dialogs.vcxproj')
env.msvb(target = p4comaddin, source = 'p4comaddin/p4comaddin.vbp')
# env.build_typelibs(target = vboosttypes6, source = 'p4comaddin/PowerVB/VBoostTypes6.idl')
env.Depends(p4comaddin, vboosttypes6)
#env.Depends(p4dialogs, libp4gt)
env.Depends(p4comaddin, p4dialogs)
for f in [p4com, p4comaddin, vboosttypes6, threadapi, p4dialogs, libeay32, ssleay32]:
env.Install(dir = files_dir, source = f)
env.Depends(setup, files_dir + '/' + filename(f))
env.mkinstall(target = setup, source = 'install/P4ForOffice.iss')
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 11216 | Robert Cowham | Save a log file if MSDev fails to build | ||
| #1 | 10843 | Robert Cowham |
Initial version of P4OFC source code. See README.txt (and LICENSE.txt and doc\P4OFC-Design.docx) |