You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by "paul@wrada.com" <pa...@wrada.com> on 2016/02/04 03:12:28 UTC

egg file cflags

I was just working on importing an existing code tree into my HW directory for arduino zero.

Rather than re-arrange the files, I wanted to pass include directives to the compiler for specific directories.

But the only option is relative paths to the compiled file. That cause includes like

-I../../../sam0/utils/header_files
-I../../../utils/header_files
 -I../../../../utils/header_files
-I./sam0/utils/header_files

Depending how deep in the tree the compiler was working.  it'd be nice to have an option to have include paths that were absolute and referenced to the egg.yml file

Also, since I had a few dozen of these, it would be nice to have the egg.cflags: token accept the \ symbol to extend to multiple lines.



Re: egg file cflags

Posted by Sterling Hughes <st...@apache.org>.

On 2/3/16 6:12 PM, paul@wrada.com wrote:
> I was just working on importing an existing code tree into my HW directory for arduino zero.
>
> Rather than re-arrange the files, I wanted to pass include directives to the compiler for specific directories.
>
> But the only option is relative paths to the compiled file. That cause includes like
>
> -I../../../sam0/utils/header_files
> -I../../../utils/header_files
>   -I../../../../utils/header_files
> -I./sam0/utils/header_files
>
> Depending how deep in the tree the compiler was working.  it'd be nice to have an option to have include paths that were absolute and referenced to the egg.yml file
>

Just to summarize: this is the same directory specified multiple times 
in the egg.yml file, because as the newt tool descends the include path, 
there is nothing relative to the egg itself to anchor it.

I think we should add a variable "egg_path" that can be referenced in a 
given egg's egg.yml file.  So this would become:

egg.cflags: -I{{egg_path}}/src/sam0/utils/header_files

This means we need to come up with a syntax for variable names in YAML 
files, as we'll need to do a string replace in order to fix this. 
Options are: {{var}}, $(var), suggest your alternative here.  Anyone 
feel strongly?

Sterling

Re: egg file cflags

Posted by marko kiiskila <ma...@runtime.io>.
> On Feb 4, 2016, at 7:58 AM, marko kiiskila <ma...@runtime.io> wrote:
> 
> Hi Paul,
> 
>> On Feb 3, 2016, at 6:12 PM, paul@wrada.com wrote:
> 
>> Also, since I had a few dozen of these, it would be nice to have the egg.cflags: token accept the \ symbol to extend to multiple lines.
> 
> I concur. We should make it easier to have multiple lines of input for cflags.

Ok, I made a change to newt.

You should be able to specify the cflags either by saying:

egg.cflags.FS: -DFS_PRESENT -DANOTHER_DEFINE

or on separate lines:

egg.cflags.FS:
    - -DFS_PRESENT
   - -DANOTHER_DEFINE

looks like following works as well:
egg.cflags.FS:
   -DFS_PRESENT
   -DANOTHER_DEFINE

So no ‘\’ needed, just newline.

Let me know how it goes,
M

Re: egg file cflags

Posted by marko kiiskila <ma...@runtime.io>.
Hi Paul,

> On Feb 3, 2016, at 6:12 PM, paul@wrada.com wrote:
> 
> I was just working on importing an existing code tree into my HW directory for arduino zero.
> 
> Rather than re-arrange the files, I wanted to pass include directives to the compiler for specific directories.
> 
> But the only option is relative paths to the compiled file. That cause includes like
> 
> -I../../../sam0/utils/header_files
> -I../../../utils/header_files
> -I../../../../utils/header_files
> -I./sam0/utils/header_files
> 
> Depending how deep in the tree the compiler was working.  it'd be nice to have an option to have include paths that were absolute and referenced to the egg.yml file

As you've noticed, the whole system is geared toward organizing code inside an egg in a certain way :)
Exported headers in once place and source and internal headers in another.

> Also, since I had a few dozen of these, it would be nice to have the egg.cflags: token accept the \ symbol to extend to multiple lines.

I concur. We should make it easier to have multiple lines of input for cflags.
—
M