How to embed sub-project frameworks through cli?

58 views Asked by At

I'm working with Qt which generates its own XCode project to make an iOS app. For this app I want to include a cocoapod dependency (Sentry). But I can't figure out how to add the sub-project frameworks to the main project. Is this possible?

Here is how the Podfile is installed and added:

# 1. Copy a Podfile to the build directory.
pods.commands = cp $$PWD/ios/Podfile $$OUT_PWD/Podfile
# 2. Install the pod (without integration).
pods.commands += && cd $$OUT_PWD && /usr/local/bin/pod install
# 3. Add the Pods project to the main project.
pods.commands += && python3 -m pbxproj file \
    --target AgraGPS \
    $$shell_path($$OUT_PWD/AgraGPS.xcodeproj/project.pbxproj) \
    $$OUT_PWD/Pods/Pods.xcodeproj
    --sign-on-copy

And the Podfile:

platform :ios, '11.0'

install! 'cocoapods',
    :integrate_targets => false

target 'AgraGPS' do
  use_frameworks!

  pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '8.8.0'
end

Normally when I want to include a framework I'd do something like this:

embed.commands = pip3 install pbxproj
embed.commands += && python3 -m pbxproj file \
    --target AgraGPS \
    $$shell_path($$OUT_PWD/AgraGPS.xcodeproj/project.pbxproj) \
    $$shell_path($$PWD/../Library/build/bin/Lib.framework) \
    --sign-on-copy
PRE_TARGETDEPS +=      embed
QMAKE_EXTRA_TARGETS += embed

But how do I refer to the frameworks? Using the framework name does not work. I can still add it through XCode and it works perfectly.

Adding the dependency through XCode by going to General, Frameworks, Add

Although I can enable integration and create a workspace. Trying to build and run the workspace lead to more bugs that I would like to avoid.

1

There are 1 answers

0
cj- On

Was able to get it working by first building the Pods project (instead of adding it to the main project). Than I was able to embed the frameworks normally.

embed.commands += && /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild install \
    -project $$shell_path(Pods/Pods.xcodeproj) \
    -destination generic/platform=iOS \
    -destination-timeout 1
debug {
    embed.commands += -configuration Debug
} else {
    embed.commands += -configuration Release
}
embed.commands = && python3 -m pbxproj file \
    --target AgraGPS \
    $$shell_path($$OUT_PWD/AgraGPS.xcodeproj/project.pbxproj) \
    $$shell_path($$OUT_PWD/build/Debug-iphoneos/Pod/Pod.framework) \
    --sign-on-copy
# Still need to add each framework individually
PRE_TARGETDEPS +=      embed
QMAKE_EXTRA_TARGETS += embed