[wx-dev] Creating a MacOS X Framework

Anders F Björklund afb at algonet.se
Mon Mar 5 01:11:25 PST 2007


Vadim Zeitlin wrote:

> On Wed, 28 Feb 2007 11:51:50 +0100 Etienne Samson  
> <samson.etienne at gmail.com> wrote:
>
> ES> I'm still tinkering with this idea in order to have a less annoying
> ES> way of using wx for MacOS X developers ;-)

I'll respond to this, since parts were taken from my wxWidgets outline  
at:
http://www.algonet.se/~afb/wx/

> ES> What do you think of this approach :
> ES> - Select from a list of Targets :
> ES> 	- Framework Debug Unicode
> ES> 	- Framework Release Unicode
> ES> 	- Framework Debug ANSI
> ES> 	- Framework Release ANSI
> ES> - Make Xcode project run configure to create setup.h files and wx-
> ES> config files (by passing configure correct arguments).
>
>  Maybe this is a stupid question but what's the point of using Xcode  
> for
> something like that? Wouldn't it be more convenient (and, importantly,  
> much
> more amenable to automation) to use a simple makefile?

I think that most people on Mac use Xcode rather than Make, and those  
that
use autoconf/make probably *want* the UNIX libraries rather than  
frameworks.
People that use Make to build/use frameworks (like me), are pretty rare  
:-)
Xcode would probably want to use "setup0.h" rather than configure,  
though ?

It would be a good thing if both the Xcode projects and the  
autoconf/make
built the same libraries, though, same deal as with the regular wx  
builds...
Even nicer would be if the Xcode projects could be generated  
automatically,
but that would first require a major new feature for Bakefile - though  
great.

BTW; "Debug" and "Release" are in the same target (but are two build  
styles)

> ES> 	What I use currently is configure --enable-mac --enable-monolitic-
> ES> with-expat=builtin --with-regex=builtin --with-zlib=builtin
>
>  Why --enable-monolithic?

I think we went over this in detail last time the framework was  
discusssed,
some time in fall before wx 2.8.0, but it's harder to comply with the  
single
"wx" library requirement of a framework using multi-lib ? It would have  
to
use sub-frameworks or included dylibs or something, that would be  
complex.

There's no probably good reason for e.g. MacPorts* to use monolithic  
libs,
but for making a wx.framework it's definitely easier. You'll still have  
to
deal with the problem on what to do for the various contribs and  
add-ons,
like for instance OpenGL or STC - I ended up building all those  
statically.

*
http://trac.macports.org/projects/macports/browser/trunk/dports/ 
graphics/wxWidgets
	--with-mac --enable-unicode --enable-display --enable-monolithic

>  Why is this called "Home"??

It's all Java's fault (e.g. $JAVA_HOME). Both "Commands" and "Home".
i.e. it was borrowed from /System/Library/Frameworks/JavaVM.framework

It's of course a totally optional feature, the only reason was to get
a $WXWIN or $WXDIR directory to be able to pass to non-Mac programs...

> ES> I could then make an installer putting the wx.framework in  
> /Library/
> ES> Framework and symlinking /usr/local/bin/wx-config to /Library/
> ES> Frameworks/wx.framework/Commands/wx-config.
>
>  You'd also probably need to symlink some other things, e.g. wxstd.mo  
> and
> wxwin.m4.

Then again, if you want to support those you probably want UNIX install  
?
(such as the automated port being offered by the MacPorts build system)

I'm not even sure the wx-config should be symlinked. Perhaps not even
included, says some (i.e. leave both Commands and Home directories out)
Instead one could use Xcode template projects to set the required flags
and libraries and such, like it is being done now by for instance SDL ?

Just thought it would be a nice thing to have around, so I hacked it.
Sorta like the existing http://wxconfig.googlepages.com/ for Windows ?
But maybe wx-config on Windows and on Mac OS X is a pipe dream, I dunno.
(yeah I know it works for MinGW and Darwin, I meant as in non-UNIX ways)

Think the instructions for wx-config in Xcode would read something like
"run this command in Terminal, copy the output over to Xcode settings"
rather than having Xcode itself run a `wx-config --cxxflags` anyway ?
(at least that was how it worked for the traditional install and Xcode)

> ES> I would like to know if this fits everybody...
>
>  I think this is exactly what needs to be done.

And it would probably require the build scripts and Xcode templates
and other things to be written *first*, before it being considered ?
For the moment I copied the .dylibs over to the "@executable_path"
for all my public wx applications, instead of using any frameworks.

Still, it would be nice if those 20 MB could be shared with others.
(got 15 MB for wxWidgets 2.6, both for the Unicode/Universal Build)
But maybe 2.8.2 should have a /usr/local Installer, rather than a
/Library/Frameworks/wx.framework ? Either way "works", your call...

--anders





More information about the wx-dev mailing list