How to ignore some static library at compile time - objective-c

I am trying to figure out if there is a way to ignore a static library at compile time if the project already exists with similar library?
I am creating a framework in which I require to have the static library to utilize the scanning mechanism. However, the project I am trying to utilize this project also have such library, hence I am curious if there is any mechanism to ignore such library at compile time? Doesn't matter either from the framework or project.
Thanks.

I once had a similar case, where a library I wrote required some common open source components, which were used by many developers.
The best solution we found was to not link those components into our library, provide a list of these components, and to require the user of our library to include those components.

Related

What should I provide in the config.cmake of my library

I have a library that I have developed and this library has some dependencies on other libraries. To be able to use this library in other projects, I need to provide a config.cmake. My question is, what do I need to put in my config.camke. Normally this config.cmake files have an INCLUDE_DIRS, LIBRARIES and EXECUTABLE variables as well as FOUND (and each one is properly set with the library, executables, and paths). However, I see that if I only give this when I try to compile the project depending on my library I get linking errors saying that the executable is missing the library that my library depends on. Is there a way that I can avoid this by doing a better config.cmake?
Thank you very much.

how to make static library link against frameworks needed automatically in xcode

I have a static library base on MapKit.framework CoreLocation.framework etc.
I want to distribute the static library to other developers, to make it easy, I hope to find a method to eliminate the process of linking against frameworks in developers project.
I know there are some people achieve this.
If you can read chinese, you can refer to
http://dev.umeng.com/releasenote/releasenote_ana_ios.html
简化SDK集成,一句代码集成友盟SDK([MobClick startWithAppkey:]),不再需要手动link framework
There is no way to do this as of Xcode 4.5.2. A static library cannot specify its dynamic library dependencies. Only a dynamic library can do that.

Understanding bundles frameworks and libraries

I'm developing ios B2B app and I have several questions regarding app modularization.
Firstly i need to understand main difference between bundles and frameworks. When to use bundles and when frameworks.
Another question is. Is it possible for bundle to contain a .framework inside in it and vice versa.
Is it possible to create a plugins for ios app and load them dynamically, if yes then what it should be? bundle framework or library?
Is it possible for library to contain a resource files ?
Is it possible to create a resource bundle and dynamic library and then load them dynamically at runtime.
Is it possible to create a plugins for ios app and load them
dynamically, if yes then what it should be? bundle framework or
library?
No
Is it possible for library to contain a resource files ?
No
Is it possible to create a resource bundle and dynamic library and
then load them dynamically at runtime.
No
A Bundle is a type of Directory, a folder. A Framework is a bundle. So is an Application and so is a Plugin.
A Static Library is a single file code archive you can compile into your app at build time
A Dynamic Library is a single file code archive you can load at Runtime
A Framework is a Dynamic library in a Bundle with other things
A Plugin is a Dynamic library in a Bundle with other things
The Xcode build option 'Bundle' means 'Place the compiled Dynamic Library in a Bundle' - this is what you do when you want to create a Plugin.
Static libraries are the only option for modularising your code on iOS.
On the desktop..
Typically a Framework is for sharing code and resources between multiple apps. You want your app to behave as though the code was actually compiled into it. You want loading to happen transparently and you don't want to do anything special to use the methods, functions, etc. contained in it.
A Plugin (a Bundle containing compiled code and resources) is for optional, dynamically loaded code, e.g. a software extension that you can choose to load or not. You want to carefully architect your app so that it isn't dependent on the Plugin but acquires new behaviour if you manually locate and load it at Runtime.
A Framework and a Plugin are very similar, but a Framework has a strict file layout to facilitate locating and loading code and resources. With a plugin, these jobs are your responsibility so you can structure the Bundle contents however you want.
Because loading code is so easy in Cocoa on OSX (but not iOS) Frameworks can contain Plugins which contain Frameworks which contain more Frameworks, etc.
On iOS some people put Static Libraries in Bundles with resources and call them Frameworks. This has none of the benefits and all of the drawbacks of a real framework.

Static Library vs. Source Code?

I'm creating a modular open-source library. Let's say the project has 15 .m files in it.
Should I (1) release it like the Venmo iOS SDK (Cocoa Touch Static Library) or (2) release it like JSONKit (just the source code)?
Releasing as source code means you, and your developers, don't have problems when a new architecture comes out. A static library built as armv6 wouldn't work with the latest Xcode today.
One caveat with source code releases, since you don't know what build settings the project it's added to will have, you'll need to do extra work to make sure it builds without warnings as best you can, even for pedantic warnings.
I prefer frameworks over static libs. Its easier to ship resources in the framework bundle if you eventually need to and there no cost to dynamic linking. If its pure C and the libraries dependencies are guaranteed to be there then it might be ok. But in general I try to avoid static linking unless I know the target OS has the exact dependencies for that binary at deployment time.
Its much easier to load a dynamic library with the endpoints you need at runtime (which were compiled for that exact platform but have the same external interface) than it is to fail with a static lib that was compiled directly to external dependencies which dont exist on the target platform.
Maybe Im crazy but this is what Ive always done in C, C++ or obj C. Just my opinion.
http://en.wikipedia.org/wiki/Static_library

Maemo / Symbian and external libraries

How can I know, whether an external library can be compiled to work on a different platform? the library for instance is tesseract-ocr
And if it possible, how do I do this?? (Basically I would like to create a Qt application that uses this library)
To find out, try building the library yourself. At the moment your question is quite broad. Post new questions when you have something more specific to ask.
If building the library fails, it is most probably due to some unsupported dependencies that you need to port first yourself.
Porting to Maemo is probably straightforward as it is a Debian-based environment and supports all the build tools such as autotools.
Symbian doesn't have autotools. Perhaps the fastest way to get started there is to first configure and build the library on e.g. cygwin and then generate the required bld.inf and .mmp files to build it on Symbian.
You can link your Qt application to regular C/C++ libraries. Just include the necessary header files in your code and link to the library using LIBS += -lfoo in your .pro file.