Adding Frameworks to Xcode project automatically

Monkey Targets Forums/iOS/Adding Frameworks to Xcode project automatically

AndroidAndy(Posted 2015) [#1]
I know I can create a custom target, and change the MonkeyGame.xcodeproj and other files that will configure specific frameworks, etc... in the build process.

However, I found that using the fairlight module, I place the module in modules_ext and Import Chartboost and Import fairlight and it will add the "Chartboost.framework" to the MonkeyGame project Frameworks "Linked Frameworks and Libraries". That is nice, it also adds the "chartboostglue.ios.h" header under the Other Sources/libs folder in the project, that is nice too! Problem is the "Chartboost.framework" is colored "RED" indicating it is not found. Checking the Identity and Type it is set to location "Relative to SDK", so of course that is why it is not found.

I notice that the #define CFG_LIBS has the Chartboost.framework added, and strangely it has a full reference to the chartboostglue.ios.h header that includes the absolute path to the monkey modules_ext full path down through the fairlight module folder structure that contains code and for the chartboost framework among other things.

It seems like the best way for this to work would be to use the absolute path to point to the files that are part of the fairlight module instead of adding the framework to /Library/Frameworks, of course that would work, but so would a dozen other configuration options. It seems like the module configuration does quite a bit of the work trying to get the framework in the project, but it falls short.

If I simply create a new target and configure the MonkeyGame.xcodeproj to fix all the issues it will work, but I would really like to know if there is a way for the build process (transcc) to correctly configure the project, again it seems very close.

If anyone has any insight into this entire process, it would be really helpful. Also, here are some specific questions that could help if you have the answers:

1. Is there a way to control the xcodeproj "Identity and Type" Location of an added framework in modules_ext to make it one of the other choices like "Absolute Path" from the default " Relative to SDK"?

2. #define CFG_LIBS appended to the .mm code by .monkey statements #LIBS += "Chartboost.framework" what does (CFG_LIBS) do exactly? I know it adds to the string in the #define CFG_LIBS, does it also control the add to the xcodeproj, and anything else?

3. What is controlling the adding of chartboostglue.ios.h in the "Other Sources/libs" folder in the project? Isn't this a conflict with the CFG_LIBS statement #LIBS+="${CD}/native/chartboostglue.ios.h"?

4. What else is controlling the files that appear in the "Other Sources/libs" folder? Is it just when you #LIBS += "myheader.h", as in it only deals with header files and only from the #LIBS statement?

5. As part of the glue from monkey to an external lib there is also some .cpp code and in the case of the chartboostglue, that is Import "native/chartboostglue.ios.cpp". so that just gets sucked into the resulting main.mm file, but it also starts with #import "chartboostglue.ios.h" isn't that redundant if the "Other Sources/libs" folder already automatically includes the same file and copies it to the project folder? Or again maybe the "Other Sources/libs/chartboostglue.ios.h" folder is really not needed at all?

I know that Jon (skn3) wrote this part of the wrapper that was later included in Jochen's fairlight framework. At this point it is not so much about fairlight, but about the whole functionality of adding frameworks to Xcode projects without having to manually update the project, create custom targets, or copying frameworks all over the place.

I know that over time transcc has been modified to make things better and others have modified transcc to do their bidding, but I am wondering if the features are already there and my problems are due to a mix of old and newer implementations that are clashing?


MikeHart(Posted 2015) [#2]
...


secondgear(Posted 2015) [#3]
...


AndroidAndy(Posted 2015) [#4]
... 

Long silence, often used in response to a stupid question.

Ice: Why haven't my balls dropped yet?
Joe: ...


secondgear(Posted 2015) [#5]
nope, just replacing a long useless reply with a shorter one :)


AndroidAndy(Posted 2015) [#6]
idk, was there a long useless reply that I missed, or did I inadvertently respond to my own questions? I was trying to get some deeper insight into the inner workings of how Xcode projects are managed by "monkey", should this go in the beginner forum or is this some sort of taboo subject?


MikeHart(Posted 2015) [#7]
My reply was done after just reading the headline. Later I went through your complete post and figured that you had a different problem. So I deleted my post. Which was just directing you to the BRL admob module.


AndroidAndy(Posted 2015) [#8]
Thanks Mike, will keep fishing for some answers before resorting to a new target and/or transcc modification. Cheers!