SCons output in Build directory

I am trying to modify my SCons files so that they put the files generated in the assembly directory. Initially, I, although VariantDir might be an option, but judging by everything that I read, and the examples that it does not do what I want.

Is there any easy way to get SCons to put the output in a specific directory without rewriting all the sources and scripts?

+6
source share
4 answers

After working with VariantDir for a long time (it didn’t do anything at all), I ended up using the variant_dir parameter in a top-level SConscript call, which leads to all downstream assembly outputs ending in parallel “assembly”, tree: SConscript(['subdirs/SConscript'], variant_dir='build', duplicate=0) My assembly structure is a hierarchy of SConscripts in sub-subdirs / sub-subdirs, etc. With this call, the outputs are in the lines / sub-subdirs at the same level as in the source.

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

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

+2
source

Based on this frustration, I added the scons site, which added replacement developers (for example, "Exe" instead of "Program") and specified the emitter for this builder, which replaced part of the path with the build directory. This requires the use of an alternate builder on all of your SConscripts.

Alternatively, you can try the “Environment” subclass and rewrite the main goals for using job rewriting. Then you specify your environment as the default (change Scons.Script.DefaultEnvironment or something like that). This approach made SConscripts static, but very erratic and requires additional maintenance over time when internal networks change.

0
source

Using VariantDir with duplicate=0 should work.

0
source

You can use Install or InstallAs for the target output. This works for me.

 lib = env.SharedLibrary(target = "some_target", source = sources); env.InstallAs( target = "folder/output_name.ext", source = lib ); 
0
source

Source: https://habr.com/ru/post/898925/


All Articles