[wx-dev] Creating a MacOS X Framework

Anders F Björklund afb at algonet.se
Mon Mar 5 15:19:52 PST 2007


Etienne Samson wrote:

>> AFB> It would be a good thing if both the Xcode projects and the
>> AFB> autoconf/make built the same libraries
>>
>>  This is absolutely required, indeed. Isn't it the case already?
>
> It should, as the only difference is that in a framework, there can be 
> only one dylib (which requires --enable-monolithic for configure). 
> This limitation could be overcomed by using an umbrella framework, but 
> Apple recommends not to use these...

I think that the Xcode configuration varies slightly from autoconf,
but I could be wrong - just what I gathered from building both...

> For (MacOS X) developers, a framework is preferable to a static or 
> dynamic library, because the framework contains everything needed for 
> development (dylib, headers, default icons, ...).

Slightly bloated (though convenient with just one single download)
for users, other package systems split into "shlibs" and "devel".
I don't think there is any difference between a framework and
a shared library, no more than between an app bundle and exe ?

It's just that /usr/local is not viewable with e.g. the Finder.

> I think that going the framework way doesn't require inclusion of .m4 
> files, because Apple-GCC (and IIRC mainstream GCC) support a 
> -framework option that can be used to include a Framework, which means 
> that as soon as you're building on OSX, you should just need to tell 
> the compiles "use this framework", should you go the Xcode way or the 
> configure/make way.

Unless you want to combine both aspects into a single installation ?

> What I would say as an important point, is that normally a framework 
> doesn't contain anything else than Headers, a dylib, and some 
> resources...

Even the Headers are optional, for e.g. Frameworks bundled with apps.

> The JavaVM.framework is built this way because Java ought to be 
> portable without recompilation.
> From my limited knowledge, it would seem to me that an application 
> built on a non-MacOS X system using wx would need to be recompiled 
> anyway to work on OS X (since it would require linking against wxMac 
> instead of wxGTK)... Is this right ?

Yes, this is definitely right. But it would still be nice if one
could use e.g. the same Makefile, without having to search/replace...
So the "wx-config" and "Home" were just hacks to make it portable.
If that's not required, they could both indeed be taken out of it.

> So it would be better if codebases wanting to build on OSX just launch 
> Xcode, create a project using the wx Template, add their codebase and 
> click build, and voila, they have a native codebase.app bundle 
> containing wx (or requiring installation of wx), ready to install...

The biggest hassle is bundling the .app and creating the Info.plist,
i.e. those post-link steps required on the wxMac/wxCocoa platforms

Xcode would indeed help there, by having the extra steps scripted.

> A little thought, I really need 4 version of this framework, for 
> Unicode/ANSI, Debug/Release, or is MacOS X Unicode support sufficient 
> for wx ?

Most of the other packages only provides Unicode and only Shared libs,
but I believe the current Xcode setup ("static"/"dynamic") uses Ansi ?

Debug/Release is handled by the Development/Deployment builds, though.

--anders





More information about the wx-dev mailing list