Skip to content

Commit 69209ec

Browse files
committed
make it a soft error if gstreamer libs aren't found
1 parent 99ce1a0 commit 69209ec

File tree

1 file changed

+45
-32
lines changed

1 file changed

+45
-32
lines changed

CMakeLists.txt

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ option(BUILD_RAW_KEYBOARD_PLUGIN "Include the raw keyboard plugin in the finishe
4141
option(BUILD_TEST_PLUGIN "Include the test plugin in the finished binary. Allows testing platform channel communication." OFF)
4242
option(BUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN "Include the omxplayer_video_player plugin in the finished binary. Allows for hardware accelerated video playback in flutter using omxplayer." ON)
4343
option(BUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN "Include the gstreamer_video_player plugin in the finished binary. Allows for more stable, hardware accelerated video playback in flutter using gstreamer." ON)
44+
option(TRY_BUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN "Don't throw an error if the gstreamer libs aren't found, instead just don't build the gstreamer video player plugin in that case." ON)
4445
option(DUMP_ENGINE_LAYERS "True if flutter-pi should dump the list of rendering layers that the flutter engine sends to flutter-pi on each draw." OFF)
4546
option(ENABLE_TSAN "True to build & link with -fsanitize=thread" OFF)
4647
option(ENABLE_ASAN "True to build & link with -fsanitize=address" OFF)
@@ -193,39 +194,51 @@ if (OMXPLAYER_SUPPORTS_RUNTIME_ROTATION)
193194
target_compile_definitions(flutter-pi PRIVATE "OMXPLAYER_SUPPORTS_RUNTIME_ROTATION")
194195
endif()
195196
if (BUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN)
196-
pkg_check_modules(LIBGSTREAMER REQUIRED gstreamer-1.0)
197-
pkg_check_modules(LIBGSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-1.0)
198-
pkg_check_modules(LIBGSTREAMER_APP REQUIRED gstreamer-app-1.0)
199-
pkg_check_modules(LIBGSTREAMER_ALLOCATORS REQUIRED gstreamer-allocators-1.0)
200-
pkg_check_modules(LIBGSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
197+
if (TRY_BUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN)
198+
pkg_check_modules(LIBGSTREAMER gstreamer-1.0)
199+
pkg_check_modules(LIBGSTREAMER_PLUGINS_BASE gstreamer-plugins-base-1.0)
200+
pkg_check_modules(LIBGSTREAMER_APP gstreamer-app-1.0)
201+
pkg_check_modules(LIBGSTREAMER_ALLOCATORS gstreamer-allocators-1.0)
202+
pkg_check_modules(LIBGSTREAMER_VIDEO gstreamer-video-1.0)
203+
else()
204+
pkg_check_modules(LIBGSTREAMER REQUIRED gstreamer-1.0)
205+
pkg_check_modules(LIBGSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-1.0)
206+
pkg_check_modules(LIBGSTREAMER_APP REQUIRED gstreamer-app-1.0)
207+
pkg_check_modules(LIBGSTREAMER_ALLOCATORS REQUIRED gstreamer-allocators-1.0)
208+
pkg_check_modules(LIBGSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
209+
endif()
201210

202-
target_sources(flutter-pi PRIVATE
203-
src/plugins/gstreamer_video_player/plugin.c
204-
src/plugins/gstreamer_video_player/player.c
205-
src/plugins/gstreamer_video_player/frame.c
206-
)
207-
target_compile_definitions(flutter-pi PRIVATE "BUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN")
208-
target_link_libraries(flutter-pi
209-
${LIBGSTREAMER_LDFLAGS}
210-
${LIBGSTREAMER_PLUGINS_BASE_LDFLAGS}
211-
${LIBGSTREAMER_APP_LDFLAGS}
212-
${LIBGSTREAMER_ALLOCATORS_LDFLAGS}
213-
${LIBGSTREAMER_VIDEO_LDFLAGS}
214-
)
215-
target_include_directories(flutter-pi PRIVATE
216-
${LIBGSTREAMER_INCLUDE_DIRS}
217-
${LIBGSTREAMER_PLUGINS_BASE_INCLUDE_DIRS}
218-
${LIBGSTREAMER_APP_INCLUDE_DIRS}
219-
${LIBGSTREAMER_ALLOCATORS_INCLUDE_DIRS}
220-
${LIBGSTREAMER_VIDEO_INCLUDE_DIRS}
221-
)
222-
target_compile_options(flutter-pi PRIVATE
223-
${LIBGSTREAMER_CFLAGS}
224-
${LIBGSTREAMER_PLUGINS_BASE_CFLAGS}
225-
${LIBGSTREAMER_APP_CFLAGS}
226-
${LIBGSTREAMER_ALLOCATORS_CFLAGS}
227-
${LIBGSTREAMER_VIDEO_CFLAGS}
228-
)
211+
if (LIBGSTREAMER_FOUND AND LIBGSTREAMER_PLUGINS_BASE_FOUND AND LIBGSTREAMER_APP_FOUND AND LIBGSTREAMER_ALLOCATORS_FOUND AND LIBGSTREAMER_VIDEO_FOUND)
212+
target_sources(flutter-pi PRIVATE
213+
src/plugins/gstreamer_video_player/plugin.c
214+
src/plugins/gstreamer_video_player/player.c
215+
src/plugins/gstreamer_video_player/frame.c
216+
)
217+
target_compile_definitions(flutter-pi PRIVATE "BUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN")
218+
target_link_libraries(flutter-pi
219+
${LIBGSTREAMER_LDFLAGS}
220+
${LIBGSTREAMER_PLUGINS_BASE_LDFLAGS}
221+
${LIBGSTREAMER_APP_LDFLAGS}
222+
${LIBGSTREAMER_ALLOCATORS_LDFLAGS}
223+
${LIBGSTREAMER_VIDEO_LDFLAGS}
224+
)
225+
target_include_directories(flutter-pi PRIVATE
226+
${LIBGSTREAMER_INCLUDE_DIRS}
227+
${LIBGSTREAMER_PLUGINS_BASE_INCLUDE_DIRS}
228+
${LIBGSTREAMER_APP_INCLUDE_DIRS}
229+
${LIBGSTREAMER_ALLOCATORS_INCLUDE_DIRS}
230+
${LIBGSTREAMER_VIDEO_INCLUDE_DIRS}
231+
)
232+
target_compile_options(flutter-pi PRIVATE
233+
${LIBGSTREAMER_CFLAGS}
234+
${LIBGSTREAMER_PLUGINS_BASE_CFLAGS}
235+
${LIBGSTREAMER_APP_CFLAGS}
236+
${LIBGSTREAMER_ALLOCATORS_CFLAGS}
237+
${LIBGSTREAMER_VIDEO_CFLAGS}
238+
)
239+
else()
240+
message(NOTICE "Couldn't find gstreamer libraries. Gstreamer video player plugin won't be build.")
241+
endif()
229242
endif()
230243

231244
# Needed so dart VM can actually resolve symbols in the same

0 commit comments

Comments
 (0)