Wes's Guide to building MMEX on Mac OS X

Money Manager Ex Development related posts for both Android and Desktop

Moderator: Renato

Post Reply
elliswr
Super MMEX User
Posts: 102
Joined: Tue May 05, 2009 8:21 am
Are you a spam bot?: No
Location: Granbury, TX

Wes's Guide to building MMEX on Mac OS X

Post by elliswr »

This will be edited numerous times, I am sure, but I wanted to go ahead and get this put down so that I have reference to go back to, and others may have use of it as well.

So, here are the steps I used to build MMEX on the Mac.

1. First, we need to build wxMac. We could have used the standard OS X installation of wxWidgets, but that is often many revisions behind the current stable release. Rather than have each Mac user build their own copy of wxWidgets as a shared library, I decided to use a static library and include the necessary code in the application bundle.

Download the latest stable release of wxMac from here:http://www.wxwidgets.org/downloads/

Follow the instruction here: http://wiki.wxwidgets.org/Compiling_wxW ... erminal%29 to build wxWidgets on the Mac. Don't forget the flags when configuring! I have built the copy that I am using with

Code: Select all

../configure --disable-shared --enable-universal_binary
. This builds an Ansi static version of wxWidgets that supports building universal binaries. You can create multiple versions of wxMac with different build settings for building different versions of MMEX (intel only, ppc only, universal binary, unicode). Do this with such flags as:

Code: Select all

../configure --disable-shared --enable-monolithic --with-opengl --enable-universal_binary --enable-unicode
.

2. Now that we have wxMac built it's time to set up Xcode and create a template for building apps with it. Instructions for that can be found here: http://wiki.wxwidgets.org/Creating_Xcod ... plications. Take note of a couple things on this page.

Code: Select all

# if you left wxWidgets in-place
cd /path/to/wxWidgets/build-release
./wx-config --cppflags
./wx-config --libs
I always build in place so that I can have multiple builds of wx available to me. This means that when I set up my XCode Project, I need to open a terminal and navigate to the directory of the wx build I wish to use for that app build and get the appropriate flags with the scripts above.

Also, if you enabled universal binary when you configured that build of wx, you should drop the -arch flags from the output of the wx-config --cpp flaps and --libs flags when you copy and paste them into the target settings of your XCode project.

Test your sample code, and save the project as a template with an appropriate name for the type of build that you configured with wx.

3. Checkout MMEX from SVN.

4. Build MMEX right? Well, not quite. If you just added the source files to the XCode project and attempted to build, you would have numerous errors related to basic variables such as time and date. This is due to the code in the sql folder of the MMEX source tree conflicting with the installed Mac system libraries. My work around for this was to build all the code in the sql folder of the source tree as a bsd static library.

The following mailing list has a good write-up on how to do this. *Note* This is for a much earlier version of XCode and should be followed as a guide only: http://www.mail-archive.com/sqlite-user ... 15596.html

When setting up XCode for this project, remember to pass the following C flags to the bsd static library target:

Code: Select all

-DSQLITE_CORE -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_COLUMN_METADATA
5. Now we build MMEX right? Not quite. I don't recall why I did it this way, but I decided to create wxSQLite as a framework. This is fairly straight forward if you've created a framework before. I did this and the previous step in one project with two targets. One static bsd library built as above which was then a dependency of the wxsqlite framework (which requride all of one or two source files).

6. Now that we have our framework, we can include it in our MMEX.app Project. This is it time to build MMEX. The good news is that what we have done so far, will rarely need to be done again. The code in the sql folder of the source tree doesn't change very often, so most of the time all you will be doing is updating this project with the rest of the source files from the source tree and building. The tricky part for new XCode users is setting all the project settings. Make sure to enter your search paths for the headers (the include folder of the source tree), set the architecture for the build you want, copy the files from the source tree (excluding the sql folder), and copy the wxsqlite.framework into the xcode project.

You also need to include the framework in the final app bundle. Do this by going to Project->Add new build phase->New copy files build phase. Then drag the framework from the project files and groups tree to the copy files build phase.

Copy all the files from the runtime source tree folder to the Resources folder of the project files and groups tree.

Build and go.

That should be it. Hopefully this will help anyone who wishes to build on Mac. It took me about a month and a half to figure this out the first time and I didn't write this down, so when I went to do it again I had to recreate all this. If you find anything lacking in this guide, please, shoot me a pm and I will adjust it as needed.

Cheers,
Wesley
madhan
Site Admin
Posts: 99
Joined: Sun Nov 30, 2008 8:06 pm

Re: Wes's Guide to building MMEX on Mac OS X

Post by madhan »

Very cool and helpful. Thanks a lot!
elliswr
Super MMEX User
Posts: 102
Joined: Tue May 05, 2009 8:21 am
Are you a spam bot?: No
Location: Granbury, TX

Re: Wes's Guide to building MMEX on Mac OS X

Post by elliswr »

Congratulations to Omalleypat, for being the first to navigate this maze of instructions.
omalleypat
Super MMEX User
Posts: 112
Joined: Tue Jul 28, 2009 10:34 pm
Are you a spam bot?: No
Location: Atchison, KS

Re: Wes's Guide to building MMEX on Mac OS X

Post by omalleypat »

madhan
Site Admin
Posts: 99
Joined: Sun Nov 30, 2008 8:06 pm

Re: Wes's Guide to building MMEX on Mac OS X

Post by madhan »

Added link from home page so it is not orphaned. http://www.codelathe.com/mmex/wiki/
elliswr
Super MMEX User
Posts: 102
Joined: Tue May 05, 2009 8:21 am
Are you a spam bot?: No
Location: Granbury, TX

Re: Wes's Guide to building MMEX on Mac OS X

Post by elliswr »

Here's the latest and the greatest. My recent experience with bakefile, while not successful (yet), has shown me that there is a better way of setting up XCode for MMEX. This has pictures to aid in setting up, should be a breeze. PM me if you need assistance.

[Update:] Do not name the static library sqlite3. Instead, name it libsqlite3_mmex or something, anything other than sqlite3. Doing so will cause XCode to link to the system libsqlite3, which will give you linker errors.
Attachments
XCode_Build_Instr.pdf.zip
Could we get this up on the Wiki?
(268.22 KiB) Downloaded 454 times
Post Reply