[Scons-users] using variant_dir but strip out the variant_dir from source files

Hua Yanghao huayanghao at gmail.com
Wed Oct 24 15:59:44 EDT 2018


Thanks Jason. I do see the -j build is broken when use the default
chdir mechansim ... thanks for the info.

The "cd  <variant directory> ; <compiler command>" solution works like
a charm. Not only it works, -jN also kept working, as well as the
implementation is just one line of change ... Thank you!
I still need the customized function to strip out the variant_dir
though that's a different story.
On Wed, Oct 24, 2018 at 7:05 PM Jason Kenny <dragon512 at live.com> wrote:
>
> Normally SCons will have the compiler output the target data into the Variant directory. In certain cases, the compiler doesn't allow control of where the output happens. SCons has a feature to change the current directory for you. However, this feature as it is, breaks the -j based builds. I work around this in my builds by changing the action to "cd  <variant directory> ; <compiler command>". This seems to solve the issue of compilers messing up stuff on disk for me at least.
> -Jason
> ________________________________
> From: Scons-users <scons-users-bounces at scons.org> on behalf of Hua Yanghao <huayanghao at gmail.com>
> Sent: Wednesday, October 17, 2018 2:55 PM
> To: SCons users mailing list
> Subject: [Scons-users] using variant_dir but strip out the variant_dir from source files
>
> Dear Scons User,
> I am having maybe an odd request. The background is there are some
> compilers out there produces all kinds of output in your current
> directory which you do not have control. I wanted to combine the
> variant_dir feature plus the chdir kw arguments to builders, to be
> able to invoke those compilers directly inside the variant_dir. And I
> still want to keep the source duplication in the variant_dir as it
> will be a snapshot of only the used files for a particular built out
> of thousands of irrelevant files. As a side effect now the source
> files are all prefixed with the variant_dir which becomes "invalid"
> because the compiler is already invoked in the variant_dir instead of
> the top level directory.
>
> Is there a way (e.g. a special env variable) already that when I write
> my builders instead of "$COMPILER $SOURCE", I can use something like
> "$COMPILER $ORIGINAL_SOURCE"? Or do I have to wrap around the
> $COMPILER with another command such that I can do things like
> "$COMPILER_WRAPPED $VARIANT_DIR $SOURCE"? I know the second one
> definitely can work but wondering if there are better ways already in
> scons.
>
> Best Regards,
> Yanghao
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C8f99675c2e4543f7684808d6346a906e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636754029620286727&sdata=u%2B05v9tFavMUd54jlor3Z41OZrIrITScFekV8MHN7G0%3D&reserved=0
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users


More information about the Scons-users mailing list