[Scons-users] changing the build directory
dev at mgautier.fr
dev at mgautier.fr
Mon Mar 11 09:18:22 EDT 2013
Hello Sean,
The variant dir change your working directory in the variant dir .
As there is no source in it, your os.walk doesn't find them.
As Dirk said, you can use Glob to automatically handle variant_dir
(and it is probably the better solution if you don't want to do some special
handling)
You can also handle the variant_dir "by yourself" :
def find_source_files(directory, ext = "cpp"):
print "current", os.getcwd()
print "directory", directory
_directory = Dir(directory).srcnode().abspath
print "_directory", _directory
matches = []
# look in scr dir
for root, dirnames, filenames in os.walk(_directory):
print root, dirnames, filenames
for filename in fnmatch.filter(filenames, '*.' + ext):
# return files in original directory (build dir)
matches.append(os.path.join(directory, filename))
print "matches:", matches
return matches
However, testing my solution, I found strange behavior that seems to be a bug in
Scons:
If build directory doesn't exist, the current directory is not changed.
If build directory exists, the current directory is changed to it.
Scons men, can you confirm it is really a bug ?
Sean, with your solution and without build dir, this bug cause you will properly
found the source files.
(However you will still build .o in your src dir instead of your build dir)
Matthieu.
> Le 11 mars 2013 à 07:18, Sean Ochoa <sean.m.ochoa at gmail.com> a écrit :
>
> Man, this is super annoying.
>
> I've got a problem with changing the build directory (via variant_dir). Its
> not finding the source files.
>
> Can someone who has used scons before give me some feedback on my project
> layout and help me understand why this is failing?
> <http://stackoverflow.com/q/15328995/86263>
>
> --
> Sean
>
More information about the Scons-users
mailing list