[Scons-users] Custom build flags per FileNode using AddPreAction

Hua Yanghao huayanghao at gmail.com
Wed Apr 17 11:14:17 EDT 2019


On Wed, Apr 17, 2019 at 1:20 PM Ivan Kravets <me at ikravets.com> wrote:

> Hi,
>
> This is Ivan from PlatformIO.Org. Sometimes our users ask if it is
> possible to customize build flags per a source file which was previously
> added to a build process via Program() or StaticLibrary().
>
>
I use something like this:
old_cflags = env['CFLAGS']
obj = Object(file_path, CFLAGS = old_cflags + flags) # flags is what user
provided in module definition file like below.

The user interface (module definition) looks like this:
flags = ["-DABC", ...]
usw_flags('CFLAGS', flags)
usw_files("elf_obj", ["file1.c", "file2.c", ...])

-- Yanghao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190417/c9a16417/attachment.html>


More information about the Scons-users mailing list