Selecting different header files based on configuration #13117
Replies: 5 comments 9 replies
-
Actually it is not working. I hadn't actually tested running install: $ meson install -C build.meson
...
ERROR: Tried to install something that isn't a file:
'.../flint/build.meson/include/flint/gmpcompat.h' |
Beta Was this translation helpful? Give feedback.
-
That one is easy to fix with I feel like I am misunderstanding something about how this all works or what is the typical way to do this though. Why is it that the output of Is there a better analogue of |
Beta Was this translation helpful? Give feedback.
-
Why shouldn't it? I think I'm not quite grasping conceptually how meson's semantics work here. I thought that part of the purpose of having a "file" type as distinct from "string" was so that you could represent generated files as files as well and meson would understand the dependency relationships. In that sense it seems natural to me that Is it actually intended that a "file" is only a file in the source tree? Then the purpose of the "file" type is just supposed to be that when you call
Yes, that's correct. The autotools build just makes a symbolic link like:
|
Beta Was this translation helpful? Give feedback.
-
Okay I see the difference now. Would it make sense to have something like Or why is it that the I suppose I could just "configure" the file with an empty dict: configure_file(
input: gmp_compat_h_in,
output: 'gmpcompat.h',
configuration: {},
) Conceptually what I am doing here is part of the same stage as processing other Everything works fine if I pass these arguments everywhere: install_dir: get_option('includedir') / 'flint',
install: true, It just seemed cleaner to collect a list of headers and then have a single call to
I assume that your "should we allow it" refers to wanting to disallow doing this with It seemed natural to me that if I could pass Actually copying all of the headers to the build directory does seem to take a surprising amount of time during the build step and I don't really want to have to do that if possible. The reason I did it that way is just so that you could do |
Beta Was this translation helpful? Give feedback.
-
Note that this actually does do what I wanted: project('foo', 'c')
foo_h = configure_file(
input: 'foo-v1.h',
output: 'foo.h',
configuration: {},
)
install_headers([foo_h]) I don't know if that is the expected way to do this but it would be good to demonstrate the expected way here: |
Beta Was this translation helpful? Give feedback.
-
This comes from attempting to make a meson build configuration for the Flint C library (flintlib/flint#1910).
I need to select one of several different header files depending on the configuration. This seems like a common thing to do but I can't quite find the right way to do it. Right now I have it working but meson is giving me a deprecation warning about the copy argument to
configure_file
.Currently I do this with e.g.:
This works but I get a warning:
I tried changing to copyfile:
This gives an error:
Instead of using
install_headers
I tried usinginstall: true
:This installs in
prefix/flint/gmpcompat.h
rather thanprefix/include/flint/gmpcompat.h
.I feel like I must be missing something obvious. What is the typical way to accomplish this?
Beta Was this translation helpful? Give feedback.
All reactions