libcamera: utils: Adapt libcameraPath to match use cases

The two callers of functions libcameraPath() and isLibcameraInstalled()
end up using the same process and finally use the path with
libcamera.so. Hence write a function libcameraBuildPath() which
combines their functions and returns the root of the build sources
when the library has not been installed, but is running from the build
tree, thereby making call sites simpler.

When the library is installed, libcameraBuildPath() will return an empty
string.

Make changes in the call sites accordingly.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Kaaira Gupta
2020-03-19 19:04:32 +02:00
committed by Laurent Pinchart
parent 6c34a2d386
commit 1b8ac8473c
4 changed files with 25 additions and 16 deletions
+3 -3
View File
@@ -97,9 +97,9 @@ std::string IPAProxy::resolvePath(const std::string &file) const
* This requires identifying the path of the libcamera.so, and
* referencing a relative path for the proxy workers from that point.
*/
if (!utils::isLibcameraInstalled()) {
std::string ipaProxyDir = utils::dirname(utils::libcameraPath())
+ "/proxy/worker";
std::string root = utils::libcameraBuildPath();
if (!root.empty()) {
std::string ipaProxyDir = root + "src/libcamera/proxy/worker";
LOG(IPAProxy, Info)
<< "libcamera is not installed. Loading proxy workers from'"