[libcamera-devel] test: Include specific headers instead of libcamera.h

Message ID 20200920134409.24688-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit beed258a5a3f6a690c6774d37815527fe60375eb
Headers show
Series
  • [libcamera-devel] test: Include specific headers instead of libcamera.h
Related show

Commit Message

Laurent Pinchart Sept. 20, 2020, 1:44 p.m. UTC
Let's only pull required headers, to avoid slowing compilation down.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/camera/buffer_import.cpp | 3 +++
 test/camera/capture.cpp       | 4 ++++
 test/camera/statemachine.cpp  | 2 ++
 test/libtest/buffer_source.h  | 2 +-
 test/libtest/camera_test.h    | 5 ++++-
 test/mapped-buffer.cpp        | 2 ++
 6 files changed, 16 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi Sept. 21, 2020, 7:58 a.m. UTC | #1
Hi Laurent,

On Sun, Sep 20, 2020 at 04:44:09PM +0300, Laurent Pinchart wrote:
> Let's only pull required headers, to avoid slowing compilation down.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I haven't checked for leftovers, but the idea is good
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> ---
>  test/camera/buffer_import.cpp | 3 +++
>  test/camera/capture.cpp       | 4 ++++
>  test/camera/statemachine.cpp  | 2 ++
>  test/libtest/buffer_source.h  | 2 +-
>  test/libtest/camera_test.h    | 5 ++++-
>  test/mapped-buffer.cpp        | 2 ++
>  6 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
> index d57ffa75edeb..64e96264c90b 100644
> --- a/test/camera/buffer_import.cpp
> +++ b/test/camera/buffer_import.cpp
> @@ -12,6 +12,9 @@
>  #include <numeric>
>  #include <vector>
>
> +#include <libcamera/event_dispatcher.h>
> +#include <libcamera/timer.h>
> +
>  #include "libcamera/internal/device_enumerator.h"
>  #include "libcamera/internal/media_device.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
> index eb67bf2da71f..51bbd25809ee 100644
> --- a/test/camera/capture.cpp
> +++ b/test/camera/capture.cpp
> @@ -7,6 +7,10 @@
>
>  #include <iostream>
>
> +#include <libcamera/event_dispatcher.h>
> +#include <libcamera/framebuffer_allocator.h>
> +#include <libcamera/timer.h>
> +
>  #include "camera_test.h"
>  #include "test.h"
>
> diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp
> index 0bda6fe4b0b2..28faeb913f2e 100644
> --- a/test/camera/statemachine.cpp
> +++ b/test/camera/statemachine.cpp
> @@ -7,6 +7,8 @@
>
>  #include <iostream>
>
> +#include <libcamera/framebuffer_allocator.h>
> +
>  #include "camera_test.h"
>  #include "test.h"
>
> diff --git a/test/libtest/buffer_source.h b/test/libtest/buffer_source.h
> index 95a82a8229fa..14b4770e8d8a 100644
> --- a/test/libtest/buffer_source.h
> +++ b/test/libtest/buffer_source.h
> @@ -7,7 +7,7 @@
>  #ifndef __LIBCAMERA_BUFFER_SOURCE_TEST_H__
>  #define __LIBCAMERA_BUFFER_SOURCE_TEST_H__
>
> -#include <libcamera/libcamera.h>
> +#include <libcamera/stream.h>
>
>  #include "libcamera/internal/media_device.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> diff --git a/test/libtest/camera_test.h b/test/libtest/camera_test.h
> index 0b6bad05e37c..7939798f886e 100644
> --- a/test/libtest/camera_test.h
> +++ b/test/libtest/camera_test.h
> @@ -7,7 +7,10 @@
>  #ifndef __LIBCAMERA_CAMERA_TEST_H__
>  #define __LIBCAMERA_CAMERA_TEST_H__
>
> -#include <libcamera/libcamera.h>
> +#include <memory>
> +
> +#include <libcamera/camera.h>
> +#include <libcamera/camera_manager.h>
>
>  using namespace libcamera;
>
> diff --git a/test/mapped-buffer.cpp b/test/mapped-buffer.cpp
> index 39d624cde6d5..027923375ed9 100644
> --- a/test/mapped-buffer.cpp
> +++ b/test/mapped-buffer.cpp
> @@ -7,6 +7,8 @@
>
>  #include <iostream>
>
> +#include <libcamera/framebuffer_allocator.h>
> +
>  #include "libcamera/internal/buffer.h"
>
>  #include "camera_test.h"
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Niklas Söderlund Sept. 21, 2020, 8:36 a.m. UTC | #2
Hi Laurent,

Thanks for your patch.

On 2020-09-20 16:44:09 +0300, Laurent Pinchart wrote:
> Let's only pull required headers, to avoid slowing compilation down.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  test/camera/buffer_import.cpp | 3 +++
>  test/camera/capture.cpp       | 4 ++++
>  test/camera/statemachine.cpp  | 2 ++
>  test/libtest/buffer_source.h  | 2 +-
>  test/libtest/camera_test.h    | 5 ++++-
>  test/mapped-buffer.cpp        | 2 ++
>  6 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
> index d57ffa75edeb..64e96264c90b 100644
> --- a/test/camera/buffer_import.cpp
> +++ b/test/camera/buffer_import.cpp
> @@ -12,6 +12,9 @@
>  #include <numeric>
>  #include <vector>
>  
> +#include <libcamera/event_dispatcher.h>
> +#include <libcamera/timer.h>
> +
>  #include "libcamera/internal/device_enumerator.h"
>  #include "libcamera/internal/media_device.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
> index eb67bf2da71f..51bbd25809ee 100644
> --- a/test/camera/capture.cpp
> +++ b/test/camera/capture.cpp
> @@ -7,6 +7,10 @@
>  
>  #include <iostream>
>  
> +#include <libcamera/event_dispatcher.h>
> +#include <libcamera/framebuffer_allocator.h>
> +#include <libcamera/timer.h>
> +
>  #include "camera_test.h"
>  #include "test.h"
>  
> diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp
> index 0bda6fe4b0b2..28faeb913f2e 100644
> --- a/test/camera/statemachine.cpp
> +++ b/test/camera/statemachine.cpp
> @@ -7,6 +7,8 @@
>  
>  #include <iostream>
>  
> +#include <libcamera/framebuffer_allocator.h>
> +
>  #include "camera_test.h"
>  #include "test.h"
>  
> diff --git a/test/libtest/buffer_source.h b/test/libtest/buffer_source.h
> index 95a82a8229fa..14b4770e8d8a 100644
> --- a/test/libtest/buffer_source.h
> +++ b/test/libtest/buffer_source.h
> @@ -7,7 +7,7 @@
>  #ifndef __LIBCAMERA_BUFFER_SOURCE_TEST_H__
>  #define __LIBCAMERA_BUFFER_SOURCE_TEST_H__
>  
> -#include <libcamera/libcamera.h>
> +#include <libcamera/stream.h>
>  
>  #include "libcamera/internal/media_device.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> diff --git a/test/libtest/camera_test.h b/test/libtest/camera_test.h
> index 0b6bad05e37c..7939798f886e 100644
> --- a/test/libtest/camera_test.h
> +++ b/test/libtest/camera_test.h
> @@ -7,7 +7,10 @@
>  #ifndef __LIBCAMERA_CAMERA_TEST_H__
>  #define __LIBCAMERA_CAMERA_TEST_H__
>  
> -#include <libcamera/libcamera.h>
> +#include <memory>
> +
> +#include <libcamera/camera.h>
> +#include <libcamera/camera_manager.h>
>  
>  using namespace libcamera;
>  
> diff --git a/test/mapped-buffer.cpp b/test/mapped-buffer.cpp
> index 39d624cde6d5..027923375ed9 100644
> --- a/test/mapped-buffer.cpp
> +++ b/test/mapped-buffer.cpp
> @@ -7,6 +7,8 @@
>  
>  #include <iostream>
>  
> +#include <libcamera/framebuffer_allocator.h>
> +
>  #include "libcamera/internal/buffer.h"
>  
>  #include "camera_test.h"
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Sept. 21, 2020, 10:52 a.m. UTC | #3
Hi Jacopo,

On Mon, Sep 21, 2020 at 09:58:01AM +0200, Jacopo Mondi wrote:
> On Sun, Sep 20, 2020 at 04:44:09PM +0300, Laurent Pinchart wrote:
> > Let's only pull required headers, to avoid slowing compilation down.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> I haven't checked for leftovers, but the idea is good

Thanks. There's one leftover in the cam application, I may look at it at
some point.

> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> > ---
> >  test/camera/buffer_import.cpp | 3 +++
> >  test/camera/capture.cpp       | 4 ++++
> >  test/camera/statemachine.cpp  | 2 ++
> >  test/libtest/buffer_source.h  | 2 +-
> >  test/libtest/camera_test.h    | 5 ++++-
> >  test/mapped-buffer.cpp        | 2 ++
> >  6 files changed, 16 insertions(+), 2 deletions(-)
> >
> > diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
> > index d57ffa75edeb..64e96264c90b 100644
> > --- a/test/camera/buffer_import.cpp
> > +++ b/test/camera/buffer_import.cpp
> > @@ -12,6 +12,9 @@
> >  #include <numeric>
> >  #include <vector>
> >
> > +#include <libcamera/event_dispatcher.h>
> > +#include <libcamera/timer.h>
> > +
> >  #include "libcamera/internal/device_enumerator.h"
> >  #include "libcamera/internal/media_device.h"
> >  #include "libcamera/internal/v4l2_videodevice.h"
> > diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
> > index eb67bf2da71f..51bbd25809ee 100644
> > --- a/test/camera/capture.cpp
> > +++ b/test/camera/capture.cpp
> > @@ -7,6 +7,10 @@
> >
> >  #include <iostream>
> >
> > +#include <libcamera/event_dispatcher.h>
> > +#include <libcamera/framebuffer_allocator.h>
> > +#include <libcamera/timer.h>
> > +
> >  #include "camera_test.h"
> >  #include "test.h"
> >
> > diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp
> > index 0bda6fe4b0b2..28faeb913f2e 100644
> > --- a/test/camera/statemachine.cpp
> > +++ b/test/camera/statemachine.cpp
> > @@ -7,6 +7,8 @@
> >
> >  #include <iostream>
> >
> > +#include <libcamera/framebuffer_allocator.h>
> > +
> >  #include "camera_test.h"
> >  #include "test.h"
> >
> > diff --git a/test/libtest/buffer_source.h b/test/libtest/buffer_source.h
> > index 95a82a8229fa..14b4770e8d8a 100644
> > --- a/test/libtest/buffer_source.h
> > +++ b/test/libtest/buffer_source.h
> > @@ -7,7 +7,7 @@
> >  #ifndef __LIBCAMERA_BUFFER_SOURCE_TEST_H__
> >  #define __LIBCAMERA_BUFFER_SOURCE_TEST_H__
> >
> > -#include <libcamera/libcamera.h>
> > +#include <libcamera/stream.h>
> >
> >  #include "libcamera/internal/media_device.h"
> >  #include "libcamera/internal/v4l2_videodevice.h"
> > diff --git a/test/libtest/camera_test.h b/test/libtest/camera_test.h
> > index 0b6bad05e37c..7939798f886e 100644
> > --- a/test/libtest/camera_test.h
> > +++ b/test/libtest/camera_test.h
> > @@ -7,7 +7,10 @@
> >  #ifndef __LIBCAMERA_CAMERA_TEST_H__
> >  #define __LIBCAMERA_CAMERA_TEST_H__
> >
> > -#include <libcamera/libcamera.h>
> > +#include <memory>
> > +
> > +#include <libcamera/camera.h>
> > +#include <libcamera/camera_manager.h>
> >
> >  using namespace libcamera;
> >
> > diff --git a/test/mapped-buffer.cpp b/test/mapped-buffer.cpp
> > index 39d624cde6d5..027923375ed9 100644
> > --- a/test/mapped-buffer.cpp
> > +++ b/test/mapped-buffer.cpp
> > @@ -7,6 +7,8 @@
> >
> >  #include <iostream>
> >
> > +#include <libcamera/framebuffer_allocator.h>
> > +
> >  #include "libcamera/internal/buffer.h"
> >
> >  #include "camera_test.h"

Patch

diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
index d57ffa75edeb..64e96264c90b 100644
--- a/test/camera/buffer_import.cpp
+++ b/test/camera/buffer_import.cpp
@@ -12,6 +12,9 @@ 
 #include <numeric>
 #include <vector>
 
+#include <libcamera/event_dispatcher.h>
+#include <libcamera/timer.h>
+
 #include "libcamera/internal/device_enumerator.h"
 #include "libcamera/internal/media_device.h"
 #include "libcamera/internal/v4l2_videodevice.h"
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index eb67bf2da71f..51bbd25809ee 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -7,6 +7,10 @@ 
 
 #include <iostream>
 
+#include <libcamera/event_dispatcher.h>
+#include <libcamera/framebuffer_allocator.h>
+#include <libcamera/timer.h>
+
 #include "camera_test.h"
 #include "test.h"
 
diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp
index 0bda6fe4b0b2..28faeb913f2e 100644
--- a/test/camera/statemachine.cpp
+++ b/test/camera/statemachine.cpp
@@ -7,6 +7,8 @@ 
 
 #include <iostream>
 
+#include <libcamera/framebuffer_allocator.h>
+
 #include "camera_test.h"
 #include "test.h"
 
diff --git a/test/libtest/buffer_source.h b/test/libtest/buffer_source.h
index 95a82a8229fa..14b4770e8d8a 100644
--- a/test/libtest/buffer_source.h
+++ b/test/libtest/buffer_source.h
@@ -7,7 +7,7 @@ 
 #ifndef __LIBCAMERA_BUFFER_SOURCE_TEST_H__
 #define __LIBCAMERA_BUFFER_SOURCE_TEST_H__
 
-#include <libcamera/libcamera.h>
+#include <libcamera/stream.h>
 
 #include "libcamera/internal/media_device.h"
 #include "libcamera/internal/v4l2_videodevice.h"
diff --git a/test/libtest/camera_test.h b/test/libtest/camera_test.h
index 0b6bad05e37c..7939798f886e 100644
--- a/test/libtest/camera_test.h
+++ b/test/libtest/camera_test.h
@@ -7,7 +7,10 @@ 
 #ifndef __LIBCAMERA_CAMERA_TEST_H__
 #define __LIBCAMERA_CAMERA_TEST_H__
 
-#include <libcamera/libcamera.h>
+#include <memory>
+
+#include <libcamera/camera.h>
+#include <libcamera/camera_manager.h>
 
 using namespace libcamera;
 
diff --git a/test/mapped-buffer.cpp b/test/mapped-buffer.cpp
index 39d624cde6d5..027923375ed9 100644
--- a/test/mapped-buffer.cpp
+++ b/test/mapped-buffer.cpp
@@ -7,6 +7,8 @@ 
 
 #include <iostream>
 
+#include <libcamera/framebuffer_allocator.h>
+
 #include "libcamera/internal/buffer.h"
 
 #include "camera_test.h"