/
archBuild_sconscript
178 lines (146 loc) · 5.87 KB
/
archBuild_sconscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
###
#This file is a part of the NVDA project.
#URL: http://www.nvda-project.org/
#Copyright 2006-2010 NVDA contributers.
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 2.0, as published by
#the Free Software Foundation.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#This license can be found at:
#http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
###
import os
import shutil
Import(
'env',
'sourceDir',
'sourceTypelibDir',
'libInstallDir',
'clientInstallDir',
)
# We only support compiling with MSVC 14 (2015)
if not env.get('MSVC_VERSION','').startswith('14.'):
raise RuntimeError("Microsoft Visual C++ 14 not found")
TARGET_ARCH=env['TARGET_ARCH']
debug=env['nvdaHelperDebugFlags']
release=env['release']
signExec=env['signExec'] if env['certFile'] else None
#Some defines and includes for the environment
env.Append(CPPDEFINES=['UNICODE','_CRT_SECURE_NO_DEPRECATE',('LOGLEVEL','${nvdaHelperLogLevel}'),('_WIN32_WINNT','_WIN32_WINNT_WS03')])
env.Append(CCFLAGS=['/W3','/WX'])
if 'analyze' in debug:
env.Append(CCFLAGS=['/analyze'])
# Disable: Inconsistent annotation for 'x': this instance has no annotations.
# Seems all MIDL-generated code from idl files don't add annotations
env.Append(CCFLAGS='/wd28251')
# Disable: 'x': unreferenced formal parameter
# We use a great deal of hook functions where we have no need for various parameters
env.Append(CCFLAGS='/wd4100')
env.Append(CXXFLAGS=['/EHsc'])
env.Append(CPPPATH=['#/include','#/miscDeps/include',Dir('.').abspath])
env.Append(LINKFLAGS=['/incremental:no','/WX'])
env.Append(LINKFLAGS='/release') #We always want a checksum in the header
env.Append(MIDLFLAGS='/x64' if TARGET_ARCH=='x86_64' else '/win32')
if not release:
env.Append(CCFLAGS=['/Od'])
else:
env.Append(CCFLAGS='/O2')
env.Append(CCFLAGS='/GL')
env.Append(LINKFLAGS=['/LTCG'])
if 'debugCRT' in debug:
env.Append(CCFLAGS=['/MTd'])
else:
env.Append(CCFLAGS=['/MT'])
env.Append(CPPDEFINES=['NDEBUG'])
if 'RTC' in debug:
env.Append(CCFLAGS=['/RTCsu'])
#We always want debug symbols
env.Append(PDB='${TARGET}.pdb')
env.Append(LINKFLAGS='/OPT:REF') #having symbols usually turns this off but we have no need for unused symbols
Export('env')
import versionInfo
projectRCSubstDict={
'%version_year%':env['version_year'],
'%version_major%':env['version_major'],
'%version_minor%':env['version_minor'],
'%version_build%':env['version_build'],
'%copyright%':env['copyright'],
'%publisher%':env['publisher'],
'%version%':env['version'],
'%productName%':"%s (%s)"%(versionInfo.name,versionInfo.longName),
}
env['projectResFile']=env.RES(env.Substfile('nvda.rc.subst',SUBST_DICT=projectRCSubstDict))
acrobatAccessRPCStubs=env.SConscript('acrobatAccess_sconscript')
Export('acrobatAccessRPCStubs')
if TARGET_ARCH=='x86':
env.Install(sourceTypelibDir,acrobatAccessRPCStubs[0]) #typelib
ia2RPCStubs=env.SConscript('ia2_sconscript')
Export('ia2RPCStubs')
if signExec:
env.AddPostAction(ia2RPCStubs[0],[signExec])
env.Install(libInstallDir,ia2RPCStubs[0]) #proxy dll
if TARGET_ARCH=='x86':
env.Install(sourceTypelibDir,ia2RPCStubs[1]) #typelib
iSimpleDomRPCStubs=env.SConscript('ISimpleDOM_sconscript')
if TARGET_ARCH=='x86':
env.Install(sourceTypelibDir,iSimpleDomRPCStubs[0]) #typelib
mathPlayerRPCStubs=env.SConscript('mathPlayer_sconscript')
if TARGET_ARCH=='x86':
env.Install(sourceTypelibDir,mathPlayerRPCStubs[0]) #typelib
if TARGET_ARCH=='x86':
localLib=env.SConscript('local/sconscript')
Export('localLib')
if signExec:
env.AddPostAction(localLib[0],[signExec])
env.Install(libInstallDir,localLib)
clientLib=env.SConscript('client/sconscript')
Export('clientLib')
if signExec:
env.AddPostAction(clientLib[0],[signExec])
env.Install(clientInstallDir,clientLib)
minHookLib=env.SConscript('minHook/sconscript')
Export('minHookLib')
if signExec:
env.AddPostAction(minHookLib[0],[signExec])
env.Install(libInstallDir,minHookLib)
remoteLib=env.SConscript('remote/sconscript')
Export('remoteLib')
if signExec:
env.AddPostAction(remoteLib[0],[signExec])
env.Install(libInstallDir,remoteLib)
if TARGET_ARCH=='x86_64':
remoteLoaderProgram=env.SConscript('remoteLoader/sconscript')
if signExec:
env.AddPostAction(remoteLoaderProgram,[signExec])
env.Install(libInstallDir,remoteLoaderProgram)
vbufBaseStaticLib=env.SConscript('vbufBase/sconscript')
Export('vbufBaseStaticLib')
adobeAcrobatVBufBackend=env.SConscript('vbufBackends/adobeAcrobat/sconscript')
if signExec:
env.AddPostAction(adobeAcrobatVBufBackend[0],[signExec])
env.Install(libInstallDir,adobeAcrobatVBufBackend)
adobeFlashVBufBackend=env.SConscript('vbufBackends/adobeFlash/sconscript')
if signExec:
env.AddPostAction(adobeFlashVBufBackend[0],[signExec])
env.Install(libInstallDir,adobeFlashVBufBackend)
lotusNotesRichTextVBufBackend=env.SConscript('vbufBackends/lotusNotesRichText/sconscript')
if signExec:
env.AddPostAction(lotusNotesRichTextVBufBackend[0],[signExec])
env.Install(libInstallDir,lotusNotesRichTextVBufBackend)
geckoVBufBackend=env.SConscript('vbufBackends/gecko_ia2/sconscript')
if signExec:
env.AddPostAction(geckoVBufBackend[0],[signExec])
env.Install(libInstallDir,geckoVBufBackend)
mshtmlVBufBackend=env.SConscript('vbufBackends/mshtml/sconscript')
if signExec:
env.AddPostAction(mshtmlVBufBackend[0],[signExec])
env.Install(libInstallDir,mshtmlVBufBackend)
webKitVBufBackend=env.SConscript('vbufBackends/webKit/sconscript')
if signExec:
env.AddPostAction(webKitVBufBackend[0],[signExec])
env.Install(libInstallDir,webKitVBufBackend)
if TARGET_ARCH=='x86':
env.SConscript('espeak/sconscript')
env.SConscript('liblouis/sconscript')