Adding other frameworks to plugin

Hi all,

I struggle a little bit in creating a plugin that depends on other frameworks.
I use CocoaPods to manage the dependecy to the other framework. the Podfile is within the Plugin Directory (from the template for plugins).
It compiles and creates the *.a. Checking with otool -L, the *.a file does not include the other libraries.

Sorry if this question is so basic and maybe silly, but how do I add such frameworks to the plugin *.a file / plugin definition.

Any hint is highly appreciated,
Markus.

You include them in the metadata file like this:

local metadata =
{
	plugin =
	{
		format = 'framework',
		frameworks = { 'FBAudienceNetwork', 'FBSDKCoreKit','ISFacebookAdapter',}
	},
}

return metadata

This is probably a better example of what you are trying to achieve.

local metadata =
{
	plugin =
	{
		format = "staticLibrary",
		staticLibs = { 'plugin_cgflurry' },

		frameworks = { "SystemConfiguration", "Security" },
		frameworksOptional = {},
	}
}

return metadata

Thank you, But how does Solar2D knows from where to get the frameworks? For packaging a plug-in, the documentation says it has to be flat file which gets tar-balled. Sorry for bothering.

Well that documentation that you reference is sort of old. Here are the was to get your plugins to work:

  1. You can put it up on Github and then create a collector. Never done this so can’t help you there.
  2. You can put it up on the Solar2dplugin site. That structure looks like the picture attached. You then zip up the entire folder and upload it to solar2d site. @richard11 has more detailed instructions.

Screen Shot 2020-08-16 at 2.12.19 PM

  1. You can keep them on your local machine. This is what I do when I am beta testing my plugins. On a mac I put it in the folder path in the picture attached and tar the entire thing with this command. In the picture the data.tgz archive is the tar of what is around it. You can delete the stuff around it once you have the tar file.

adriangomez$ tar -czf data.tgz metadata.lua library.a blablaFramework

Screen Shot 2020-08-16 at 2.15.19 PM

Screen Shot 2020-08-16 at 2.22.04 PM

Just in case you don’t realize it. In the first example using the solar2dmarketplace @richard11 will provide a URL you just put in your build settings.

In the second example you just have to add something like this in your build settings. com.cabagomez which is the publisherId is the top folder. Then plugin.tapjoyinstall is the next folder. Then your iphone folder will have the .tgz file.

["plugin.tapjoyInstall"] =
        {
            publisherId = "com.cabagomez",
            supportedPlatforms = { android=true, ["android-kindle"]=true, iphone=true }

        },

Great! Thank you @agramonte that helps, Markus.

After playing around with the information received here, I ended up with the following set-up which worked at least for me. Maybe it is also of interest for others.

  1. I started with the Plugin-Template from Solar2D

  2. May plugin requires a few 3rd-party Frameworks. I added those frameworks to the “Embedded Framework” folder of the project.

  3. Due to the nature of those Frameworks, I had to develop a few UIViews/Controllers. The XIB-files are located within PlugIn directory together with the other code of my plugin

  4. For testing with XCode, I added (linked) the XIB files also to the App in Xcode, so that they are available in compiled NIB version. I guess that could also be done during PlugIn Build.

  5. After debugging and finalizing the code, I used the “build.sh”-script which is part of the project template. That creates a directory structure which differes a little bit from @agramonte.


    Well, the NIB files were not created.

  6. I had to manually add the generated NIB files during the build of the App (not only the plugin) from the created App-package to the directory resources. (I pretty believe that this can be highly improved).

  7. Next I created the tar file within the directory “iphone” or “iphone-sim”
    (Terminal): tar -czf iphone.tgz metadata.lua libplugin_paybluecode.a resources

  8. Upload to a server which can be reached via HTTPS (this is a self-hosted scenario)
    The tar file can be downloaded “https://whatever-server/plugins/iphone.tgz”

  9. Start develop your Solar2D app.
    build.settings

 plugins =

{
[“plugin.paybluecode”] =
{
publisherId = “de.explorative”,
supportedPlatforms = {
iphone = { url=“https://whatever-server/plugins/iphone.tgz” },
android = { url=“https://whatever-server/plugins/android.tgz” },
macos = false,
win32 = false
},
},
},

Things worked out as expected.

1 Like