Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCons Output in Build directory

Tags:

scons

I'm trying to modify my SCons files so that they put the generated files into a build directory. Initially I though VariantDir could be an option but judging from all I read and the examples it does not do what I want.

Is there any easy way to force SCons to put the output in a certain directory without having to rewrite all the sources and scripts?

like image 485
abergmeier Avatar asked Oct 09 '11 17:10

abergmeier


People also ask

What is a build directory?

The build directory is where Qt will build your project. The working / current directory is the directory the application is currently working in.

What is Scons build?

SCons is a computer software build tool that automatically analyzes source code file dependencies and operating system adaptation requirements from a software project description and generates final binary executables for installation on the target operating system platform.


1 Answers

After struggling with VariantDir for a while (it wasn't doing anything at all), I ended up using variant_dir parameter in the top level SConscript call, which causes all downstream build outputs end up in a parallel 'build' tree: SConscript(['subdirs/SConscript'], variant_dir='build', duplicate=0) My build structure is a hierarchy of SConscripts in subdirs/sub-subdirs, etc. With this call the outputs end up in build/sub-subdirs at the same level as they would in the source.

This eats up one level, though (subdirs), and using "../build" does not help. The solution is to have a SConscript file at the same level as SConstruct and call SConscript(['SConscript'], variant_dir='build', duplicate=0)

See also Force Scons output (exe, obj, lib & dll) to specific build directory - it has a similar answer

like image 133
Evgen Avatar answered Sep 28 '22 09:09

Evgen