Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - OSX cmake dmg #11364

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 88 additions & 75 deletions libs/qmlglsink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we are using a Framework for gstreamer you use find_library to find it. cmake supports finding frameworks in find_library.

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()

Expand Down Expand Up @@ -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)
Copy link
Contributor Author

@DonLakeFlyer DonLakeFlyer Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the find_library uses a different mechanism to find the framework the GST_FOUND variable is not set automatically. So I set it manually here. I must be doing this wrong somehow.

Copy link
Contributor Author

@DonLakeFlyer DonLakeFlyer Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this specific CMakelists.txt it does see that GST_FOUND was set to TRUE further down the file.

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")
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/VideoManager/VideoManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "GStreamer.h"
#include "VideoSettings.h"
#else
#error Boom
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then I use this to verify that the DEFINE is set correctly which it is not.

#include "GLVideoItemStub.h"
#endif

Expand Down
1 change: 1 addition & 0 deletions src/VideoReceiver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if(GST_FOUND)
Settings
)

message(FATAL_ERROR "GST_FOUND: ${GST_FOUND}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But once it gets here it doesn't see that GST_FOUND is set to TRUE.

target_compile_definitions(VideoReceiver PUBLIC QGC_GST_STREAMING)

if(CMAKE_BUILD_TYPE STREQUAL "Release")
Expand Down
Loading