@@ -277,6 +277,8 @@ def getRealAbsoluteCwd(self, relativePath=None):
277277 if relativePath :
278278 if isinstance (relativePath , SCons .Node .FS .Dir ):
279279 return relativePath .srcnode ().abspath
280+ elif not isinstance (relativePath , str ):
281+ return relativePath
280282 elif relativePath .startswith ('#' ):
281283 return os .path .join (self .dir , relativePath [1 :])
282284 elif os .path .isabs (relativePath ):
@@ -991,10 +993,10 @@ def MSVSProject(self, targetName, buildTarget,
991993 l_env .Replace ( CPPPATH = self .convertSconsPathToStr (l_env ['CPPPATH' ]) )
992994
993995 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 ],
9981000 resources = resources ,
9991001 misc = misc ,
10001002 buildtarget = buildTarget [0 ],
@@ -1004,6 +1006,11 @@ def MSVSProject(self, targetName, buildTarget,
10041006 self .allVisualProjects .append ( visualProject )
10051007 self .env .Alias ( 'visualProject-' + targetName , visualProject )
10061008
1009+ def normpath ( self , s ):
1010+ if ( isinstance (s , str ) ):
1011+ return os .path .normpath ( s )
1012+ return s
1013+
10071014 def ObjectLibrary ( self , target ,
10081015 libraries = [], includes = [], envFlags = {}, sources = [],
10091016 public = True , publicName = None ,
@@ -1272,7 +1279,7 @@ def SharedLibrary( self, target,
12721279 return dstLibInstall
12731280
12741281 def Program ( self , target ,
1275- sources = [], dirs = [], libraries = [], includes = [],
1282+ sources = [], dirs = [], libraries = [], includes = [], rc_files = [], precsrc = [], precinc = [],
12761283 env = None , localEnvFlags = {}, replaceLocalEnvFlags = {}, externEnvFlags = {}, globalEnvFlags = {},
12771284 dependencies = [], installDir = None , install = True ,
12781285 headers = [], localHeaders = [],
@@ -1315,7 +1322,7 @@ def Program( self, target,
13151322 localEnv = None
13161323 localLibraries = l_libraries
13171324 if env :
1318- localEnv = env . Clone ()
1325+ localEnv = env
13191326 self .appendLibsToEnv (localEnv , localLibraries )
13201327 if 'SconsProjectLibraries' in localEnv :
13211328 localLibraries += localEnv ['SconsProjectLibraries' ]
@@ -1334,10 +1341,20 @@ def Program( self, target,
13341341 localEnv .AppendUnique ( ** globalEnvFlags )
13351342
13361343 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 ]
13371355
13381356 # create the target
13391357 dst = localEnv .Program ( target = target , source = sourcesFiles )
1340-
13411358 dstInstall = localEnv .Install ( installDir if installDir else self .inOutputBin (), dst ) if install else dst
13421359 localEnv .Alias ( target , dstInstall )
13431360 localEnv .Alias ( 'all' , target )
0 commit comments