Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Library source code directory can't be subdir or root dir #716

Open
aamcampbell opened this issue Feb 19, 2016 · 2 comments
Open

Library source code directory can't be subdir or root dir #716

aamcampbell opened this issue Feb 19, 2016 · 2 comments
Labels

Comments

@aamcampbell
Copy link

The documentation for the module.json file clearly states that a subdirectory may be used for the "lib" property of a library module:

For example, to build a library out of the contents of ./some/subdirectory instead of the default source directory, use:

"lib": "./some/subdirectory"
(http://yottadocs.mbed.com/reference/module.html)

However, this does not work for me. I have a "source" folder which is empty except for a "subsrc" directory, which contains source code. If I set "lib": "./source", my source files are compiled correctly. If I set "lib": "./source/subsrc", yotta finds no sources and generates an empty placeholder library instead.

The same thing happens when I set "lib": "./" (no sources are found). The behavior of using the root directory as the source dir is not clearly documented, but it seems like it ought to be allowed.

@autopulated
Copy link
Contributor

Thanks for reporting!

The subdirectory should work, so that's definitely a bug. Does it work if you try a subdirectory of somewhere other than ./source? (I ask because ./source is the default location, so it's special-cased in a few places).

Putting source files directly in the root directory is probably not generally a good idea, but I think it should be supported for compatibility with existing libraries that do that.

@aamcampbell
Copy link
Author

Yes, it works fine with ./anyfolder or just anyfolder, but not with ./folder1/folder2. I haven't tried ./source/folder2.

The reason I might use the root directory for sources is to maintain compatibility with other build systems. A custom cmake is probably a better idea, but it would be nice to choose.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants