[libcamera-devel] ipa: Generate the two dummy IPA modules from the same source

Message ID 20190915011257.11947-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 4ec807192d9f1ef682e2c257cf4d832c35042305
Headers show
Series
  • [libcamera-devel] ipa: Generate the two dummy IPA modules from the same source
Related show

Commit Message

Laurent Pinchart Sept. 15, 2019, 1:12 a.m. UTC
The ipa_dummy.cpp and ipa_dummy_isolate.cpp only differ in the license
reported in the IPAModuleInfo structure. Drop the second file and
generate the two .so from ipa_dummy.cpp, with the license defined
through the command line.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/ipa/ipa_dummy.cpp         |  2 +-
 src/ipa/ipa_dummy_isolate.cpp | 47 -----------------------------------
 src/ipa/meson.build           | 10 ++++----
 3 files changed, 6 insertions(+), 53 deletions(-)
 delete mode 100644 src/ipa/ipa_dummy_isolate.cpp

Comments

Jacopo Mondi Sept. 15, 2019, 8:39 a.m. UTC | #1
Hi Laurent,

On Sun, Sep 15, 2019 at 04:12:57AM +0300, Laurent Pinchart wrote:
> The ipa_dummy.cpp and ipa_dummy_isolate.cpp only differ in the license
> reported in the IPAModuleInfo structure. Drop the second file and
> generate the two .so from ipa_dummy.cpp, with the license defined
> through the command line.
>

Very smart! Thanks for having me rebase all my patches from the last
days :p

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/ipa/ipa_dummy.cpp         |  2 +-
>  src/ipa/ipa_dummy_isolate.cpp | 47 -----------------------------------
>  src/ipa/meson.build           | 10 ++++----
>  3 files changed, 6 insertions(+), 53 deletions(-)
>  delete mode 100644 src/ipa/ipa_dummy_isolate.cpp
>
> diff --git a/src/ipa/ipa_dummy.cpp b/src/ipa/ipa_dummy.cpp
> index 9313aabd2db8..9d0cbdc8b1ad 100644
> --- a/src/ipa/ipa_dummy.cpp
> +++ b/src/ipa/ipa_dummy.cpp
> @@ -34,7 +34,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
>  	0,
>  	"PipelineHandlerVimc",
>  	"Dummy IPA for Vimc",
> -	"LGPL-2.1-or-later",
> +	LICENSE,
>  };
>
>  IPAInterface *ipaCreate()
> diff --git a/src/ipa/ipa_dummy_isolate.cpp b/src/ipa/ipa_dummy_isolate.cpp
> deleted file mode 100644
> index cd66626df2df..000000000000
> --- a/src/ipa/ipa_dummy_isolate.cpp
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -/* SPDX-License-Identifier: LGPL-2.1-or-later */
> -/*
> - * Copyright (C) 2019, Google Inc.
> - *
> - * ipa_dummy_isolate.cpp - Dummy Image Processing Algorithm module that needs
> - * to be isolated
> - */
> -
> -#include <iostream>
> -
> -#include <ipa/ipa_interface.h>
> -#include <ipa/ipa_module_info.h>
> -
> -namespace libcamera {
> -
> -class IPADummyIsolate : public IPAInterface
> -{
> -public:
> -	int init();
> -};
> -
> -int IPADummyIsolate::init()
> -{
> -	std::cout << "initializing isolated dummy IPA!" << std::endl;
> -	return 0;
> -}
> -
> -/*
> - * External IPA module interface
> - */
> -
> -extern "C" {
> -const struct IPAModuleInfo ipaModuleInfo = {
> -	IPA_MODULE_API_VERSION,
> -	0,
> -	"PipelineHandlerVimc",
> -	"Dummy IPA for Vimc that needs to be isolated",
> -	"Proprietary",
> -};
> -
> -IPAInterface *ipaCreate()
> -{
> -	return new IPADummyIsolate();
> -}
> -};
> -
> -}; /* namespace libcamera */
> diff --git a/src/ipa/meson.build b/src/ipa/meson.build
> index 2b9863bce3ea..f09915bc1388 100644
> --- a/src/ipa/meson.build
> +++ b/src/ipa/meson.build
> @@ -1,17 +1,17 @@
>  ipa_dummy_sources = [
> -    ['ipa_dummy', 'ipa_dummy.cpp'],
> -    ['ipa_dummy_isolate', 'ipa_dummy_isolate.cpp'],
> +    ['ipa_dummy',         'LGPL-2.1-or-later'],
> +    ['ipa_dummy_isolate', 'Proprietary'],
>  ]
>
>  ipa_install_dir = join_paths(get_option('libdir'), 'libcamera')
>
>  foreach t : ipa_dummy_sources
> -    ipa = shared_module(t[0],
> -                        t[1],
> +    ipa = shared_module(t[0], 'ipa_dummy.cpp',
>                          name_prefix : '',
>                          include_directories : libcamera_includes,
>                          install : true,
> -                        install_dir : ipa_install_dir)
> +                        install_dir : ipa_install_dir,
> +                        cpp_args : '-DLICENSE="' + t[1] + '"')
>  endforeach
>
>  config_h.set('IPA_MODULE_DIR',
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/ipa/ipa_dummy.cpp b/src/ipa/ipa_dummy.cpp
index 9313aabd2db8..9d0cbdc8b1ad 100644
--- a/src/ipa/ipa_dummy.cpp
+++ b/src/ipa/ipa_dummy.cpp
@@ -34,7 +34,7 @@  const struct IPAModuleInfo ipaModuleInfo = {
 	0,
 	"PipelineHandlerVimc",
 	"Dummy IPA for Vimc",
-	"LGPL-2.1-or-later",
+	LICENSE,
 };
 
 IPAInterface *ipaCreate()
diff --git a/src/ipa/ipa_dummy_isolate.cpp b/src/ipa/ipa_dummy_isolate.cpp
deleted file mode 100644
index cd66626df2df..000000000000
--- a/src/ipa/ipa_dummy_isolate.cpp
+++ /dev/null
@@ -1,47 +0,0 @@ 
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * ipa_dummy_isolate.cpp - Dummy Image Processing Algorithm module that needs
- * to be isolated
- */
-
-#include <iostream>
-
-#include <ipa/ipa_interface.h>
-#include <ipa/ipa_module_info.h>
-
-namespace libcamera {
-
-class IPADummyIsolate : public IPAInterface
-{
-public:
-	int init();
-};
-
-int IPADummyIsolate::init()
-{
-	std::cout << "initializing isolated dummy IPA!" << std::endl;
-	return 0;
-}
-
-/*
- * External IPA module interface
- */
-
-extern "C" {
-const struct IPAModuleInfo ipaModuleInfo = {
-	IPA_MODULE_API_VERSION,
-	0,
-	"PipelineHandlerVimc",
-	"Dummy IPA for Vimc that needs to be isolated",
-	"Proprietary",
-};
-
-IPAInterface *ipaCreate()
-{
-	return new IPADummyIsolate();
-}
-};
-
-}; /* namespace libcamera */
diff --git a/src/ipa/meson.build b/src/ipa/meson.build
index 2b9863bce3ea..f09915bc1388 100644
--- a/src/ipa/meson.build
+++ b/src/ipa/meson.build
@@ -1,17 +1,17 @@ 
 ipa_dummy_sources = [
-    ['ipa_dummy', 'ipa_dummy.cpp'],
-    ['ipa_dummy_isolate', 'ipa_dummy_isolate.cpp'],
+    ['ipa_dummy',         'LGPL-2.1-or-later'],
+    ['ipa_dummy_isolate', 'Proprietary'],
 ]
 
 ipa_install_dir = join_paths(get_option('libdir'), 'libcamera')
 
 foreach t : ipa_dummy_sources
-    ipa = shared_module(t[0],
-                        t[1],
+    ipa = shared_module(t[0], 'ipa_dummy.cpp',
                         name_prefix : '',
                         include_directories : libcamera_includes,
                         install : true,
-                        install_dir : ipa_install_dir)
+                        install_dir : ipa_install_dir,
+                        cpp_args : '-DLICENSE="' + t[1] + '"')
 endforeach
 
 config_h.set('IPA_MODULE_DIR',