Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add include() function #3557

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add include() function #3557

wants to merge 4 commits into from

Conversation

BeChris
Copy link
Contributor

@BeChris BeChris commented May 9, 2018

Hello, here's a proposal to add an include() function in order to be able to parse other build files.

included file must be valid meson file.

It's like subdir() except that:

  • It is not limited to relative path
  • included file can have any name (not mandatory to be meson.build)

Add a check to test inclusion of the same file several times.
@tp-m
Copy link
Member

tp-m commented May 9, 2018

Nice! This fixes issue #375 for what it's worth. Does it already include detection to make sure the same (actual) file can't be included multiple times? If not, that may be required.

@xclaesse
Copy link
Member

I guess it could be accepted if a file can be included only once, otherwise it would be equivalent to having functions, which is explicitly rejected by meson design. If I understand correctly.

@amitdo
Copy link
Contributor

amitdo commented May 10, 2018

+1 for adding this feature to meson.

To what directory will the object files go?

@BeChris
Copy link
Contributor Author

BeChris commented May 10, 2018 via email

@BeChris
Copy link
Contributor Author

BeChris commented May 10, 2018 via email

@leio
Copy link

leio commented Feb 26, 2019

Please have it require a prefix of meson.build. or at least meson, or a specific extension, preferably .build or maybe .meson. It's a pain to monitor changes across version bumps downstream if these files could theoretically be anywhere with any names. With prefix they are at least together in a tool like meld, or with suffix extension can at least filter by something concrete. If dependency and their minimum requirements can start to go in randomly named files, it's very inconvenient to be able to notice the fact when doing version bumps.
Disclaimer: I'm just saying this as a downstream packager worried his work becomes more complicated without this kind of limitations; not speaking for the meson project whatsoever.

@TheQwertiest
Copy link
Contributor

TheQwertiest commented Feb 26, 2019

IMO, the included filename should have a limit imposed, e.g. FILENAME.meson or meson.FILENAME, for the ease of tracking such includes (imagine include('my_logic.cpp')).
This would be also consistent with other meson logic, like restricting extensions of source files for specific language (e.g. .c for C and .cpp for C++).

[EDIT] @leio was faster :D

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

Successfully merging this pull request may close these issues.

None yet

7 participants