Skip to content

Commit

Permalink
build: Use 'feature' type for all meson options.
Browse files Browse the repository at this point in the history
For consistency, use 'feature' types for enable_libav, enable_drm,
enable_egl and enable_qt meson options.

Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed May 17, 2024
1 parent 42fca03 commit c8351a0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rpicam-apps-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
clean: true

- name: Configure meson
run: meson setup ${{github.workspace}}/build --pkg-config-path=${{env.LIBCAMERA_LKG_DIR}}/lib/aarch64-linux-gnu/pkgconfig/ -Dbuildtype=release -Denable_drm=false -Denable_egl=false -Denable_qt=false -Denable_opencv='disabled' -Denable_tflite='disabled' -Denable_libav=false
run: meson setup ${{github.workspace}}/build --pkg-config-path=${{env.LIBCAMERA_LKG_DIR}}/lib/aarch64-linux-gnu/pkgconfig/ -Dbuildtype=release -Denable_drm='disabled' -Denable_egl='disabled' -Denable_qt='disabled' -Denable_opencv='disabled' -Denable_tflite='disabled' -Denable_libav='disabled'
timeout-minutes: 5

- name: Build
Expand Down
20 changes: 9 additions & 11 deletions encoder/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ encoder_headers = files([
'null_encoder.hpp',
])

enable_libav = get_option('enable_libav')
libav_dep_names = ['libavcodec', 'libavdevice', 'libavformat', 'libavutil', 'libswresample']
libav_deps = []

if enable_libav
foreach name : libav_dep_names
dep = dependency(name, required : false)
if not dep.found()
enable_libav = false
break
endif
libav_deps += dep
endforeach
endif
enable_libav = true
foreach name : libav_dep_names
dep = dependency(name, required : get_option('enable_libav'))
if not dep.found()
enable_libav = false
break
endif
libav_deps += dep
endforeach

if enable_libav
rpicam_app_src += files('libav_encoder.cpp')
Expand Down
16 changes: 8 additions & 8 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
option('enable_libav',
type : 'boolean',
value : true,
type : 'feature',
value : 'auto',
description : 'Enable the libav encoder for video/audio capture')

option('enable_drm',
type : 'boolean',
value : true,
type : 'feature',
value : 'auto',
description : 'Enable DRM preview window support')

option('enable_egl',
type : 'boolean',
value : true,
type : 'feature',
value : 'auto',
description : 'Enable EGL preview window support')

option('enable_qt',
type : 'boolean',
value : true,
type : 'feature',
value : 'auto',
description : 'Enable QT preview window support')

option('enable_opencv',
Expand Down
30 changes: 13 additions & 17 deletions preview/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,34 @@ preview_headers = files([
'preview.hpp',
])

enable_drm = get_option('enable_drm')
drm_deps = dependency('libdrm', required : false)
enable_drm = false
drm_deps = dependency('libdrm', required : get_option('enable_drm'))

if enable_drm and drm_deps.found()
if drm_deps.found()
rpicam_app_dep += drm_deps
rpicam_app_src += files('drm_preview.cpp')
cpp_arguments += '-DLIBDRM_PRESENT=1'
else
enable_drm = false
enable_drm = true
endif

enable_egl = get_option('enable_egl')
x11_deps = dependency('x11', required : false)
epoxy_deps = dependency('epoxy', required : false)
enable_egl = false
x11_deps = dependency('x11', required : get_option('enable_egl'))
epoxy_deps = dependency('epoxy', required : get_option('enable_egl'))

if enable_egl and x11_deps.found() and epoxy_deps.found()
if x11_deps.found() and epoxy_deps.found()
rpicam_app_dep += [x11_deps, epoxy_deps]
rpicam_app_src += files('egl_preview.cpp')
cpp_arguments += '-DLIBEGL_PRESENT=1'
else
enable_egl = false
enable_egl = true
endif

enable_qt = get_option('enable_qt')
qt_dep = dependency('qt5', modules : ['Core', 'Widgets'], required : false)

if enable_qt and qt_dep.found()
enable_qt = false
qt_dep = dependency('qt5', modules : ['Core', 'Widgets'], required : get_option('enable_qt'))
if qt_dep.found()
rpicam_app_dep += qt_dep
rpicam_app_src += files('qt_preview.cpp')
cpp_arguments += '-DQT_PRESENT=1'
else
enable_qt = false
enable_qt = true
endif

install_headers(preview_headers, subdir: meson.project_name() / 'preview')

0 comments on commit c8351a0

Please sign in to comment.