apps: Share common source between applications
Multiple source files in the src/apps/cam/ directory are used by cam, qcam and lc-compliance. They are compiled separately for each application. Move them to a new src/apps/common/ directory and compile them in a static library to decrease the number of compilation operations. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
11f5c3ad05
commit
a8113fb3a8
30 changed files with 61 additions and 47 deletions
|
@ -13,9 +13,11 @@
|
|||
#include <libcamera/control_ids.h>
|
||||
#include <libcamera/property_ids.h>
|
||||
|
||||
#include "../common/event_loop.h"
|
||||
#include "../common/stream_options.h"
|
||||
|
||||
#include "camera_session.h"
|
||||
#include "capture_script.h"
|
||||
#include "event_loop.h"
|
||||
#include "file_sink.h"
|
||||
#ifdef HAVE_KMS
|
||||
#include "kms_sink.h"
|
||||
|
@ -24,7 +26,6 @@
|
|||
#ifdef HAVE_SDL
|
||||
#include "sdl_sink.h"
|
||||
#endif
|
||||
#include "stream_options.h"
|
||||
|
||||
using namespace libcamera;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <libcamera/request.h>
|
||||
#include <libcamera/stream.h>
|
||||
|
||||
#include "options.h"
|
||||
#include "../common/options.h"
|
||||
|
||||
class CaptureScript;
|
||||
class FrameSink;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <libdrm/drm_mode.h>
|
||||
|
||||
#include "event_loop.h"
|
||||
#include "../common/event_loop.h"
|
||||
|
||||
namespace DRM {
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
|
||||
#include <libcamera/camera.h>
|
||||
|
||||
#include "dng_writer.h"
|
||||
#include "../common/dng_writer.h"
|
||||
#include "../common/image.h"
|
||||
|
||||
#include "file_sink.h"
|
||||
#include "image.h"
|
||||
|
||||
using namespace libcamera;
|
||||
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
#include <libcamera/libcamera.h>
|
||||
#include <libcamera/property_ids.h>
|
||||
|
||||
#include "../common/event_loop.h"
|
||||
#include "../common/options.h"
|
||||
#include "../common/stream_options.h"
|
||||
|
||||
#include "camera_session.h"
|
||||
#include "event_loop.h"
|
||||
#include "main.h"
|
||||
#include "options.h"
|
||||
#include "stream_options.h"
|
||||
|
||||
using namespace libcamera;
|
||||
|
||||
|
|
|
@ -10,16 +10,12 @@ cam_enabled = true
|
|||
cam_sources = files([
|
||||
'camera_session.cpp',
|
||||
'capture_script.cpp',
|
||||
'event_loop.cpp',
|
||||
'file_sink.cpp',
|
||||
'frame_sink.cpp',
|
||||
'image.cpp',
|
||||
'main.cpp',
|
||||
'options.cpp',
|
||||
'stream_options.cpp',
|
||||
])
|
||||
|
||||
cam_cpp_args = []
|
||||
cam_cpp_args = [apps_cpp_args]
|
||||
|
||||
libdrm = dependency('libdrm', required : false)
|
||||
libjpeg = dependency('libjpeg', required : false)
|
||||
|
@ -49,14 +45,8 @@ if libsdl2.found()
|
|||
endif
|
||||
endif
|
||||
|
||||
if libtiff.found()
|
||||
cam_cpp_args += ['-DHAVE_TIFF']
|
||||
cam_sources += files([
|
||||
'dng_writer.cpp',
|
||||
])
|
||||
endif
|
||||
|
||||
cam = executable('cam', cam_sources,
|
||||
link_with : apps_lib,
|
||||
dependencies : [
|
||||
libatomic,
|
||||
libcamera_public,
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
#include <libcamera/camera.h>
|
||||
#include <libcamera/formats.h>
|
||||
|
||||
#include "event_loop.h"
|
||||
#include "image.h"
|
||||
#include "../common/event_loop.h"
|
||||
#include "../common/image.h"
|
||||
|
||||
#ifdef HAVE_LIBJPEG
|
||||
#include "sdl_texture_mjpg.h"
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include "image.h"
|
||||
#include "../common/image.h"
|
||||
|
||||
class SDLTexture
|
||||
{
|
||||
|
|
26
src/apps/common/meson.build
Normal file
26
src/apps/common/meson.build
Normal file
|
@ -0,0 +1,26 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
apps_sources = files([
|
||||
'image.cpp',
|
||||
'options.cpp',
|
||||
'stream_options.cpp',
|
||||
])
|
||||
|
||||
apps_cpp_args = []
|
||||
|
||||
if libevent.found()
|
||||
apps_sources += files([
|
||||
'event_loop.cpp',
|
||||
])
|
||||
endif
|
||||
|
||||
if libtiff.found()
|
||||
apps_cpp_args += ['-DHAVE_TIFF']
|
||||
apps_sources += files([
|
||||
'dng_writer.cpp',
|
||||
])
|
||||
endif
|
||||
|
||||
apps_lib = static_library('apps', apps_sources,
|
||||
cpp_args : apps_cpp_args,
|
||||
dependencies : [libcamera_public])
|
|
@ -14,8 +14,9 @@
|
|||
|
||||
#include <libcamera/libcamera.h>
|
||||
|
||||
#include "../common/options.h"
|
||||
|
||||
#include "environment.h"
|
||||
#include "../cam/options.h"
|
||||
|
||||
using namespace libcamera;
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@ endif
|
|||
lc_compliance_enabled = true
|
||||
|
||||
lc_compliance_sources = files([
|
||||
'../cam/event_loop.cpp',
|
||||
'../cam/options.cpp',
|
||||
'environment.cpp',
|
||||
'main.cpp',
|
||||
'simple_capture.cpp',
|
||||
|
@ -21,6 +19,7 @@ lc_compliance_sources = files([
|
|||
|
||||
lc_compliance = executable('lc-compliance', lc_compliance_sources,
|
||||
cpp_args : [ '-fexceptions' ],
|
||||
link_with : apps_lib,
|
||||
dependencies : [
|
||||
libatomic,
|
||||
libcamera_public,
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <libcamera/libcamera.h>
|
||||
|
||||
#include "../cam/event_loop.h"
|
||||
#include "../common/event_loop.h"
|
||||
|
||||
class SimpleCapture
|
||||
{
|
||||
|
|
|
@ -12,6 +12,8 @@ endif
|
|||
|
||||
libtiff = dependency('libtiff-4', required : false)
|
||||
|
||||
subdir('common')
|
||||
|
||||
subdir('lc-compliance')
|
||||
|
||||
subdir('cam')
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <libcamera/formats.h>
|
||||
|
||||
#include "../cam/image.h"
|
||||
#include "../common/image.h"
|
||||
|
||||
#define RGBSHIFT 8
|
||||
#ifndef MAX
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
|
||||
#include <libcamera/camera_manager.h>
|
||||
|
||||
#include "../cam/options.h"
|
||||
#include "../cam/stream_options.h"
|
||||
#include "../common/options.h"
|
||||
#include "../common/stream_options.h"
|
||||
|
||||
#include "main_window.h"
|
||||
#include "message_handler.h"
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include <QToolButton>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "../cam/dng_writer.h"
|
||||
#include "../cam/image.h"
|
||||
#include "../common/dng_writer.h"
|
||||
#include "../common/image.h"
|
||||
|
||||
#include "cam_select_dialog.h"
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <QQueue>
|
||||
#include <QTimer>
|
||||
|
||||
#include "../cam/stream_options.h"
|
||||
#include "../common/stream_options.h"
|
||||
|
||||
#include "viewfinder.h"
|
||||
|
||||
|
|
|
@ -15,9 +15,6 @@ endif
|
|||
qcam_enabled = true
|
||||
|
||||
qcam_sources = files([
|
||||
'../cam/image.cpp',
|
||||
'../cam/options.cpp',
|
||||
'../cam/stream_options.cpp',
|
||||
'cam_select_dialog.cpp',
|
||||
'format_converter.cpp',
|
||||
'main.cpp',
|
||||
|
@ -36,14 +33,7 @@ qcam_resources = files([
|
|||
'assets/feathericons/feathericons.qrc',
|
||||
])
|
||||
|
||||
qt5_cpp_args = ['-DQT_NO_KEYWORDS']
|
||||
|
||||
if libtiff.found()
|
||||
qt5_cpp_args += ['-DHAVE_TIFF']
|
||||
qcam_sources += files([
|
||||
'../cam/dng_writer.cpp',
|
||||
])
|
||||
endif
|
||||
qt5_cpp_args = [apps_cpp_args, '-DQT_NO_KEYWORDS']
|
||||
|
||||
if cxx.has_header_symbol('QOpenGLWidget', 'QOpenGLWidget',
|
||||
dependencies : qt5_dep, args : '-fPIC')
|
||||
|
@ -73,6 +63,7 @@ resources = qt5.preprocess(moc_headers: qcam_moc_headers,
|
|||
|
||||
qcam = executable('qcam', qcam_sources, resources,
|
||||
install : true,
|
||||
link_with : apps_lib,
|
||||
dependencies : [
|
||||
libatomic,
|
||||
libcamera_public,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <libcamera/formats.h>
|
||||
|
||||
#include "../cam/image.h"
|
||||
#include "../common/image.h"
|
||||
|
||||
static const QList<libcamera::PixelFormat> supportedFormats{
|
||||
/* YUV - packed (single plane) */
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <QPainter>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "../cam/image.h"
|
||||
#include "../common/image.h"
|
||||
|
||||
#include "format_converter.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue