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

Workaround for iOS. #1775

Merged
merged 4 commits into from
Jan 17, 2025
Merged
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
21 changes: 21 additions & 0 deletions CppSamples/Layers/PlayAKmlTour/PlayAKmlTour.pro
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ ios {
$$PWD/Info.plist

QMAKE_INFO_PLIST = $$PWD/Info.plist

# workaround for https://bugreports.qt.io/browse/QTBUG-129651
# ArcGIS Maps SDK for Qt adds 'QMAKE_RPATHDIR = @executable_path/Frameworks'
# and ffmpeg frameworks have embedded '@rpath/Frameworks' path.
# so in order for them to be found, we need to add @executable_path to the
# search path.
FFMPEG_LIB_DIR = $$absolute_path($$replace(QMAKE_QMAKE, "qmake6", "../../ios/lib/ffmpeg"))
Copy link
Collaborator

@bri12415 bri12415 Jan 14, 2025

Choose a reason for hiding this comment

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

So we grab the qmake absolute path with QMAKE_QMAKE and use that to source the location of the ffmpeg binaries?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It's not great, but I can't find any non-hacky qmake way to locate the Qt kit's lib dir. QTDIR is the obvious one, but that's only set with Qt Creator. Christian is testing in CI now and it fails, so we can't use that.

It gets pretty ugly, because qmake for iOS is just a script that points to macOS's qmake binary. Then users could be using either qmake or qmake6 so we don't know which one to replace, so we have to handle both.

FFMPEG_LIB_DIR = $$absolute_path($$replace(FFMPEG_LIB_DIR, "qmake", "../../ios/lib/ffmpeg"))
QMAKE_LFLAGS += -F$${FFMPEG_LIB_DIR} -Wl,-rpath,@executable_path
LIBS += -framework libavcodec \
-framework libavformat \
-framework libavutil \
-framework libswresample \
-framework libswscale
ffmpeg.files = $${FFMPEG_LIB_DIR}/libavcodec.framework \
$${FFMPEG_LIB_DIR}/libavformat.framework \
$${FFMPEG_LIB_DIR}/libavutil.framework \
$${FFMPEG_LIB_DIR}/libswresample.framework \
$${FFMPEG_LIB_DIR}/libswscale.framework
ffmpeg.path = Frameworks
QMAKE_BUNDLE_DATA += ffmpeg
}

android {
Expand Down
27 changes: 24 additions & 3 deletions SampleViewer/SampleViewer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exists($$PWD/../../../DevBuildCpp.pri) {
# use the Esri dev build script
include ($$PWD/../../../DevBuildCpp.pri)
# include the toolkitcpp.pri, which contains all the toolkit resources
include($$PWD/../../toolkit/uitools/toolkitcpp.pri)
include($$PWD/../../toolkit/uitools/toolkitcpp/toolkitcpp.pri)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This avoids a toolkit warning. This file was recently moved into uitools/toolkitcpp. There is still a uitools/toolkitcpp.pri, but it logs a warning and says to use the new file directly.

FYI @GuillaumeBelz


INCLUDEPATH += \
$$SAMPLEPATHCPP \
Expand All @@ -52,8 +52,8 @@ exists($$PWD/../../../DevBuildCpp.pri) {
CONFIG += c++17

# include the toolkitcpp.pri, which contains all the toolkit resources
!include($$PWD/../arcgis-maps-sdk-toolkit-qt/uitools/toolkitcpp.pri) {
message("ERROR: Cannot find toolkitcpp.pri at path:" $$PWD/../arcgis-maps-sdk-toolkit-qt/uitools/toolkitcpp.pri)
!include($$PWD/../arcgis-maps-sdk-toolkit-qt/uitools/toolkitcpp/toolkitcpp.pri) {
message("ERROR: Cannot find toolkitcpp.pri at path:" $$PWD/../arcgis-maps-sdk-toolkit-qt/uitools/toolkitcpp/toolkitcpp.pri)
message("Please ensure the Qt Toolkit repository is cloned and the path above is correct.")
}

Expand Down Expand Up @@ -120,6 +120,27 @@ exists($$PWD/../../../DevBuildCpp.pri) {

ios {
PLATFORM = "iOS"

# workaround for https://bugreports.qt.io/browse/QTBUG-129651
# ArcGIS Maps SDK for Qt adds 'QMAKE_RPATHDIR = @executable_path/Frameworks'
# and ffmpeg frameworks have embedded '@rpath/Frameworks' path.
# so in order for them to be found, we need to add @executable_path to the
# search path.
FFMPEG_LIB_DIR = $$absolute_path($$replace(QMAKE_QMAKE, "qmake6", "../../ios/lib/ffmpeg"))
FFMPEG_LIB_DIR = $$absolute_path($$replace(FFMPEG_LIB_DIR, "qmake", "../../ios/lib/ffmpeg"))
QMAKE_LFLAGS += -F$${FFMPEG_LIB_DIR} -Wl,-rpath,@executable_path
LIBS += -framework libavcodec \
-framework libavformat \
-framework libavutil \
-framework libswresample \
-framework libswscale
ffmpeg.files = $${FFMPEG_LIB_DIR}/libavcodec.framework \
$${FFMPEG_LIB_DIR}/libavformat.framework \
$${FFMPEG_LIB_DIR}/libavutil.framework \
$${FFMPEG_LIB_DIR}/libswresample.framework \
$${FFMPEG_LIB_DIR}/libswscale.framework
ffmpeg.path = Frameworks
QMAKE_BUNDLE_DATA += ffmpeg
}

DEFINES += BUILD_FROM_SETUP
Expand Down