diff --git a/libs/qmlglsink/CMakeLists.txt b/libs/qmlglsink/CMakeLists.txt index 5e2177fe92e..fdcc6eced08 100644 --- a/libs/qmlglsink/CMakeLists.txt +++ b/libs/qmlglsink/CMakeLists.txt @@ -87,11 +87,17 @@ if(QGC_ENABLE_VIDEOSTREAMING) endif() endif() - find_package(PkgConfig) - if(NOT EXISTS ${GSTREAMER_ROOT}) - pkg_check_modules(GSTREAMER gstreamer-1.0>=${GST_TARGET_VERSION}) - if(GSTREAMER_FOUND) - set(GSTREAMER_ROOT ${GSTREAMER_PREFIX}) + if(MACOS) + find_library(GSTREAMER_FRAMEWORK + NAMES GStreamer + HINTS ${GSTREAMER_ROOT}) + else() + find_package(PkgConfig) + if(NOT EXISTS ${GSTREAMER_ROOT}) + pkg_check_modules(GSTREAMER gstreamer-1.0>=${GST_TARGET_VERSION}) + if(GSTREAMER_FOUND) + set(GSTREAMER_ROOT ${GSTREAMER_PREFIX}) + endif() endif() endif() @@ -122,43 +128,48 @@ if(QGC_ENABLE_VIDEOSTREAMING) ${GST_TARGET_PLUGINS} ) elseif(LINUX) - set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/lib/pkgconfig:${GSTREAMER_ROOT}/x86_64-linux-gnu/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/lib/ pkgconfig:${GSTREAMER_ROOT}/x86_64-linux-gnu/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") pkg_check_modules(GST IMPORTED_TARGET ${GST_TARGET_MODULES}) elseif(MACOS) - set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/Versions/Current/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") - pkg_check_modules(GST IMPORTED_TARGET ${GST_TARGET_MODULES}) - else() - set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") - pkg_check_modules(GST IMPORTED_TARGET ${GST_TARGET_MODULES}) + if (GSTREAMER_FRAMEWORK-NOTFOUND) + message(WARNING "Gstreamer Framework Not Found") + else() + set(GST_FOUND TRUE) + message(STATUS "Gstreamer Framework Found") + endif() endif() - if(TARGET PkgConfig::GST) - target_link_libraries(qmlglsink PUBLIC PkgConfig::GST) - target_include_directories(qmlglsink PUBLIC ${GSTREAMER_ROOT}/include/gstreamer-1.0) - if(GST_STATIC_BUILD) - target_link_libraries(qmlglsink PUBLIC ${GST_STATIC_LINK_LIBRARIES}) - target_link_directories(qmlglsink PUBLIC ${GST_STATIC_LIBRARY_DIRS}) - target_link_options(qmlglsink PUBLIC ${GST_STATIC_LDFLAGS} ${GST_STATIC_LDFLAGS_OTHER}) - target_compile_options(qmlglsink PUBLIC ${GST_STATIC_CFLAGS} ${GST_STATIC_CFLAGS_OTHER}) - target_include_directories(qmlglsink PUBLIC ${GST_STATIC_INCLUDE_DIRS}) - if(ANDROID) - target_link_options(PkgConfig::GST INTERFACE "-Wl,-Bsymbolic") + if(MACOS) + target_link_libraries(qmlglsink PUBLIC "-framework GStreamer") + else() + if(TARGET PkgConfig::GST) + target_link_libraries(qmlglsink PUBLIC PkgConfig::GST) + target_include_directories(qmlglsink PUBLIC ${GSTREAMER_ROOT}/include/gstreamer-1.0) + if(GST_STATIC_BUILD) + target_link_libraries(qmlglsink PUBLIC ${GST_STATIC_LINK_LIBRARIES}) + target_link_directories(qmlglsink PUBLIC ${GST_STATIC_LIBRARY_DIRS}) + target_link_options(qmlglsink PUBLIC ${GST_STATIC_LDFLAGS} ${GST_STATIC_LDFLAGS_OTHER}) + target_compile_options(qmlglsink PUBLIC ${GST_STATIC_CFLAGS} ${GST_STATIC_CFLAGS_OTHER}) + target_include_directories(qmlglsink PUBLIC ${GST_STATIC_INCLUDE_DIRS}) + if(ANDROID) + target_link_options(PkgConfig::GST INTERFACE "-Wl,-Bsymbolic") + endif() + else() + target_link_libraries(qmlglsink PUBLIC ${GST_LINK_LIBRARIES}) + target_link_directories(qmlglsink PUBLIC ${GST_LIBRARY_DIRS}) + target_link_options(qmlglsink PUBLIC ${GST_LDFLAGS} ${GST_LDFLAGS_OTHER}) + target_compile_options(qmlglsink PUBLIC ${GST_CFLAGS} ${GST_CFLAGS_OTHER}) + target_include_directories(qmlglsink PUBLIC ${GST_INCLUDE_DIRS}) + if(WIN32) + cmake_path(CONVERT "${GSTREAMER_ROOT}/bin/*.dll" TO_CMAKE_PATH_LIST GST_WIN_BINS_PATH) + file(GLOB GST_WIN_BINS ${GST_WIN_BINS_PATH}) + cmake_print_variables(GST_WIN_BINS_PATH GST_WIN_BINS) + # TODO: Only install needed libs + install(FILES ${GST_WIN_BINS} DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() endif() - else() - target_link_libraries(qmlglsink PUBLIC ${GST_LINK_LIBRARIES}) - target_link_directories(qmlglsink PUBLIC ${GST_LIBRARY_DIRS}) - target_link_options(qmlglsink PUBLIC ${GST_LDFLAGS} ${GST_LDFLAGS_OTHER}) - target_compile_options(qmlglsink PUBLIC ${GST_CFLAGS} ${GST_CFLAGS_OTHER}) - target_include_directories(qmlglsink PUBLIC ${GST_INCLUDE_DIRS}) - if(WIN32) - cmake_path(CONVERT "${GSTREAMER_ROOT}/bin/*.dll" TO_CMAKE_PATH_LIST GST_WIN_BINS_PATH) - file(GLOB GST_WIN_BINS ${GST_WIN_BINS_PATH}) - cmake_print_variables(GST_WIN_BINS_PATH GST_WIN_BINS) - # TODO: Only install needed libs - install(FILES ${GST_WIN_BINS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() - endif() - # file(GET_RUNTIME_DEPENDENCIES) + # file(GET_RUNTIME_DEPENDENCIES) + endif() endif() else() message(WARNING "Gstreamer Not Found") @@ -237,44 +248,46 @@ if(QGC_ENABLE_VIDEOSTREAMING) ) endif() - message(STATUS "GStreamer version: ${GST_gstreamer-1.0_VERSION}") - message(STATUS "GStreamer prefix: ${GST_gstreamer-1.0_PREFIX}") - message(STATUS "GStreamer include dir: ${GST_gstreamer-1.0_INCLUDEDIR}") - message(STATUS "GStreamer libdir: ${GST_gstreamer-1.0_LIBDIR}") - if(GST_STATIC_BUILD) - list(REMOVE_DUPLICATES GST_STATIC_LIBRARIES) - list(REMOVE_DUPLICATES GST_STATIC_LINK_LIBRARIES) - list(REMOVE_DUPLICATES GST_STATIC_LIBRARY_DIRS) - list(REMOVE_DUPLICATES GST_STATIC_INCLUDE_DIRS) - list(REMOVE_DUPLICATES GST_STATIC_LDFLAGS) - list(REMOVE_DUPLICATES GST_STATIC_LDFLAGS_OTHER) - list(REMOVE_DUPLICATES GST_STATIC_CFLAGS) - list(REMOVE_DUPLICATES GST_STATIC_CFLAGS_OTHER) - message(VERBOSE "GStreamer static libs: ${GST_STATIC_LIBRARIES}") - message(VERBOSE "GStreamer static link libs: ${GST_STATIC_LINK_LIBRARIES}") - message(VERBOSE "GStreamer static link dirs: ${GST_STATIC_LIBRARY_DIRS}") - message(VERBOSE "GStreamer static include dirs: ${GST_STATIC_INCLUDE_DIRS}") - message(VERBOSE "GStreamer static ldflags: ${GST_STATIC_LDFLAGS}") - message(VERBOSE "GStreamer static ldflags other: ${GST_STATIC_LDFLAGS_OTHER}") - message(VERBOSE "GStreamer static cflags: ${GST_STATIC_CFLAGS}") - message(VERBOSE "GStreamer static cflags other: ${GST_STATIC_CFLAGS_OTHER}") - else() - list(REMOVE_DUPLICATES GST_LIBRARIES) - list(REMOVE_DUPLICATES GST_LINK_LIBRARIES) - list(REMOVE_DUPLICATES GST_LIBRARY_DIRS) - list(REMOVE_DUPLICATES GST_LDFLAGS) - list(REMOVE_DUPLICATES GST_LDFLAGS_OTHER) - list(REMOVE_DUPLICATES GST_INCLUDE_DIRS) - list(REMOVE_DUPLICATES GST_CFLAGS) - list(REMOVE_DUPLICATES GST_CFLAGS_OTHER) - message(VERBOSE "GStreamer libs: ${GST_LIBRARIES}") - message(VERBOSE "GStreamer link libs: ${GST_LINK_LIBRARIES}") - message(VERBOSE "GStreamer link dirs: ${GST_LIBRARY_DIRS}") - message(VERBOSE "GStreamer ldflags: ${GST_LDFLAGS}") - message(VERBOSE "GStreamer ldflags other: ${GST_LDFLAGS_OTHER}") - message(VERBOSE "GStreamer include dirs: ${GST_INCLUDE_DIRS}") - message(VERBOSE "GStreamer cflags: ${GST_CFLAGS}") - message(VERBOSE "GStreamer cflags other: ${GST_CFLAGS_OTHER}") + if(NOT MACOS) + message(STATUS "GStreamer version: ${GST_gstreamer-1.0_VERSION}") + message(STATUS "GStreamer prefix: ${GST_gstreamer-1.0_PREFIX}") + message(STATUS "GStreamer include dir: ${GST_gstreamer-1.0_INCLUDEDIR}") + message(STATUS "GStreamer libdir: ${GST_gstreamer-1.0_LIBDIR}") + if(GST_STATIC_BUILD) + list(REMOVE_DUPLICATES GST_STATIC_LIBRARIES) + list(REMOVE_DUPLICATES GST_STATIC_LINK_LIBRARIES) + list(REMOVE_DUPLICATES GST_STATIC_LIBRARY_DIRS) + list(REMOVE_DUPLICATES GST_STATIC_INCLUDE_DIRS) + list(REMOVE_DUPLICATES GST_STATIC_LDFLAGS) + list(REMOVE_DUPLICATES GST_STATIC_LDFLAGS_OTHER) + list(REMOVE_DUPLICATES GST_STATIC_CFLAGS) + list(REMOVE_DUPLICATES GST_STATIC_CFLAGS_OTHER) + message(VERBOSE "GStreamer static libs: ${GST_STATIC_LIBRARIES}") + message(VERBOSE "GStreamer static link libs: ${GST_STATIC_LINK_LIBRARIES}") + message(VERBOSE "GStreamer static link dirs: ${GST_STATIC_LIBRARY_DIRS}") + message(VERBOSE "GStreamer static include dirs: ${GST_STATIC_INCLUDE_DIRS}") + message(VERBOSE "GStreamer static ldflags: ${GST_STATIC_LDFLAGS}") + message(VERBOSE "GStreamer static ldflags other: ${GST_STATIC_LDFLAGS_OTHER}") + message(VERBOSE "GStreamer static cflags: ${GST_STATIC_CFLAGS}") + message(VERBOSE "GStreamer static cflags other: ${GST_STATIC_CFLAGS_OTHER}") + else() + list(REMOVE_DUPLICATES GST_LIBRARIES) + list(REMOVE_DUPLICATES GST_LINK_LIBRARIES) + list(REMOVE_DUPLICATES GST_LIBRARY_DIRS) + list(REMOVE_DUPLICATES GST_LDFLAGS) + list(REMOVE_DUPLICATES GST_LDFLAGS_OTHER) + list(REMOVE_DUPLICATES GST_INCLUDE_DIRS) + list(REMOVE_DUPLICATES GST_CFLAGS) + list(REMOVE_DUPLICATES GST_CFLAGS_OTHER) + message(VERBOSE "GStreamer libs: ${GST_LIBRARIES}") + message(VERBOSE "GStreamer link libs: ${GST_LINK_LIBRARIES}") + message(VERBOSE "GStreamer link dirs: ${GST_LIBRARY_DIRS}") + message(VERBOSE "GStreamer ldflags: ${GST_LDFLAGS}") + message(VERBOSE "GStreamer ldflags other: ${GST_LDFLAGS_OTHER}") + message(VERBOSE "GStreamer include dirs: ${GST_INCLUDE_DIRS}") + message(VERBOSE "GStreamer cflags: ${GST_CFLAGS}") + message(VERBOSE "GStreamer cflags other: ${GST_CFLAGS_OTHER}") + endif() endif() else() message(WARNING "GST Modules Not Found") diff --git a/src/VideoManager/VideoManager.cc b/src/VideoManager/VideoManager.cc index a43ffc05a63..5b5e2fd878c 100644 --- a/src/VideoManager/VideoManager.cc +++ b/src/VideoManager/VideoManager.cc @@ -32,6 +32,7 @@ #include "GStreamer.h" #include "VideoSettings.h" #else +#error Boom #include "GLVideoItemStub.h" #endif diff --git a/src/VideoReceiver/CMakeLists.txt b/src/VideoReceiver/CMakeLists.txt index 3a97be54a3b..37425a85a0b 100644 --- a/src/VideoReceiver/CMakeLists.txt +++ b/src/VideoReceiver/CMakeLists.txt @@ -35,6 +35,7 @@ if(GST_FOUND) Settings ) + message(FATAL_ERROR "GST_FOUND: ${GST_FOUND}") target_compile_definitions(VideoReceiver PUBLIC QGC_GST_STREAMING) if(CMAKE_BUILD_TYPE STREQUAL "Release")