Import project as reference

(JohnMoshakis) #1

Hi,

I tried creating one but its not building. It looks like a similar problem as before where the resulting fx file is way smaller than the one I generated using headerimport.

https://drive.google.com/open?id=1Nd3lMcTrCClDDWON2lYjUgL0HbGQLZ8y

Cheers,
John

0 Likes

(marc hoffman) #2

Your .framework has the wrong build action, “AppFramework”. How did you generate this project?

0 Likes

(JohnMoshakis) #3

I used the open you gave me in the other thread and drag and dropped the framework file.

Can it only be done by hand at the moment ? I tried creating a regular ios project but couldnt see anything in the settings that would let me change the project type.

0 Likes

(JohnMoshakis) #4

It fails at the linking stage

        <- Task RemObjects.EBuild.Elements.ElementsPostCompile finished for RealmiOSApplication, Toffee-iOS, took 0.0000s (0.0006s).
        -> Task RemObjects.EBuild.Elements.ElementsLink started for RealmiOSApplication.
           -> Task Link started for RealmiOSApplication, Toffee-iOS.
              -> Phase Linking for Device started.

D: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -arch arm64 -o “/Users/JohnMoshakis/Library/Application Support/RemObjects Software/EBuild/Obj/RealmiOSApplication-93A1D62F6E1CCA3EB4E730C04ECF7FEE2B46B664/Debug/Toffee-iOS/Device/arm64/RealmiOSApplication” “/Users/JohnMoshakis/Library/Application Support/RemObjects Software/EBuild/Obj/RealmiOSApplication-93A1D62F6E1CCA3EB4E730C04ECF7FEE2B46B664/Debug/Toffee-iOS/Device/arm64/RealmiOSApplication.a” “/Users/JohnMoshakis/Library/Application Support/RemObjects Software/EBuild/Obj/RealmiOSApplication-93A1D62F6E1CCA3EB4E730C04ECF7FEE2B46B664/Debug/Toffee-iOS/Device/arm64/RealmiOSApplication.o” -lSystem -lobjc -lToffee -lxml2 -L/Users/JohnMoshakis/Documents/Elements/References/Toffee/iOS -framework CloudKit -framework CoreFoundation -framework CoreGraphics -framework Foundation -framework Intents -framework Realm -framework UIKit -ios_version_min 12.2 -ObjC -dynamic -demangle -force_load /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1/lib/darwin/libclang_rt.ios.a -dead_strip -rpath @executable_path -rpath @executable_path/Frameworks -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
E: ld: framework not found Realm
<- Phase Linking for Device failed.
<- Task Link failed for RealmiOSApplication, Toffee-iOS, took 0.1252s (0.1254s).

0 Likes

(marc hoffman) #5

Change it to ImportFramework, and set CopyLocal, and it works.

Pro tip: set the “Generate Reference Code” setting to a language of your choice to have a code file (e.g. a .pas) emitted that shows what was imported.

One more issue remained that I just fixed (20190330-162247-elements-develop): the iOS project won’t be ab le to link, because the framework wasn’t copied to /obj, but the project reference picks the .fx up from there. Get the new build too fix that, or as a workaround, drop the project reference and reference the final .fx file directly, instead.

0 Likes

(JohnMoshakis) #6

Thanks.

I set generate reference code and when I select “show source (oxygene)” it shows me the 1st file in the project ie AppDelegate.pas

0 Likes

(marc hoffman) #7

Hmm, curious. I completely forgot about that option, and that it would activate. reproduced, I’ll check why it doesn’t work as expected.

All that :generate reference source" will do is generate an extra .pas file as part of the output.

check the build output:

               Final Output for 'Realm':
                 Realm.framework (/Users/mh/Downloads/RealmExample/ImportSolution/Bin/Debug/iOS/Realm.framework)
                 Realm.frameworkz (/Users/mh/Downloads/RealmExample/ImportSolution/Bin/Debug/iOS/Realm.frameworkz)
                 Realm.fx (/Users/mh/Downloads/RealmExample/ImportSolution/Bin/Debug/iOS/Realm.fx)
                 Realm.pas (/Users/mh/Downloads/RealmExample/ImportSolution/Bin/Debug/iOS/Realm.pas)
               Final Output for Referencing:
                 Realm (/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/Realm-C61A0D69878F7A1B11F8C225A126E485BAB7EE08/Unknown/Toffee-iOS/Device/Realm.fx)
0 Likes

(marc hoffman) #8

Fixed.

0 Likes

(JohnMoshakis) #9

Thanks it’s working now. This is a great solution to using frameworks

Should copy local be automatically set ? It feels a bit strange having to do copy local inside the import project

1 Like

(marc hoffman) #10

Dragging the .framework in to auto-create the import project should probably set CopyLocal. I’ll check/fix that. How did you create your project — manually?

0 Likes

(marc hoffman) #11

Fixed.

0 Likes