@@ -277,6 +277,8 @@ def getRealAbsoluteCwd(self, relativePath=None):
277
277
if relativePath :
278
278
if isinstance (relativePath , SCons .Node .FS .Dir ):
279
279
return relativePath .srcnode ().abspath
280
+ elif not isinstance (relativePath , str ):
281
+ return relativePath
280
282
elif relativePath .startswith ('#' ):
281
283
return os .path .join (self .dir , relativePath [1 :])
282
284
elif os .path .isabs (relativePath ):
@@ -991,10 +993,10 @@ def MSVSProject(self, targetName, buildTarget,
991
993
l_env .Replace ( CPPPATH = self .convertSconsPathToStr (l_env ['CPPPATH' ]) )
992
994
993
995
visualProject = l_env .MSVSProject (
994
- target = os . path .normpath ( self .getRealAbsoluteCwd (visualProjectFile ) ),
995
- srcs = [ os . path .normpath ( self .getRealAbsoluteCwd (i ) ) for i in sources ],
996
- incs = [ os . path .normpath ( self .getRealAbsoluteCwd (i ) ) for i in headers ],
997
- localincs = [ os . path .normpath ( self .getRealAbsoluteCwd (i ) ) for i in localHeaders ],
996
+ target = self .normpath ( self .getRealAbsoluteCwd (visualProjectFile ) ),
997
+ srcs = [ self .normpath ( self .getRealAbsoluteCwd (i ) ) for i in sources ],
998
+ incs = [ self .normpath ( self .getRealAbsoluteCwd (i ) ) for i in headers ],
999
+ localincs = [ self .normpath ( self .getRealAbsoluteCwd (i ) ) for i in localHeaders ],
998
1000
resources = resources ,
999
1001
misc = misc ,
1000
1002
buildtarget = buildTarget [0 ],
@@ -1004,6 +1006,11 @@ def MSVSProject(self, targetName, buildTarget,
1004
1006
self .allVisualProjects .append ( visualProject )
1005
1007
self .env .Alias ( 'visualProject-' + targetName , visualProject )
1006
1008
1009
+ def normpath ( self , s ):
1010
+ if ( isinstance (s , str ) ):
1011
+ return os .path .normpath ( s )
1012
+ return s
1013
+
1007
1014
def ObjectLibrary ( self , target ,
1008
1015
libraries = [], includes = [], envFlags = {}, sources = [],
1009
1016
public = True , publicName = None ,
@@ -1272,7 +1279,7 @@ def SharedLibrary( self, target,
1272
1279
return dstLibInstall
1273
1280
1274
1281
def Program ( self , target ,
1275
- sources = [], dirs = [], libraries = [], includes = [],
1282
+ sources = [], dirs = [], libraries = [], includes = [], rc_files = [], precsrc = [], precinc = [],
1276
1283
env = None , localEnvFlags = {}, replaceLocalEnvFlags = {}, externEnvFlags = {}, globalEnvFlags = {},
1277
1284
dependencies = [], installDir = None , install = True ,
1278
1285
headers = [], localHeaders = [],
@@ -1315,7 +1322,7 @@ def Program( self, target,
1315
1322
localEnv = None
1316
1323
localLibraries = l_libraries
1317
1324
if env :
1318
- localEnv = env . Clone ()
1325
+ localEnv = env
1319
1326
self .appendLibsToEnv (localEnv , localLibraries )
1320
1327
if 'SconsProjectLibraries' in localEnv :
1321
1328
localLibraries += localEnv ['SconsProjectLibraries' ]
@@ -1334,10 +1341,20 @@ def Program( self, target,
1334
1341
localEnv .AppendUnique ( ** globalEnvFlags )
1335
1342
1336
1343
sourcesFiles = self .getAbsoluteCwd ( sourcesFiles )
1344
+
1345
+ # Add rc files (windows only)
1346
+ if self .windows :
1347
+ for rc in rc_files :
1348
+ print rc
1349
+ # sourcesFiles.append( localEnv.RES( rc ) );
1350
+
1351
+ if precinc and self .windows :
1352
+ localEnv ['PCHSTOP' ] = self .getRealAbsoluteCwd () + '/' + precinc
1353
+ localEnv .Append ( CPPFLAGS = [ '/FI' + self .getRealAbsoluteCwd () + '/' + precinc , '/Zm135' ] )
1354
+ localEnv ['PCH' ] = localEnv .PCH ( precsrc )[0 ]
1337
1355
1338
1356
# create the target
1339
1357
dst = localEnv .Program ( target = target , source = sourcesFiles )
1340
-
1341
1358
dstInstall = localEnv .Install ( installDir if installDir else self .inOutputBin (), dst ) if install else dst
1342
1359
localEnv .Alias ( target , dstInstall )
1343
1360
localEnv .Alias ( 'all' , target )
0 commit comments