Message ID | 20220706191016.2842476-1-eschwartz93@gmail.com |
---|---|
State | Accepted |
Commit | ba6435930f08e802cffc688d90f156a8959a0f86 |
Headers | show |
Series |
|
Related | show |
Hi Eli, Quoting Eli Schwartz via libcamera-devel (2022-07-06 20:10:16) > It's not safe to assume `-include config.h` works, since this depends on > the functionality of the compiler that the cwd when running the compiler > is searched first. > > When libcamera is included as a Meson subproject, the cwd of the > compiler is the cwd of the main project, not of libcamera's build dir, > and thus cannot be found. Instead, pass the include filename as a path > based on the current build dir. > Thank you for identifying this so quickly and supporting on the meson channel. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> > --- > meson.build | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meson.build b/meson.build > index 6d7d3ca6..3f7a3f56 100644 > --- a/meson.build > +++ b/meson.build > @@ -44,7 +44,7 @@ endif > > common_arguments = [ > '-Wshadow', > - '-include', 'config.h', > + '-include', meson.current_build_dir() / 'config.h', > ] > > c_arguments = [] > -- > 2.35.1 >
Hi Eli, Thank you for the patch. On Wed, Jul 06, 2022 at 03:10:16PM -0400, Eli Schwartz via libcamera-devel wrote: > It's not safe to assume `-include config.h` works, since this depends on > the functionality of the compiler that the cwd when running the compiler > is searched first. > > When libcamera is included as a Meson subproject, the cwd of the > compiler is the cwd of the main project, not of libcamera's build dir, > and thus cannot be found. Instead, pass the include filename as a path > based on the current build dir. > > Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> > --- > meson.build | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meson.build b/meson.build > index 6d7d3ca6..3f7a3f56 100644 > --- a/meson.build > +++ b/meson.build > @@ -44,7 +44,7 @@ endif > > common_arguments = [ > '-Wshadow', > - '-include', 'config.h', > + '-include', meson.current_build_dir() / 'config.h', I may be a bit better (being pedantic) to use the return value of the configure_file() function here, but that would require reorganizing the top-level meson.build and is probably not worth it. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > ] > > c_arguments = []
diff --git a/meson.build b/meson.build index 6d7d3ca6..3f7a3f56 100644 --- a/meson.build +++ b/meson.build @@ -44,7 +44,7 @@ endif common_arguments = [ '-Wshadow', - '-include', 'config.h', + '-include', meson.current_build_dir() / 'config.h', ] c_arguments = []
It's not safe to assume `-include config.h` works, since this depends on the functionality of the compiler that the cwd when running the compiler is searched first. When libcamera is included as a Meson subproject, the cwd of the compiler is the cwd of the main project, not of libcamera's build dir, and thus cannot be found. Instead, pass the include filename as a path based on the current build dir. Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)