summaryrefslogtreecommitdiff
path: root/meson.build
AgeCommit message (Collapse)Author
2021-06-25libcamera: Move libcamera.so pkg-config file generationKieran Bingham
The pkg-config file for the main libcamera.so is generated at the top level meson.build. Move this to the actual core libcamera build structure to be consistent and keep it next to the library construction. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-19libcamera: utils: Support systems that lack secure_getenv and issetugidLaurent Pinchart
Android provides neither secure_getenv() nor issetugid(). Enable compilation on that platform by using a plain getenv(), as that seems to be the best we can do. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-05-27meson: Print summary boolean options in coloursLaurent Pinchart
Boolean options in the summary are printed as 'True' or 'False' by default. Enable the bool_yn option, which prints them as 'YES' or 'NO', in green and red respectively. This makes the summary more readable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-05-26android: Fix file system library usage on gcc 7 and 8Laurent Pinchart
On gcc versions older than 9, the file system library, used by the Android camera HAL configuration file parser, is implemented in a separate static library. Furthermore, on gcc 7, it's provided in the std::experimental namespace. This breaks compilation of the HAL on gcc 7, and linking on gcc 8. Fix the compilation issue by conditionally including <experimental/filesystem> and creating a namespace alias in std, and the link issue by linking to libstdc++fs on gcc versions older than 9. The inclusion of <experimental/filesystem> is a bit of a hack, and when we'll start using the file system library in another compilation unit, we should then move all this to an internal helper to abstract the compiler version. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-05-24meson: Add a configuration option to build IPAsUmang Jain
There can be multiple IPAs per pipeline-handler or platform. They can live in-tree or externally linked. It is up to the vendor whether to use in-tree IPA for a platform or provide it externally. In the case of IPAs being external, building in-tree IPAs might be futile hence, provide a clear and explicit mechanism to choose whether to build the in-tree IPA for the platform or not. By default, all in-tree IPAs are built when a matching Pipeline handler is also enabled. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-11meson: Replace obselete join_paths() with '/' operatorUmang Jain
Since meson v0.49.0, join_paths() is equivalent to '/' hence, drop and replace it with '/' short-hand in meson files. This commit does not introduce any functional changes. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-12lc-compliance: Add a libcamera compliance toolNiklas Söderlund
Add a compliance tool to ease testing of cameras. In contrast to the unit-tests under test/ that aims to test the internal components of libcamera the compliance tool aims to test application use-cases and to some extent the public API. This change adds the boilerplate code of a simple framework for the creation of tests. The tests aim both to demonstrate the tool and to catch real problems. The tests added are: - Test that if one queues exactly N requests to a camera exactly N requests are eventually completed. - Test that a configured camera can be started and stopped multiple times in an attempt to exercise cleanup code paths otherwise not often tested with 'cam' for example. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-03-28meson: Summarize which applications and adaptation layers are builtLaurent Pinchart
Add the application and adaptation layers being built to the meson summary. The summary now prints libcamera 0.0.0 Configuration Enabled pipelines: ipu3 raspberrypi rkisp1 simple uvcvideo vimc Android support: True GStreamer support: True V4L2 emulation support: True cam application: True qcam application: True Unit tests: True Subprojects libyuv: YES Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-02-23libcamera: Enable vimc pipeline handler when tests are enabledLaurent Pinchart
The addition of the new IPA IPC mechanism compiles pipeline-specific headers to define the interface between the pipeline and the IPA. This was optimised in 08ce394465b5 ("meson: ipa, proxy: Only build proxies for enabled pipelines") to only build for enabled pipelines, however the tests directly use the VIMC pipeline handler, and require it to be built. Create a local variable to store the requested pipelines from the user configuration and extend the enabled pipelines to ensure that VIMC is always enabled if the tests are also enabled Fixes: 08ce394465b5 ("meson: ipa, proxy: Only build proxies for enabled pipelines") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Sebastian Fricke<sebastian.fricke@posteo.net>
2021-02-04subprojects: Add libyuv and built if -Dandroid=enabledHirokazu Honda
Android HAL adaptation layer may need image processing, for example, scaling and format conversion. Libyuv is a general image processing. This adds libyuv to subprojects, so that it is forked locally and can be used with Android HAL implementation code. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-01-20libcamera: Use meson summary() function to summarize configurationLaurent Pinchart
Now that Debian backports have been updated to meson v0.56, all major distributions provide meson >= v0.53 in their latest LTS version. We can replace the manual message()-based configuration summary with the summary() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-12-30meson: test: Simplify top level mesonKieran Bingham
Utilise the subdir_done() functionality as is used with other optional components to simplify the top level meson file. Suggested-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-11-03libcamera: tracing: Implement tracing infrastructurePaul Elder
Implement tracing infrastructure in libcamera. It takes .tp files, as required by lttng, and generates a tracepoint header and C file, as lttng requires. meson is updated accordingly to get it to compile with the rest of libcamera. Update the documentation accordingly. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-21meson: Enable shadowed variable warningKieran Bingham
Shadowing variables can lead to unexpected bugs where a code path utilises a variable that may not have been intended by the developer, leading to hard to find bugs. Enable warnings for shadowed variables as defined at: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow As an effect of utilising -Werror, this will cause variable or type shadowing to become a build-time error. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-20meson: Enable -Wextra-semi for clangHirokazu Honda
The option, -Wextra-semi, helps developers to find unnecessary semicolons. This option is available with clang. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-12meson: Enable -Wno-psabi for gcc 9+Tomi Valkeinen
I get the warnings related to psabi with: gcc 9.3.0 "arm-buildroot-linux-gnueabihf-g++.br_real (Buildroot 2020.08-24-gc5c5f1fa46) 9.3.0" Remove the check for gcc-9, so that -Wno-psabi is used on all gcc versions over 7.1. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24meson: Define python3 and python3-yaml required dependenciesEzequiel Garcia
With this change, meson will complain specifically about missing python3 and missing python3-yaml. As specified by meson documentation: https://mesonbuild.com/Python-module.html, this change requires meson v0.51. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24meson: Bump meson version to 0.51Ricardo Ribalda
Version 0.51 allows, among others, checking for python modules, which is a required feature. It is also now easily accessible: it is in stable distros such as Debian testing, or in pip: https://tracker.debian.org/pkg/meson https://pypi.org/project/meson/ Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24Documentation: Move all dependencies into featuresRicardo Ribalda
This way if the user enables the documentation and the dependencies are missing the configure fails. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24meson: Process utils firstKieran Bingham
The utils directory can contain helpers and support tools which are used throughout other components of the build. Ensure that the utils subdir is parsed first allowing helpers to be defined there. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2020-09-15qcam: Add ViewFinderGL class to accelerate the format conversionShow Liu
The viewfinderGL accelerates the format conversion by using OpenGL ES shader. The minimum Qt version is bumped to v5.4, as QOpenGLWidget wasn't available before that. Signed-off-by: Show Liu <show.liu@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-07meson: Provide build configuration summaryKieran Bingham
Report the enabled pipelines when configuring the meson build hierarchy. This helps clarify what pipelines are used when building, and is useful when looking back through build-traces to see what was actually configured. This can be expanded upon to report other options, and ideally will be replaced by mesons summary() functionality when it is available. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-08-25meson: Remove -Wno-unused-parameterLaurent Pinchart
We build libcamera with -Wno-unused-parameter and this doesn't cause much issue internally. However, it prevents catching unused parameters in inline functions defined in public headers. This can lead to compilation warnings for applications compiled without -Wno-unused-parameter. To catch those issues, remove -Wno-unused-parameter and fix all the related warnings with [[maybe_unused]]. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-08-25meson: Switch to C++17Laurent Pinchart
Due to popular request, move from C++14 to C++17. This will allow dropping some custom constructs (such as a custom utils::clamp), benefiting from new language features, and dropping gcc 5 and 6 from the compilation tests. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-15meson: detect kernel versionStéphane Cerveau
Add kernel version detection to warn user that only >= 5.0.0 V4L API are supported in libcamera. Signed-off-by: Stéphane Cerveau <scerveau@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-13licenses: License all meson files under CC0-1.0Laurent Pinchart
In an attempt to clarify the license terms of all files in the libcamera project, the build system files deserve particular attention. While they describe how the binaries are created, they are not themselves transformed into any part of binary distributions of the software, and thus don't influence the copyright on the binary packages. They are however subject to copyright, and thus influence the distribution terms of the source packages. Most of the meson.build files would not meet the threshold of originality criteria required for copyright protection. Some of the more complex meson.build files may be eligible for copyright protection. To avoid any ambiguity and uncertainty, state our intent to not assert copyrights on the build system files by putting them in the public domain with the CC0-1.0 license. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Show Liu <show.liu@linaro.org>
2020-05-10pkgconfig: Fix include directory pathNicolas Dufresne
Should be $includedir/libcamera, as we install into a subdirectory name 'libcamera'. This is fixed by passing the 'subdirs' argument to the pkgconfig generator. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-01libcamera: Set -Wno-psabi on gcc 7 and 8 for armLaurent Pinchart
gcc 7.1 introduced processor-specific ABI breakages related to parameter passing on ARM platforms. This generates a large number of messages during compilation with gcc >=7.1 until gcc 9. Silence them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28libcamera: utils: Add a function to retrieve the libcamera source treeLaurent Pinchart
Similarly to libcameraBuildPath(), there's a need to locate resources within the source tree when running libcamera without installing it. Support this use case with a new utils::libcameraSourcePath() function. The implementation uses a symlink from the build root to the source root in order to avoid hardcoding the path to the source root in the libcamera.so binary. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-02-13meson.build: Silence the C99 designators warningLaurent Pinchart
We use array designators for array initialization, which is a C99 extension. clang-10 warns about it, causing a build failure. As this is a useful extension, silence the warning. This needs to be done only if the compiler supports the -Wno-c99-designator argument, otherwise a -Wunknown-warning-option will be generated. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-17meson: Bump required version to 0.47Nicolas Dufresne
This is needed to use option type 'feature'. This is a tri-state (auto/enabled/disabled) which comes with utility to enable them all, or disabled them all to avoid any dynamic selection happening. It can also be used as value to any "required" field. This will be used in GStreamer support. If you don't have a recent enough meson in your distribution, you can always install or upgrade your version using pip3. pip3 install --user meson pip3 install --user --upgrade meson Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-14meson.build: Switch to C++14Laurent Pinchart
C++14 is a minor release that doesn't introduce major new concepts or paradigms compared to C++11, but brings two useful changes for us: - std::make_unique allows dropping our custom implementation in utils. - Functions returning constexpr are not assumed to be const anymore, which is needed to create a standard-conformant span implementation. All the g++ and clang++ versions we support and test (g++-5 onwards and clang++6 onwards) support C++14. However, due to a defect in the original C++14 specification, solved in N4387 ([1]), compilation would fail on g++-5 due to the use of std::map::emplace() with a non-copyable value type. It turns out we can easily fix it by switching to the explicit piecewise emplace() overload. There is thus really nothing holding back the switch. Let's do it, and update the coding style accordingly. [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4387 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-26libcamera: Print backtrace on fatal errorsLaurent Pinchart
When a fatal error occurs the program aborts, and all the logger provides is the location of the line that caused the error. Extend this with a full backtrace to help debugging. The backtrace is generated using the backtrace() call, a GNU extension to the C library. It is available in glibc and uClibc but not in musl. Test for availability of the function to condition compilation of the backtrace printing. Implementing backtrace support with musl is an exercise left to the reader if desired. The LogOutput class is extended to support writing string messages directly to the output. Strings written directly will be considered as LogDebug messages when written to the Syslog. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-11-21meson: Really define _FORTIFY_SOURCE for optimised buildsLaurent Pinchart
Commit 965c5bf7fbf5 ("meson: Define _FORTIFY_SOURCE for optimised builds") tried to define _FORTIFY_SOURCE for optimised builds with clang, but updated the common_arguments after it was used. This resulted in the _FORTIFY_SOURCE option not being applied. Fix it. Fixes: 965c5bf7fbf5 ("meson: Define _FORTIFY_SOURCE for optimised builds") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-08-22meson: Rename 'tests' option to 'test'Laurent Pinchart
The 'tests' option enables compilation of tests. On Gentoo and Chrome OS, the corresponding package USE flag is named 'test'. Rename the option to 'test' to bring it in line. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-22meson: Define _FORTIFY_SOURCE for optimised buildsLaurent Pinchart
_FORTIFY_SOURCE adds useful checks during compilation. The option is enabled by default by gcc on all non-optimised builds (as it requires -O1 or higher). Enable it explicitly for clang. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-07-11libcamera: skip auto version generation when building for Chromium OSPaul Elder
Commit b817bcec6b53 ("libcamera: Auto generate version information") causes the build to fail in the Chromium OS build environment, because git update-index tries to take a lock (ie. write) in the git repo that is outside of the build directory. The solution is to simply skip git update-index if we are building in the Chromium OS build environment, and this decision is made if the build directory is not a subdirectory of the source directory. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-09libcamera: Rework automatic version generation to avoid rebuildsLaurent Pinchart
Commit b817bcec6b53 ("libcamera: Auto generate version information") generates version information in order to automatically include it various locations (Sphinx and Doxygen documentation, libcamera::version variable available at runtime, and version.h available at compile time). Unfortunately this causes lots of unnecessary rebuilds when modifying the git tree state, which hinders development. The problem is caused by the generated version.h being listed as a dependency for the whole libcamera. This is required as meson (to the best of my knowledge) doesn't provide a way to explicitly specify the dependency of a single object file (camera_manager.o in this case, as camera_manager.cpp is the only consumer of the generated version string) on the custom target used to generate version.h. The dependency can't be automatically detected at build time, like dependencies on normal headers that are generated by parsing the source, because the version.h header may not exist yet. The build could then fail in a racy way. This change attempts at solving the issue by generating a version.cpp instead of a version.h to set the git-based version. This minimises the number of files that need to be rebuild when then git tree state changes, while retaining the main purpose of the original automatic version generation, the ability to access the git-based version string at runtime. We however lose the ability to access git-based version information at build time in an application building against libcamera, but there is no expected use case for this. The version string is moved from the libcamera namespace to the CameraManager class in order to avoid including version.h inside libcamera (in version.cpp and in camera_manager.cpp), which would create dependencies causing more rebuild steps, as described above. On the other hand, major, minor and patch level version numbers are useful at build time. This commit changes the generation of version.h in order to add three macros named LIBCAMERA_VERSION_MAJOR, LIBCAMERA_VERSION_MINOR and LIBCAMERA_VERSION_PATCH for this purpose. version.h is not included by any other libcamera header or source file, and thus doesn't force a rebuild of the library. The Sphinx and Doxygen documentation keep their git-based version information, which is set during the configuration of the build and then doesn't track git commits. We may want to investigate how to improve this, but given that git-based version for the documentation has very few use cases outside of tagging nightly builds, this isn't considered an issue at the moment. The documentation install directory now uses the base version string, in order to avoid increasing the number of documentation directories needlessly. This shouldn't cause any issue as the API should not change without a change to the version number. The version number generation and handling code now also standardises the version variables to not start with a 'v' prefix in meson, in order to simplify their handling. The prefix is added when generating the relevant files. Note that we go back to specifying the fallback version in the main meson.build, in the call to the project() function. For the time being I believe this should be a good compromise to avoid unnecessary recompilation, and moving the fallback version to a different file for tarball releases can be built on top of this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-04libcamera: Auto generate version informationKieran Bingham
Generate a version string, and provide a global string object which allows applications to interrogate the current libcamera version information. The version header is automatically updated by meson on each build. The string roughly follows the semver [0] conventions of major.minor.patch-label as a value. [0] https://semver.org/ A script (utils/gen-version.sh) is provided which is modelled upon the processing from autoconf's git-version-gen. The gen-version.sh script will look for tags in the form vX.Y as starting points for the version string. While the repository does not have any matching tags, v0.0 will be assumed, resulting in versions with both major and minor being set to '0', and the patch count resulting from the number of patches in the history to that point. Finally, a uniquely identifying shortened hash is provided from git: v0.0.509+0ec0edf7 Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-06-19meson: Link against libc++ with compiling with clangLaurent Pinchart
libc++ is used by Chrome OS, and likely as well by other environments based on clang. Using it by default if available when compiling with clang will help extending the compile-testing coverage. The drawback is that issues specific to clang with libstdc++ will not be caught as easily, but based on the experience with clang so far, code compiling correctly with gcc/libstdc++ has failed with clang due to either clang-specific or libc++-specific behaviour, never due only to the combination of clang with libstdc++. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-05-23meson: Fix coding style in meson.build filesLaurent Pinchart
Consistently go for 4 spaces indentation, and always put a space between the colon in argument lists, as per the examples from the meson documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-27libcamera: Make libudev optionalLaurent Pinchart
libcamera depends on libudev for device enumeration. It is however useful to allow building documentation without requiring the dependency to be installed. Make the libudev dependency optional and compile the udev-based device enumerator out when libudev is not present. Note that while libcamera will compile without libudev, it will not be able to enumerate devices. A sysfs-based device enumerator is planned as a fallback but not implemented yet. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-26meson: check if secure_getenv() is presentGiulio Benetti
Not all libc make secure_getenv() available, this could lead to build failure on certain build systems. Check if secure_getenv() is available and emit #define HAVE_SECURE_GETENV to config.h Include config.h to every c/c++ file during building by adding `-include config.h` to project arguments for both c and c++. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Kieran: Drop unnessecary meson message Update commit message] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-03meson: Re-order the optional componentsKieran Bingham
Re-order the optional components to make them alphabetical, and fix up the indentation to use two spaces as required by meson. A comment is added to highlight that these optional components are enabled by default. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-03-20meson: Provide options to disable test/docsKieran Bingham
It can be desirable to disable the compilation and processing of both the test suite and documentation for use cases such as packaging to an embedded target. Provide a new meson_options.txt file to allow disabling either or both of the tests and documentation components of libcamera. These options can be provided at the initial configuration time, for example: meson build -Dtests=false -Ddocumentation=false or by reconfiguring an existing build tree: cd build meson configure -Ddocumentation=false meson configure -Dtests=false Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-15meson: Utilise default compiler optionsKieran Bingham
Remove our custom declarations for cpp_std=c++11, -Wall, -Wextra and -Werror, instead prefering to use the built-in default_option parameters from meson. Our custom compiler flags (such as -Wno-unused-parameter) are maintained. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-01meson: Shorten project descriptionKieran Bingham
The project description is really the project name. The extraneosly long string gets printed at the test runner prefixed to the suite. As such it should really be the shortened simple project name. Remove the 'description' from the project naming field. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-13build: Add 'std=c++11' cpp compiler flagJacopo Mondi
Building the current master branch with g++ 5.4.0-6 fails with: ./src/libcamera/include/log.h:25:34: error: defaulted and deleted functions only available with -std=c++11 \ or -std=gnu++11 [-Werror] LogMessage(const LogMessage&) = delete; Fix this by adding the 'std=c++11' compiler argument for to the list of cpp build flags. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-12Documentation: Generate source code documentation using DoxygenLaurent Pinchart
Extend the documentation build system to automatically generate documentation from source code using Doxygen. This is currently separate from the sphinx documentation, and should be integrated using the breathe (and possibly exhale) extensions. As the Documentation/meson.build file needs to reference the variables holding the source files, move the Documentation directory to the end of the subdirs() in the top-level meson.build. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-06Overhaul the directory structureLaurent Pinchart
In order to match the directory structure of traditional projects, rename the top-level lib/ directory to src/libcamera/. Other libraries developed as part of the project will later find a home in src/. Split the libcamera header files in three categories: public headers describing the public API in include/libcamera/, internal headers describing the internal API in src/libcamera/include/, and private headers local to one or a small number of compilation units along the corresponding .cpp files. As no internal header exists yet the src/libcamera/include/ directory is created empty as the build system would fail otherwise. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>